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;
typedef long LONG_PTR;
typedef unsigned long ULONG_PTR;
typedef double DOUBLE;
#ifdef __i386__
typedef double LONGLONG;
typedef double ULONGLONG;
#endif /*__i386__*/
/* Integer types. These are the same for emulator and library. */
......@@ -396,8 +394,18 @@ DECL_WINELIB_TYPE(HWND)
#define OFFSETOF(ptr) (LOWORD(ptr))
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
#ifdef __i386__
/* Note: These macros are semantically broken, at least for wrc. wrc
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 GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
......@@ -411,7 +419,7 @@ DECL_WINELIB_TYPE(HWND)
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* __i386__ */
#endif /* 1 */
/* MIN and MAX macros */
......
......@@ -27,7 +27,7 @@ typedef struct wrc_resource16
INT32 resid; /* The resource id if resname == NULL */
LPSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */
LPSTR typename;
LPSTR restypename;
LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */
} wrc_resource16_t;
......@@ -37,7 +37,7 @@ typedef struct wrc_resource32
INT32 resid; /* The resource id if resname == NULL */
LPWSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */
LPWSTR typename;
LPWSTR restypename;
LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */
} wrc_resource32_t;
......
......@@ -543,6 +543,8 @@ DWORD WINAPI FormatMessage32A(
DWORD nSize,
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;
DWORD talloced;
LPSTR from,f;
......@@ -698,6 +700,9 @@ DWORD WINAPI FormatMessage32A(
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer);
#else
return 0;
#endif /* __i386__ */
}
#undef ADD_TO_T
......@@ -714,6 +719,8 @@ DWORD WINAPI FormatMessage32W(
DWORD nSize,
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;
DWORD talloced;
LPSTR from,f;
......@@ -870,5 +877,8 @@ DWORD WINAPI FormatMessage32W(
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
lstrlen32W(*(LPWSTR*)lpBuffer):
lstrlen32W(lpBuffer);
#else
return 0;
#endif /* __i386__ */
}
#undef ADD_TO_T
......@@ -239,6 +239,29 @@ static UINT32 WPRINTF_GetLen( WPRINTF_FORMAT *format, LPCVOID arg,
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)
......@@ -344,6 +367,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
LPSTR p = buffer;
UINT32 i, len;
CHAR number[20];
LPVOID argPtr = NULL;
while (*spec && (maxlen > 1))
{
......@@ -351,29 +375,30 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
spec++;
if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
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))
for (i = format.precision; i < format.width; i++, maxlen--)
*p++ = ' ';
switch(format.type)
{
case WPR_WCHAR:
if ((*p = (CHAR)va_arg( args, WCHAR ))) p++;
if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_CHAR:
if ((*p = va_arg( args, CHAR ))) p++;
if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_STRING:
memcpy( p, va_arg( args, LPCSTR ), len );
memcpy( p, (LPCSTR)argPtr, len );
p += len;
break;
case WPR_WSTRING:
{
LPCWSTR ptr = va_arg( args, LPCWSTR );
LPCWSTR ptr = (LPCWSTR)argPtr;
for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
}
break;
......@@ -393,7 +418,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
memcpy( p, number, len );
p += len;
(void)va_arg( args, INT32 ); /* Go to the next arg */
/* Go to the next arg */
break;
case WPR_UNKNOWN:
continue;
......
......@@ -377,6 +377,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) {
HMODULE32 hModule;
int i;
#ifdef __i386__
if (!(TRACE_ON(relay) || WARN_ON(relay)))
return;
for (dll = BuiltinDLLs; dll->descr; dll++) {
......@@ -402,6 +403,7 @@ void BUILTIN32_SwitchRelayDebug(BOOL32 onoff) {
}
}
}
#endif /* __i386__ */
return;
}
......
......@@ -4,7 +4,6 @@
* Copyright 1997 Alexandre Julliard
*/
#ifdef __i386__
#include <assert.h>
#include <string.h>
......@@ -18,6 +17,7 @@
char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL;
#ifdef __i386__
/***********************************************************************
* RELAY_ShowDebugmsgRelay
*
......
......@@ -18,10 +18,10 @@
#include "debugstr.h"
#include "debug.h"
#ifdef __i386__
char **debug_snoop_excludelist = NULL, **debug_snoop_includelist = NULL;
#ifdef __i386__
#ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_"
#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