C++ compiler warnings: conversion from string literal to 'char *'

This commit is contained in:
Shahram Najm 2022-11-20 14:40:57 +00:00
parent 4f084f050e
commit 6e39ecda5e
3 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ static void usage(const char* prog)
int main(int argc, char* argv[])
{
char* resource_path = NULL;
char* resource_name = NULL;
const char* resource_name = NULL;
ResourceType resource_type = UNKNOWN;
char* full_path = NULL;
char* out_file = NULL;

View File

@ -58,7 +58,7 @@ int grib_tool_init(grib_runtime_options* options)
{
int opt = grib_options_on("C") + grib_options_on("O") + grib_options_on("D");
options->dump_mode = "default";
options->dump_mode = (char*)"default";
if (opt > 1) {
@ -67,12 +67,12 @@ int grib_tool_init(grib_runtime_options* options)
}
if (grib_options_on("O")) {
options->dump_mode = "wmo";
options->dump_mode = (char*)"wmo";
options->dump_flags = GRIB_DUMP_FLAG_CODED | GRIB_DUMP_FLAG_OCTET | GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("D")) {
options->dump_mode = "debug";
options->dump_mode = (char*)"debug";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}

View File

@ -56,7 +56,7 @@ int grib_tool_init(grib_runtime_options* options)
{
int opt = grib_options_on("C") + grib_options_on("O") + grib_options_on("D");
options->dump_mode = "default";
options->dump_mode = (char*)"default";
if (opt > 1) {
printf("%s: simultaneous O/D options not allowed\n", tool_name);
@ -64,22 +64,22 @@ int grib_tool_init(grib_runtime_options* options)
}
if (grib_options_on("O")) {
options->dump_mode = "wmo";
options->dump_mode = (char*)"wmo";
options->dump_flags = GRIB_DUMP_FLAG_CODED | GRIB_DUMP_FLAG_OCTET | GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("D")) {
options->dump_mode = "debug";
options->dump_mode = (char*)"debug";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("J")) {
options->dump_mode = "json";
options->dump_mode = (char*)"json";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("X")) {
options->dump_mode = "xml";
options->dump_mode = (char*)"xml";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}