Skip to content

Commit e51c335

Browse files
authored
Merge pull request #121 from yossigo/fix/compile-warnings
Fix C++ compiler warnings.
2 parents b95dd16 + 2e5c903 commit e51c335

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

memtier_benchmark.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,7 @@ static void cleanup_openssl(void)
12081208

12091209
int main(int argc, char *argv[])
12101210
{
1211-
struct benchmark_config cfg;
1212-
1213-
memset(&cfg, 0, sizeof(struct benchmark_config));
1211+
benchmark_config cfg = benchmark_config();
12141212
cfg.arbitrary_commands = new arbitrary_command_list();
12151213

12161214
if (config_parse_args(argc, argv, &cfg) < 0) {

obj_gen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ void object_generator::alloc_value_buffer(void)
237237
assert(m_random_fd != -1);
238238
}
239239

240-
char buf1[64];
241-
char buf2[64];
242-
int buf1_idx = sizeof(buf1);
243-
int buf2_idx = sizeof(buf2);
240+
char buf1[64] = { 0 };
241+
char buf2[64] = { 0 };
242+
unsigned int buf1_idx = sizeof(buf1);
243+
unsigned int buf2_idx = sizeof(buf2);
244244
char *d = m_value_buffer;
245245
int ret;
246246
int iter = 0;
@@ -249,7 +249,7 @@ void object_generator::alloc_value_buffer(void)
249249
if (buf1_idx == sizeof(buf1)) {
250250
buf1_idx = 0;
251251
buf2_idx++;
252-
if (buf2_idx == sizeof(buf2)) {
252+
if (buf2_idx >= sizeof(buf2)) {
253253
iter++;
254254
if (iter == 20) {
255255
ret = read(m_random_fd, buf1, sizeof(buf1));

0 commit comments

Comments
 (0)