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

Comparing deliantra/server/include/dynbuf.h (file contents):
Revision 1.9 by root, Sun May 27 23:22:29 2007 UTC vs.
Revision 1.10 by root, Sun May 27 23:49:49 2007 UTC

54 _reserve (size); 54 _reserve (size);
55 55
56 return ptr; 56 return ptr;
57 } 57 }
58 58
59 char *alloc (int size) 59 char *falloc (int size)
60 { 60 {
61 char *res = force (size); 61 char *res = ptr;
62 ptr += size; 62 ptr += size;
63 return res; 63 return res;
64 } 64 }
65 65
66 char *alloc (int size)
67 {
68 force (size);
69 return falloc (size);
70 }
71
66 void fadd (char c) { *ptr++ = c; } 72 void fadd (char c) { *ptr++ = c; }
67 void fadd (unsigned char c) { fadd (char (c)); } 73 void fadd (unsigned char c) { fadd (char (c)); }
74 void fadd (const void *p, int len)
75 {
76 memcpy (falloc (len), p, len);
77 }
68 78
69 void add (const void *p, int len) 79 void add (const void *p, int len)
70 { 80 {
71 memcpy (alloc (len), p, len); 81 force (len);
82 fadd (p, len);
72 } 83 }
73 84
74 void add (char c) 85 void add (char c)
75 { 86 {
76 alloc (1)[0] = c; 87 alloc (1)[0] = c;
104 : dynbuf (initial, extend) 115 : dynbuf (initial, extend)
105 { } 116 { }
106 117
107 using dynbuf::add; 118 using dynbuf::add;
108 119
109 static const int max_sint32_size = 11;
110 static const int max_sint64_size = 20;
111
112 void add (sint32 i); 120 void add (sint32 i);
113 void add (sint64 i); 121 void add (sint64 i);
114 122
115 void printf (const char *format, ...); 123 void printf (const char *format, ...);
116}; 124};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines