5148ded61163c9564fdffdf5d72e43208cc166b2 galt Sat Apr 22 03:00:54 2017 -0700 Changed unnecessary and unavailable fread_unlocked to simply use fread instead. diff --git src/lib/tests/sha1Test.c src/lib/tests/sha1Test.c index 3ca2ba4..a2ba48e 100644 --- src/lib/tests/sha1Test.c +++ src/lib/tests/sha1Test.c @@ -24,31 +24,31 @@ /* generate sha1 manually the hard way. */ { FILE *fp = fopen (filename, "r"); if (!fp) { printf("missing file %s\n", filename); exit(1); } #define BS 4096 /* match coreutils */ SHA1_CTX ctx; SHA1_Init(&ctx); size_t nr; char buf[BS]; -while ((nr=fread_unlocked(buf, 1, sizeof(buf), fp))) +while ((nr=fread(buf, 1, sizeof(buf), fp))) SHA1_Update(&ctx, (const uint8_t*)buf, nr); SHA1_Final(&ctx, hash); } char *string_way(char *filename) /* generate sha1 via lib on single long string. */ { char *buf = NULL; size_t bufSize; readInGulp(filename, &buf, &bufSize); return sha1HexForBuf(buf, bufSize); } char *git_way(char *filename) @@ -79,31 +79,31 @@ #define BS 4096 /* match coreutils */ unsigned char hash[20]; off_t fs = fileSize(filename); char prefix[1024]; safef(prefix, sizeof prefix, "blob %llu", (unsigned long long)fs); SHA1_CTX ctx; SHA1_Init(&ctx); SHA1_Update(&ctx, (const uint8_t*)prefix, strlen(prefix)+1); size_t nr; char buf[BS]; -while ((nr=fread_unlocked(buf, 1, sizeof(buf), fp))) +while ((nr=fread(buf, 1, sizeof(buf), fp))) SHA1_Update(&ctx, (const uint8_t*)buf, nr); SHA1_Final(&ctx, hash); return sha1ToHex(hash); } void git_way3(char *filename) /* generate sha1 manually the hard way. */ { char cmd[1024]; safef(cmd, sizeof cmd, "git hash-object %s", filename); printf("executing system command [%s]\n", cmd); system(cmd); }