Skip to content

Fix GCC warning regarding strcpy.#78

Merged
dfaranha merged 1 commit intorelic-toolkit:masterfrom
riot-appstore:fix-Wsizeof-pointer-memaccess
May 30, 2018
Merged

Fix GCC warning regarding strcpy.#78
dfaranha merged 1 commit intorelic-toolkit:masterfrom
riot-appstore:fix-Wsizeof-pointer-memaccess

Conversation

@jcarrano
Copy link
Copy Markdown
Contributor

GCC's -Wsizeof-pointer-memaccess (activated by -Wall) checks calls of the form

strncpy(dest, src, sizeof(X))

And emits a warning if X does not seem to make sense. In Relic, src = X= a constant
string and this triggers gcc's warning.

I replaced stncpy by memcpy. Because the strings being usd do not contain embedded
zeroes, this should not be a proble,

GCC's -Wsizeof-pointer-memaccess (activated by -Wall) checks calls of the form

  strncpy(dest, src, sizeof(X))

And emits a warning if X does not seem to make sense. In Relic, src = X= a constant
string and this triggers gcc's warning.

I replaced stncpy by memcpy. Because the strings being usd do not contain embedded
zeroes, this should not be a proble,
@dfaranha dfaranha merged commit b5bbb59 into relic-toolkit:master May 30, 2018
@jcarrano jcarrano deleted the fix-Wsizeof-pointer-memaccess branch November 8, 2018 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants