ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/dynbuf.C
(Generate patch)

Comparing deliantra/server/server/dynbuf.C (file contents):
Revision 1.17 by root, Tue Jul 10 05:51:38 2007 UTC vs.
Revision 1.18 by root, Thu Aug 16 06:36:56 2007 UTC

125 // could optimise 125 // could optimise
126 return std::string (linearise (), size ()); 126 return std::string (linearise (), size ());
127} 127}
128 128
129void 129void
130dynbuf_text::printf (const char *format, ...) 130dynbuf_text::vprintf (const char *format, va_list ap)
131{ 131{
132 int len; 132 int len;
133 133
134 { 134 {
135 force (128); 135 force (128);
136 136
137 va_list ap; 137 va_list apc;
138 va_start (ap, format); 138 va_copy (apc, ap);
139 len = vsnprintf (ptr, end - ptr, format, ap); 139 len = vsnprintf (ptr, end - ptr, format, ap);
140 va_end (ap); 140 va_end (apc);
141 141
142 assert (len >= 0); // shield against broken vsnprintf's 142 assert (len >= 0); // shield against broken vsnprintf's
143 143
144 // was enough room available 144 // was enough room available
145 if (ptr + len < end) 145 if (ptr + len < end)
148 return; 148 return;
149 } 149 }
150 } 150 }
151 151
152 // longer, try harder 152 // longer, try harder
153 vsnprintf (force (len + 1), len + 1, format, ap);
154
155 ptr += len;
156}
157
158void
159dynbuf_text::printf (const char *format, ...)
160{
153 va_list ap; 161 va_list ap;
154 va_start (ap, format); 162 va_start (ap, format);
155 vsnprintf (force (len + 1), len + 1, format, ap); 163 vprintf (format, ap);
156 va_end (ap); 164 va_end (ap);
157
158 ptr += len;
159} 165}
160 166
161// simply return a mask with "bits" bits set 167// simply return a mask with "bits" bits set
162inline uint64 168inline uint64
163m (int b) 169m (int b)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines