annotate src/vbuf.h @ 178:b4d1a35bf4ab

Added tag stable-0-6-35 for changeset 59bd93d02feb
author Carl Byington <carl@five-ten-sg.com>
date Wed, 08 Apr 2009 15:31:51 -0700
parents ac6e22c8a9cf
children b65e8d0a088a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
1 /* vbuf.h - variable length buffer functions
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
2 *
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
3 * Functions that try to make dealing with buffers easier.
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
4 *
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
5 * vbuf
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
6 *
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
7 * vstr
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
8 * - should always contain a valid string
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
9 *
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
10 */
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
11
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
12 #ifndef VBUF_H
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
13 #define VBUF_H
132
5e4d6faada34 fix from Fridrich Strba for parallel make
Carl Byington <carl@five-ten-sg.com>
parents: 130
diff changeset
14
5e4d6faada34 fix from Fridrich Strba for parallel make
Carl Byington <carl@five-ten-sg.com>
parents: 130
diff changeset
15 #include "common.h"
5e4d6faada34 fix from Fridrich Strba for parallel make
Carl Byington <carl@five-ten-sg.com>
parents: 130
diff changeset
16
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
17 #define SZ_MAX 4096
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
18 /***************************************************/
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
19
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
20
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
21 // Variable-length buffers
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
22 struct varbuf {
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
23 size_t dlen; //length of data stored in buffer
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
24 size_t blen; //length of buffer
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
25 char *buf; //buffer
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
26 char *b; //start of stored data
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
27 };
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
28
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
29
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
30 // The exact same thing as a varbuf but should always contain at least '\0'
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
31 struct varstr {
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
32 size_t dlen; //length of data stored in buffer
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
33 size_t blen; //length of buffer
70
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
34 char *buf; //buffer
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
35 char *b; //start of stored data
b12f4e50e2e8 Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
36 };
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
37
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
38
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
39 typedef struct varbuf vbuf;
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
40 typedef struct varstr vstr;
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
41
172
6954d315aaa8 move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents: 151
diff changeset
42 #define VBUF_STATIC(x,y) static vbuf *x = NULL; if(!x) x = pst_vballoc(y);
6954d315aaa8 move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents: 151
diff changeset
43 #define VSTR_STATIC(x,y) static vstr *x = NULL; if(!x) x = pst_vsalloc(y);
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
44
176
ac6e22c8a9cf build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents: 172
diff changeset
45 vbuf *pst_vballoc(size_t len);
ac6e22c8a9cf build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents: 172
diff changeset
46 void pst_vbgrow(vbuf *vb, size_t len); // grow buffer by len bytes, data are preserved
ac6e22c8a9cf build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents: 172
diff changeset
47 void pst_vbset(vbuf *vb, void *data, size_t len);
ac6e22c8a9cf build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents: 172
diff changeset
48 void pst_vbappend(vbuf *vb, void *data, size_t length);
ac6e22c8a9cf build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents: 172
diff changeset
49 void pst_unicode_init();
172
6954d315aaa8 move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents: 151
diff changeset
50 size_t pst_vb_utf16to8(vbuf *dest, const char *inbuf, int iblen);
6954d315aaa8 move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents: 151
diff changeset
51 size_t pst_vb_utf8to8bit(vbuf *dest, const char *inbuf, int iblen, const char* charset);
6954d315aaa8 move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents: 151
diff changeset
52 size_t pst_vb_8bit2utf8(vbuf *dest, const char *inbuf, int iblen, const char* charset);
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
53
129
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 120
diff changeset
54
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 120
diff changeset
55 #endif // VBUF_H