Hi,
is s/o interested in a working implementation of strtoull? I submitted a patch 4 or 5 months ago but it wasn't added yet so I retry my submission.
Regards, Mark
Index: crt.xml =================================================================== --- crt.xml (revision 17794) +++ crt.xml (working copy) @@ -317,6 +317,7 @@ <file>senv.c</file> <file>strtod.c</file> <file>strtoul.c</file> + <file>strtoull.c</file> <file>swab.c</file> <file>wcstod.c</file> <file>wcstombs.c</file> Index: stdlib/strtoull.c =================================================================== --- stdlib/strtoull.c (revision 17794) +++ stdlib/strtoull.c (working copy) @@ -1,24 +1,38 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include <windows.h> #include <limits.h> #include <ctype.h> #include <errno.h> #include <stdlib.h> -//#include <msvcrt/unconst.h> +#include <internal/file.h> +/*#include <msvcrt/unconst.h>*/
+#if defined(LONG_LONG_MAX) +#define ULONGLONG_MAX ULONG_LONG_MAX +#elif defined(_UI64_MAX) +#define ULONGLONG_MAX _UI64_MAX +#elif defined(ULLONG_MAX) +#define ULONGLONG_MAX ULLONG_MAX +#else +/* FIXME: There must be a better way because LONGLONG might be defined as + * double. */ +#define ULONGLONG_MAX ((ULONGLONG) (LONGLONG) -1) +#endif + /* * Convert a string to an unsigned long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -unsigned long +ULONGLONG strtoull(const char *nptr, char **endptr, int base) { const char *s = nptr; - unsigned long acc; + ULONGLONG acc; int c; - unsigned long cutoff; + ULONGLONG cutoff; int neg = 0, any, cutlim;
/* @@ -43,8 +57,8 @@ } if (base == 0) base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / base; - cutlim = (unsigned long)ULONG_MAX % base; + cutoff = ULONGLONG_MAX / base; + cutlim = (int) (ULONGLONG_MAX % base); for (acc = 0, any = 0;; c = *s++) { if (isdigit(c)) @@ -65,7 +79,7 @@ } if (any < 0) { - acc = ULONG_MAX; + acc = ULONGLONG_MAX; __set_errno ( ERANGE ); } else if (neg)
Mark Junker wrote:
Hi,
is s/o interested in a working implementation of strtoull? I submitted a patch 4 or 5 months ago but it wasn't added yet so I retry my submission.
Regards, Mark
Sorry, I must have missed it that time. I commited a big different version that uses existing CRT types and constants (ULONGLONG -> uint64_t, ULONGLONG_MAX -> UINT64_MAX) now. Thanks!
Best regards, Filip
Filip Navara schrieb:
Sorry, I must have missed it that time. I commited a big different version that uses existing CRT types and constants (ULONGLONG -> uint64_t, ULONGLONG_MAX -> UINT64_MAX) now. Thanks!
Ahh ... I forgot that stdint.h is available on most platforms nowadays.
Ge van Geldorp schrieb:
The preferred way to submit patches is create a new bug in Bugzilla (http://www.reactos.com/bugzilla), give it a component of "Patches" and attach your patch to that bug. Having it in Bugzilla means it won't get lost. Sending it to ros-dev might work, but there's a bigger chance that we'll be working on something at the moment the mail comes in, think "Hey, a patch, I need to take a look at that later" and then forget about it (as probably happened to your earlier submission).
Ok, thank you, I'll do this in future.
Regards, Mark
From: Mark Junker
is s/o interested in a working implementation of strtoull? I submitted a patch 4 or 5 months ago but it wasn't added yet so I retry my submission.
Yes, we are interested (in general) in patches. I see Filip applied it already this time.
The preferred way to submit patches is create a new bug in Bugzilla (http://www.reactos.com/bugzilla), give it a component of "Patches" and attach your patch to that bug. Having it in Bugzilla means it won't get lost. Sending it to ros-dev might work, but there's a bigger chance that we'll be working on something at the moment the mail comes in, think "Hey, a patch, I need to take a look at that later" and then forget about it (as probably happened to your earlier submission).
Anyway, thanks for your patch.
Gé van Geldorp.