Skip to content

Silence -Wstringop-truncate compilwer warnings#1

Open
gicmo wants to merge 1 commit intoFeralInteractive:masterfrom
gicmo:secrev1
Open

Silence -Wstringop-truncate compilwer warnings#1
gicmo wants to merge 1 commit intoFeralInteractive:masterfrom
gicmo:secrev1

Conversation

@gicmo
Copy link

@gicmo gicmo commented Mar 27, 2019

In FeralInteractive/gamemode#122 I added a bunch of new compiler warnings, including -Wstringop-truncate. This commit is fixing the fall-out.

When using strncpy (buf, source, sizeof (buf)); the compiler will
issue a warning even if 'buf' is then properly terminated via
buf[sizeof (buf) - 1] = '\0'. Usage of 'sizeof (buf) -1' within
the strncpy will silence the warning.

When using strncpy (buf, source, sizeof (buf)); the compiler will
issue a warning even if 'buf' is then properly terminated via
buf[sizeof (buf) - 1] = '\0'. Usage of 'sizeof (buf) -1' within
the strncpy will silence the warning.
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.

1 participant