Mercurial > libpst
comparison src/libpst.c @ 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 | ed2a260bbb98 |
children | 6395ced2b8b2 |
comparison
equal
deleted
inserted
replaced
117:0a3d854b53f6 | 118:0f1492b7fe8b |
---|---|
2 * libpst.c | 2 * libpst.c |
3 * Part of the LibPST project | 3 * Part of the LibPST project |
4 * Written by David Smith | 4 * Written by David Smith |
5 * dave.s@earthcorp.com | 5 * dave.s@earthcorp.com |
6 */ | 6 */ |
7 | |
7 #include "define.h" | 8 #include "define.h" |
8 #include "libstrfunc.h" | 9 #include "libstrfunc.h" |
9 #include "vbuf.h" | 10 #include "vbuf.h" |
10 #include "libpst.h" | 11 #include "libpst.h" |
12 #include "common.h" | |
11 #include "timeconv.h" | 13 #include "timeconv.h" |
12 | 14 |
13 #define ASSERT(x) { if(!(x)) raise( SIGSEGV ); } | 15 #define ASSERT(x) { if(!(x)) raise( SIGSEGV ); } |
14 | 16 |
15 | 17 |
16 #define INDEX_TYPE32 0x0E | 18 #define INDEX_TYPE32 0x0E |
19 #define INDEX_TYPE32A 0x0F // unknown, but assumed to be similar for now | |
17 #define INDEX_TYPE64 0x17 | 20 #define INDEX_TYPE64 0x17 |
18 #define INDEX_TYPE_OFFSET (off_t)0x0A | 21 #define INDEX_TYPE_OFFSET (off_t)0x0A |
19 | 22 |
20 #define FILE_SIZE_POINTER32 (off_t)0xA8 | 23 #define FILE_SIZE_POINTER32 (off_t)0xA8 |
21 #define INDEX_POINTER32 (off_t)0xC4 | 24 #define INDEX_POINTER32 (off_t)0xC4 |
194 // read index type | 197 // read index type |
195 (void)pst_getAtPos(pf, INDEX_TYPE_OFFSET, &(pf->ind_type), sizeof(pf->ind_type)); | 198 (void)pst_getAtPos(pf, INDEX_TYPE_OFFSET, &(pf->ind_type), sizeof(pf->ind_type)); |
196 DEBUG_INFO(("index_type = %i\n", pf->ind_type)); | 199 DEBUG_INFO(("index_type = %i\n", pf->ind_type)); |
197 switch (pf->ind_type) { | 200 switch (pf->ind_type) { |
198 case INDEX_TYPE32 : | 201 case INDEX_TYPE32 : |
202 case INDEX_TYPE32A : | |
199 pf->do_read64 = 0; | 203 pf->do_read64 = 0; |
200 break; | 204 break; |
201 case INDEX_TYPE64 : | 205 case INDEX_TYPE64 : |
202 pf->do_read64 = 1; | 206 pf->do_read64 = 1; |
203 break; | 207 break; |
4470 DEBUG_RET(); | 4474 DEBUG_RET(); |
4471 return size; | 4475 return size; |
4472 } | 4476 } |
4473 | 4477 |
4474 | 4478 |
4475 #ifdef _MSC_VER | 4479 #ifdef _WIN32 |
4476 char * fileTimeToAscii(const FILETIME* filetime) { | 4480 char * fileTimeToAscii(const FILETIME* filetime) { |
4477 time_t t; | 4481 time_t t; |
4478 DEBUG_ENT("fileTimeToAscii"); | 4482 DEBUG_ENT("fileTimeToAscii"); |
4479 t = fileTimeToUnixTime(filetime, 0); | 4483 t = fileTimeToUnixTime(filetime, 0); |
4480 if (t == -1) | 4484 if (t == -1) |
4506 t1 = fileTimeToUnixTime(filetime, 0); | 4510 t1 = fileTimeToUnixTime(filetime, 0); |
4507 return gmtime(&t1); | 4511 return gmtime(&t1); |
4508 } | 4512 } |
4509 | 4513 |
4510 | 4514 |
4511 #endif //_MSC_VER | 4515 #endif //_WIN32 |
4512 | 4516 |
4513 int pst_stricmp(char *a, char *b) { | 4517 int pst_stricmp(char *a, char *b) { |
4514 // compare strings case-insensitive. | 4518 // compare strings case-insensitive. |
4515 // returns -1 if a < b, 0 if a==b, 1 if a > b | 4519 // returns -1 if a < b, 0 if a==b, 1 if a > b |
4516 while(*a != '\0' && *b != '\0' && toupper(*a)==toupper(*b)) { | 4520 while(*a != '\0' && *b != '\0' && toupper(*a)==toupper(*b)) { |