mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-08-05 07:59:24 +02:00
Fixed string warnings with gcc 8.1.0.
This commit is contained in:
parent
4dcced2805
commit
4cdf427d12
@ -58,7 +58,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
memset(username, 0, sizeof(username));
|
||||
strncpy(username, profilebase.username, sizeof(profilebase.username));//Even though profilebase.username usually has a NUL-terminator, don't assume it does for safety.
|
||||
strncpy(username, profilebase.username, sizeof(username)-1);//Even though profilebase.username usually has a NUL-terminator, don't assume it does for safety.
|
||||
|
||||
printf("Username: %s\n", username);//Note that the print-console doesn't support UTF-8. The username is UTF-8, so this will only display properly if there isn't any non-ASCII characters. To display it properly, a print method which supports UTF-8 should be used instead.
|
||||
|
||||
|
@ -55,7 +55,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
memset(name, 0, sizeof(name));
|
||||
strncpy(name, langentry->name, sizeof(langentry->name));//Don't assume the nacp string is NUL-terminated for safety.
|
||||
strncpy(name, langentry->name, sizeof(name)-1);//Don't assume the nacp string is NUL-terminated for safety.
|
||||
|
||||
printf("Name: %s\n", name);//Note that the print-console doesn't support UTF-8. The name is UTF-8, so this will only display properly if there isn't any non-ASCII characters. To display it properly, a print method which supports UTF-8 should be used instead.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user