[Freeciv-Dev] (PR#11079) fixed-sized buffer in fz_fprintf
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11079 >
fz_fprintf has a fixed-sized buffer.
Ideally this should be allocated based on the size needed. But this is
a little tricky since snprintf's return value isn't consistent across
platforms. I think g_strdup_printf probably just doubles the size or
something when it's not big enough.
This patch just makes the buffer much larger. There's really no reason
not to do this since this buffer is allocated on the stack. A buffer
size of 1 page versus 16 pages won't make any difference to caching
either, I think.
jason
Index: utility/ioz.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/ioz.c,v
retrieving revision 1.17
diff -u -r1.17 ioz.c
--- utility/ioz.c 17 May 2004 02:16:15 -0000 1.17
+++ utility/ioz.c 19 Nov 2004 00:41:53 -0000
@@ -229,7 +229,7 @@
#ifdef HAVE_LIBZ
case FZ_ZLIB:
{
- char buffer[4096];
+ char buffer[65536];
int num;
num = my_vsnprintf(buffer, sizeof(buffer), format, ap);
if (num == -1) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11079) fixed-sized buffer in fz_fprintf,
Jason Short <=
|
|