]> Creatis software - cpPlugins.git/blobdiff - lib/third_party/Pluma/uce-dirent.h
Some minor warnings on windows removed.
[cpPlugins.git] / lib / third_party / Pluma / uce-dirent.h
index ecf78eb2ca895bb077dba2317bb56da0319ecfab..91415bd9cd5bce100f1af2cd614d6e8f4e29bb39 100644 (file)
@@ -296,6 +296,15 @@ static void rewinddir (DIR *dirp);
 #include <assert.h>
 #include <errno.h>
 
+/** Change by florez-l@javeriana.edu.co **/
+#if defined(WIN32)
+#  define NEW_STRCPY(A,B) strcpy_s(A,strlen(A),B)
+#  define NEW_STRNCPY(A,B,C) strncpy_s(A,C,B,C)
+#else // defined(WIN32)
+#  define NEW_STRCPY(A,B) strcpy(A,B)
+#  define NEW_STRNCPY(A,B,C) strncpy(A,B,C)
+#endif // defined(WIN32)
+
 /* use ffblk instead of _find_t if requested */
 #if defined(DIRENT_USE_FFBLK)
 # define _A_ARCH   (FA_ARCH)
@@ -361,17 +370,17 @@ opendir(
      * Directory separator is not appended if the name already ends with
      * drive or directory separator.  Directory separator is assumed to be
      * '/' or '\' and drive separator is assumed to be ':'. */
-    strcpy (dirp->dirname, dirname);
+    NEW_STRCPY (dirp->dirname, dirname);
     p = strchr (dirp->dirname, '\0');
     if (dirp->dirname < p  &&
         *(p - 1) != '\\'  &&  *(p - 1) != '/'  &&  *(p - 1) != ':')
     {
-      strcpy (p++, "/");
+      NEW_STRCPY (p++, "/");
     }
 # ifdef DIRENT_WIN32_INTERFACE
-    strcpy (p, "*"); /*scan files with and without extension in win32*/
+    NEW_STRCPY (p, "*"); /*scan files with and without extension in win32*/
 # else
-    strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
+    NEW_STRCPY (p, "*.*"); /*scan files with and without extension in DOS*/
 # endif
 
     /* open stream */
@@ -659,7 +668,7 @@ _setdirname (struct DIR *dirp) {
   /* make sure that d_name is long enough */
   assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
   
-  strncpy (dirp->current.d_name,
+  NEW_STRNCPY (dirp->current.d_name,
       _getdirname (&dirp->current),
       NAME_MAX);
   dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/