[janitor] programs/wcmd -Wwrite-strings cleanup

Alexandre Julliard julliard at winehq.org
Thu Oct 9 16:49:38 CDT 2003


Daniel Marmier <d.marmier at bluewin.ch> writes:

> There has to be a better solution. Perhaps something like:
>
> 	#define FAKE_LPSTR(s) ((LPSTR)(ptrdiff_t)(s))
>
> 	WriteSpool16( physDev->job.hJob, FAKE_LPSTR(buf), strlen(buf) );
>
> Where the intermediate cast to ptrdiff_t serves to shut-up gcc's
> -Wcast-qual (which might be my one of my next candidates ...)
>
> Or perhaps something really better ...
>
> Comments, ideas, suggestions?

In some cases parameters to API functions are not declared const even
though they really are const; some of these could be fixed. Notably,
all the 16-bit ones can be freely changed since no external code
depends on them. Some 32-bit ones can probably be changed too, like
all the undocumented ones. Not sure how much this helps.

In cases where the official prototype is broken but we can't fix it, I
think a cast is better than creating a writable string. Of course this
means making sure that the string really isn't modified by the
function.

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list