zeroconf: Compile fix for MinGW

Change-Id: I08120e945fea6455ea109926b9b0a95406d078da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Christian Stenger
2012-08-24 16:29:09 +02:00
committed by Friedemann Kleint
parent 7f44d7b2ae
commit 89cfba79b2
2 changed files with 25 additions and 21 deletions

View File

@@ -746,26 +746,6 @@
typedef unsigned long long uint64_t;
#endif
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
#if (( !defined( _MSC_VER ) || TARGET_OS_WINDOWS_CE ) && !defined( _WIN32 ) )
typedef long int intptr_t;
typedef unsigned long int uintptr_t;

View File

@@ -79,9 +79,33 @@ namespace ZeroConf { namespace embeddedLib {
DWORD err = WSAGetLastError();
(void) priority;
va_start( args, message );
#ifdef _MSC_VER
len = _vscprintf( message, args ) + 1;
buffer = reinterpret_cast<char*>(malloc( len * sizeof(char) ));
if ( buffer ) { vsprintf( buffer, message, args ); OutputDebugStringA( buffer ); free( buffer ); }
if ( buffer ) {
vsprintf(buffer, message, args);
OutputDebugStringA(buffer);
free(buffer);
}
#else // MinGW 4.4, no longer required for 4.6
len = vsnprintf(NULL, 0, message, args);
va_end(args);
if (len == -1) // encoding error
return;
buffer = reinterpret_cast<char*>(malloc((len + 1) * sizeof(char)));
if (buffer == NULL) // no memory allocation possible
return;
va_start(args, message);
len = vsnprintf(buffer, (len + 1) * sizeof(char), message, args);
va_end(args);
if (len == -1) { // encoding error
free(buffer);
return;
} else {
OutputDebugStringA(buffer);
free(buffer);
}
#endif
WSASetLastError( err );
}
}}