Fix bugprone-narrowing-conversion errors in csync tests
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
parent
c7c37f9bef
commit
2916144fe3
|
@ -652,8 +652,8 @@ static void check_csync_excluded_performance(void **)
|
||||||
|
|
||||||
gettimeofday(&after, nullptr);
|
gettimeofday(&after, nullptr);
|
||||||
|
|
||||||
const double total = (after.tv_sec - before.tv_sec)
|
const auto total = static_cast<double>(after.tv_sec - before.tv_sec)
|
||||||
+ (after.tv_usec - before.tv_usec) / 1.0e6;
|
+ static_cast<double>(after.tv_usec - before.tv_usec) / 1.0e6;
|
||||||
const double perCallMs = total / 2 / N * 1000;
|
const double perCallMs = total / 2 / N * 1000;
|
||||||
printf("csync_excluded: %f ms per call\n", perCallMs);
|
printf("csync_excluded: %f ms per call\n", perCallMs);
|
||||||
}
|
}
|
||||||
|
@ -670,8 +670,8 @@ static void check_csync_excluded_performance(void **)
|
||||||
|
|
||||||
gettimeofday(&after, nullptr);
|
gettimeofday(&after, nullptr);
|
||||||
|
|
||||||
const double total = (after.tv_sec - before.tv_sec)
|
const auto total = static_cast<double>(after.tv_sec - before.tv_sec)
|
||||||
+ (after.tv_usec - before.tv_usec) / 1.0e6;
|
+ static_cast<double>(after.tv_usec - before.tv_usec) / 1.0e6;
|
||||||
const double perCallMs = total / 2 / N * 1000;
|
const double perCallMs = total / 2 / N * 1000;
|
||||||
printf("csync_excluded_traversal: %f ms per call\n", perCallMs);
|
printf("csync_excluded_traversal: %f ms per call\n", perCallMs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ static void traverse_dir(void **state, const char *dir, int *cnt)
|
||||||
if( !sv->result ) {
|
if( !sv->result ) {
|
||||||
sv->result = c_strdup( subdir_out);
|
sv->result = c_strdup( subdir_out);
|
||||||
} else {
|
} else {
|
||||||
int newlen = 1+strlen(sv->result)+strlen(subdir_out);
|
const auto newlen = 1 + strlen(sv->result)+strlen(subdir_out);
|
||||||
char *tmp = sv->result;
|
char *tmp = sv->result;
|
||||||
sv->result = (char*)c_malloc(newlen);
|
sv->result = (char*)c_malloc(newlen);
|
||||||
strcpy( sv->result, tmp);
|
strcpy( sv->result, tmp);
|
||||||
|
@ -406,7 +406,7 @@ static void check_readdir_longtree(void **state)
|
||||||
"<DIR> C:/tmp/csync_test/vierzig/mann/auf/des/toten/Mann/kiste/ooooooooooooooooooooooh/and/ne/bottle/voll/rum/und/so/singen/wir/VIERZIG/MANN/AUF/DES/TOTEN/MANNS/KISTE/OOOOOOOOH/AND/NE/BOTTLE/VOLL/RUM/undnochmalallezusammen/VierZig/MannaufDesTotenManns/KISTE/ooooooooooooooooooooooooooohhhhhh/und/BESSER/ZWEI/Butteln/VOLL RUM";
|
"<DIR> C:/tmp/csync_test/vierzig/mann/auf/des/toten/Mann/kiste/ooooooooooooooooooooooh/and/ne/bottle/voll/rum/und/so/singen/wir/VIERZIG/MANN/AUF/DES/TOTEN/MANNS/KISTE/OOOOOOOOH/AND/NE/BOTTLE/VOLL/RUM/undnochmalallezusammen/VierZig/MannaufDesTotenManns/KISTE/ooooooooooooooooooooooooooohhhhhh/und/BESSER/ZWEI/Butteln/VOLL RUM";
|
||||||
|
|
||||||
/* assemble the result string ... */
|
/* assemble the result string ... */
|
||||||
int overall_len = 1+strlen(r1)+strlen(r2)+strlen(r3);
|
const auto overall_len = 1 + strlen(r1) + strlen(r2) + strlen(r3);
|
||||||
int files_cnt = 0;
|
int files_cnt = 0;
|
||||||
char *result = (char*)c_malloc(overall_len);
|
char *result = (char*)c_malloc(overall_len);
|
||||||
*result = '\0';
|
*result = '\0';
|
||||||
|
|
Loading…
Reference in New Issue