List: Internals « Previous MessageNext Message » From: Michael Widenius Date: August 15 2001 5:27pm Subject: Re: libmysql and MS Visual Studio .NET View as plain text
```Hi!

>>>>> "Sebastian" == Sebastian Bergmann <sb@stripped>
> writes:

Sebastian> Michael Widenius wrote:
>> Could you email the lines 380-445 from  .NET\Vc7\include\winnt.h
>> so that I can take a look at this.

Sebastian>   I uploaded it to http://www.sebastian-bergmann.de/winnt.h.

Thanks.  This helped me sovle this problem.

It seams that Microsoft is using LONGLONG as a typedef in their new
code.

The fix is to change in strtoll.c the define LONGLONG to USE_LONGLONG
and do the same change in strto.c

Here is a full fix for this:

===== strtoul.c 1.3 vs edited =====
*** /tmp/strtoul.c-1.3-28519	Wed Aug 30 22:41:59 2000
--- edited/strtoul.c	Wed Aug 15 20:23:51 2001
***************
*** 19,24 ****

#include <global.h>
#if !defined(MSDOS) && !defined(HAVE_STRTOUL)
! #define UNSIGNED
#include "strto.c"
#endif
--- 19,24 ----

#include <global.h>
#if !defined(MSDOS) && !defined(HAVE_STRTOUL)
! #define USE_UNSIGNED
#include "strto.c"
#endif
===== strto.c 1.3 vs edited =====
*** /tmp/strto.c-1.3-28519	Wed Aug 30 22:41:59 2000
--- edited/strto.c	Wed Aug 15 20:20:49 2001
***************
*** 42,54 ****
#include "my_sys.h"			/* defines errno */
#include <errno.h>

! #ifdef LONGLONG
#define UTYPE_MAX (~(ulonglong) 0)
#define TYPE_MIN LONGLONG_MIN
#define TYPE_MAX LONGLONG_MAX
#define longtype longlong
#define ulongtype ulonglong
! #ifdef UNSIGNED
#define function ulongtype strtoull
#else
#define function longtype strtoll
--- 42,54 ----
#include "my_sys.h"			/* defines errno */
#include <errno.h>

! #ifdef USE_LONGLONG
#define UTYPE_MAX (~(ulonglong) 0)
#define TYPE_MIN LONGLONG_MIN
#define TYPE_MAX LONGLONG_MAX
#define longtype longlong
#define ulongtype ulonglong
! #ifdef USE_UNSIGNED
#define function ulongtype strtoull
#else
#define function longtype strtoll
***************
*** 59,65 ****
#define TYPE_MAX LONG_MAX
#define longtype long
#define ulongtype unsigned long
! #ifdef UNSIGNED
#define function ulongtype strtoul
#else
#define function longtype strtol
--- 59,65 ----
#define TYPE_MAX LONG_MAX
#define longtype long
#define ulongtype unsigned long
! #ifdef USE_UNSIGNED
#define function ulongtype strtoul
#else
#define function longtype strtol
***************
*** 170,176 ****
if (endptr != NULL)
*endptr = (char *) s;

! #ifndef UNSIGNED
/* Check for a value that is within the range of
`unsigned long int', but outside the range of `long int'.	*/
if (negative)
--- 170,176 ----
if (endptr != NULL)
*endptr = (char *) s;

! #ifndef USE_UNSIGNED
/* Check for a value that is within the range of
`unsigned long int', but outside the range of `long int'.	*/
if (negative)
***************
*** 185,191 ****
if (overflow)
{
my_errno=ERANGE;
! #ifdef UNSIGNED
return UTYPE_MAX;
#else
return negative ? TYPE_MIN : TYPE_MAX;
--- 185,191 ----
if (overflow)
{
my_errno=ERANGE;
! #ifdef USE_UNSIGNED
return UTYPE_MAX;
#else
return negative ? TYPE_MIN : TYPE_MAX;
===== strtoull.c 1.3 vs edited =====
*** /tmp/strtoull.c-1.3-28519	Wed Aug 30 22:41:59 2000
--- edited/strtoull.c	Wed Aug 15 20:20:49 2001
***************
*** 20,26 ****
#include <global.h>
#include <m_string.h>
#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
! #define UNSIGNED
! #define LONGLONG
#include "strto.c"
#endif
--- 20,26 ----
#include <global.h>
#include <m_string.h>
#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
! #define USE_UNSIGNED
! #define USE_LONGLONG
#include "strto.c"
#endif
===== strtoll.c 1.3 vs edited =====
*** /tmp/strtoll.c-1.3-28519	Wed Aug 30 22:41:59 2000
--- edited/strtoll.c	Wed Aug 15 20:20:49 2001
***************
*** 19,25 ****

#include <global.h>
#include <m_string.h>
! #if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
! #define LONGLONG
#include "strto.c"
#endif
--- 19,25 ----

#include <global.h>
#include <m_string.h>
! #if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
! #define USE_LONGLONG
#include "strto.c"
#endif

Regards,
Monty
```