MCPcopy Index your code
hub / github.com/NetHack/NetHack / uptodate

Function uptodate

src/version.c:712–746  ·  view source on GitHub ↗

this used to be based on file date and somewhat OS-dependent, * but now examines the initial part of the file's contents. * * returns: * * SF_UPTODATE (0) everything matched and looks good * SF_OUTDATED (1) savefile is outdated * SF_CRITICAL_BYTE_COUNT_MISMATCH (2) critical size count mismatch * SF_DM_IL32LLP64_ON_ILP32LL64 (3) Windows x6

Source from the content-addressed store, hash-verified

710 * SF_DM_MISMATCH (9) some other mismatch
711 */
712int
713uptodate(NHFILE *nhfp, const char *name, unsigned long utdflags)
714{
715#ifdef SFCTOOL
716 extern struct version_info vers_info;
717#else
718 struct version_info vers_info;
719#endif
720 char indicator;
721 int sfstatus = 0, idx_1st_mismatch = 0;
722 boolean quietly = (utdflags & UTD_QUIETLY) != 0;
723 boolean verbose = name ? TRUE : FALSE;
724
725 Sfi_char(nhfp, &indicator, "indicate-format", 1);
726 if ((sfstatus = compare_critical_bytes(nhfp, &idx_1st_mismatch, utdflags))
727 != SF_UPTODATE) {
728 if (sfstatus > 0 && idx_1st_mismatch) {
729 if (!quietly)
730 raw_printf("comparison of critical bytes mismatched at %d (%s).",
731 critical_sizes[idx_1st_mismatch].ucsize,
732 critical_sizes[idx_1st_mismatch].nm);
733 }
734 }
735
736 Sfi_version_info(nhfp, &vers_info, "version_info");
737 if (!check_version(&vers_info, name, verbose, utdflags)) {
738 if (verbose) {
739 if ((utdflags & UTD_WITHOUT_WAITSYNCH_PERFILE) == 0) {
740 wait_synch();
741 }
742 }
743 return SF_OUTDATED;
744 }
745 return sfstatus;
746}
747
748/*
749 * returns:

Callers 1

validateFunction · 0.85

Calls 3

compare_critical_bytesFunction · 0.85
wait_synchFunction · 0.85
raw_printfFunction · 0.70

Tested by

no test coverage detected