Author: amunger
Date: Thu Jun 1 05:03:05 2006
New Revision: 22137
URL:
http://svn.reactos.ru/svn/reactos?rev=22137&view=rev
Log:
Merged crt and string fixes from trunk, per GreatLord.
Revisions: 21936, 21937*, 21939-21941, 21963-21965, 21967, 21969-21970, 21973-21974,
21976, 21987, 22011-22013, 22019-22023, 22027, 22060-22062, 22069-22073, 22075, 22079,
22105.
Fixes the calc bug and supposedly some other things. ;0)
*partial
Added:
branches/ros-branch-0_3_0/reactos/lib/crt/math/s_modf.c
Modified:
branches/ros-branch-0_3_0/reactos/lib/crt/README.txt (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/cgets.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/cprintf.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/cputs.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/getch.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/getche.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/kbhit.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/putch.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/conio/ungetch.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/crt.rbuild
branches/ros-branch-0_3_0/reactos/lib/crt/io/open.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/acos.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/adjust.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/asin.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/atan.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/atan2.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/cabs.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/ceil.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/cos.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/cosh.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/exp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/fabs.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/floor.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/fmod.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/frexp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/huge_val.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/hypot.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/j0_y0.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/j1_y1.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/jn_yn.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/ldexp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/log.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/log10.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/math.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/modf.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/pow.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/sin.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/sinh.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/sqrt.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/stubs.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/tan.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/math/tanh.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/misc/environ.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/precomp.h (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdio/fgetws.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvt.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvtbuf.c (contents, props
changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itoa.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itow.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/putenv.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/swab.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wfulpath.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/witoa.c (contents, props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wmakpath.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wputenv.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wsenv.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wsplitp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtoi.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtoi64.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtol.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/cpp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/cppexcept.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/heap.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/scanf.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/scanf.h (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/thread.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wine/undname.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcscoll.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcscspn.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsdup.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsicmp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcslwr.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsnicmp.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcspbrk.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsrev.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsset.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsspn.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsstr.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcstok.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsupr.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsxfrm.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wlasttok.c (props changed)
branches/ros-branch-0_3_0/reactos/lib/string/itoa.c
branches/ros-branch-0_3_0/reactos/lib/string/itow.c
branches/ros-branch-0_3_0/reactos/lib/string/wtoi.c
branches/ros-branch-0_3_0/reactos/lib/string/wtol.c
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/README.txt
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/cgets.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/conio/cprintf.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/conio/cprintf.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/conio/cprintf.c Thu Jun 1 05:03:05 2006
@@ -1,27 +1,36 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
+ * COPYRIGHT: Winehq
+ * PROJECT: wine
* FILE: msvcrt/conio/cprintf.c
* PURPOSE: C Runtime
- * PROGRAMMER: Eric Kohl (Imported from DJGPP)
+ * PROGRAMMER: Magnus Olsen (Imported from wine cvs 2006-05-23)
*/
#include <precomp.h>
/*
- * @unimplemented
+ * @implemented
*/
int
_cprintf(const char *fmt, ...)
{
- int cnt;
- char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
- va_list ap;
-
- va_start(ap, fmt);
- cnt = vsprintf(buf, fmt, ap);
- va_end(ap);
-
- _cputs(buf);
- return cnt;
+ char buf[2048], *mem = buf;
+ int written, resize = sizeof(buf), retval;
+ va_list valist;
+
+ while ((written = _vsnprintf( mem, resize, fmt, valist )) == -1 ||
+ written > resize)
+ {
+ resize = (written == -1 ? resize * 2 : written + 1);
+ if (mem != buf)
+ free (mem);
+ if (!(mem = (char *)malloc(resize)))
+ return EOF;
+ va_start( valist, fmt );
+ }
+ va_end(valist);
+ retval = _cputs( mem );
+ if (mem != buf)
+ free (mem);
+ return retval;
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/cprintf.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/cputs.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/conio/getch.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/conio/getch.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/conio/getch.c Thu Jun 1 05:03:05 2006
@@ -53,17 +53,3 @@
return c;
}
-#if 0
-/*
- * @unimplemented
- */
-int _getche(void)
-{
- int c;
-
- c = _getch();
- _putch(c);
-
- return c;
-}
-#endif
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/getch.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/getche.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/kbhit.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/putch.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/conio/ungetch.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/crt.rbuild
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/crt.rbuild (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/crt.rbuild Thu Jun 1 05:03:05 2006
@@ -119,7 +119,8 @@
<file>jn_yn.c</file>
<file>ldexp.c</file>
<file>log10.c</file>
- <file>modf.c</file>
+ <file>modf.c</file>
+ <file>s_modf.c</file>
<file>pow.c</file>
<file>sinh.c</file>
<file>stubs.c</file>
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/io/open.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/acos.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/adjust.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/asin.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/atan.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/atan2.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/cabs.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/ceil.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/cos.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/cosh.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/exp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/fabs.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/floor.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/fmod.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/frexp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/huge_val.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/hypot.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/j0_y0.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/j1_y1.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/jn_yn.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/ldexp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/log.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/log10.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/math.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/math/modf.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/math/modf.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/math/modf.c Thu Jun 1 05:03:05 2006
@@ -14,74 +14,6 @@
//static const double one = 1.0;
-double modf(double __x, double *__i)
-{
- union
- {
- double* __x;
- double_t* x;
- } x;
- union
- {
- double* __i;
- double_t* iptr;
- } iptr;
-
- int j0;
- unsigned int i;
-
- x.__x = &__x;
- iptr.__i = __i;
-
-
- j0 = x.x->exponent - 0x3ff; /* exponent of x */
- if(j0<20) { /* integer part in high x */
- if(j0<0) { /* |x|<1 */
- *__i = 0.0;
- iptr.iptr->sign = x.x->sign;
- return __x;
- } else {
-
- if ( x.x->mantissah == 0 && x.x->mantissal == 0 ) {
- *__i = __x;
- return 0.0;
- }
-
- i = (0x000fffff)>>j0;
- iptr.iptr->sign = x.x->sign;
- iptr.iptr->exponent = x.x->exponent;
- iptr.iptr->mantissah = x.x->mantissah&(~i);
- iptr.iptr->mantissal = 0;
- if ( __x == *__i ) {
- __x = 0.0;
- x.x->sign = iptr.iptr->sign;
- return __x;
- }
- return __x - *__i;
- }
- } else if (j0>51) { /* no fraction part */
- *__i = __x;
- if ( _isnan(__x) || _isinf(__x) )
- return __x;
-
- __x = 0.0;
- x.x->sign = iptr.iptr->sign;
- return __x;
- } else { /* fraction part in low x */
-
- i = ((unsigned)(0xffffffff))>>(j0-20);
- iptr.iptr->sign = x.x->sign;
- iptr.iptr->exponent = x.x->exponent;
- iptr.iptr->mantissah = x.x->mantissah;
- iptr.iptr->mantissal = x.x->mantissal&(~i);
- if ( __x == *__i ) {
- __x = 0.0;
- x.x->sign = iptr.iptr->sign;
- return __x;
- }
- return __x - *__i;
- }
-}
long double modfl(long double __x, long double *__i)
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/modf.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/pow.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Added: branches/ros-branch-0_3_0/reactos/lib/crt/math/s_modf.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/math/s_modf.c (added)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/math/s_modf.c Thu Jun 1 05:03:05 2006
@@ -1,0 +1,194 @@
+
+
+/* @(#)s_modf.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+FUNCTION
+ <<modf>>, <<modff>>---split fractional and integer parts
+
+INDEX
+ modf
+INDEX
+ modff
+
+ANSI_SYNOPSIS
+ #include <math.h>
+ double modf(double <[val]>, double *<[ipart]>);
+ float modff(float <[val]>, float *<[ipart]>);
+
+TRAD_SYNOPSIS
+ #include <math.h>
+ double modf(<[val]>, <[ipart]>)
+ double <[val]>;
+ double *<[ipart]>;
+
+ float modff(<[val]>, <[ipart]>)
+ float <[val]>;
+ float *<[ipart]>;
+
+DESCRIPTION
+ <<modf>> splits the double <[val]> apart into an integer part
+ and a fractional part, returning the fractional part and
+ storing the integer part in <<*<[ipart]>>>. No rounding
+ whatsoever is done; the sum of the integer and fractional
+ parts is guaranteed to be exactly equal to <[val]>. That
+ is, if . <[realpart]> = modf(<[val]>, &<[intpart]>); then
+ `<<<[realpart]>+<[intpart]>>>' is the same as
<[val]>.
+ <<modff>> is identical, save that it takes and returns
+ <<float>> rather than <<double>> values.
+
+RETURNS
+ The fractional part is returned. Each result has the same
+ sign as the supplied argument <[val]>.
+
+PORTABILITY
+ <<modf>> is ANSI C. <<modff>> is an extension.
+
+QUICKREF
+ modf ansi pure
+ modff - pure
+
+*/
+
+/*
+ * modf(double x, double *iptr)
+ * return fraction part of x, and return x's integral part in *iptr.
+ * Method:
+ * Bit twiddling.
+ *
+ * Exception:
+ * No exception.
+ */
+
+
+static const double one = 1.0;
+
+#define __int32_t long
+#define __uint32_t unsigned long
+#define __IEEE_LITTLE_ENDIAN
+
+#ifdef __IEEE_BIG_ENDIAN
+
+typedef union
+{
+ struct
+ {
+ __uint32_t msw;
+ __uint32_t lsw;
+ } parts;
+ double value;
+} ieee_double_shape_type;
+
+#endif
+
+#ifdef __IEEE_LITTLE_ENDIAN
+
+typedef union
+{
+ struct
+ {
+ __uint32_t lsw;
+ __uint32_t msw;
+ } parts;
+ double value;
+} ieee_double_shape_type;
+
+#endif
+
+
+/* Get two 32 bit ints from a double. */
+
+#define EXTRACT_WORDS(ix0,ix1,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix0) = ew_u.parts.msw; \
+ (ix1) = ew_u.parts.lsw; \
+} while (0)
+
+/* Get the more significant 32 bit int from a double. */
+
+#define GET_HIGH_WORD(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.parts.msw; \
+} while (0)
+
+/* Get the less significant 32 bit int from a double. */
+
+#define GET_LOW_WORD(i,d) \
+do { \
+ ieee_double_shape_type gl_u; \
+ gl_u.value = (d); \
+ (i) = gl_u.parts.lsw; \
+} while (0)
+
+/* Set a double from two 32 bit ints. */
+
+#define INSERT_WORDS(d,ix0,ix1) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.parts.msw = (ix0); \
+ iw_u.parts.lsw = (ix1); \
+ (d) = iw_u.value; \
+} while (0)
+
+
+
+
+double modf(double x, double *iptr)
+{
+ __int32_t i0,i1,j_0;
+ __uint32_t i;
+ EXTRACT_WORDS(i0,i1,x);
+ j_0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
+ if(j_0<20) { /* integer part in high x */
+ if(j_0<0) { /* |x|<1 */
+ INSERT_WORDS(*iptr,i0&0x80000000U,0); /* *iptr = +-0 */
+ return x;
+ } else {
+ i = (0x000fffff)>>j_0;
+ if(((i0&i)|i1)==0) { /* x is integral */
+ __uint32_t high;
+ *iptr = x;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
+ return x;
+ } else {
+ INSERT_WORDS(*iptr,i0&(~i),0);
+ return x - *iptr;
+ }
+ }
+ } else if (j_0>51) { /* no fraction part */
+ __uint32_t high;
+ *iptr = x*one;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
+ return x;
+ } else { /* fraction part in low x */
+ i = ((__uint32_t)(0xffffffffU))>>(j_0-20);
+ if((i1&i)==0) { /* x is integral */
+ __uint32_t high;
+ *iptr = x;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
+ return x;
+ } else {
+ INSERT_WORDS(*iptr,i0,i1&(~i));
+ return x - *iptr;
+ }
+ }
+}
+
+//#endif /* _DOUBLE_IS_32BITS */
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/sin.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/sinh.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/sqrt.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/stubs.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/tan.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/math/tanh.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/misc/environ.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/precomp.h
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdio/fgetws.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdio/fgetws.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdio/fgetws.c Thu Jun 1 05:03:05 2006
@@ -32,23 +32,19 @@
wchar_t* fgetws(wchar_t* s, int n, FILE* f)
{
- wchar_t c = 0;
- wchar_t* cs;
+
+ int c=0;
+ wchar_t *cs;
cs = s;
- //while (--n > 0 && (c = getwc(f)) != WEOF) {
- while (n > 0) {
- c = getwc(f);
- if (c == WEOF)
- break;
- n--;
+ while (--n>0 && (c = getwc(f)) != WEOF)
+ {
*cs++ = c;
if (c == L'\n')
break;
}
- if (c == WEOF && cs == s) {
+ if (c == WEOF && cs == s)
return NULL;
- }
*cs++ = L'\0';
return s;
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdio/fgetws.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvt.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvtbuf.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvtbuf.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvtbuf.c Thu Jun 1 05:03:05 2006
@@ -1,61 +1,127 @@
-/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
+#include <math.h>
#include <malloc.h>
// #include <msvcrt/locale.h>
-void __ecvround (char *, char *, const char *, int *);
-char *ecvtbuf (double, int, int *, int *, char *);
+// replace fjgpp fcvtbuf from project
http://www.jbox.dk/sanos/source/lib/fcvt.c.html
+// with small modification's to match ReactOS arch
-char *
-fcvtbuf (double value, int ndigits, int *decpt, int *sign, char *buf)
+// Floating point to string conversion routines
+//
+// Copyright (C) 2002 Michael Ringgaard. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+
+
+//#include <math.h>
+#define CVTBUFSIZE 2 * DBL_MAX_10_EXP + 10
+static char *cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int eflag)
{
- static char INFINITY[] = "Infinity";
- char decimal = '.' /* localeconv()->decimal_point[0] */;
- int digits = ndigits >= 0 ? ndigits : 0;
- char *cvtbuf = (char *)_alloca (2*DBL_MAX_10_EXP + 16);
- char *s = cvtbuf;
- char *dot;
+ int r2;
+ double fi, fj;
+ char *p, *p1;
- sprintf (cvtbuf, "%-+#.*f", DBL_MAX_10_EXP + digits + 1, value);
+ if (ndigits < 0) ndigits = 0;
+ if (ndigits >= CVTBUFSIZE - 1) ndigits = CVTBUFSIZE - 2;
+ r2 = 0;
+ *sign = 0;
+ p = &buf[0];
+ if (arg < 0)
+ {
+ *sign = 1;
+ arg = -arg;
+ }
+ arg = modf(arg, &fi);
+ p1 = &buf[CVTBUFSIZE];
- /* The sign. */
- if (*s++ == '-')
- *sign = 1;
- else
- *sign = 0;
+ if (fi != 0)
+ {
+ p1 = &buf[CVTBUFSIZE];
+ while (fi != 0)
+ {
+ fj = modf(fi / 10, &fi);
+ *--p1 = (int)((fj + .03) * 10) + '0';
+ r2++;
+ }
+ while (p1 < &buf[CVTBUFSIZE]) *p++ = *p1++;
+ }
+ else if (arg > 0)
+ {
+ while ((fj = arg * 10) < 1)
+ {
+ arg = fj;
+ r2--;
+ }
+ }
+ p1 = &buf[ndigits];
+ if (eflag == 0) p1 += r2;
+ *decpt = r2;
+ if (p1 < &buf[0])
+ {
+ buf[0] = '\0';
+ return buf;
+ }
+ while (p <= p1 && p < &buf[CVTBUFSIZE])
+ {
+ arg *= 10;
+ arg = modf(arg, &fj);
+ *p++ = (int) fj + '0';
+ }
+ if (p1 >= &buf[CVTBUFSIZE])
+ {
+ buf[CVTBUFSIZE - 1] = '\0';
+ return buf;
+ }
+ p = p1;
+ *p1 += 5;
+ while (*p1 > '9')
+ {
+ *p1 = '0';
+ if (p1 > buf)
+ ++*--p1;
+ else
+ {
+ *p1 = '1';
+ (*decpt)++;
+ if (eflag == 0)
+ {
+ if (p > buf) *p = '0';
+ p++;
+ }
+ }
+ }
+ *p = '\0';
+ return buf;
+}
- /* Where's the decimal point? */
- dot = strchr (s, decimal);
- *decpt = dot ? dot - s : (int)strlen (s);
-
- /* SunOS docs says if NDIGITS is 8 or more, produce "Infinity"
- instead of "Inf". */
- if (strncmp (s, "Inf", 3) == 0)
- {
- memcpy (buf, INFINITY, ndigits >= 8 ? 9 : 3);
- if (ndigits < 8)
- buf[3] = '\0';
- return buf;
- }
- else if (ndigits < 0)
- return ecvtbuf (value, *decpt + ndigits, decpt, sign, buf);
- else if (*s == '0' && value != 0.0)
- return ecvtbuf (value, ndigits, decpt, sign, buf);
- else
- {
- memcpy (buf, s, *decpt);
- if (s[*decpt] == decimal)
- {
- memcpy (buf + *decpt, s + *decpt + 1, ndigits);
- buf[*decpt + ndigits] = '\0';
- }
- else
- buf[*decpt] = '\0';
- __ecvround (buf, buf + *decpt + ndigits - 1,
- s + *decpt + ndigits + 1, decpt);
- return buf;
- }
+char *fcvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf)
+{
+ return cvt(arg, ndigits, decpt, sign, buf, 0);
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/fcvtbuf.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itoa.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itoa.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itoa.c Thu Jun 1 05:03:05 2006
@@ -104,37 +104,32 @@
/*
* @implemented
+ * copy it from wine 0.9.0 with small modifcations do check for NULL
*/
-char* _ultoa(unsigned long value, char* string, int radix)
+char* ultoa(unsigned long value, char* string, int radix)
{
- char tmp[33];
- char* tp = tmp;
- long i;
- unsigned long v = value;
- char* sp;
+ char buffer[33];
+ char *pos;
+ int digit;
+
+ pos = &buffer[32];
+ *pos = '\0';
- if (radix > 36 || radix <= 1)
- {
- __set_errno(EDOM);
- return 0;
- }
+ if (string == NULL)
+ {
+ return NULL;
+ }
+
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
-
- if (string == 0)
- string = (char*)malloc((tp-tmp)+1);
- sp = string;
-
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ memcpy(string, pos, &buffer[32] - pos + 1);
+ return string;
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itoa.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itow.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itow.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itow.c Thu Jun 1 05:03:05 2006
@@ -16,138 +16,81 @@
/*
* @implemented
+ * from wine cvs 2006-05-21
*/
wchar_t* _itow(int value, wchar_t* string, int radix)
{
- wchar_t tmp [33];
- wchar_t * tp = tmp;
- int i;
- unsigned int v;
- int sign;
- wchar_t * sp;
+ return _ltow(value, string, radix);
+}
- if (radix > 36 || radix <= 1)
- {
- __set_errno(EDOM);
- return 0;
- }
+/*
+ * @implemented
+ * from wine cvs 2006-05-21
+ */
+wchar_t* _ltow(long value, wchar_t* string, int radix)
+{
+ unsigned long val;
+ int negative;
+ WCHAR buffer[33];
+ PWCHAR pos;
+ WCHAR digit;
- sign = ((radix == 10) && (value < 0));
- if (sign) {
- v = -value;
+ if (value < 0 && radix == 10) {
+ negative = 1;
+ val = -value;
} else {
- v = (unsigned) value;
- }
- while (v || tp == tmp) {
- i = v % radix;
- v = v / radix;
- if (i < 10) {
- *tp++ = i+ (wchar_t) '0';
- } else {
- *tp++ = i + (wchar_t) 'a' - 10;
- }
- }
+ negative = 0;
+ val = value;
+ } /* if */
- if (string == 0) {
- string = (wchar_t*) malloc((tp-tmp) + (sign + 1) * sizeof(wchar_t));
- }
- sp = string;
+ pos = &buffer[32];
+ *pos = '\0';
- if (sign) {
- *sp++ = (wchar_t) '-';
- }
- while (tp > tmp) {
- *sp++ = *--tp;
- }
- *sp = (wchar_t) 0;
+ do {
+ digit = val % radix;
+ val = val / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (val != 0L);
+
+ if (negative) {
+ *--pos = '-';
+ } /* if */
+
+ if (str != NULL) {
+ memcpy(string, pos, (&buffer[32] - pos + 1) * sizeof(WCHAR));
+ } /* if */
return string;
}
/*
* @implemented
- */
-wchar_t* _ltow(long value, wchar_t* string, int radix)
-{
- wchar_t tmp [33];
- wchar_t* tp = tmp;
- long int i;
- unsigned long int v;
- int sign;
- wchar_t* sp;
-
- if (radix > 36 || radix <= 1) {
- __set_errno(EDOM);
- return 0;
- }
-
- sign = ((radix == 10) && (value < 0));
- if (sign) {
- v = -value;
- } else {
- v = (unsigned long) value;
- }
- while (v || tp == tmp) {
- i = v % radix;
- v = v / radix;
- if (i < 10) {
- *tp++ = i + (wchar_t) '0';
- } else {
- *tp++ = i + (wchar_t) 'a' - 10;
- }
- }
-
- if (string == 0) {
- string = (wchar_t*) malloc((tp - tmp) + (sign + 1) * sizeof(wchar_t));
- }
- sp = string;
-
- if (sign) {
- *sp++ = (wchar_t) '-';
- }
- while (tp > tmp) {
- *sp++ = *--tp;
- }
- *sp = (wchar_t) 0;
- return string;
-}
-
-/*
- * @unimplemented
+ * from wine cvs 2006-05-21
*/
wchar_t* _ultow(unsigned long value, wchar_t* string, int radix)
{
- wchar_t tmp [33];
- wchar_t* tp = tmp;
- long int i;
- unsigned long int v = value;
- wchar_t* sp;
+ WCHAR buffer[33];
+ PWCHAR pos;
+ WCHAR digit;
- if (radix > 36 || radix <= 1) {
- __set_errno(EDOM);
- return 0;
- }
- while (v || tp == tmp) {
- i = v % radix;
- v = v / radix;
- if (i < 10) {
- *tp++ = i + (wchar_t) '0';
- } else {
- *tp++ = i + (wchar_t) 'a' - 10;
- }
- }
+ pos = &buffer[32];
+ *pos = '\0';
- if (string == 0) {
-#ifdef _MSVCRT_LIB_ // TODO: check on difference?
- string = (wchar_t*)malloc(((tp-tmp)+1)*sizeof(wchar_t));
-#else // TODO: FIXME: review which is correct
- string = (wchar_t*)malloc((tp - tmp) + sizeof(wchar_t));
-#endif /*_MSVCRT_LIB_*/
- }
- sp = string;
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- while (tp > tmp) {
- *sp++ = *--tp;
- }
- *sp = (wchar_t) 0;
+ if (string != NULL) {
+ memcpy(string, pos, (&buffer[32] - pos + 1) * sizeof(WCHAR));
+ } /* if */
return string;
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/itow.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/putenv.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/swab.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/swab.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/swab.c Thu Jun 1 05:03:05 2006
@@ -12,17 +12,23 @@
/*
* @implemented
+ *
+ * copy this swab from wine cvs 2006-05-24
*/
-void _swab (const char* caFrom, char* caTo, size_t sizeToCopy)
+void _swab (const char * src, char * dst, size_t sizeToCopy
+ )
+
{
- if (sizeToCopy > 1)
+ if (sizeToCopy > 1)
{
- sizeToCopy = sizeToCopy >> 1;
+ sizeToCopy = (unsigned)sizeToCopy >> 1;
while (sizeToCopy--) {
- *caTo++ = caFrom[1];
- *caTo++ = *caFrom++;
- caFrom++;
+ char s0 = src[0];
+ char s1 = src[1];
+ *dst++ = s1;
+ *dst++ = s0;
+ src = src + 2;
}
}
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/swab.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wfulpath.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/witoa.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/crt…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/witoa.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/witoa.c Thu Jun 1 05:03:05 2006
@@ -7,88 +7,75 @@
* UPDATE HISTORY:
* 1995: Created
* 1998: Added ltoa Boudewijn Dekker
+ * 2006 : replace all api in this file to wine cvs 2006-05-21
*/
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+/* */
#include <precomp.h>
/*
* @implemented
+ * copy _i64toa from wine cvs 2006 month 05 day 21
*/
char* _i64toa(__int64 value, char* string, int radix)
{
- char tmp[65];
- char *tp = tmp;
- int i;
- unsigned v;
- int sign;
- char *sp;
+ ULONGLONG val;
+ int negative;
+ char buffer[65];
+ char *pos;
+ int digit;
- if (radix > 36 || radix <= 1)
- {
- __set_errno(EDOM);
- return 0;
- }
+ if (value < 0 && radix == 10) {
+ negative = 1;
+ val = -value;
+ } else {
+ negative = 0;
+ val = value;
+ } /* if */
- sign = (radix == 10 && value < 0);
- if (sign)
- v = -value;
- else
- v = (unsigned)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- if (string == 0)
- string = (char *)malloc((tp-tmp)+sign+1);
- sp = string;
+ do {
+ digit = val % radix;
+ val = val / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (val != 0L);
- if (sign)
- *sp++ = '-';
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ if (negative) {
+ *--pos = '-';
+ } /* if */
+
+ memcpy(string, pos, &buffer[64] - pos + 1);
+ return string;
}
+
/*
* @implemented
*/
char* _ui64toa(unsigned __int64 value, char* string, int radix)
{
- char tmp[65];
- char *tp = tmp;
- long i;
- unsigned long v = value;
- char *sp;
+ char buffer[65];
+ char *pos;
+ int digit;
- if (radix > 36 || radix <= 1)
- {
- __set_errno(EDOM);
- return 0;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- if (string == 0)
- string = (char *)malloc((tp-tmp)+1);
- sp = string;
-
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ memcpy(string, pos, &buffer[64] - pos + 1);
+ return string;
}
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/witoa.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wmakpath.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wputenv.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wsenv.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wsplitp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtoi.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtoi64.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/stdlib/wtol.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/cpp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/cppexcept.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/heap.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/scanf.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/scanf.h
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/thread.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wine/undname.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcscoll.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcscspn.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsdup.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsicmp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcslwr.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsnicmp.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcspbrk.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsrev.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsset.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsspn.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsstr.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcstok.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsupr.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wcsxfrm.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Propchange: branches/ros-branch-0_3_0/reactos/lib/crt/wstring/wlasttok.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*
Modified: branches/ros-branch-0_3_0/reactos/lib/string/itoa.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/str…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/string/itoa.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/string/itoa.c Thu Jun 1 05:03:05 2006
@@ -1,82 +1,76 @@
#include <string.h>
#include <stdlib.h>
+#include <windows.h>
/*
* @implemented
+ * copy _i64toa from wine cvs 2006 month 05 day 21
*/
char *
_i64toa(__int64 value, char *string, int radix)
{
- char tmp[65];
- char *tp = tmp;
- __int64 i;
- unsigned __int64 v;
- __int64 sign;
- char *sp;
+ ULONGLONG val;
+ int negative;
+ char buffer[65];
+ char *pos;
+ int digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ if (value < 0 && radix == 10) {
+ negative = 1;
+ val = -value;
+ } else {
+ negative = 0;
+ val = value;
+ } /* if */
- sign = (radix == 10 && value < 0);
- if (sign)
- v = -value;
- else
- v = (unsigned __int64)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- sp = string;
- if (sign)
- *sp++ = '-';
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ do {
+ digit = val % radix;
+ val = val / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (val != 0L);
+
+ if (negative) {
+ *--pos = '-';
+ } /* if */
+
+ memcpy(string, pos, &buffer[64] - pos + 1);
+ return string;
}
/*
* @implemented
+ * copy _i64toa from wine cvs 2006 month 05 day 21
*/
char *
_ui64toa(unsigned __int64 value, char *string, int radix)
{
- char tmp[65];
- char *tp = tmp;
- __int64 i;
- unsigned __int64 v;
- char *sp;
+ char buffer[65];
+ char *pos;
+ int digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- v = (unsigned __int64)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- sp = string;
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ memcpy(string, pos, &buffer[64] - pos + 1);
+ return string;
}
@@ -133,35 +127,35 @@
/*
- * @implemented
+ * @implemented
+ * copy it from wine 0.9.0 with small modifcations do check for NULL
*/
char *
_ultoa(unsigned long value, char *string, int radix)
{
- char tmp[33];
- char *tp = tmp;
- long i;
- unsigned long v = value;
- char *sp;
+ char buffer[33];
+ char *pos;
+ int digit;
+
+ pos = &buffer[32];
+ *pos = '\0';
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ if (string == NULL)
+ {
+ return NULL;
+ }
+
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+'0';
- else
- *tp++ = i + 'a' - 10;
- }
-
- sp = string;
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ memcpy(string, pos, &buffer[32] - pos + 1);
+
+ return string;
}
Modified: branches/ros-branch-0_3_0/reactos/lib/string/itow.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/str…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/string/itow.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/string/itow.c Thu Jun 1 05:03:05 2006
@@ -1,45 +1,48 @@
#include <string.h>
+#include <windows.h>
/*
* @implemented
+ * from wine cvs 2006-05-21
*/
wchar_t *
_i64tow(__int64 value, wchar_t *string, int radix)
{
- wchar_t tmp[65];
- wchar_t *tp = tmp;
- __int64 i;
- unsigned __int64 v;
- __int64 sign;
- wchar_t *sp;
+ ULONGLONG val;
+ int negative;
+ WCHAR buffer[65];
+ PWCHAR pos;
+ WCHAR digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ if (value < 0 && radix == 10) {
+ negative = 1;
+ val = -value;
+ } else {
+ negative = 0;
+ val = value;
+ } /* if */
- sign = (radix == 10 && value < 0);
- if (sign)
- v = -value;
- else
- v = (unsigned __int64)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+L'0';
- else
- *tp++ = i + L'a' - 10;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- sp = string;
- if (sign)
- *sp++ = L'-';
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ do {
+ digit = val % radix;
+ val = val / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (val != 0L);
+
+ if (negative) {
+ *--pos = '-';
+ } /* if */
+
+ if (string != NULL) {
+ memcpy(string, pos, (&buffer[64] - pos + 1) * sizeof(WCHAR));
+ } /* if */
+ return string;
}
@@ -49,152 +52,112 @@
wchar_t *
_ui64tow(unsigned __int64 value, wchar_t *string, int radix)
{
- wchar_t tmp[65];
- wchar_t *tp = tmp;
- __int64 i;
- unsigned __int64 v;
- wchar_t *sp;
+ WCHAR buffer[65];
+ PWCHAR pos;
+ WCHAR digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ pos = &buffer[64];
+ *pos = '\0';
- v = (unsigned __int64)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+L'0';
- else
- *tp++ = i + L'a' - 10;
- }
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- sp = string;
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ if (string != NULL) {
+ memcpy(string, pos, (&buffer[64] - pos + 1) * sizeof(WCHAR));
+ } /* if */
+ return string;
}
/*
* @implemented
+ * from wine cvs 2006-05-21
*/
wchar_t *
_itow(int value, wchar_t *string, int radix)
{
- wchar_t tmp[33];
- wchar_t *tp = tmp;
- int i;
- unsigned v;
- int sign;
- wchar_t *sp;
-
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
-
- sign = (radix == 10 && value < 0);
- if (sign)
- v = -value;
- else
- v = (unsigned)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+L'0';
- else
- *tp++ = i + L'a' - 10;
- }
-
- sp = string;
- if (sign)
- *sp++ = L'-';
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ return _ltow(value, string, radix);
}
/*
* @implemented
+ * from wine cvs 2006-05-21
*/
wchar_t *
_ltow(long value, wchar_t *string, int radix)
{
- wchar_t tmp[33];
- wchar_t *tp = tmp;
- long i;
- unsigned long v;
- int sign;
- wchar_t *sp;
+ unsigned long val;
+ int negative;
+ WCHAR buffer[33];
+ PWCHAR pos;
+ WCHAR digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ if (value < 0 && radix == 10) {
+ negative = 1;
+ val = -value;
+ } else {
+ negative = 0;
+ val = value;
+ } /* if */
- sign = (radix == 10 && value < 0);
- if (sign)
- v = -value;
- else
- v = (unsigned long)value;
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+L'0';
- else
- *tp++ = i + L'a' - 10;
- }
+ pos = &buffer[32];
+ *pos = '\0';
- sp = string;
- if (sign)
- *sp++ = L'-';
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ do {
+ digit = val % radix;
+ val = val / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (val != 0L);
+
+ if (negative) {
+ *--pos = '-';
+ } /* if */
+
+ if (string != NULL) {
+ memcpy(string, pos, (&buffer[32] - pos + 1) * sizeof(WCHAR));
+ } /* if */
+ return string;
}
/*
* @implemented
+ * from wine cvs 2006-05-21
*/
wchar_t *
_ultow(unsigned long value, wchar_t *string, int radix)
{
- wchar_t tmp[33];
- wchar_t *tp = tmp;
- long i;
- unsigned long v = value;
- wchar_t *sp;
+ WCHAR buffer[33];
+ PWCHAR pos;
+ WCHAR digit;
- if (radix > 36 || radix <= 1)
- {
- return 0;
- }
+ pos = &buffer[32];
+ *pos = '\0';
- while (v || tp == tmp)
- {
- i = v % radix;
- v = v / radix;
- if (i < 10)
- *tp++ = i+L'0';
- else
- *tp++ = i + L'a' - 10;
- }
+ do {
+ digit = value % radix;
+ value = value / radix;
+ if (digit < 10) {
+ *--pos = '0' + digit;
+ } else {
+ *--pos = 'a' + digit - 10;
+ } /* if */
+ } while (value != 0L);
- sp = string;
- while (tp > tmp)
- *sp++ = *--tp;
- *sp = 0;
- return string;
+ if (string != NULL) {
+ memcpy(string, pos, (&buffer[32] - pos + 1) * sizeof(WCHAR));
+ } /* if */
+ return string;
}
Modified: branches/ros-branch-0_3_0/reactos/lib/string/wtoi.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/str…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/string/wtoi.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/string/wtoi.c Thu Jun 1 05:03:05 2006
@@ -3,9 +3,10 @@
/*
* @implemented
+ * copy _i64toa from wine cvs 2006 month 05 day 21
*/
int
_wtoi(const wchar_t *str)
{
- return (int)wcstol(str, 0, 10);
+ return _wtol(str);
}
Modified: branches/ros-branch-0_3_0/reactos/lib/string/wtol.c
URL:
http://svn.reactos.ru/svn/reactos/branches/ros-branch-0_3_0/reactos/lib/str…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/lib/string/wtol.c (original)
+++ branches/ros-branch-0_3_0/reactos/lib/string/wtol.c Thu Jun 1 05:03:05 2006
@@ -1,5 +1,6 @@
#include <string.h>
#include <stdlib.h>
+#include <windows.h>
/*
* @implemented
@@ -7,5 +8,26 @@
long
_wtol(const wchar_t *str)
{
- return wcstol(str, 0, 10);
+ ULONG RunningTotal = 0;
+ char bMinus = 0;
+
+ while (iswctype(*str, _SPACE) ) {
+ str++;
+ } /* while */
+
+ if (*str == L'+') {
+ str++;
+ } else if (*str == L'-') {
+ bMinus = 1;
+ str++;
+ } /* if */
+
+ while (*str >= L'0' && *str <= L'9') {
+ RunningTotal = RunningTotal * 10 + *str - L'0';
+ str++;
+ } /* while */
+
+ return bMinus ? -RunningTotal : RunningTotal;
}
+
+