Author: tkreuzer
Date: Sun Jan 11 20:46:45 2009
New Revision: 38717
URL:
http://svn.reactos.org/svn/reactos?rev=38717&view=rev
Log:
Sync wsprintf.c to wine head (Wine-1_1_12)
Alexandre Julliard <julliard(a)winehq.org>
user32: Convert wvsprintfA/W to use an MS ABI vararg list for x86_64.
Modified:
trunk/reactos/dll/win32/user32/include/user32p.h
trunk/reactos/dll/win32/user32/misc/misc.c
trunk/reactos/dll/win32/user32/misc/wsprintf.c
Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Sun Jan 11 20:46:45
2009
@@ -231,5 +231,17 @@
#define SYSCOLOR_GetPen(index) GetSysColorPen(index)
#define WIN_GetFullHandle(h) ((HWND)(h))
+#ifndef __ms_va_list
+# if defined(__x86_64__) && defined (__GNUC__)
+# define __ms_va_list __builtin_ms_va_list
+# define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
+# define __ms_va_end(list) __builtin_ms_va_end(list)
+# else
+# define __ms_va_list va_list
+# define __ms_va_start(list,arg) va_start(list,arg)
+# define __ms_va_end(list) va_end(list)
+# endif
+#endif
+
#endif
/* EOF */
Modified: trunk/reactos/dll/win32/user32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] Sun Jan 11 20:46:45 2009
@@ -541,3 +541,76 @@
return ValidateHwnd(hwnd);
}
+
+/*
+ * @implemented
+ */
+DWORD WINAPI WCSToMBEx(WORD CodePage,LPWSTR UnicodeString,LONG UnicodeSize,LPSTR
*MBString,LONG MBSize,BOOL Allocate)
+{
+ DWORD Size;
+ if (UnicodeSize == -1)
+ {
+ UnicodeSize = wcslen(UnicodeString)+1;
+ }
+ if (MBSize == -1)
+ {
+ if (!Allocate)
+ {
+ return 0;
+ }
+ MBSize = UnicodeSize * 2;
+ }
+ if (Allocate)
+ {
+ LPSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, MBSize);
+ if (SafeString == NULL)
+ return 0;
+ *MBString = SafeString;
+ }
+ if (CodePage == 0)
+ {
+ RtlUnicodeToMultiByteN(*MBString,MBSize,&Size,UnicodeString,UnicodeSize);
+ }
+ else
+ {
+ WideCharToMultiByte(CodePage,0,UnicodeString,UnicodeSize,*MBString,MBSize,0,0);
+ }
+ return UnicodeSize;
+}
+
+/*
+ * @implemented
+ */
+DWORD WINAPI MBToWCSEx(WORD CodePage,LPSTR MBString,LONG MBSize,LPWSTR
*UnicodeString,LONG UnicodeSize,BOOL Allocate)
+{
+ DWORD Size;
+ if (MBSize == -1)
+ {
+ MBSize = strlen(MBString)+1;
+ }
+ if (UnicodeSize == -1)
+ {
+ if (!Allocate)
+ {
+ return 0;
+ }
+ UnicodeSize = MBSize;
+ }
+ if (Allocate)
+ {
+ LPWSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, UnicodeSize);
+ if (SafeString == NULL)
+ return 0;
+ *UnicodeString = SafeString;
+ }
+ UnicodeSize *= sizeof(WCHAR);
+ if (CodePage == 0)
+ {
+ RtlMultiByteToUnicodeN(*UnicodeString,UnicodeSize,&Size,MBString,MBSize);
+ }
+ else
+ {
+ Size = MultiByteToWideChar(CodePage,0,MBString,MBSize,*UnicodeString,UnicodeSize);
+ }
+ return Size;
+}
Modified: trunk/reactos/dll/win32/user32/misc/wsprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/wspr…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/wsprintf.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/wsprintf.c [iso-8859-1] Sun Jan 11 20:46:45 2009
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE:
* This code is duplicated in shlwapi. If you change something here make sure
@@ -33,6 +33,7 @@
#include <user32.h>
+#define WINE_NO_TRACE_MSGS
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(string);
@@ -282,7 +283,7 @@
/***********************************************************************
* wvsnprintfA (internal)
*/
-static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
+static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, __ms_va_list args )
{
WPRINTF_FORMAT format;
LPSTR p = buffer;
@@ -290,7 +291,7 @@
CHAR number[20];
WPRINTF_DATA argData;
- //TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
+ TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
while (*spec && (maxlen > 1))
{
@@ -377,7 +378,7 @@
maxlen -= len;
}
*p = 0;
- //TRACE("%s\n",debugstr_a(buffer));
+ TRACE("%s\n",debugstr_a(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1;
}
@@ -385,7 +386,7 @@
/***********************************************************************
* wvsnprintfW (internal)
*/
-static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
+static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, __ms_va_list args )
{
WPRINTF_FORMAT format;
LPWSTR p = buffer;
@@ -393,7 +394,7 @@
CHAR number[20];
WPRINTF_DATA argData;
- //TRACE("%p %u %s\n", buffer, maxlen, debugstr_w(spec));
+ TRACE("%p %u %s\n", buffer, maxlen, debugstr_w(spec));
while (*spec && (maxlen > 1))
{
@@ -479,15 +480,14 @@
maxlen -= len;
}
*p = 0;
- //TRACE("%s\n",debugstr_w(buffer));
+ TRACE("%s\n",debugstr_w(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1;
}
/***********************************************************************
* wvsprintfA (USER32.@)
- * @implemented
- */
-INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
+ */
+INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, __ms_va_list args )
{
INT res = wvsnprintfA( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res;
@@ -496,9 +496,8 @@
/***********************************************************************
* wvsprintfW (USER32.@)
- * @implemented
- */
-INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
+ */
+INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, __ms_va_list args )
{
INT res = wvsnprintfW( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res;
@@ -506,101 +505,28 @@
/***********************************************************************
* wsprintfA (USER32.@)
- * @implemented
*/
INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... )
{
- va_list valist;
+ __ms_va_list valist;
INT res;
- va_start( valist, spec );
+ __ms_va_start( valist, spec );
res = wvsnprintfA( buffer, 1024, spec, valist );
- va_end( valist );
+ __ms_va_end( valist );
return ( res == -1 ) ? 1024 : res;
}
/***********************************************************************
* wsprintfW (USER32.@)
- * @implemented
*/
INT WINAPIV wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
{
- va_list valist;
+ __ms_va_list valist;
INT res;
- va_start( valist, spec );
+ __ms_va_start( valist, spec );
res = wvsnprintfW( buffer, 1024, spec, valist );
- va_end( valist );
+ __ms_va_end( valist );
return ( res == -1 ) ? 1024 : res;
}
-/*
- * @implemented
- */
-DWORD WINAPI WCSToMBEx(WORD CodePage,LPWSTR UnicodeString,LONG UnicodeSize,LPSTR
*MBString,LONG MBSize,BOOL Allocate)
-{
- DWORD Size;
- if (UnicodeSize == -1)
- {
- UnicodeSize = wcslen(UnicodeString)+1;
- }
- if (MBSize == -1)
- {
- if (!Allocate)
- {
- return 0;
- }
- MBSize = UnicodeSize * 2;
- }
- if (Allocate)
- {
- LPSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, MBSize);
- if (SafeString == NULL)
- return 0;
- *MBString = SafeString;
- }
- if (CodePage == 0)
- {
- RtlUnicodeToMultiByteN(*MBString,MBSize,&Size,UnicodeString,UnicodeSize);
- }
- else
- {
- WideCharToMultiByte(CodePage,0,UnicodeString,UnicodeSize,*MBString,MBSize,0,0);
- }
- return UnicodeSize;
-}
-/*
- * @implemented
- */
-DWORD WINAPI MBToWCSEx(WORD CodePage,LPSTR MBString,LONG MBSize,LPWSTR
*UnicodeString,LONG UnicodeSize,BOOL Allocate)
-{
- DWORD Size;
- if (MBSize == -1)
- {
- MBSize = strlen(MBString)+1;
- }
- if (UnicodeSize == -1)
- {
- if (!Allocate)
- {
- return 0;
- }
- UnicodeSize = MBSize;
- }
- if (Allocate)
- {
- LPWSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, UnicodeSize);
- if (SafeString == NULL)
- return 0;
- *UnicodeString = SafeString;
- }
- UnicodeSize *= sizeof(WCHAR);
- if (CodePage == 0)
- {
- RtlMultiByteToUnicodeN(*UnicodeString,UnicodeSize,&Size,MBString,MBSize);
- }
- else
- {
- Size = MultiByteToWideChar(CodePage,0,MBString,MBSize,*UnicodeString,UnicodeSize);
- }
- return Size;
-}