RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
195 stars 42 forks source link

asar-tests: fix -Wformat-truncation warning #312

Closed orbea closed 5 months ago

orbea commented 5 months ago

Gentoo considers this warning to be a QA issue for the ebuild and prints an additional warning.

Please review for correctness, I don't think these need to be 512 and the tests work fine on my end.

/tmp/asar/src/asar-tests/test.cpp: In function 'int main(int, char**)':
/tmp/asar/src/asar-tests/test.cpp:1019:44: warning: '%s' directive output may be truncated writing up to 511 bytes into a region of size between 381 and 892 [-Wformat-truncation=]
 1019 |                                 " \"%s\" \"%s\"",
      |                                            ^~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                                                  ~~~~~~~~~~~~
/tmp/asar/src/asar-tests/test.cpp:1015:33: note: 'snprintf' output 134 or more bytes (assuming 1156) into a destination of size 1024
 1015 |                         snprintf(cmd, sizeof(cmd),
      |                         ~~~~~~~~^~~~~~~~~~~~~~~~~~
 1016 |                                 "\"%s\" -I\"%s\" -Dcli_only=\\$1 -Dcmddefined -D!cmddefined2= --define \" !cmddefined3 = 16,240,224 \""
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1017 |                                 // RPG Hacker: 日本語������ǵ in UTF-8
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1018 |                                 " -Dcmdl_define_utf8=\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xf0\x9f\x87\xaf\xf0\x9f\x87\xb5"
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1019 |                                 " \"%s\" \"%s\"",
      |                                 ~~~~~~~~~~~~~~~~~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
randomdude999 commented 5 months ago

this entire test runner is gone in 2.0, but doesn't hurt to merge it i guess

(edit: oh hm it's not actually deleted. i think i've now rewritten all of its functionality though, so should be fine to delete)

randomdude999 commented 5 months ago

....oh whoops, i thought you targeted this against asar_19. i'll cherry-pick it into there, and possibly soon delete this runner

orbea commented 5 months ago

....oh whoops, i thought you targeted this against asar_19. i'll cherry-pick it into there, and possibly soon delete this runner

Thanks, I saw the warning in both places so I decided to do it in the asar_2_beta first.