X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=opts.c;h=e37ba7356d78ad6bdace480b77113c1d75863b25;hp=c669ee73b670c6bbc053d0eaa72c3d861c4e70b3;hb=f2b21158d801e96b5f8d7c9491186267dc75a4dc;hpb=46892daa3ad6ad98706abfb00ea947658dca3aa7 diff --git a/opts.c b/opts.c index c669ee7..e37ba73 100644 --- a/opts.c +++ b/opts.c @@ -64,6 +64,7 @@ static void opts_setdefault() { opts_set(opts.flags, BAIL_ON_WERROR, true); opts_set(opts.flags, LEGACY_VECTOR_MATHS, true); opts_set(opts.flags, DARKPLACES_STRING_TABLE_BUG, true); + } void opts_backup_non_Wall() { @@ -96,6 +97,7 @@ void opts_init(const char *output, int standard, size_t arraysize) { OPTS_OPTION_STR(OPTION_OUTPUT) = (char*)output; OPTS_OPTION_U32(OPTION_STANDARD) = standard; OPTS_OPTION_U32(OPTION_MAX_ARRAY_SIZE) = arraysize; + OPTS_OPTION_U16(OPTION_MEMDUMPCOLS) = 16; } static bool opts_setflag_all(const char *name, bool on, uint32_t *flags, const opts_flag_def *list, size_t listsize) { @@ -142,6 +144,9 @@ void opts_setoptimlevel(unsigned int level) { size_t i; for (i = 0; i < COUNT_OPTIMIZATIONS; ++i) opts_set(opts.optimization, i, level >= opts_opt_oflag[i]); + + if (!level) + opts.optimizeoff = true; } /* @@ -190,7 +195,7 @@ static size_t opts_ini_parse ( char *read_name; char *read_value; - while (file_getline(&line, &linesize, filehandle) != EOF) { + while (fs_file_getline(&line, &linesize, filehandle) != EOF) { parse_beg = line; /* handle BOM */ @@ -254,7 +259,7 @@ static size_t opts_ini_parse ( static bool opts_ini_bool(const char *value) { if (!strcmp(value, "true")) return true; if (!strcmp(value, "false")) return false; - return !!atoi(value); + return !!strtol(value, NULL, 10); } static char *opts_ini_load(const char *section, const char *name, const char *value) { @@ -345,11 +350,11 @@ void opts_ini_init(const char *file) { if (!file) { /* try ini */ - if (!(ini = file_open((file = "gmqcc.ini"), "r"))) + if (!(ini = fs_file_open((file = "gmqcc.ini"), "r"))) /* try cfg */ - if (!(ini = file_open((file = "gmqcc.cfg"), "r"))) + if (!(ini = fs_file_open((file = "gmqcc.cfg"), "r"))) return; - } else if (!(ini = file_open(file, "r"))) + } else if (!(ini = fs_file_open(file, "r"))) return; con_out("found ini file `%s`\n", file); @@ -360,5 +365,5 @@ void opts_ini_init(const char *file) { vec_free(error); } - file_close(ini); + fs_file_close(ini); }