aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/util/cmdline.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/util/cmdline.cc')
-rw-r--r--test/core/util/cmdline.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/core/util/cmdline.cc b/test/core/util/cmdline.cc
index 20bce273cd..fd3959bfe9 100644
--- a/test/core/util/cmdline.cc
+++ b/test/core/util/cmdline.cc
@@ -56,7 +56,7 @@ struct gpr_cmdline {
static int normal_state(gpr_cmdline* cl, char* arg);
gpr_cmdline* gpr_cmdline_create(const char* description) {
- gpr_cmdline* cl = (gpr_cmdline*)gpr_zalloc(sizeof(gpr_cmdline));
+ gpr_cmdline* cl = static_cast<gpr_cmdline*>(gpr_zalloc(sizeof(gpr_cmdline)));
cl->description = description;
cl->state = normal_state;
@@ -85,7 +85,7 @@ static void add_arg(gpr_cmdline* cl, const char* name, const char* help,
GPR_ASSERT(0 != strcmp(a->name, name));
}
- a = (arg*)gpr_zalloc(sizeof(arg));
+ a = static_cast<arg*>(gpr_zalloc(sizeof(arg)));
a->name = name;
a->help = help;
a->type = type;
@@ -223,13 +223,13 @@ static int value_state(gpr_cmdline* cl, char* str) {
cl->cur_arg->name);
return print_usage_and_die(cl);
}
- *(int*)cl->cur_arg->value = (int)intval;
+ *static_cast<int*>(cl->cur_arg->value) = static_cast<int>(intval);
break;
case ARGTYPE_BOOL:
if (0 == strcmp(str, "1") || 0 == strcmp(str, "true")) {
- *(int*)cl->cur_arg->value = 1;
+ *static_cast<int*>(cl->cur_arg->value) = 1;
} else if (0 == strcmp(str, "0") || 0 == strcmp(str, "false")) {
- *(int*)cl->cur_arg->value = 0;
+ *static_cast<int*>(cl->cur_arg->value) = 0;
} else {
fprintf(stderr, "expected boolean, got '%s' for %s\n", str,
cl->cur_arg->name);
@@ -237,7 +237,7 @@ static int value_state(gpr_cmdline* cl, char* str) {
}
break;
case ARGTYPE_STRING:
- *(char**)cl->cur_arg->value = str;
+ *static_cast<char**>(cl->cur_arg->value) = str;
break;
}
@@ -281,14 +281,14 @@ static int normal_state(gpr_cmdline* cl, char* str) {
fprintf(stderr, "%s is not a flag argument\n", str);
return print_usage_and_die(cl);
}
- *(int*)cl->cur_arg->value = 0;
+ *static_cast<int*>(cl->cur_arg->value) = 0;
return 1; /* early out */
}
eq = strchr(str, '=');
if (eq != nullptr) {
/* copy the string into a temp buffer and extract the name */
- tmp = arg_name = (char*)gpr_malloc((size_t)(eq - str + 1));
- memcpy(arg_name, str, (size_t)(eq - str));
+ tmp = arg_name = static_cast<char*>(gpr_malloc(static_cast<size_t>(eq - str + 1)));
+ memcpy(arg_name, str, static_cast<size_t>(eq - str));
arg_name[eq - str] = 0;
} else {
arg_name = str;
@@ -305,7 +305,7 @@ static int normal_state(gpr_cmdline* cl, char* str) {
cl->state = value_state;
} else {
/* flag parameter: just set the value */
- *(int*)cl->cur_arg->value = 1;
+ *static_cast<int*>(cl->cur_arg->value) = 1;
}
} else {
r = extra_state(cl, str);