changeset 2126:97839ff3c985

Win: Switch to using _snprintf() for compatibility with old versions of Visual C.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 28 Jun 2020 05:39:08 +0000
parents 37758cfed67b
children 663467f6eee4
files win/dw.c
diffstat 1 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Thu Jun 25 00:59:32 2020 +0000
+++ b/win/dw.c	Sun Jun 28 05:39:08 2020 +0000
@@ -4276,7 +4276,7 @@
          if((pos++) && !_dw_app_id[0])
          {
             /* If we have a binary name, use that for the Application ID instead. */
-            snprintf(_dw_app_id, 100, "%s.%s", DW_APP_DOMAIN_DEFAULT, pos);
+            _snprintf(_dw_app_id, 100, "%s.%s", DW_APP_DOMAIN_DEFAULT, pos);
             strncpy(_dw_app_name, pos, 100);
          }
       }
@@ -4431,21 +4431,21 @@
       exit(1);
    }
 
-    if(!_dw_app_id[0])
-    {
-        /* Generate an Application ID based on the PID if all else fails. */
-        snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
-    }
-    if(!_dw_app_name[0])
-    {
-       /* If we still don't have an app name, get the executable name */
-       char fullpath[261] = {0}, *pos;
-       GetModuleFileNameA(DWInstance, fullpath, 260);
-       pos = strrchr(fullpath, '\\');
-       if(pos)
-          pos++;
-       strncpy(_dw_app_name, pos ? pos : fullpath, 100);
-    }
+   if(!_dw_app_id[0])
+   {
+      /* Generate an Application ID based on the PID if all else fails. */
+      _snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
+   }
+   if(!_dw_app_name[0])
+   {
+      /* If we still don't have an app name, get the executable name */
+      char fullpath[261] = {0}, *pos;
+      GetModuleFileNameA(DWInstance, fullpath, 260);
+      pos = strrchr(fullpath, '\\');
+      if(pos)
+         pos++;
+      strncpy(_dw_app_name, pos ? pos : fullpath, 100);
+   }
     
 #if (defined(BUILD_DLL) || defined(BUILD_HTML))
    /* Register HTML renderer class */