shithub: choc

Download patch

ref: 4a3c8c6d7eedf2f9e4d960bf9c121f4902f73a27
parent: 7a1267e2f98f2ae78bb7e7fdfe9900670cb7fe89
parent: cd65e9dae04c4473c3e979fdc6a6319cb56d2051
author: Mike Swanson <[email protected]>
date: Tue Mar 20 08:08:05 EDT 2018

Merge pull request #1003 from turol/const

Non-trivial constness fix

--- a/textscreen/txt_fileselect.c
+++ b/textscreen/txt_fileselect.c
@@ -282,7 +282,7 @@
     return result;
 }
 
-char *TXT_SelectFile(char *window_title, char **extensions)
+char *TXT_SelectFile(const char *window_title, char **extensions)
 {
     OPENFILENAME fm;
     char selected[MAX_PATH] = "";
@@ -621,8 +621,8 @@
     }
 
     argv = calloc(5 + NumExtensions(extensions), sizeof(char *));
-    argv[0] = ZENITY_BINARY;
-    argv[1] = "--file-selection";
+    argv[0] = strdup(ZENITY_BINARY);
+    argv[1] = strdup("--file-selection");
     argc = 2;
 
     if (window_title != NULL)
@@ -662,7 +662,7 @@
 
     result = ExecReadOutput(argv);
 
-    for (i = 2; i < argc; ++i)
+    for (i = 0; i < argc; ++i)
     {
         free(argv[i]);
     }