# HG changeset patch # User Carl Byington # Date 1233854542 28800 # Node ID 7f747c8c9d02ca22977c6dd9e26368ee5140578a # Parent c2482d0cd84ef8e1c61a9d136e3f19ddfb1e7296 cleanup installed headers diff -r c2482d0cd84e -r 7f747c8c9d02 Makefile.cvs --- a/Makefile.cvs Thu Feb 05 09:20:02 2009 -0800 +++ b/Makefile.cvs Thu Feb 05 09:22:22 2009 -0800 @@ -3,6 +3,7 @@ HOST=$(shell hostname) all: + libtoolize --force --copy aclocal autoheader automake diff -r c2482d0cd84e -r 7f747c8c9d02 configure.in --- a/configure.in Thu Feb 05 09:20:02 2009 -0800 +++ b/configure.in Thu Feb 05 09:22:22 2009 -0800 @@ -1,8 +1,8 @@ AC_PREREQ(2.59) AC_INIT(libpst,0.6.26,carl@five-ten-sg.com) -AC_CONFIG_SRCDIR([config.h.in]) +AC_CONFIG_SRCDIR([src/libpst.c]) AC_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION) +AM_INIT_AUTOMAKE AC_CANONICAL_HOST diff -r c2482d0cd84e -r 7f747c8c9d02 src/define.h --- a/src/define.h Thu Feb 05 09:20:02 2009 -0800 +++ b/src/define.h Thu Feb 05 09:22:22 2009 -0800 @@ -8,6 +8,8 @@ #ifndef DEFINEH_H #define DEFINEH_H +#include "common.h" + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -298,4 +300,75 @@ unsigned int type; }; +#if BYTE_ORDER == BIG_ENDIAN +# define LE64_CPU(x) \ + x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \ + (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ + (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ + (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ + (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ + (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ + (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ + (((x) & UINT64_C(0x00000000000000ff)) << 56)); +# define LE32_CPU(x) \ + x = ((((x) & 0xff000000) >> 24) | \ + (((x) & 0x00ff0000) >> 8 ) | \ + (((x) & 0x0000ff00) << 8 ) | \ + (((x) & 0x000000ff) << 24)); +# define LE16_CPU(x) \ + x = ((((x) & 0xff00) >> 8) | \ + (((x) & 0x00ff) << 8)); +#elif BYTE_ORDER == LITTLE_ENDIAN +# define LE64_CPU(x) {} +# define LE32_CPU(x) {} +# define LE16_CPU(x) {} +#else +# error "Byte order not supported by this library" +#endif // BYTE_ORDER + + +#define PST_LE_GET_UINT64(p) \ + (uint64_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8) | \ + (((uint8_t const *)(p))[2] << 16) | \ + (((uint8_t const *)(p))[3] << 24) | \ + (((uint8_t const *)(p))[4] << 32) | \ + (((uint8_t const *)(p))[5] << 40) | \ + (((uint8_t const *)(p))[6] << 48) | \ + (((uint8_t const *)(p))[7] << 56)) + +#define PST_LE_GET_INT64(p) \ + (int64_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8) | \ + (((uint8_t const *)(p))[2] << 16) | \ + (((uint8_t const *)(p))[3] << 24) | \ + (((uint8_t const *)(p))[4] << 32) | \ + (((uint8_t const *)(p))[5] << 40) | \ + (((uint8_t const *)(p))[6] << 48) | \ + (((uint8_t const *)(p))[7] << 56)) + +#define PST_LE_GET_UINT32(p) \ + (uint32_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8) | \ + (((uint8_t const *)(p))[2] << 16) | \ + (((uint8_t const *)(p))[3] << 24)) + +#define PST_LE_GET_INT32(p) \ + (int32_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8) | \ + (((uint8_t const *)(p))[2] << 16) | \ + (((uint8_t const *)(p))[3] << 24)) + +#define PST_LE_GET_UINT16(p) \ + (uint16_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8)) + +#define PST_LE_GET_INT16(p) \ + (int16_t)((((uint8_t const *)(p))[0] << 0) | \ + (((uint8_t const *)(p))[1] << 8)) + +#define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) + +#define PST_LE_GET_INT8(p) (*(int8_t const *)(p)) + #endif //DEFINEH_H diff -r c2482d0cd84e -r 7f747c8c9d02 src/deltasearch.cpp --- a/src/deltasearch.cpp Thu Feb 05 09:20:02 2009 -0800 +++ b/src/deltasearch.cpp Thu Feb 05 09:22:22 2009 -0800 @@ -1,8 +1,10 @@ #include +#include #include #include #include #include +#include using namespace std; extern "C" { #include "define.h" @@ -55,14 +57,14 @@ struct stat st; fstat(fd, &st); off_t size = st.st_size; - char buf[size]; - size_t s = read(fd, buf, size); - pst_debug_hexdumper(stdout, buf, s, 16, 0); + vector buf(size); + size_t s = read(fd, &buf[0], size); + pst_debug_hexdumper(stdout, &buf[0], s, 16, 0); printf("\n\n dump decrypted data \n"); for (off_t i=0; i> 56) | \ - (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ - (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ - (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ - (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ - (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ - (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ - (((x) & UINT64_C(0x00000000000000ff)) << 56)); -# define LE32_CPU(x) \ - x = ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8 ) | \ - (((x) & 0x0000ff00) << 8 ) | \ - (((x) & 0x000000ff) << 24)); -# define LE16_CPU(x) \ - x = ((((x) & 0xff00) >> 8) | \ - (((x) & 0x00ff) << 8)); -#elif BYTE_ORDER == LITTLE_ENDIAN -# define LE64_CPU(x) {} -# define LE32_CPU(x) {} -# define LE16_CPU(x) {} -#else -# error "Byte order not supported by this library" -#endif // BYTE_ORDER - - #define PST_TYPE_NOTE 1 #define PST_TYPE_APPOINTMENT 8 #define PST_TYPE_CONTACT 9 diff -r c2482d0cd84e -r 7f747c8c9d02 src/pst2ldif.cpp --- a/src/pst2ldif.cpp Thu Feb 05 09:20:02 2009 -0800 +++ b/src/pst2ldif.cpp Thu Feb 05 09:22:22 2009 -0800 @@ -104,10 +104,10 @@ string_set::iterator i = all_strings.find(name); if (i == all_strings.end()) return register_string(name); while (true) { - char n[strlen(name)+10]; - snprintf(n, sizeof(n), "%s %d", name, unique++); - string_set::iterator i = all_strings.find(n); - if (i == all_strings.end()) return register_string(n); + vector n(strlen(name)+10); + snprintf(&n[0], n.size(), "%s %d", name, unique++); + string_set::iterator i = all_strings.find(&n[0]); + if (i == all_strings.end()) return register_string(&n[0]); } } @@ -327,8 +327,8 @@ // Strip leading spaces while (*value == ' ') value++; len = strlen(value) + 1; - char buffer[len]; - char *p = buffer; + vector buffer(len); + char *p = &buffer[0]; // See if "value" is a "SAFE STRING" // First check characters that are safe but not safe as initial characters @@ -359,29 +359,29 @@ } *p = 0; if (is_safe_string) { - printf("%s: %s\n", attr, buffer); + printf("%s: %s\n", attr, &buffer[0]); return; } if (needs_code_conversion && cd != 0) { - size_t inlen = p - buffer; + size_t inlen = p - &buffer[0]; size_t utf8_len = 2 * inlen + 1; - char utf8_buffer[utf8_len]; - char *utf8_p = utf8_buffer; + vector utf8_buffer(utf8_len); + char *utf8_p = &utf8_buffer[0]; iconv(cd, NULL, NULL, NULL, NULL); - p = buffer; + p = &buffer[0]; int ret = iconv(cd, (ICONV_CONST char**)&p, &inlen, &utf8_p, &utf8_len); if (ret >= 0) { *utf8_p = 0; - p = base64_encode(utf8_buffer, utf8_p - utf8_buffer); + p = base64_encode(&utf8_buffer[0], utf8_p - &utf8_buffer[0]); } else - p = base64_encode(buffer, strlen(buffer)); + p = base64_encode(&buffer[0], buffer.size()); } else - p = base64_encode(buffer, strlen(buffer)); + p = base64_encode(&buffer[0], buffer.size()); printf("%s:: %s\n", attr, p); free(p); } @@ -486,11 +486,11 @@ return; } - char value[len1 + len2 + 2]; - memcpy(value, value1, len1); + vector value(len1 + len2 + 2); + memcpy(&value[0], value1, len1); value[len1] = ' '; - memcpy(value + len1 + 1, value2, len2 + 1); - print_ldif_single(attr, value); + memcpy(&value[0] + len1 + 1, value2, len2 + 1); + print_ldif_single(attr, &value[0]); }