[CRT] Sync strtok_s() with Wine Staging 1.9.16 and mark strtok() as synced. CORE...
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Aug 2016 16:24:00 +0000 (16:24 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Aug 2016 16:24:00 +0000 (16:24 +0000)
svn path=/trunk/; revision=72405

reactos/media/doc/README.WINE
reactos/sdk/lib/crt/crt.cmake
reactos/sdk/lib/crt/string/strtok.c
reactos/sdk/lib/crt/string/strtok_s.c [new file with mode: 0644]

index f87cf7d..476c0e6 100644 (file)
@@ -292,6 +292,8 @@ msvcrt -
   reactos/lib/sdk/crt/signal/xcptinfo.c         # Synced to WineStaging-1.7.37
   reactos/lib/sdk/crt/string/scanf.c/h          # Synced to Wine-1.7.17
   reactos/lib/sdk/crt/string/strtoi64.c         # Synced to WineStaging-1.9.9
+  reactos/lib/sdk/crt/string/strtok.c           # Synced to WineStaging-1.9.16
+  reactos/lib/sdk/crt/string/strtok_s.c         # Synced to WineStaging-1.9.16
   reactos/lib/sdk/crt/string/strtoul.c          # Synced to WineStaging-1.9.9
   reactos/lib/sdk/crt/strings/wcs.c             # Synced at 20080611
   reactos/lib/sdk/crt/wine/heap.c               # Synced at 20080529
index ba65bd4..c6c1af4 100644 (file)
@@ -294,6 +294,7 @@ list(APPEND CRT_SOURCE
     string/strtod.c
     string/strtoi64.c
     string/strtok.c
+    #string/strtok_s.c
     string/strtol.c
     string/strtoul.c
     string/strtoull.c
index 2c39b7f..28ba9a8 100644 (file)
@@ -1,4 +1,4 @@
-/* taken from wine string.c */
+/* Taken from Wine Staging msvcrt/string.c */
 
 #include <precomp.h>
 #include <internal/wine/msvcrt.h>
@@ -22,31 +22,3 @@ char * CDECL strtok( char *str, const char *delim )
     data->strtok_next = str;
     return ret;
 }
-
-/*********************************************************************
- *             strtok_s  (MSVCRT.@)
- */
-char * CDECL strtok_s(char *str, const char *delim, char **ctx)
-{
-    if (!MSVCRT_CHECK_PMT(delim != NULL) || !MSVCRT_CHECK_PMT(ctx != NULL) ||
-        !MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) {
-        *_errno() = EINVAL;
-        return NULL;
-    }
-
-    if(!str)
-        str = *ctx;
-
-    while(*str && strchr(delim, *str))
-        str++;
-    if(!*str)
-        return NULL;
-
-    *ctx = str+1;
-    while(**ctx && !strchr(delim, **ctx))
-        (*ctx)++;
-    if(**ctx)
-        *(*ctx)++ = 0;
-
-    return str;
-}
diff --git a/reactos/sdk/lib/crt/string/strtok_s.c b/reactos/sdk/lib/crt/string/strtok_s.c
new file mode 100644 (file)
index 0000000..46a06cd
--- /dev/null
@@ -0,0 +1,30 @@
+/* Taken from Wine Staging msvcrt/string.c */
+
+#include <precomp.h>
+#include <internal/wine/msvcrt.h>
+
+/*********************************************************************
+ *             strtok_s  (MSVCRT.@)
+ */
+char * CDECL strtok_s(char *str, const char *delim, char **ctx)
+{
+    if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
+    if (!MSVCRT_CHECK_PMT(ctx != NULL)) return NULL;
+    if (!MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) return NULL;
+
+    if(!str)
+        str = *ctx;
+
+    while(*str && strchr(delim, *str))
+        str++;
+    if(!*str)
+        return NULL;
+
+    *ctx = str+1;
+    while(**ctx && !strchr(delim, **ctx))
+        (*ctx)++;
+    if(**ctx)
+        *(*ctx)++ = 0;
+
+    return str;
+}