glib: Problems with g_fprintf (fout, "\n");
- From: Stefan Andersen <zingo zingo org>
- To: gtk-devel-list gnome org
- Cc: zingo zingo org
- Subject: glib: Problems with g_fprintf (fout, "\n");
- Date: 11 Sep 2003 22:27:29 +0200
Hello
I have some trouble with something simple as g_fprintf (fout, "\n");
the result is that on the fout-stream on my platform I get
(in hex):"0x0a 0x00" If I patch _g_gnulib_vfprintf() to not fwrite
length+1 (se below) I dont get this, but I think there has to something
fishy somewere else, and I don't thing that my patch is the solution and
if I sometimes lose some characters,
If anyone has any clue In what could cause this...
Background:
I am in the middle of a port to a new target (Tao's Elate platform)
and I was living on a pre 2.2 branch until now were I updated to HEAD.
Doing this I got a bunch of new function like g_fprintf(), and a lot of
internal _g_gnulib_*() functions.
When using this functions for the first time I got into trouble, the
first place were they were used was when compiling glib/gobjects and
executing the glib-genmarshal that was just compiled.
The resulting output had a few 0x00 in it.
Looking at the code this seems like impossible, hacking around a bit it
seams that if I patch _g_gnulib_vfprintf() my 0x00 goes away, but it
seems very strange that I should be the only one needing to to this so
my problem is probably somthing else since this would have been noticed
on other platform. But currently I have no clue what it could be, here
is my patched function:
int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args)
{
char *result;
size_t length;
result = vasnprintf (NULL, &length, format, args);
if (result == NULL)
return -1;
length-=1; //<<-- Here is my patch
fwrite (result, 1, length + 1, file);
free (result);
return length;
}
--
/Stefan "Zingo" Andersen (www.zingo.org & www.vectrace.com)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]