Mercurial > libpst
annotate archive/readpst.c.diff @ 118:0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
add processing for pst files of type 0x0f
start adding support for properly building and installing libpst.so and the header files required to use it.
remove version.h since the version number is now in config.h
more const correctness issues regarding getopt()
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 31 Jan 2009 12:12:36 -0800 |
parents | de3753c3160a |
children |
rev | line source |
---|---|
57
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 Index: readpst.c |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 =================================================================== |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 --- readpst.c (revision 45) |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 +++ readpst.c (working copy) |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 @@ -1396,6 +1396,7 @@ |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 // char *rfc2426_escape(char *str) {{{1 |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 char *rfc2426_escape(char *str) { |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 static char *buf = NULL; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 + static int buflen = 0; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 char *a, *b; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 int x, y, z; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 DEBUG_ENT("rfc2426_escape"); |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 @@ -1411,9 +1412,10 @@ |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 z = chr_count(str, '\r'); |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 x = strlen(str) + y - z; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 - if ( (y - z) == 0 ) // resize buffer if needed |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 + if ( x + 1 > buflen ) // resize buffer if needed |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 { |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 buf = (char*) realloc(buf, x + 1); // don't forget room for the NUL |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 + buflen = x + 1; |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 if ( buf == NULL ) |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 { |
de3753c3160a
add archive directory with history of alioth versions that have been merged here
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 fprintf(stderr, "Error: rfc2426_escape(): realloc(%d) returned NULL!\n", x + 1); |