Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typecast memcchr in os-shared-common.h #1141

Closed
thesamprice opened this issue Sep 7, 2021 · 0 comments · Fixed by #1142 or #1145
Closed

Typecast memcchr in os-shared-common.h #1141

thesamprice opened this issue Sep 7, 2021 · 0 comments · Fixed by #1142 or #1145
Assignees
Labels
Milestone

Comments

@thesamprice
Copy link

Describe the bug
memchr is called and then assigned to a const char * without a cast.
This causes failures on certain compilers (llvm).

https://www.cplusplus.com/reference/cstring/memchr/

const void * memchr ( const void * ptr, int value, size_t num );
      void * memchr (       void * ptr, int value, size_t num );

In file os-shared-common.h
change

    const char *end = memchr(s, 0, maxlen);

to

    const char *end = (const char *)memchr(s, 0, maxlen);

System observed on:

  • Hardware
  • OS: [MAC]
  • Versions [OSAL Hash 7ebb463]
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Reporter Info
Sam Price - GSFC

image

@thesamprice thesamprice changed the title Typecast Typecast memcchr in os-shared-common.h Sep 7, 2021
@jphickey jphickey self-assigned this Sep 7, 2021
@jphickey jphickey added the bug label Sep 7, 2021
jphickey added a commit to jphickey/osal that referenced this issue Sep 7, 2021
This function is documented as returning `void*`, and on some compilers
this requires an explicit cast to `const char*` to avoid a warning.
astrogeco added a commit that referenced this issue Sep 8, 2021
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022
Do not print the pipe name in the debug event, just pipe ID.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants