@@ -451,18 +451,18 @@ fossil_bluecrab_myshell_error_t fossil_myshell_put(fossil_bluecrab_myshell_t *db
451451 char * hash_comment = strstr (eq + 1 , "#hash=" );
452452 if (hash_comment ) {
453453 uint64_t file_hash = 0 ;
454- sscanf (hash_comment , "#hash=%llx" , & file_hash );
454+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
455455 if (strcmp (line , key ) == 0 && file_hash == key_hash ) {
456456 // Overwrite with new value and type
457- fprintf (temp_file , "%s=%s #type=%s #hash=%016llx \n" , key , value , myshell_fson_type_to_string (type_id ), ( unsigned long long ) key_hash );
457+ fprintf (temp_file , "%s=%s #type=%s #hash=%016" PRIx64 " \n" , key , value , myshell_fson_type_to_string (type_id ), key_hash );
458458 updated = true;
459459 * eq = '=' ; // Restore
460460 continue ;
461461 }
462462 } else {
463463 if (strcmp (line , key ) == 0 ) {
464464 // Overwrite with new value and type
465- fprintf (temp_file , "%s=%s #type=%s #hash=%016llx \n" , key , value , myshell_fson_type_to_string (type_id ), ( unsigned long long ) key_hash );
465+ fprintf (temp_file , "%s=%s #type=%s #hash=%016" PRIx64 " \n" , key , value , myshell_fson_type_to_string (type_id ), key_hash );
466466 updated = true;
467467 * eq = '=' ; // Restore
468468 continue ;
@@ -475,7 +475,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_put(fossil_bluecrab_myshell_t *db
475475
476476 if (!updated ) {
477477 // Add new entry with FSON type and hash
478- fprintf (temp_file , "%s=%s #type=%s #hash=%016llx \n" , key , value , myshell_fson_type_to_string (type_id ), ( unsigned long long ) key_hash );
478+ fprintf (temp_file , "%s=%s #type=%s #hash=%016" PRIx64 " \n" , key , value , myshell_fson_type_to_string (type_id ), key_hash );
479479 }
480480
481481 fclose (temp_file );
@@ -527,7 +527,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_get(
527527 char * type_comment = strstr (eq + 1 , "#type=" );
528528 if (hash_comment ) {
529529 uint64_t file_hash = 0 ;
530- sscanf (hash_comment , "#hash=%llx" , & file_hash );
530+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
531531 if (strcmp (line , key ) == 0 && file_hash == key_hash ) {
532532 // Extract value (between '=' and #type or #hash)
533533 size_t value_len = 0 ;
@@ -602,7 +602,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_del(fossil_bluecrab_myshell_t *db
602602 char * type_comment = strstr (eq + 1 , "#type=" );
603603 if (hash_comment ) {
604604 uint64_t file_hash = 0 ;
605- sscanf (hash_comment , "#hash=%llx" , & file_hash );
605+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
606606 if (strcmp (line , key ) == 0 && file_hash == key_hash ) {
607607 // Optionally validate type against FSON type system
608608 if (type_comment ) {
@@ -733,8 +733,8 @@ fossil_bluecrab_myshell_error_t fossil_myshell_commit(fossil_bluecrab_myshell_t
733733 }
734734 // FSON v2: commit lines can optionally include a #type=enum for commit type
735735 // For compatibility, always append #type=enum to commit lines
736- if (fprintf (db -> file , "#commit %016llx %s %lld #type=%s\n" ,
737- ( unsigned long long ) db -> commit_head , message , (long long )db -> commit_timestamp ,
736+ if (fprintf (db -> file , "#commit %016" PRIx64 " %s %lld #type=%s\n" ,
737+ db -> commit_head , message , (long long )db -> commit_timestamp ,
738738 myshell_fson_type_to_string (MYSHELL_FSON_TYPE_ENUM )) < 0 ) {
739739 return FOSSIL_MYSHELL_ERROR_IO ;
740740 }
@@ -788,7 +788,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_branch(fossil_bluecrab_myshell_t
788788 if (fseek (db -> file , 0 , SEEK_END ) != 0 ) {
789789 return FOSSIL_MYSHELL_ERROR_IO ;
790790 }
791- if (fprintf (db -> file , "#branch %016llx %s #type=%s\n" , ( unsigned long long ) db -> commit_head , branch_name , myshell_fson_type_to_string (type_id )) < 0 ) {
791+ if (fprintf (db -> file , "#branch %016" PRIx64 " %s #type=%s\n" , db -> commit_head , branch_name , myshell_fson_type_to_string (type_id )) < 0 ) {
792792 return FOSSIL_MYSHELL_ERROR_IO ;
793793 }
794794 fflush (db -> file );
@@ -834,7 +834,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_checkout(fossil_bluecrab_myshell_
834834 int n = sscanf (line , "#branch %16s %511s" , hash_str , name );
835835 if (n >= 2 ) {
836836 uint64_t parsed_hash = 0 ;
837- sscanf (hash_str , "%llx" , & parsed_hash );
837+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
838838 if ((strcmp (name , branch_or_commit ) == 0 ) || (parsed_hash == hash )) {
839839 branch_found = true;
840840 strncpy (found_branch_name , name , sizeof (found_branch_name ));
@@ -847,7 +847,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_checkout(fossil_bluecrab_myshell_
847847 int n = sscanf (line , "#commit %16s" , hash_str );
848848 if (n >= 1 ) {
849849 uint64_t parsed_hash = 0 ;
850- sscanf (hash_str , "%llx" , & parsed_hash );
850+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
851851 if (parsed_hash == hash ) {
852852 commit_found = true;
853853 break ;
@@ -906,7 +906,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_merge(fossil_bluecrab_myshell_t *
906906 int n = sscanf (line , "#branch %16s %511s #type=%31s" , hash_str , name , type_name );
907907 if (n >= 2 ) {
908908 uint64_t parsed_hash = 0 ;
909- sscanf (hash_str , "%llx" , & parsed_hash );
909+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
910910 if ((strcmp (name , source_branch ) == 0 ) || (parsed_hash == source_hash )) {
911911 branch_found = true;
912912 strncpy (found_branch_name , name , sizeof (found_branch_name ) - 1 );
@@ -952,9 +952,9 @@ fossil_bluecrab_myshell_error_t fossil_myshell_merge(fossil_bluecrab_myshell_t *
952952
953953 // Optionally, append merge info to file for history, include FSON type
954954 if (fseek (db -> file , 0 , SEEK_END ) == 0 ) {
955- fprintf (db -> file , "#merge %016llx %s %s %lld #type=%s\n" ,
956- ( unsigned long long ) db -> commit_head , found_branch_name , message , (long long )db -> commit_timestamp ,
957- myshell_fson_type_to_string (branch_type ));
955+ fprintf (db -> file , "#merge %016" PRIx64 " %s %s %lld #type=%s\n" ,
956+ db -> commit_head , found_branch_name , message , (long long )db -> commit_timestamp ,
957+ myshell_fson_type_to_string (branch_type ));
958958 fflush (db -> file );
959959 }
960960
@@ -986,7 +986,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_revert(fossil_bluecrab_myshell_t
986986 int n = sscanf (line , "#commit %16s %*[^#] #type=%31s" , hash_str , type_name );
987987 if (n >= 1 ) {
988988 uint64_t parsed_hash = 0 ;
989- sscanf (hash_str , "%llx" , & parsed_hash );
989+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
990990 if (parsed_hash == hash ) {
991991 commit_found = true;
992992 // Validate FSON type if present
@@ -1069,7 +1069,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_stage(fossil_bluecrab_myshell_t *
10691069 char * hash_comment = strstr (eq + 1 , "#hash=" );
10701070 if (hash_comment ) {
10711071 uint64_t file_hash = 0 ;
1072- sscanf (hash_comment , "#hash=%llx" , & file_hash );
1072+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
10731073 if (strcmp (line + 7 , key ) == 0 && file_hash == key_hash ) {
10741074 * eq = '=' ; // Restore
10751075 continue ;
@@ -1087,7 +1087,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_stage(fossil_bluecrab_myshell_t *
10871087 }
10881088
10891089 // Add new staged entry at the end, using FSON type system
1090- fprintf (temp_file , "#stage %s=%s #type=%s #hash=%016llx \n" , key , value , myshell_fson_type_to_string (type_id ), ( unsigned long long ) key_hash );
1090+ fprintf (temp_file , "#stage %s=%s #type=%s #hash=%016" PRIx64 " \n" , key , value , myshell_fson_type_to_string (type_id ), key_hash );
10911091
10921092 fclose (temp_file );
10931093 fclose (db -> file );
@@ -1160,7 +1160,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_unstage(fossil_bluecrab_myshell_t
11601160 }
11611161 if (hash_comment ) {
11621162 uint64_t file_hash = 0 ;
1163- sscanf (hash_comment , "#hash=%llx" , & file_hash );
1163+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
11641164 if (strcmp (line + 7 , key ) == 0 && file_hash == key_hash && (type_comment == NULL || valid_type )) {
11651165 found = true; // Skip this line
11661166 * eq = '=' ; // Restore
@@ -1227,7 +1227,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_tag(fossil_bluecrab_myshell_t *db
12271227 int n = sscanf (line , "#commit %16s %*[^#] #type=%31s" , hash_str , type_name );
12281228 if (n >= 1 ) {
12291229 uint64_t parsed_hash = 0 ;
1230- sscanf (hash_str , "%llx" , & parsed_hash );
1230+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
12311231 if (parsed_hash == hash ) {
12321232 commit_found = true;
12331233 if (n == 2 ) {
@@ -1252,7 +1252,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_tag(fossil_bluecrab_myshell_t *db
12521252 if (fseek (db -> file , 0 , SEEK_END ) != 0 ) {
12531253 return FOSSIL_MYSHELL_ERROR_IO ;
12541254 }
1255- if (fprintf (db -> file , "#tag %016llx %s #type=%s\n" , ( unsigned long long ) hash , tag_name , myshell_fson_type_to_string (commit_type )) < 0 ) {
1255+ if (fprintf (db -> file , "#tag %016" PRIx64 " %s #type=%s\n" , hash , tag_name , myshell_fson_type_to_string (commit_type )) < 0 ) {
12561256 return FOSSIL_MYSHELL_ERROR_IO ;
12571257 }
12581258 fflush (db -> file );
@@ -1291,7 +1291,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_log(fossil_bluecrab_myshell_t *db
12911291
12921292 if (n >= 3 ) {
12931293 uint64_t parsed_hash = 0 ;
1294- sscanf (hash_str , "%llx" , & parsed_hash );
1294+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
12951295 char commit_data [1024 ];
12961296 snprintf (commit_data , sizeof (commit_data ), "%s:%lld" , message , timestamp );
12971297 uint64_t computed_hash = myshell_hash64 (commit_data );
@@ -1331,7 +1331,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_backup(fossil_bluecrab_myshell_t
13311331
13321332 // Write a hash of the backup path as a comment for integrity
13331333 uint64_t backup_hash = myshell_hash64 (backup_path );
1334- if (fprintf (backup_file , "#backup_hash=%016llx \n" , ( unsigned long long ) backup_hash ) < 0 ) {
1334+ if (fprintf (backup_file , "#backup_hash=%016" PRIx64 " \n" , backup_hash ) < 0 ) {
13351335 fclose (backup_file );
13361336 return FOSSIL_MYSHELL_ERROR_IO ;
13371337 }
@@ -1380,7 +1380,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_restore(const char *backup_path,
13801380 if (fgets (hash_line , sizeof (hash_line ), backup_file )) {
13811381 uint64_t file_hash = 0 ;
13821382 if (strncmp (hash_line , "#backup_hash=" , 13 ) == 0 ) {
1383- sscanf (hash_line , "#backup_hash=%llx" , & file_hash );
1383+ sscanf (hash_line , "#backup_hash=%" SCNx64 , & file_hash );
13841384 if (file_hash != expected_hash ) {
13851385 fclose (backup_file );
13861386 return FOSSIL_MYSHELL_ERROR_INTEGRITY ;
@@ -1526,7 +1526,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_check_integrity(fossil_bluecrab_m
15261526 }
15271527 if (n >= 3 ) {
15281528 uint64_t parsed_hash = 0 ;
1529- sscanf (hash_str , "%llx" , & parsed_hash );
1529+ sscanf (hash_str , "%" SCNx64 , & parsed_hash );
15301530 char commit_data [1024 ];
15311531 snprintf (commit_data , sizeof (commit_data ), "%s:%lld" , message , timestamp );
15321532 uint64_t computed_hash = myshell_hash64 (commit_data );
@@ -1593,7 +1593,7 @@ fossil_bluecrab_myshell_error_t fossil_myshell_check_integrity(fossil_bluecrab_m
15931593 }
15941594 if (hash_comment ) {
15951595 uint64_t file_hash = 0 ;
1596- sscanf (hash_comment , "#hash=%llx" , & file_hash );
1596+ sscanf (hash_comment , "#hash=%" SCNx64 , & file_hash );
15971597 uint64_t key_hash = myshell_hash64 (line );
15981598 if (file_hash != key_hash ) {
15991599 * eq = '=' ; // Restore
0 commit comments