vsnprintf: glibc and win32 not compatible

Bill Medland billmedland at mercuryspeed.com
Mon Mar 8 13:03:14 CST 2004


On March 8, 2004 10:54 am, Bill Medland wrote:
> On March 8, 2004 10:15 am, Alexandre Julliard wrote:
> > Mike Hearn <mh at codeweavers.com> writes:
> > > On Sun, 07 Mar 2004 19:32:39 -0700, Jesse Allen wrote:
> > >> 1)  Create our own vsnprintf version from scratch   (fairly difficult)
> > >> or
> > >> 2)  Create a wrapper for glibc's vsnprintf that translates win32ish
> > >> format statements into a glibc friendly one.  (not too bad and smaller
> > >> patch)  We could later move in a better or complete version to improve
> > >> performance.
> > >
> > > 3) Copy/paste the glibc version into Wine with appropriate munging and
> > > start fixing bugs in it.
> > >
> > > No clue which is best. Alexandre?
> >
> > Probably 3), but I don't think you want to start with the glibc code,
> > it's fairly ugly code, with many dependencies on glibc internals and
> > gcc-specific things. Hopefully we can find a more portable
> > implementation somewhere else.
>
> Just to complicate things there is also the complication that (at least on
> my system) the Windows version has an off-by-1 bug.
> (msvcrt 6.1.9844 - snprintf (buffer, 4, "%d", 4321) writes 4321, returns 4
> and does not add the \0)
Woops - my mistake.  Actually it is the difference between the Windows 
definition and the POSIX definiton (and I can't be bothered looking up the 
exact details of the old (SUS V2?) one).
Anyway, no matter how we look at it the return behaviour needs munging.
-- 
Bill Medland
mailto:billmedland at mercuryspeed.com
http://webhome.idirect.com/~kbmed




More information about the wine-devel mailing list