ReactOS  0.4.13-dev-455-g28ed234
wsprintf.c File Reference
#include <stdarg.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
Include dependency graph for wsprintf.c:

Go to the source code of this file.

Functions

static void wsprintfATest (void)
 
static void wsprintfWTest (void)
 
static void CharUpperTest (void)
 
static void CharLowerTest (void)
 
 START_TEST (wsprintf)
 

Variables

struct {
   const char *   fmt
 
   ULONGLONG   value
 
   const char *   res
 
i64_formats []
 

Function Documentation

◆ CharLowerTest()

static void CharLowerTest ( void  )
static

Definition at line 131 of file wsprintf.c.

132 {
133  INT_PTR i, out;
134  BOOL failed = FALSE;
135 
136  for (i=0;i<256;i++)
137  {
139  if ((out >> 16) != 0)
140  {
141  failed = TRUE;
142  break;
143  }
144  }
145  ok(!failed,"CharLower failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
146 }
#define TRUE
Definition: types.h:120
int32_t INT_PTR
Definition: typedefs.h:62
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharLowerA(_Inout_ LPSTR)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
static FILE * out
Definition: regtests2xml.c:44

Referenced by START_TEST().

◆ CharUpperTest()

static void CharUpperTest ( void  )
static

Definition at line 114 of file wsprintf.c.

115 {
116  INT_PTR i, out;
117  BOOL failed = FALSE;
118 
119  for (i=0;i<256;i++)
120  {
122  if ((out >> 16) != 0)
123  {
124  failed = TRUE;
125  break;
126  }
127  }
128  ok(!failed,"CharUpper failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
129 }
#define TRUE
Definition: types.h:120
int32_t INT_PTR
Definition: typedefs.h:62
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharUpperA(_Inout_ LPSTR)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
static FILE * out
Definition: regtests2xml.c:44

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( wsprintf  )

Definition at line 149 of file wsprintf.c.

150 {
151  wsprintfATest();
152  wsprintfWTest();
153  CharUpperTest();
154  CharLowerTest();
155 }
static void CharLowerTest(void)
Definition: wsprintf.c:131
static void CharUpperTest(void)
Definition: wsprintf.c:114
static void wsprintfWTest(void)
Definition: wsprintf.c:77
static void wsprintfATest(void)
Definition: wsprintf.c:53

◆ wsprintfATest()

static void wsprintfATest ( void  )
static

Definition at line 53 of file wsprintf.c.

54 {
55  char buf[25];
56  unsigned int i;
57  int rc;
58 
59  rc=wsprintfA(buf, "%010ld", -1);
60  ok(rc == 10, "wsprintfA length failure: rc=%d error=%d\n",rc,GetLastError());
61  ok((lstrcmpA(buf, "-000000001") == 0),
62  "wsprintfA zero padded negative value failure: buf=[%s]\n",buf);
63  rc = wsprintfA(buf, "%I64X", (ULONGLONG)0);
64  if (rc == 4 && !lstrcmpA(buf, "I64X"))
65  {
66  win_skip( "I64 formats not supported\n" );
67  return;
68  }
69  for (i = 0; i < sizeof(i64_formats)/sizeof(i64_formats[0]); i++)
70  {
72  ok(rc == strlen(i64_formats[i].res), "%u: wsprintfA length failure: rc=%d\n", i, rc);
73  ok(!strcmp(buf, i64_formats[i].res), "%u: wrong result [%s]\n", i, buf);
74  }
75 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
uint64_t ULONGLONG
Definition: typedefs.h:65
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
GLuint res
Definition: glext.h:9613
static const struct @1662 i64_formats[]
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define win_skip
Definition: test.h:141
Definition: dsound.c:943

Referenced by START_TEST().

◆ wsprintfWTest()

static void wsprintfWTest ( void  )
static

Definition at line 77 of file wsprintf.c.

78 {
79  static const WCHAR fmt_010ld[] = {'%','0','1','0','l','d','\0'};
80  static const WCHAR res_010ld[] = {'-','0','0','0','0','0','0','0','0','1', '\0'};
81  static const WCHAR fmt_I64x[] = {'%','I','6','4','x',0};
82  WCHAR buf[25], fmt[25], res[25];
83  unsigned int i;
84  int rc;
85 
86  rc=wsprintfW(buf, fmt_010ld, -1);
88  {
89  win_skip("wsprintfW is not implemented\n");
90  return;
91  }
92  ok(rc == 10, "wsPrintfW length failure: rc=%d error=%d\n",rc,GetLastError());
93  ok((lstrcmpW(buf, res_010ld) == 0),
94  "wsprintfW zero padded negative value failure\n");
95  rc = wsprintfW(buf, fmt_I64x, (ULONGLONG)0 );
96  if (rc == 4 && !lstrcmpW(buf, fmt_I64x + 1))
97  {
98  win_skip( "I64 formats not supported\n" );
99  return;
100  }
101  for (i = 0; i < sizeof(i64_formats)/sizeof(i64_formats[0]); i++)
102  {
103  MultiByteToWideChar( CP_ACP, 0, i64_formats[i].fmt, -1, fmt, sizeof(fmt)/sizeof(WCHAR) );
104  MultiByteToWideChar( CP_ACP, 0, i64_formats[i].res, -1, res, sizeof(res)/sizeof(WCHAR) );
105  rc = wsprintfW(buf, fmt, i64_formats[i].value);
106  ok(rc == lstrlenW(res), "%u: wsprintfW length failure: rc=%d\n", i, rc);
107  ok(!lstrcmpW(buf, res), "%u: wrong result [%s]\n", i, wine_dbgstr_w(buf));
108  }
109 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define lstrlenW
Definition: compat.h:407
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:65
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
static const struct @1662 i64_formats[]
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141
Definition: dsound.c:943

Referenced by START_TEST().

Variable Documentation

◆ fmt

Definition at line 30 of file wsprintf.c.

Referenced by __get_date_order(), CFSDropTarget::_DoDrop(), _vsnprintf(), add_undo_set_char_fmt(), AddrToAddrStr(), apply_image_attributes(), check_messages_(), checkfmt(), clipboard_thread(), context_dump_fbo_attachment(), create_automatic_entry(), D3DXCheckTextureRequirements(), DataCache_UpdateCache(), DataObject_GetData(), DataObject_QueryGetData(), ddraw7_EnumDisplayModes(), dialog_choose_font(), doflag(), CFSDropTarget::DragEnter(), CExeDropHandler::Drop(), CRecyclerDropTarget::Drop(), f_mkfs(), find_volume(), format_insert(), format_size(), FormatBytes(), FormatDouble(), FormatInt(), get_data_from_bitmap(), get_data_from_enhmetafile(), get_data_from_global(), get_data_from_metafilepict(), get_data_from_storage(), get_data_from_stream(), get_date_format(), get_storage(), get_textfont_prop_for_pos(), GetCurrencyFormatA(), getFmt(), GetNumberFormatA(), COpenWithMenu::Initialize(), CListView::InsertColumn(), IntAddFormatedData(), MCICDA_GetStatus(), MCICDA_Play(), MCICDA_Status(), ME_DrawOLE(), ME_GetOLEObjectSize(), ME_HandleMessage(), ME_JoinParagraphs(), ME_RTFCharAttrHook(), ME_RTFParAttrHook(), ME_StreamOutRTFCharProps(), msi_export_forcecodepage(), NtUserGetClipboardData(), OleQueryCreateFromData(), OnCommand(), OnUser(), OpenMsg(), optend(), PICE_vsprintf(), populate_font_list(), populate_size_list(), PrintF(), PrintkCallback(), printopts(), set_clipboard_formats(), set_default_font(), set_font(), set_format(), set_size(), set_textfont_prop(), SetXtermTitle(), SH_GetApidlFromDataObject(), shader_glsl_float16(), SHGetRealIDL(), string_error::string_error(), test_cf_dataobject(), test_channelvolume(), test_consumer_refs(), test_data_cache_cache(), test_data_cache_updatecache(), test_DataObject(), test_EM_POSFROMCHAR(), test_EM_STREAMIN(), test_enum_fmtetc(), test_flushed_getdata(), test_formats(), test_fragmentsize(), test_getdatahere(), test_GetDataHere_Proxy(), test_GetGlyphOutline(), test_hw_buffers(), test_nonole_clipboard(), test_OleLoad(), test_para_numbering(), test_reset_default_para_fmt(), test_rtf(), test_session_creation(), test_SETPARAFORMAT(), test_simplevolume(), test_streamvolume(), test_volume_dependence(), textrange_set_font(), TIFFError(), TIFFErrorExt(), TIFFWarning(), TIFFWarningExt(), Trace(), update_font_list(), update_size_list(), UPDOWN_SetBuddyInt(), VARIANT_GetNamedFormat(), vstrmake(), and wcsftime().

◆ i64_formats

const { ... } i64_formats[]
Initial value:
=
{
{ "%I64X", ((ULONGLONG)0x12345 << 32) | 0x67890a, "123450067890A" },
{ "%I32X", ((ULONGLONG)0x12345 << 32) | 0x67890a, "67890A" },
{ "%I64d", (ULONGLONG)543210 * 1000000, "543210000000" },
{ "%I64X", (LONGLONG)-0x12345, "FFFFFFFFFFFEDCBB" },
{ "%I32x", (LONGLONG)-0x12345, "fffedcbb" },
{ "%I64u", (LONGLONG)-123, "18446744073709551493" },
{ "%Id", (LONGLONG)-12345, "-12345" },
{ "%Ix", ((ULONGLONG)0x12345 << 32) | 0x67890a, "67890a" },
{ "%Ix", (LONGLONG)-0x12345, "fffedcbb" },
{ "%p", (LONGLONG)-0x12345, "FFFEDCBB" },
}
int64_t LONGLONG
Definition: typedefs.h:66
uint64_t ULONGLONG
Definition: typedefs.h:65

Referenced by wsprintfATest(), and wsprintfWTest().

◆ res

Definition at line 32 of file wsprintf.c.

Referenced by wnsprintfA(), and wnsprintfW().

◆ value

Definition at line 31 of file wsprintf.c.