Skip to content

Commit fd9076d

Browse files
committed
[???] Use std:: when calling strcmp
1 parent ef4ca71 commit fd9076d

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

include/irods/private/re/python.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef IRODS_RE_PYTHON_HPP
22
#define IRODS_RE_PYTHON_HPP
33

4+
#include <cstring>
45
#include <type_traits>
56
#include <functional>
67

@@ -109,28 +110,28 @@ namespace
109110
else if (!msParam.type) {
110111
THROW(SYS_NOT_SUPPORTED, "msParam type is null");
111112
}
112-
else if (strcmp(msParam.type, GenQueryInp_MS_T) == 0) {
113+
else if (std::strcmp(msParam.type, GenQueryInp_MS_T) == 0) {
113114
return boost::python::object{*static_cast<genQueryInp_t*>(msParam.inOutStruct)};
114115
}
115-
else if (strcmp(msParam.type, GenQueryOut_MS_T) == 0) {
116+
else if (std::strcmp(msParam.type, GenQueryOut_MS_T) == 0) {
116117
return boost::python::object{*static_cast<genQueryOut_t*>(msParam.inOutStruct)};
117118
}
118-
else if (strcmp(msParam.type, KeyValPair_MS_T) == 0) {
119+
else if (std::strcmp(msParam.type, KeyValPair_MS_T) == 0) {
119120
return boost::python::object{*static_cast<keyValPair_t*>(msParam.inOutStruct)};
120121
}
121-
else if (strcmp(msParam.type, DataObjLseekOut_MS_T) == 0) {
122+
else if (std::strcmp(msParam.type, DataObjLseekOut_MS_T) == 0) {
122123
return boost::python::object{*static_cast<fileLseekOut_t*>(msParam.inOutStruct)};
123124
}
124-
else if (strcmp(msParam.type, RodsObjStat_MS_T) == 0) {
125+
else if (std::strcmp(msParam.type, RodsObjStat_MS_T) == 0) {
125126
return boost::python::object{*static_cast<rodsObjStat_t*>(msParam.inOutStruct)};
126127
}
127-
else if (strcmp(msParam.type, INT_MS_T) == 0) {
128+
else if (std::strcmp(msParam.type, INT_MS_T) == 0) {
128129
return boost::python::object{*static_cast<int*>(msParam.inOutStruct)};
129130
}
130-
else if (strcmp(msParam.type, FLOAT_MS_T) == 0) {
131+
else if (std::strcmp(msParam.type, FLOAT_MS_T) == 0) {
131132
return boost::python::object{*static_cast<float*>(msParam.inOutStruct)};
132133
}
133-
else if (strcmp(msParam.type, BUF_LEN_MS_T) == 0) {
134+
else if (std::strcmp(msParam.type, BUF_LEN_MS_T) == 0) {
134135
// clang-format off
135136
return msParam.inpOutBuf
136137
? boost::python::object{bytesBuf_t{msParam.inpOutBuf->len, msParam.inpOutBuf->buf}}

src/main.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <pyconfig.h>
33

44
#include <cstdint>
5+
#include <cstring>
56
#include <ctime>
67
#include <fstream>
78
#include <list>
@@ -750,20 +751,20 @@ static irods::error exec_rule_text(const irods::default_re_ctx&,
750751
if (mp->type == NULL) {
751752
rule_vars_python[label] = NULL;
752753
}
753-
else if (strcmp(mp->type, DOUBLE_MS_T) == 0) {
754+
else if (std::strcmp(mp->type, DOUBLE_MS_T) == 0) {
754755
double* tmpDouble = (double*) mp->inOutStruct;
755756
rule_vars_python[label] = tmpDouble;
756757
}
757-
else if (strcmp(mp->type, INT_MS_T) == 0) {
758+
else if (std::strcmp(mp->type, INT_MS_T) == 0) {
758759
int* tmpInt = (int*) mp->inOutStruct;
759760
rule_vars_python[label] = tmpInt;
760761
}
761-
else if (strcmp(mp->type, STR_MS_T) == 0) {
762+
else if (std::strcmp(mp->type, STR_MS_T) == 0) {
762763
char* tmpChar = (char*) mp->inOutStruct;
763764
std::string tmpStr(tmpChar);
764765
rule_vars_python[label] = tmpStr;
765766
}
766-
else if (strcmp(mp->type, DATETIME_MS_T) == 0) {
767+
else if (std::strcmp(mp->type, DATETIME_MS_T) == 0) {
767768
rodsLong_t* tmpRodsLong = (rodsLong_t*) mp->inOutStruct;
768769
rule_vars_python[label] = tmpRodsLong;
769770
}
@@ -899,20 +900,20 @@ static irods::error exec_rule_expression(irods::default_re_ctx&,
899900
if (mp->type == NULL) {
900901
rule_vars_python[label] = boost::python::object{};
901902
}
902-
else if (strcmp(mp->type, DOUBLE_MS_T) == 0) {
903+
else if (std::strcmp(mp->type, DOUBLE_MS_T) == 0) {
903904
double* tmpDouble = (double*) mp->inOutStruct;
904905
rule_vars_python[label] = tmpDouble;
905906
}
906-
else if (strcmp(mp->type, INT_MS_T) == 0) {
907+
else if (std::strcmp(mp->type, INT_MS_T) == 0) {
907908
int* tmpInt = (int*) mp->inOutStruct;
908909
rule_vars_python[label] = tmpInt;
909910
}
910-
else if (strcmp(mp->type, STR_MS_T) == 0) {
911+
else if (std::strcmp(mp->type, STR_MS_T) == 0) {
911912
char* tmpChar = (char*) mp->inOutStruct;
912913
std::string tmpStr(tmpChar);
913914
rule_vars_python[label] = tmpStr;
914915
}
915-
else if (strcmp(mp->type, DATETIME_MS_T) == 0) {
916+
else if (std::strcmp(mp->type, DATETIME_MS_T) == 0) {
916917
rodsLong_t* tmpRodsLong = (rodsLong_t*) mp->inOutStruct;
917918
rule_vars_python[label] = tmpRodsLong;
918919
}

src/types/irods/objInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "irods/private/re/python/types/irods/objInfo.hpp"
55

6+
#include <cstring>
7+
68
#include <irods/objInfo.h>
79

810
#include "irods/private/re/python/types/array_ref.hpp"
@@ -92,7 +94,7 @@ namespace irods::re::python::types
9294
.add_property("value", +[](keyValPair_t *s) { return array_ref<array_ref<char, true>>{s->value, static_cast<std::size_t>(s->len)}; })
9395
.def("__getitem__", +[](keyValPair_t* s, const std::string key) {
9496
for (int i = 0; i < s->len; ++i) {
95-
if (strcmp(key.c_str(), s->keyWord[i]) == 0) {
97+
if (std::strcmp(key.c_str(), s->keyWord[i]) == 0) {
9698
return std::string{s->value[i]};
9799
}
98100
}

0 commit comments

Comments
 (0)