Closed rotorman closed 1 year ago
hi ! thank you for submitting.
but can you point out what compiler warning does this fix ? which compiler/version/platform ?
i don't get a warning on recent debian
I was testing with Teensy 4.0 (Freescale MIMXRT1062, ARM Cortex M7) under Arduino IDE v2.04. Teensyduino uses Arm GNU toolchain in v11.3.1
ok. what's the compilers complaint ?
c:\Users\rotorman\Documents\Arduino\libraries\libSML\src\sml_octet_string.c: In function 'sml_octet_string_generate_uuid':
c:\Users\rotorman\Documents\Arduino\libraries\libSML\src\sml_octet_string.c:122:38: warning: pointer targets in passing argument 1 of 'sml_octet_string_init' differ in signedness [-Wpointer-sign]
122 | return sml_octet_string_init(uuid, 16);
| ^~~~
| |
| char *
c:\Users\rotorman\Documents\Arduino\libraries\libSML\src\sml_octet_string.c:35:52: note: expected 'unsigned char *' but argument is of type 'char *'
35 | octet_string *sml_octet_string_init(unsigned char *str, int length) {
| ~~~~~~~~~~~~~~~^~~
sorry for the delayed response.
your commit/MR is missing some details that make it hard to get the context.
the issue occurs:
uuid_t
typechar *
,uuid_t
is internally defined as unsigned char *
https://github.com/lixiangyun/libuuid/blob/master/uuid.h#L44 (note: NOT the official repo, just a convenient mirror.)can you maybe update your commit message to provide a little more detail? i'd merge this then.
Done, thank you for the hints!
sorry, i meant to update the git commit message (as this will go int the project's git history), not the pull request description (but that also looks much nicer now!)
i missed that gitlab lets me edit the message with "squash and merge" => merged. thanks for your contribution!
Fixes a compiler warning when building without
libuuid
.Without
libuuid
(SML_NO_UUID_LIB
defined), the code takes the path via line 107: https://github.com/volkszaehler/libsml/blob/7e7c5d46f82a8c8ce50c9be150da0c35bc0168cb/sml/src/sml_octet_string.c#L103-L107Line 122 calls
sml_octet_string_init()
withuuid
char array variable as the first parameter: https://github.com/volkszaehler/libsml/blob/7e7c5d46f82a8c8ce50c9be150da0c35bc0168cb/sml/src/sml_octet_string.c#L122sml_octet_string_init()
expects unsigned char instead of char as the first argument: https://github.com/volkszaehler/libsml/blob/7e7c5d46f82a8c8ce50c9be150da0c35bc0168cb/sml/src/sml_octet_string.c#L35