Cleanup: fixed Clang-Tidy `bugprone-suspicious-string-compare` warnings

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2020-08-07 17:16:46 +02:00
parent 7309ee4df7
commit a9c91ce331
6 changed files with 8 additions and 9 deletions

View File

@ -31,7 +31,6 @@ Checks: >
-bugprone-sizeof-expression, -bugprone-sizeof-expression,
-bugprone-integer-division, -bugprone-integer-division,
-bugprone-incorrect-roundings, -bugprone-incorrect-roundings,
-bugprone-suspicious-string-compare,
-bugprone-not-null-terminated-result, -bugprone-not-null-terminated-result,
-bugprone-suspicious-missing-comma, -bugprone-suspicious-missing-comma,
-bugprone-parent-virtual-call, -bugprone-parent-virtual-call,

View File

@ -713,8 +713,8 @@ CCGError ccgSubSurf_syncFace(
if (f) { if (f) {
if (f->numVerts != numVerts || if (f->numVerts != numVerts ||
memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) || memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) != 0 ||
memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts)) { memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts) != 0) {
topologyChanged = 1; topologyChanged = 1;
} }
} }
@ -784,8 +784,8 @@ CCGError ccgSubSurf_syncFace(
if (f) { if (f) {
if (f->numVerts != numVerts || if (f->numVerts != numVerts ||
memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) || memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) != 0 ||
memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts)) { memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts) != 0) {
topologyChanged = 1; topologyChanged = 1;
} }
} }

View File

@ -166,7 +166,7 @@ static bool idkey_cmp(const void *a, const void *b)
{ {
const struct IDNameLib_Key *idkey_a = a; const struct IDNameLib_Key *idkey_a = a;
const struct IDNameLib_Key *idkey_b = b; const struct IDNameLib_Key *idkey_b = b;
return strcmp(idkey_a->name, idkey_b->name) || (idkey_a->lib != idkey_b->lib); return strcmp(idkey_a->name, idkey_b->name) != 0 || (idkey_a->lib != idkey_b->lib);
} }
ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map, ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map,

View File

@ -416,7 +416,7 @@ enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name,
break; break;
} }
if (memcmp(buf, ((char *)pf->data) + i, len)) { if (memcmp(buf, ((char *)pf->data) + i, len) != 0) {
ret_val = PF_CMP_DIFFERS; ret_val = PF_CMP_DIFFERS;
break; break;
} }

View File

@ -1201,7 +1201,7 @@ static void do_version_fcurve_hide_viewport_fix(struct ID *UNUSED(id),
struct FCurve *fcu, struct FCurve *fcu,
void *UNUSED(user_data)) void *UNUSED(user_data))
{ {
if (strcmp(fcu->rna_path, "hide")) { if (strcmp(fcu->rna_path, "hide") != 0) {
return; return;
} }

View File

@ -63,7 +63,7 @@ static IArchive open_archive(const std::string &filename,
else if (!the_file.read(header, sizeof(header))) { else if (!the_file.read(header, sizeof(header))) {
std::cerr << "Unable to read from " << filename << std::endl; std::cerr << "Unable to read from " << filename << std::endl;
} }
else if (strncmp(header + 1, "HDF", 3)) { else if (strncmp(header + 1, "HDF", 3) != 0) {
std::cerr << filename << " has an unknown file format, unable to read." << std::endl; std::cerr << filename << " has an unknown file format, unable to read." << std::endl;
} }
else { else {