changeset 2164:05dd5189099f

Win: Fix some warnings reported with -W3 in Visual C. Can compile with -W3 by issuing: "set DEBUG=Y" before building.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 30 Sep 2020 22:56:59 +0000
parents 98db0e81a514
children 87d574dda8f5
files dwcompat.c win/dw.c win/edge.cpp winmain.c
diffstat 4 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dwcompat.c	Wed Sep 30 19:34:17 2020 +0000
+++ b/dwcompat.c	Wed Sep 30 22:56:59 2020 +0000
@@ -54,8 +54,10 @@
 
 int API makedir(char *path)
 {
-#if defined(__IBMC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
+#if defined(__IBMC__) || defined(__WATCOMC__) || defined(__MINGW32__) || defined(__MINGW64__)
 	return mkdir(path);
+#elif defined(_MSC_VER)
+	return _mkdir(path);
 #else
 	return mkdir(path,S_IRWXU);
 #endif
--- a/win/dw.c	Wed Sep 30 19:34:17 2020 +0000
+++ b/win/dw.c	Wed Sep 30 22:56:59 2020 +0000
@@ -4706,7 +4706,7 @@
    if(!_dw_app_id[0])
    {
       /* Generate an Application ID based on the PID if all else fails. */
-      _snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
+      _snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, _getpid());
    }
    if(!_dw_app_name[0])
    {
@@ -12952,7 +12952,7 @@
          strcat(newparams[z], "\"");
       }
       else
-         newparams[z] = strdup(params[z]);
+         newparams[z] = _strdup(params[z]);
    }
    newparams[count] = NULL;
 
@@ -12975,7 +12975,7 @@
  */
 int API dw_browse(const char *url)
 {
-   char *browseurl = strdup(url);
+   char *browseurl = _strdup(url);
    int retcode;
 
    if(strlen(browseurl) > 7 && strncmp(browseurl, "file://", 7) == 0)
--- a/win/edge.cpp	Wed Sep 30 19:34:17 2020 +0000
+++ b/win/edge.cpp	Wed Sep 30 22:56:59 2020 +0000
@@ -421,7 +421,7 @@
 		if (webview)
 			return webview->Raw(string);
 		else
-			dw_window_set_data(hwnd, _DW_HTML_DATA_RAW, strdup(string));
+			dw_window_set_data(hwnd, _DW_HTML_DATA_RAW, _strdup(string));
 		return DW_ERROR_NONE;
 	}
 
@@ -440,7 +440,7 @@
 		if (webview)
 			return webview->URL(url);
 		else
-			dw_window_set_data(hwnd, _DW_HTML_DATA_LOCATION, strdup(url));
+			dw_window_set_data(hwnd, _DW_HTML_DATA_LOCATION, _strdup(url));
 		return DW_ERROR_NONE;
 	}
 
--- a/winmain.c	Wed Sep 30 19:34:17 2020 +0000
+++ b/winmain.c	Wed Sep 30 22:56:59 2020 +0000
@@ -74,7 +74,7 @@
          else if(*tmp == ' ' && !inquotes)
          {
             *tmp = 0;
-            argv[loc] = strdup(argstart);
+            argv[loc] = _strdup(argstart);
 
             /* Push past any white space */
             while(*(tmp+1) == ' ')
@@ -92,12 +92,15 @@
          tmp++;
       }
       if(*argstart)
-         argv[loc] = strdup(argstart);
+         argv[loc] = _strdup(argstart);
    }
    argv[loc+1] = NULL;
    return argv;
 }
 
+/* Protoype for the application entrypoint */
+int main(int argc, char **argv);
+
 /* Ok this is a really big hack but what the hell ;) */
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {