Commit 8c8a3a52 authored by Gavriel State's avatar Gavriel State Committed by Alexandre Julliard

A few non-x86 Winelib fixes.

parent 4097865b
...@@ -110,10 +110,8 @@ typedef long SCODE; ...@@ -110,10 +110,8 @@ typedef long SCODE;
typedef long LONG_PTR; typedef long LONG_PTR;
typedef unsigned long ULONG_PTR; typedef unsigned long ULONG_PTR;
typedef double DOUBLE; typedef double DOUBLE;
#ifdef __i386__
typedef double LONGLONG; typedef double LONGLONG;
typedef double ULONGLONG; typedef double ULONGLONG;
#endif /*__i386__*/
/* Integer types. These are the same for emulator and library. */ /* Integer types. These are the same for emulator and library. */
...@@ -396,8 +394,18 @@ DECL_WINELIB_TYPE(HWND) ...@@ -396,8 +394,18 @@ DECL_WINELIB_TYPE(HWND)
#define OFFSETOF(ptr) (LOWORD(ptr)) #define OFFSETOF(ptr) (LOWORD(ptr))
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */ /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
/* Note: These macros are semantically broken, at least for wrc. wrc
#ifdef __i386__ spits out data in the platform's current binary format, *not* in
little-endian format. These macros are used throughout the resource
code to load and store data to the resources. Since it is unlikely
that we'll ever be dealing with little-endian resource data, the
byte-swapping nature of these macros has been disabled. Rather than
remove the use of these macros from the resource loading code, the
macros have simply been disabled. In the future, someone may want
to reactivate these macros for other purposes. In that case, the
resource code will have to be modified to use different macros. */
#if 1
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w)) #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
#define GET_WORD(ptr) (*(WORD *)(ptr)) #define GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw)) #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
...@@ -411,7 +419,7 @@ DECL_WINELIB_TYPE(HWND) ...@@ -411,7 +419,7 @@ DECL_WINELIB_TYPE(HWND)
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw))) PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \ #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16))) ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* __i386__ */ #endif /* 1 */
/* MIN and MAX macros */ /* MIN and MAX macros */
......
...@@ -27,7 +27,7 @@ typedef struct wrc_resource16 ...@@ -27,7 +27,7 @@ typedef struct wrc_resource16
INT32 resid; /* The resource id if resname == NULL */ INT32 resid; /* The resource id if resname == NULL */
LPSTR resname; LPSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */ INT32 restype; /* The resource type-id if typename == NULL */
LPSTR typename; LPSTR restypename;
LPBYTE data; /* Actual resource data */ LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */ UINT32 datasize; /* The size of the resource */
} wrc_resource16_t; } wrc_resource16_t;
...@@ -37,7 +37,7 @@ typedef struct wrc_resource32 ...@@ -37,7 +37,7 @@ typedef struct wrc_resource32
INT32 resid; /* The resource id if resname == NULL */ INT32 resid; /* The resource id if resname == NULL */
LPWSTR resname; LPWSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */ INT32 restype; /* The resource type-id if typename == NULL */
LPWSTR typename; LPWSTR restypename;
LPBYTE data; /* Actual resource data */ LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */ UINT32 datasize; /* The size of the resource */
} wrc_resource32_t; } wrc_resource32_t;
......
...@@ -543,6 +543,8 @@ DWORD WINAPI FormatMessage32A( ...@@ -543,6 +543,8 @@ DWORD WINAPI FormatMessage32A(
DWORD nSize, DWORD nSize,
LPDWORD args /* va_list *args */ LPDWORD args /* va_list *args */
) { ) {
#ifdef __i386__
/* This implementation is completely dependant on the format of the va_list on x86 CPUs */
LPSTR target,t; LPSTR target,t;
DWORD talloced; DWORD talloced;
LPSTR from,f; LPSTR from,f;
...@@ -698,6 +700,9 @@ DWORD WINAPI FormatMessage32A( ...@@ -698,6 +700,9 @@ DWORD WINAPI FormatMessage32A(
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer): strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer); strlen(lpBuffer);
#else
return 0;
#endif /* __i386__ */
} }
#undef ADD_TO_T #undef ADD_TO_T
...@@ -714,6 +719,8 @@ DWORD WINAPI FormatMessage32W( ...@@ -714,6 +719,8 @@ DWORD WINAPI FormatMessage32W(
DWORD nSize, DWORD nSize,
LPDWORD args /* va_list *args */ LPDWORD args /* va_list *args */
) { ) {
#ifdef __i386__
/* This implementation is completely dependant on the format of the va_list on x86 CPUs */
LPSTR target,t; LPSTR target,t;
DWORD talloced; DWORD talloced;
LPSTR from,f; LPSTR from,f;
...@@ -870,5 +877,8 @@ DWORD WINAPI FormatMessage32W( ...@@ -870,5 +877,8 @@ DWORD WINAPI FormatMessage32W(
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
lstrlen32W(*(LPWSTR*)lpBuffer): lstrlen32W(*(LPWSTR*)lpBuffer):
lstrlen32W(lpBuffer); lstrlen32W(lpBuffer);
#else
return 0;
#endif /* __i386__ */
} }
#undef ADD_TO_T #undef ADD_TO_T
...@@ -239,6 +239,29 @@ static UINT32 WPRINTF_GetLen( WPRINTF_FORMAT *format, LPCVOID arg, ...@@ -239,6 +239,29 @@ static UINT32 WPRINTF_GetLen( WPRINTF_FORMAT *format, LPCVOID arg,
return len; return len;
} }
/***********************************************************************
* WPRINTF_ExtractVAPtr (Not a Windows API)
*/
static LPVOID WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list args )
{
switch(format->type)
{
case WPR_WCHAR:
return (LPVOID)va_arg( args, WCHAR );
case WPR_CHAR:
return (LPVOID)va_arg( args, CHAR );
case WPR_STRING:
return (LPVOID)va_arg( args, LPCSTR);
case WPR_WSTRING:
return (LPVOID)va_arg( args, LPCWSTR);
case WPR_HEXA:
case WPR_SIGNED:
case WPR_UNSIGNED:
return (LPVOID)va_arg( args, INT32 );
default:
return NULL;
}
}
/*********************************************************************** /***********************************************************************
* wvsnprintf16 (Not a Windows API) * wvsnprintf16 (Not a Windows API)
...@@ -344,6 +367,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, ...@@ -344,6 +367,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
LPSTR p = buffer; LPSTR p = buffer;
UINT32 i, len; UINT32 i, len;
CHAR number[20]; CHAR number[20];
LPVOID argPtr = NULL;
while (*spec && (maxlen > 1)) while (*spec && (maxlen > 1))
{ {
...@@ -351,29 +375,30 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, ...@@ -351,29 +375,30 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
spec++; spec++;
if (*spec == '%') { *p++ = *spec++; maxlen--; continue; } if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
spec += WPRINTF_ParseFormatA( spec, &format ); spec += WPRINTF_ParseFormatA( spec, &format );
len = WPRINTF_GetLen( &format, args, number, maxlen - 1 ); argPtr = WPRINTF_ExtractVAPtr( &format, args );
len = WPRINTF_GetLen( &format, &argPtr, number, maxlen - 1 );
if (!(format.flags & WPRINTF_LEFTALIGN)) if (!(format.flags & WPRINTF_LEFTALIGN))
for (i = format.precision; i < format.width; i++, maxlen--) for (i = format.precision; i < format.width; i++, maxlen--)
*p++ = ' '; *p++ = ' ';
switch(format.type) switch(format.type)
{ {
case WPR_WCHAR: case WPR_WCHAR:
if ((*p = (CHAR)va_arg( args, WCHAR ))) p++; if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
break; break;
case WPR_CHAR: case WPR_CHAR:
if ((*p = va_arg( args, CHAR ))) p++; if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
break; break;
case WPR_STRING: case WPR_STRING:
memcpy( p, va_arg( args, LPCSTR ), len ); memcpy( p, (LPCSTR)argPtr, len );
p += len; p += len;
break; break;
case WPR_WSTRING: case WPR_WSTRING:
{ {
LPCWSTR ptr = va_arg( args, LPCWSTR ); LPCWSTR ptr = (LPCWSTR)argPtr;
for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++; for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
} }
break; break;
...@@ -393,7 +418,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec, ...@@ -393,7 +418,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
for (i = len; i < format.precision; i++, maxlen--) *p++ = '0'; for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
memcpy( p, number, len ); memcpy( p, number, len );
p += len; p += len;
(void)va_arg( args, INT32 ); /* Go to the next arg */ /* Go to the next arg */
break; break;
case WPR_UNKNOWN: case WPR_UNKNOWN:
continue; continue;
......
...@@ -377,6 +377,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) { ...@@ -377,6 +377,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) {
HMODULE32 hModule; HMODULE32 hModule;
int i; int i;
#ifdef __i386__
if (!(TRACE_ON(relay) || WARN_ON(relay))) if (!(TRACE_ON(relay) || WARN_ON(relay)))
return; return;
for (dll = BuiltinDLLs; dll->descr; dll++) { for (dll = BuiltinDLLs; dll->descr; dll++) {
...@@ -402,6 +403,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) { ...@@ -402,6 +403,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) {
} }
} }
} }
#endif /* __i386__ */
return; return;
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* Copyright 1997 Alexandre Julliard * Copyright 1997 Alexandre Julliard
*/ */
#ifdef __i386__
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL; char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL;
#ifdef __i386__
/*********************************************************************** /***********************************************************************
* RELAY_ShowDebugmsgRelay * RELAY_ShowDebugmsgRelay
* *
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include "debugstr.h" #include "debugstr.h"
#include "debug.h" #include "debug.h"
#ifdef __i386__
char **debug_snoop_excludelist = NULL, **debug_snoop_includelist = NULL; char **debug_snoop_excludelist = NULL, **debug_snoop_includelist = NULL;
#ifdef __i386__
#ifdef NEED_UNDERSCORE_PREFIX #ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_" # define PREFIX "_"
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment