Never comment out testcases...
A few minutes before releasing uriparser
0.4.0 I once
again had to replace a call to itoa
with a call to sprintf
because that
functon is not available on Unix. No big deal - I wrote a testcase for that.
Replace the call, compile, run the test suite. Too bad I commented out that
testcase when debugging some code a few lines further down. The testcase could
have saved me if it had not been commented out! So what happened when you
called uriToString[AW]
on a URI with IPv[46] part? The text was printed to
stdout since I replaced itoa
with plain printf
instead of sprintf
by
mistake. Good news is there will be a new release in a few hours.
[EDIT] Did you know swprintf
has different signatures on Unix and
Windows?
Unix
int swprintf(wchar_t * wcs, size_t maxlen, const wchar_t * format, ...);
Windows
int swprintf(wchar_t * buffer, /* without maxlen! */ const wchar_t * format, ...);
Awesome, isn't it... cough. So if you write code for the Windows edition and
make it run on Unix the formatting string's pointer will be passed as the
length parameter and the parameter after that will be the formatting sting.
That brought me a nice segfault. But at least there is _snwprintf
on Windows
with the same signature as the Unix version so we can build a preprocessor-
based solution. I wish we didn't have to...
[EDIT] Seems like OpenBSD doesn't have swprintf at all...?