2012/1/10 Vitaliy Margolen wine-devel@kievinfo.com:
On 01/09/2012 10:18 AM, Lucas Fialho Zawacki wrote:
From: Lucas Fialho Zawackilfzawacki@gmail.com
+static BOOL _write_private_profile_intW(const char *format, WCHAR* section, WCHAR* key, int value, WCHAR* file)
I don't think this is such a good idea to mix ASCII and WCHAR parameters.
Even if this is for convenience in my "private" code? I use this a great deal through the code.
- static WCHAR path[] = {
'%','C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s','%','\',
- 'D','i','r','e','c','t','X','\',
- 'D','i','r','e','c','t','I','n','p','u','t','\',
- 'U','s','e','r',' ','M','a','p','s','\0'};
Why do you think it should be there in the first place?
Windows keeps it there, you can check it by running any application using SetActionMap. But I suppose no application depends on it being there specifically.
You can't do this. It seems to be you have not tested it with initial buffer too small. You have to do va_start & va_end every time you pass "args" to another function.
Yes, you're right. There were other mistakes as well. Is this version better?
... while (1) { /* Test if it's the first time */ if (buffer == NULL) buffer = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR)); else buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, size*sizeof(WCHAR));
if (buffer == NULL) break;
va_start(args, format); n = vsnprintfW(buffer, size, formatW, args); va_end(args);
if (n == -1) size *= 2; else if (n >= size) size = n + 1; else break; }
HeapFree(GetProcessHeap(), 0, formatW);
return buffer;
I tested it for smaller buffer values. If that's alright I can send a patch to winemenubuilder.c too because the heap_printf there should suffer from the same bug.
Would you please drop leading underscore from all of your function names?
Ok. I can stop doing this from this patch onwards if you think this convention is bad.