Skip to content

Commit fe43dec

Browse files
kpumukJens-G
authored andcommitted
Fixed C++ cppcheck offenses
1 parent 6721241 commit fe43dec

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/cpp/src/thrift/generate/t_c_glib_generator.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,13 @@ class t_c_glib_generator : public t_oop_generator {
7676
this->nspace_lc = "";
7777
} else {
7878
/* replace dots with underscores */
79-
char* tmp = strdup(this->nspace.c_str());
80-
for (unsigned int i = 0; i < strlen(tmp); i++) {
79+
string tmp = this->nspace;
80+
for (size_t i = 0; i < tmp.size(); i++) {
8181
if (tmp[i] == '.') {
8282
tmp[i] = '_';
8383
}
8484
}
85-
this->nspace = string(tmp, strlen(tmp));
86-
free(tmp);
85+
this->nspace = tmp;
8786

8887
/* clean up the namespace for C.
8988
* An input of 'namespace foo' should result in:

lib/cpp/test/TFileTransportTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class FsyncLog {
6767
FsyncLog() = default;
6868

6969
void fsync(int fd) {
70-
(void)fd;
7170
FsyncCall call;
71+
call.fd = fd;
7272
THRIFT_GETTIMEOFDAY(&call.time, nullptr);
7373
calls_.push_back(call);
7474
}

0 commit comments

Comments
 (0)