summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan Gu <juan.gu@mongodb.com>2022-08-25 23:31:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-30 22:52:35 +0000
commitc6c013e8a3ef72a60ce0cbc4e4fa97f894cec0bd (patch)
treef5bf0a5d5b8266fcc7facdde49491ae7b2ba8468 /src
parent5ab19c9f44431183462e09c198ef7cb4b4a43bfa (diff)
downloadmongo-c6c013e8a3ef72a60ce0cbc4e4fa97f894cec0bd.tar.gz
SERVER-69155 fix bugprone-suspicious-string-compare warnings
Diffstat (limited to 'src')
-rw-r--r--src/mongo/s/catalog/type_chunk.cpp2
-rw-r--r--src/mongo/s/catalog/type_tags.cpp2
-rw-r--r--src/mongo/util/md5main.cpp2
-rw-r--r--src/mongo/util/stacktrace_somap.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/s/catalog/type_chunk.cpp b/src/mongo/s/catalog/type_chunk.cpp
index 9def6f376b2..88fd1fc3aa1 100644
--- a/src/mongo/s/catalog/type_chunk.cpp
+++ b/src/mongo/s/catalog/type_chunk.cpp
@@ -555,7 +555,7 @@ Status ChunkType::validate() const {
while (minIt.more() && maxIt.more()) {
BSONElement minElem = minIt.next();
BSONElement maxElem = maxIt.next();
- if (strcmp(minElem.fieldName(), maxElem.fieldName())) {
+ if (strcmp(minElem.fieldName(), maxElem.fieldName()) != 0) {
return {ErrorCodes::BadValue,
str::stream() << "min and max don't have matching keys: " << *_min << ", "
<< *_max};
diff --git a/src/mongo/s/catalog/type_tags.cpp b/src/mongo/s/catalog/type_tags.cpp
index 0edfc7eb5d8..b8a362ce576 100644
--- a/src/mongo/s/catalog/type_tags.cpp
+++ b/src/mongo/s/catalog/type_tags.cpp
@@ -119,7 +119,7 @@ Status TagsType::validate() const {
while (minIt.more() && maxIt.more()) {
BSONElement minElem = minIt.next();
BSONElement maxElem = maxIt.next();
- if (strcmp(minElem.fieldName(), maxElem.fieldName())) {
+ if (strcmp(minElem.fieldName(), maxElem.fieldName()) != 0) {
return Status(ErrorCodes::BadValue, "min and max have different set of keys");
}
}
diff --git a/src/mongo/util/md5main.cpp b/src/mongo/util/md5main.cpp
index 27047713d55..87c6a7edb27 100644
--- a/src/mongo/util/md5main.cpp
+++ b/src/mongo/util/md5main.cpp
@@ -95,7 +95,7 @@ do_md5_test(void) {
md5_finish(&state, digest);
for (di = 0; di < 16; ++di)
sprintf(hex_output + di * 2, "%02x", digest[di]);
- if (strcmp(hex_output, test[i + 1])) {
+ if (strcmp(hex_output, test[i + 1]) != 0) {
printf("MD5 (\"%s\") = ", test[i]);
puts(hex_output);
printf("**** ERROR, should be: %s\n", test[i + 1]);
diff --git a/src/mongo/util/stacktrace_somap.cpp b/src/mongo/util/stacktrace_somap.cpp
index 53d4f8cdc26..c2ed5ac84f8 100644
--- a/src/mongo/util/stacktrace_somap.cpp
+++ b/src/mongo/util/stacktrace_somap.cpp
@@ -149,7 +149,7 @@ void processLoadSegment(const dl_phdr_info& info, const ElfW(Phdr) & phdr, BSONO
const char* filename = info.dlpi_name;
- if (memcmp(&eHeader.e_ident[EI_MAG0], ELFMAG, SELFMAG)) {
+ if (memcmp(&eHeader.e_ident[EI_MAG0], ELFMAG, SELFMAG) != 0) {
LOGV2_WARNING(23842,
"Bad ELF magic number",
"filename"_attr = filename,