winetest: fix a compiler warning

Vincent Povirk madewokherd+8cd9 at
Wed Dec 10 01:54:16 CST 2008

These are addressing some very weird cases. They should be an
improvement, but I wonder if we can't do better.

> void xprintf (const char *fmt, ...)
> {
>     va_list ap;
>-    size_t size;
>+    size_t size = 0;
>     DWORD written;

It would make more sense, IMO, to update the vstrfmtmake function to
also set *lenp to 0, if lenp is set, when it runs out of memory.
Winetest uses that function indirectly in other places, and one has a
similar problem. (Of course, if we did run out of memory, it's a
pretty dismal situation, and the returned string will be NULL, but at
least xprintf will silently fail instead of crashing.)

> extract_test (struct wine_test *test, const char *dir, LPTSTR res_name)
> {
>     BYTE* code;
>-    DWORD size;
>+    DWORD size = 0;

For this to matter, the extract_rcdata call has to fail. This is,
again, a pretty dismal situation. In this case, we'll later be writing
data starting at NULL, and of an undefined, or with this change 0,
length. I don't know if that actually works, and it may be better to
give up early.

Vincent Povirk

More information about the wine-devel mailing list