Branch Coverage

ext/xxHash/xxhsum.c
Criterion Covered Total %
branch 0 324 0.0


line true false branch
133 0 0 if (requiredMem > MAX_MEM) requiredMem = MAX_MEM;
135 0 0 while (!testmem) {
136 0 0 if (requiredMem > step) requiredMem -= step;
143 0 0 if (requiredMem > step) requiredMem -= step;
155 0 0 assert(s1 != NULL);
156 0 0 assert(s2 != NULL);
160 0 0 if (buf != NULL) {
298 0 0 for (iterationNb = 1; iterationNb <= nbIterations; iterationNb++) {
307 0 0 while (clock() == cStart); /* starts clock() at its exact beginning */
311 0 0 for (u=0; u
314 0 0 if (r==0) XSUM_logVerbose(3,".\r"); /* do something with r to defeat compiler "optimizing" hash away */
336 0 0 if (nbTicks < TIMELOOP_MIN) {
338 0 0 if (nbTicks == 0) { /* faster than resolution timer */
346 0 0 if (nbh_perSecond > (double)(4000U<<20)) nbh_perSecond = (double)(4000U<<20); /* avoid overflow */
350 0 0 if (g_nbIterations>0) {
355 0 0 if (ticksPerHash < fastestH) fastestH = ticksPerHash;
356 0 0 if (fastestH>0.) { /* avoid div by zero */
365 0 0 if (nbh_perSecond > (double)(4000U<<20)) nbh_perSecond = (double)(4000U<<20); /* avoid overflow */
375 0 0 if (XSUM_logLevel<1)
388 0 0 assert((((size_t)buffer) & 15) == 0); /* ensure alignment */
391 0 0 for (i = 1; i < NB_TESTFUNC; i++) {
393 0 0 assert(g_hashesToBench[hashFuncID].name != NULL);
394 0 0 if (g_testIDs[i] == 0) continue;
396 0 0 if ((i % 2) == 1) {
400 0 0 if ((i % 2) == 0) {
403 0 0 assert(hashNameBuf != NULL);
414 0 0 if ((XSUM_U64)benchedSize > inFileSize) benchedSize = (size_t)inFileSize;
415 0 0 if (benchedSize < inFileSize) {
425 0 0 for (fileIdx=0; fileIdx
427 0 0 assert(inFileName != NULL);
435 0 0 if (inFile==NULL){
440 0 0 if(!buffer) {
449 0 0 if(readSize != benchedSize) {
467 0 0 if (buffer == NULL) {
476 0 0 if (keySize > 10 KB) {
498 0 0 for (idx=length-1; idx
506 0 0 for (idx=0; idx
537 0 0 while ((readSize = fread(buffer, 1, blockSize, inFile)) > 0) {
553 0 0 if (ferror(inFile)) {
591 0 0 assert(0 <= hashType && hashType <= XSUM_TABLE_ELT_SIZE(XSUM_algoName));
613 0 0 assert(0 <= hashType && hashType <= XSUM_TABLE_ELT_SIZE(XSUM_algoName));
651 0 0 assert(displayEndianess==big_endian || displayEndianess==little_endian);
652 0 0 assert(convention==display_gnu || convention==display_bsd);
655 0 0 if (fileName == stdinName) {
660 0 0 if (XSUM_isDirectory(fileName)) {
665 0 0 if (inFile==NULL) {
672 0 0 if (buffer == NULL) {
726 0 0 if (fnTotal==0)
729 0 0 for (fnNb=0; fnNb
807 0 0 if ((*lineBuf == NULL) || (*lineMax<1)) {
0 0 if ((*lineBuf == NULL) || (*lineMax<1)) {
811 0 0 if(*lineBuf == NULL) return GetLine_outOfMemory;
817 0 0 if (c == EOF) {
822 0 0 if (len == 0) result = GetLine_eof;
827 0 0 if (len+1 >= (size_t)*lineMax) {
832 0 0 if (newBufSize > MAX_LINE_LENGTH) newBufSize = MAX_LINE_LENGTH;
833 0 0 if (len+1 >= newBufSize) return GetLine_exceedMaxLineLength;
836 0 0 if (newLineBuf == NULL) return GetLine_outOfMemory;
842 0 0 if (c == '\n') break;
858 0 0 if (c >= '0' && c <= '9') {
0 0 if (c >= '0' && c <= '9') {
860 0 0 } else if (c >= 'A' && c <= 'F') {
0 0 } else if (c >= 'A' && c <= 'F') {
862 0 0 } else if (c >= 'a' && c <= 'f') {
0 0 } else if (c >= 'a' && c <= 'f') {
882 0 0 for (i = 0; i < dstSize; ++i) {
884 0 0 size_t j = reverseBytes ? dstSize - i - 1 : i;
887 0 0 if (h0 < 0) return CanonicalFromString_invalidFormat;
890 0 0 if (h1 < 0) return CanonicalFromString_invalidFormat;
926 0 0 if (firstSpace == NULL || !firstSpace[1]) return ParseLine_invalidFormat;
0 0 if (firstSpace == NULL || !firstSpace[1]) return ParseLine_invalidFormat;
928 0 0 if (firstSpace[1] == '(') {
930 0 0 if (lastSpace - firstSpace < 5) return ParseLine_invalidFormat;
931 0 0 if (lastSpace[-1] != '=' || lastSpace[-2] != ' ' || lastSpace[-3] != ')') return ParseLine_invalidFormat;
0 0 if (lastSpace[-1] != '=' || lastSpace[-2] != ' ' || lastSpace[-3] != ')') return ParseLine_invalidFormat;
0 0 if (lastSpace[-1] != '=' || lastSpace[-2] != ' ' || lastSpace[-3] != ')') return ParseLine_invalidFormat;
949 0 0 if (XSUM_canonicalFromString(xxh32c->digest, sizeof(xxh32c->digest), hash_ptr, rev)
959 0 0 if (XSUM_canonicalFromString(xxh64c->digest, sizeof(xxh64c->digest), hash_ptr, rev)
969 0 0 if (XSUM_canonicalFromString(xxh128c->digest, sizeof(xxh128c->digest), hash_ptr, rev)
1000 0 0 while (!report->quit) {
1006 0 0 if (lineNumber == 0) {
1016 0 0 if (XSUM_getLineResult != GetLine_ok) {
1017 0 0 if (XSUM_getLineResult == GetLine_eof) break;
1044 0 0 if (XSUM_parseLine(&parsedLine, XSUM_parseFileArg->lineBuf, rev) != ParseLine_ok) {
1046 0 0 if (XSUM_parseFileArg->warn) {
1057 0 0 if (fp == NULL) {
1066 0 0 if (xxh.xxh32 == XXH32_hashFromCanonical(&parsedLine.canonical.xxh32)) {
1073 0 0 if (xxh.xxh64 == XXH64_hashFromCanonical(&parsedLine.canonical.xxh64)) {
1080 0 0 if (XXH128_isEqual(xxh.xxh128, XXH128_hashFromCanonical(&parsedLine.canonical.xxh128))) {
1100 0 0 if (!XSUM_parseFileArg->statusOnly) {
1109 0 0 if (lineStatus == LineStatus_hashOk) {
1111 0 0 if (XSUM_parseFileArg->quiet) b = 0;
1116 0 0 if (b && !XSUM_parseFileArg->statusOnly) {
0 0 if (b && !XSUM_parseFileArg->statusOnly) {
1117 0 0 XSUM_output("%s: %s\n", parsedLine.filename
1155 0 0 if (inFileName == stdinName) {
1166 0 0 if (inFile == NULL) {
1182 0 0 if ( (XSUM_parseFileArg->lineBuf == NULL)
1183 0 0 || (XSUM_parseFileArg->blockBuf == NULL) ) {
1192 0 0 if (inFile != stdin) fclose(inFile);
1196 0 0 if (report->nProperlyFormattedLines == 0) {
1198 0 0 } else if (!statusOnly) {
1199 0 0 if (report->nImproperlyFormattedLines) {
1200 0 0 XSUM_output("%lu %s improperly formatted\n"
1204 0 0 if (report->nOpenOrReadFailures) {
1205 0 0 XSUM_output("%lu listed %s could not be read\n"
1209 0 0 if (report->nMismatchedChecksums) {
1210 0 0 XSUM_output("%lu computed %s did NOT match\n"
1218 0 0 && report->nMismatchedChecksums == 0
1219 0 0 && report->nOpenOrReadFailures == 0
1220 0 0 && (!strictMode || report->nImproperlyFormattedLines == 0)
0 0 && (!strictMode || report->nImproperlyFormattedLines == 0)
1221 0 0 && report->quit == 0;
0 0 && report->quit == 0;
1237 0 0 if (fnTotal==0) {
1241 0 0 for (fnNb=0; fnNb
1302 0 0 if (strrchr(name, '/')) name = strrchr(name, '/') + 1;
1303 0 0 if (strrchr(name, '\\')) name = strrchr(name, '\\') + 1; /* windows */
1318 0 0 while ((**stringPtr >='0') && (**stringPtr <='9')) {
1319 0 0 if (result > max) return 1; /* overflow error */
1324 0 0 if ((**stringPtr=='K') || (**stringPtr=='M')) {
1326 0 0 if (result > maxK) return 1; /* overflow error */
1328 0 0 if (**stringPtr=='M') {
1329 0 0 if (result > maxK) return 1; /* overflow error */
1333 0 0 if (**stringPtr=='i') (*stringPtr)++;
1334 0 0 if (**stringPtr=='B') (*stringPtr)++;
1349 0 0 if (XSUM_readU32FromCharChecked(stringPtr, &result)) {
1374 0 0 if (strstr(exename, "xxh32sum") != NULL) algo = g_defaultAlgo = algo_xxh32;
1375 0 0 if (strstr(exename, "xxh64sum") != NULL) algo = g_defaultAlgo = algo_xxh64;
1376 0 0 if (strstr(exename, "xxh128sum") != NULL) algo = g_defaultAlgo = algo_xxh128;
1378 0 0 for (i=1; i
1380 0 0 assert(argument != NULL);
1382 0 0 if (!strcmp(argument, "--check")) { fileCheckMode = 1; continue; }
1383 0 0 if (!strcmp(argument, "--benchmark-all")) { benchmarkMode = 1; selectBenchIDs = kBenchAll; continue; }
1384 0 0 if (!strcmp(argument, "--bench-all")) { benchmarkMode = 1; selectBenchIDs = kBenchAll; continue; }
1385 0 0 if (!strcmp(argument, "--quiet")) { XSUM_logLevel--; continue; }
1386 0 0 if (!strcmp(argument, "--little-endian")) { displayEndianess = little_endian; continue; }
1387 0 0 if (!strcmp(argument, "--strict")) { strictMode = 1; continue; }
1388 0 0 if (!strcmp(argument, "--status")) { statusOnly = 1; continue; }
1389 0 0 if (!strcmp(argument, "--warn")) { warn = 1; continue; }
1390 0 0 if (!strcmp(argument, "--help")) { return XSUM_usage_advanced(exename); }
1391 0 0 if (!strcmp(argument, "--version")) { XSUM_log(FULL_WELCOME_MESSAGE(exename)); XSUM_sanityCheck(); return 0; }
1392 0 0 if (!strcmp(argument, "--tag")) { convention = display_bsd; continue; }
1394 0 0 if (!strcmp(argument, "--")) {
0 0 if (!strcmp(argument, "--")) {
0 0 if (!strcmp(argument, "--")) {
1395 0 0 if (filenamesStart==0 && i!=argc-1) filenamesStart=i+1; /* only supports a continuous list of filenames */
1398 0 0 if (*argument != '-') {
1405 0 0 if (*argument == 0) explicitStdin = 1;
1407 0 0 while (*argument != 0) {
1449 0 0 if (*argument == ',') argument++;
1451 0 0 if (selectBenchIDs < NB_TESTFUNC) {
1455 0 0 } while (*argument == ',');
1483 0 0 if (benchmarkMode) {
1486 0 0 if (selectBenchIDs == 0) memcpy(g_testIDs, k_testIDs_default, sizeof(g_testIDs));
1487 0 0 if (selectBenchIDs == kBenchAll) memset(g_testIDs, 1, sizeof(g_testIDs));
1488 0 0 if (filenamesStart==0) return XSUM_benchInternal(keySize);
1493 0 0 if ( (filenamesStart==0) && XSUM_isConsole(stdin) && !explicitStdin)
0 0 if ( (filenamesStart==0) && XSUM_isConsole(stdin) && !explicitStdin)
0 0 if ( (filenamesStart==0) && XSUM_isConsole(stdin) && !explicitStdin)
1496 0 0 if (filenamesStart==0) filenamesStart = argc;
1497 0 0 if (fileCheckMode) {