Mercurial > libpst
comparison src/libstrfunc.c @ 172:6954d315aaa8
move version-info into main configure.in, and set it properly.
prefix all external symbols in the shared library with pst_ to avoid symbol clashes with other shared libraries.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 04 Apr 2009 16:00:48 -0700 |
parents | cda7c812ec01 |
children | c947b8812120 |
comparison
equal
deleted
inserted
replaced
171:6c1e75bc4cac | 172:6954d315aaa8 |
---|---|
4 #include "define.h" | 4 #include "define.h" |
5 | 5 |
6 | 6 |
7 static char base64_code_chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=="; | 7 static char base64_code_chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=="; |
8 | 8 |
9 void base64_append(char **ou, int *line_count, char data) | 9 static void base64_append(char **ou, int *line_count, char data); |
10 static void base64_append(char **ou, int *line_count, char data) | |
10 { | 11 { |
11 if (*line_count == 76) { | 12 if (*line_count == 76) { |
12 *(*ou)++ = '\n'; | 13 *(*ou)++ = '\n'; |
13 *line_count = 0; | 14 *line_count = 0; |
14 } | 15 } |
15 *(*ou)++ = data; | 16 *(*ou)++ = data; |
16 (*line_count)++; | 17 (*line_count)++; |
17 } | 18 } |
18 | 19 |
19 | 20 |
20 char *base64_encode(void *data, size_t size) | 21 char *pst_base64_encode(void *data, size_t size) |
21 { | 22 { |
22 int line_count = 0; | 23 int line_count = 0; |
23 return base64_encode_multiple(data, size, &line_count); | 24 return pst_base64_encode_multiple(data, size, &line_count); |
24 } | 25 } |
25 | 26 |
26 | 27 |
27 char *base64_encode_multiple(void *data, size_t size, int *line_count) | 28 char *pst_base64_encode_multiple(void *data, size_t size, int *line_count) |
28 { | 29 { |
29 char *output; | 30 char *output; |
30 char *ou; | 31 char *ou; |
31 unsigned char *p = (unsigned char *)data; | 32 unsigned char *p = (unsigned char *)data; |
32 unsigned char *dte = p + size; | 33 unsigned char *dte = p + size; |