Skip to content

Commit 3c91ce8

Browse files
thedaxyellows8
authored andcommitted
Nacptool: fix bug with title id parsing on Windows. (#19)
* Fix bug with title id parsing on Windows. On Windows, longs (as specified by %lX) are 32-bit, not 64-bit, so assuming its size results in the upper 32-bits of the title id being lost. * Use SCNx64 instead.
1 parent 16fcc67 commit 3c91ce8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/nacptool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdlib.h>
33
#include <stdint.h>
44
#include <string.h>
5+
#include <inttypes.h>
56

67
typedef uint64_t u64;
78
typedef uint32_t u32;
@@ -79,7 +80,7 @@ int main(int argc, char* argv[]) {
7980
int argi;
8081
u64 titleid=0;
8182
for (argi=6; argi<argc; argi++) {
82-
if (strncmp(argv[argi], "--titleid=", 10)==0) sscanf(&argv[argi][10], "%016lX", &titleid);
83+
if (strncmp(argv[argi], "--titleid=", 10)==0) sscanf(&argv[argi][10], "%016" SCNx64, &titleid);
8384
}
8485

8586
for (i=0; i<12; i++) {//These are UTF-8.

0 commit comments

Comments
 (0)