--- deliantra/server/include/dynbuf.h 2009/10/20 05:57:08 1.26 +++ deliantra/server/include/dynbuf.h 2010/03/26 01:04:44 1.31 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -28,6 +28,7 @@ #include #include +#include "compiler.h" #include "util.h" #include "shstr.h" @@ -94,12 +95,20 @@ // make sure we have "size" extra room char *force (int size) { - if (expect_false (ptr + size >= end)) + if (expect_false (ptr + size > end)) reserve (size); + assume (ptr + size <= end); + return ptr; } + // used for force + alloc combo + void alloc (char *p) + { + ptr = p; + } + // allocate size bytes and return pointer to them (caller must force()) char *falloc (int size) { @@ -183,7 +192,7 @@ dynbuf_text &operator << (uint32 i) { add (sint64 (i)); return *this; } dynbuf_text &operator << (uint64 i) { add (sint64 (i)); return *this; } - void printf (const char *format, ...); + void printf (const char *format, ...) attribute ((format (printf, 2, 3))); void vprintf (const char *format, va_list ap); void add_abilities (const char *name, uint32 abilities);