Any chance of some help with this?
Yesterday i submitted a unit test for wsprintfA. I didn't include wsprintfW because I couldn't get it to work right. I still can't. I think it's something to do with the calling convention (since wsprintf uses cdecl, not stdcall). Here's the test code itself;
static BOOL wsprintfWTest (void) { WCHAR buf[25]; static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'}; WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1'};
printf ("%p %p\n", buf, fmt); ok ((wsprintfW (buf, fmt -1) == 10), "wsPrintfW length failure"); ok ((lstrcmpW (buf, target) == 0), "wsprintfW zero padded negative value failure\n");
return TRUE; }
but if I print the addresses of buf and fmt from within wsprintfW I get the same values for buf but for fmt I get a smaller pointer (0x401ecac instead of 0x401ecae)
(and I can't figure out how to get at it in gdb to see exactly what is going on).
Am I missing something obvious?
Bill
On Tue, Apr 23, 2002 at 09:18:45AM -0700, Medland, Bill wrote:
Any chance of some help with this?
static BOOL wsprintfWTest (void) { WCHAR buf[25]; static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'}; WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1'};
target's not '\0' terminated.
printf ("%p %p\n", buf, fmt); ok ((wsprintfW (buf, fmt -1) == 10), "wsPrintfW length failure");
missing a ',' between fmt and -1.
ok ((lstrcmpW (buf, target) == 0), "wsprintfW zero padded negative value failure\n");
return TRUE;
}
Huw.
On Tue, 23 Apr 2002, Medland, Bill wrote:
Any chance of some help with this?
Yesterday i submitted a unit test for wsprintfA. I didn't include wsprintfW because I couldn't get it to work right. I still can't. I think it's something to do with the calling convention (since wsprintf uses cdecl, not stdcall). Here's the test code itself;
static BOOL wsprintfWTest (void) { WCHAR buf[25]; static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'}; WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1'};
printf ("%p %p\n", buf, fmt); ok ((wsprintfW (buf, fmt, -1) == 10), "wsPrintfW length failure");
^
Would adding the above comma fix the problem?
ok ((lstrcmpW (buf, target) == 0), "wsprintfW zero padded negative value failure\n");
return TRUE;
}
[...]
Am I missing something obvious?
Yes and no :-)
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ It really galls me that most of the computer power in the world is wasted on screen savers. Chris Caldwell from the GIMPS project http://www.mersenne.org/prime.htm