Author: cwittich
Date: Wed Feb 4 04:09:48 2009
New Revision: 39384
URL:
http://svn.reactos.org/svn/reactos?rev=39384&view=rev
Log:
add wcsncpy_s, strcat_s (from wine)
and _ftol2 and _ftol2_sse required by vmware tools
Added:
trunk/reactos/lib/sdk/crt/string/string.c (with props)
Modified:
trunk/reactos/dll/win32/msvcrt/msvcrt.def
trunk/reactos/lib/sdk/crt/crt.rbuild
trunk/reactos/lib/sdk/crt/string/wcs.c
Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.de…
==============================================================================
--- trunk/reactos/dll/win32/msvcrt/msvcrt.def [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msvcrt/msvcrt.def [iso-8859-1] Wed Feb 4 04:09:48 2009
@@ -848,5 +848,9 @@
wscanf @842
_mbsnbcpy_s
-
+ wcsncpy_s
+ _ftol2=_ftol
+ _ftol2_sse=_ftol
+ strcat_s
+
_swprintf=swprintf
Modified: trunk/reactos/lib/sdk/crt/crt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.rbuild?rev…
==============================================================================
--- trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Wed Feb 4 04:09:48 2009
@@ -399,6 +399,7 @@
<file>strdup.c</file>
<file>strerror.c</file>
<file>stricmp.c</file>
+ <file>string.c</file>
<file>strlwr.c</file>
<file>strncoll.c</file>
<file>strnicmp.c</file>
Added: trunk/reactos/lib/sdk/crt/string/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/string.…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/string.c (added)
+++ trunk/reactos/lib/sdk/crt/string/string.c [iso-8859-1] Wed Feb 4 04:09:48 2009
@@ -1,0 +1,64 @@
+/*
+ * PROJECT: ReactOS CRT library
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: lib/sdk/crt/string/string.c
+ * PURPOSE: string CRT functions
+ * PROGRAMMERS: Wine team
+ * Ported to ReactOS by Christoph von Wittich (christoph_vw(a)reactos.org)
+ */
+
+/*
+ * msvcrt.dll string functions
+ *
+ * Copyright 1996,1998 Marcus Meissner
+ * Copyright 1996 Jukka Iivonen
+ * Copyright 1997,2000 Uwe Bonnes
+ * Copyright 2000 Jon Griffiths
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#include <precomp.h>
+
+
+/*********************************************************************
+ * strcat_s (MSVCRT.@)
+ */
+int CDECL strcat_s( char* dst, size_t elem, const char* src )
+{
+ size_t i, j;
+ if(!dst) return EINVAL;
+ if(elem == 0) return EINVAL;
+ if(!src)
+ {
+ dst[0] = '\0';
+ return EINVAL;
+ }
+
+ for(i = 0; i < elem; i++)
+ {
+ if(dst[i] == '\0')
+ {
+ for(j = 0; (j + i) < elem; j++)
+ {
+ if((dst[j + i] = src[j]) == '\0') return 0;
+ }
+ }
+ }
+ /* Set the first element to 0, not the first element after the skipped part */
+ dst[0] = '\0';
+ return ERANGE;
+}
Propchange: trunk/reactos/lib/sdk/crt/string/string.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/lib/sdk/crt/string/wcs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcs.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] Wed Feb 4 04:09:48 2009
@@ -1138,3 +1138,36 @@
return 0;
}
#endif
+
+/******************************************************************
+ * wcsncpy_s (MSVCRT.@)
+ */
+INT CDECL wcsncpy_s( wchar_t* wcDest, size_t numElement, const wchar_t *wcSrc,
+ size_t count )
+{
+ size_t size = 0;
+
+ if (!wcDest || !numElement)
+ return EINVAL;
+
+ wcDest[0] = 0;
+
+ if (!wcSrc)
+ {
+ return EINVAL;
+ }
+
+ size = min(strlenW(wcSrc), count);
+
+ if (size >= numElement)
+ {
+ return ERANGE;
+ }
+
+ memcpy( wcDest, wcSrc, size*sizeof(WCHAR) );
+ wcDest[size] = '\0';
+
+ return 0;
+}
+
+