Prechádzať zdrojové kódy

Fix obscure compile error for some compilers

src\main.c:1644:41: error: passing argument 2 of 'read_config_file' from incompatible pointer type [-Wincompatible-pointer-types]
    read_config_file(g_config_file_name, file_options);
                                         ^
src\main.c:666:1: note: expected 'const char **' but argument is of type 'char **'
 read_config_file(const char *config_file, const char **options)
 ^

While some compilers allow using a "char **" as "const char **", some do not.
For details see https://c-faq.com/ansi/constmismatch.html
bel2125 2 rokov pred
rodič
commit
1fb204ecc6
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      src/main.c

+ 3 - 3
src/main.c

@@ -1599,7 +1599,7 @@ SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 	int i, j;
 	int i, j;
 	const char *name, *value;
 	const char *name, *value;
 	const struct mg_option *default_options = mg_get_valid_options();
 	const struct mg_option *default_options = mg_get_valid_options();
-	char *file_options[MAX_OPTIONS * 2 + 1] = {0};
+	const char *file_options[MAX_OPTIONS * 2 + 1] = {0};
 	char *title;
 	char *title;
 	struct dlg_proc_param *pdlg_proc_param;
 	struct dlg_proc_param *pdlg_proc_param;
 
 
@@ -1663,8 +1663,8 @@ SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 				}
 				}
 			}
 			}
 			for (i = 0; i < MAX_OPTIONS; i++) {
 			for (i = 0; i < MAX_OPTIONS; i++) {
-				free(file_options[2 * i]);
-				free(file_options[2 * i + 1]);
+				free((void *)file_options[2 * i]);
+				free((void *)file_options[2 * i + 1]);
 			}
 			}
 			break;
 			break;