# HG changeset patch # User Carl Byington # Date 1236896252 25200 # Node ID 0b1766da9be86a7f8825f03f330d57821519f318 # Parent edebaf0e87d21346e5df9b10e71ca4a477a6b023 use AM_ICONV for better portability of the library location. structure renaming to be more specific. diff -r edebaf0e87d2 -r 0b1766da9be8 ChangeLog --- a/ChangeLog Tue Mar 10 13:09:20 2009 -0700 +++ b/ChangeLog Thu Mar 12 15:17:32 2009 -0700 @@ -10,6 +10,8 @@ character set specified by the mapi object. remove charset option from pst2ldif since we get that from each object now. * more code cleanup. + * use AM_ICONV for better portability of the library location. + * structure renaming to be more specific. LibPST 0.6.29 (2009-02-24) =============================== diff -r edebaf0e87d2 -r 0b1766da9be8 Makefile.am --- a/Makefile.am Tue Mar 10 13:09:20 2009 -0700 +++ b/Makefile.am Thu Mar 12 15:17:32 2009 -0700 @@ -3,7 +3,7 @@ html_DATA = AUTHORS COPYING ChangeLog NEWS README CLEANFILES = xml/libpst xml/Makefile -EXTRA_DIST = Doxyfile libpst.html.tar.gz libpst.spec $(wildcard xml/M*) $(wildcard xml/h*) $(wildcard xml/lib*) +EXTRA_DIST = config.rpath Doxyfile libpst.html.tar.gz libpst.spec $(wildcard xml/M*) $(wildcard xml/h*) $(wildcard xml/lib*) if !STATIC_TOOLS pkgconfigdir = $(libdir)/pkgconfig diff -r edebaf0e87d2 -r 0b1766da9be8 Makefile.cvs --- a/Makefile.cvs Tue Mar 10 13:09:20 2009 -0700 +++ b/Makefile.cvs Thu Mar 12 15:17:32 2009 -0700 @@ -4,7 +4,7 @@ all: libtoolize --force --copy - aclocal + aclocal -I m4 autoheader automake autoconf diff -r edebaf0e87d2 -r 0b1766da9be8 TODO --- a/TODO Tue Mar 10 13:09:20 2009 -0700 +++ b/TODO Thu Mar 12 15:17:32 2009 -0700 @@ -4,3 +4,6 @@ pst2diii needs header and mime type updates from readpst. +Change more c symbols to reflect mapi_element and mapi_object. A +mapi_object (email etc.) is composed of a list of mapi_elements +(subject, charset, etc.). diff -r edebaf0e87d2 -r 0b1766da9be8 config.rpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.rpath Thu Mar 12 15:17:32 2009 -0700 @@ -0,0 +1,666 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2007 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + darwin*) + case $cc_basename in + xlc*) + wl='-Wl,' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + wl='-Wl,' + ;; + pgcc | pgf77 | pgf90) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we cannot use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if test "$GCC" = yes ; then + : + else + case $cc_basename in + xlc*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix4* | aix5*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + library_names_spec='$libname.a' + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd1*) + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + nto-qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < - #include - int main(int argc, char* const* argv) - { - size_t inlen = 100; - char buffer[[inlen]]; - char *p = buffer; - size_t utf8_len = 2 * inlen + 1; - char utf8_buffer[[utf8_len]]; - char *utf8_p = utf8_buffer; - iconv_t cd = 0; - iconv(cd, (const char**)&p, &inlen, &utf8_p, &utf8_len); - } - ], - [AC_DEFINE(ICONV_CONST,const,[do we have const headers]) - AC_MSG_RESULT([yes]) - ], - [AC_DEFINE(ICONV_CONST,,[do we have const headers]) - AC_MSG_RESULT([no]) - ]) -AC_LANG_POP([C++]) - AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec, [REGEXLIB=-lregex diff -r edebaf0e87d2 -r 0b1766da9be8 m4/iconv.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/iconv.m4 Thu Mar 12 15:17:32 2009 -0700 @@ -0,0 +1,180 @@ +# iconv.m4 serial AM7 (gettext-0.18) +dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([${ac_t:- + }$am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff -r edebaf0e87d2 -r 0b1766da9be8 m4/lib-ld.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/lib-ld.m4 Thu Mar 12 15:17:32 2009 -0700 @@ -0,0 +1,110 @@ +# lib-ld.m4 serial 2 (gettext-0.12) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$acl_cv_prog_gnu_ld +]) + +dnl From libtool-1.4. Sets the variable LD. +AC_DEFUN([AC_LIB_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff -r edebaf0e87d2 -r 0b1766da9be8 m4/lib-link.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/lib-link.m4 Thu Mar 12 15:17:32 2009 -0700 @@ -0,0 +1,551 @@ +# lib-link.m4 serial 4 (gettext-0.12) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) diff -r edebaf0e87d2 -r 0b1766da9be8 m4/lib-prefix.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/lib-prefix.m4 Thu Mar 12 15:17:32 2009 -0700 @@ -0,0 +1,221 @@ +# lib-prefix.m4 serial 6 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) diff -r edebaf0e87d2 -r 0b1766da9be8 regression/regression-tests.bash --- a/regression/regression-tests.bash Tue Mar 10 13:09:20 2009 -0700 +++ b/regression/regression-tests.bash Thu Mar 12 15:17:32 2009 -0700 @@ -50,7 +50,7 @@ val="valgrind --leak-check=full" -val='' +#val='' pushd .. make || exit @@ -80,7 +80,7 @@ ##doldif 16 hourig2.pst ##doldif 17 hourig3.pst #doldif 18 test-mac.pst - doldif 19 harris.pst + #doldif 19 harris.pst else dopst 1 ams.pst dopst 2 sample_64.pst diff -r edebaf0e87d2 -r 0b1766da9be8 src/Makefile.am --- a/src/Makefile.am Tue Mar 10 13:09:20 2009 -0700 +++ b/src/Makefile.am Thu Mar 12 15:17:32 2009 -0700 @@ -1,8 +1,6 @@ if PLATFORM_WIN32 - ICONVLIB = -liconv NO_UNDEFINED = -no-undefined else - ICONVLIB = NO_UNDEFINED = endif @@ -80,7 +78,7 @@ endif libpst_la_SOURCES = $(common_source) $(common_header) -libpst_la_LIBADD = $(ICONVLIB) +libpst_la_LIBADD = $(LTLIBICONV) EXTRA_DIST = testdebug.c @@ -92,13 +90,13 @@ INCLUDES= -I$(srcdir)/.. $(all_includes) # the library search path. -lspst_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -readpst_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) $(REGEXLIB) -readpstlog_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -pst2ldif_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -pst2dii_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -lgd -dumpblocks_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -getidblock_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) -deltasearch_LDADD = $(all_libraries) $(PSTLIB) $(ICONVLIB) +lspst_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) +readpst_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) $(REGEXLIB) +readpstlog_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) +pst2ldif_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) +pst2dii_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) -lgd +dumpblocks_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) +getidblock_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) +deltasearch_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) diff -r edebaf0e87d2 -r 0b1766da9be8 src/define.h --- a/src/define.h Tue Mar 10 13:09:20 2009 -0700 +++ b/src/define.h Thu Mar 12 15:17:32 2009 -0700 @@ -74,7 +74,7 @@ #include #endif -#ifdef HAVE_ICONV_H +#ifdef HAVE_ICONV #include #endif diff -r edebaf0e87d2 -r 0b1766da9be8 src/libpst.c --- a/src/libpst.c Tue Mar 10 13:09:20 2009 -0700 +++ b/src/libpst.c Thu Mar 12 15:17:32 2009 -0700 @@ -184,7 +184,7 @@ memset(pf, 0, sizeof(*pf)); if ((pf->fp = fopen(name, "rb")) == NULL) { - WARN(("cannot open PST file. Error\n")); + perror("Error opening PST file"); DEBUG_RET(); return -1; } @@ -521,7 +521,7 @@ int pst_load_extended_attributes(pst_file *pf) { // for PST files this will load up ID2 0x61 and check it's "list" attribute. pst_desc_ll *p; - pst_num_array *na; + pst_mapi_object *na; pst_id2_ll *id2_head = NULL; char *buffer=NULL, *headerbuffer=NULL; size_t bsize=0, hsize=0, bptr=0; @@ -550,7 +550,7 @@ DEBUG_WARN(("Have not been able to fetch any id2 values for item 0x61. Brace yourself!\n")); } - na = pst_parse_block(pf, p->desc->id, id2_head, NULL); + na = pst_parse_block(pf, p->desc->id, id2_head); if (!na) { DEBUG_WARN(("Cannot process desc block for item 0x61. Not loading extended Attributes\n")); pst_free_id2(id2_head); @@ -558,13 +558,13 @@ return 0; } - for (x=0; x < na->count_item; x++) { - if (na->items[x]->id == (uint32_t)0x0003) { - buffer = na->items[x]->data; - bsize = na->items[x]->size; - } else if (na->items[x]->id == (uint32_t)0x0004) { - headerbuffer = na->items[x]->data; - hsize = na->items[x]->size; + for (x=0; x < na->count_elements; x++) { + if (na->elements[x]->mapi_id == (uint32_t)0x0003) { + buffer = na->elements[x]->data; + bsize = na->elements[x]->size; + } else if (na->elements[x]->mapi_id == (uint32_t)0x0004) { + headerbuffer = na->elements[x]->data; + hsize = na->elements[x]->size; } else { // leave them null } @@ -1064,7 +1064,7 @@ /** Process a high level object from the pst file. */ pst_item* pst_parse_item(pst_file *pf, pst_desc_ll *d_ptr, pst_id2_ll *m_head) { - pst_num_array * list; + pst_mapi_object * list; pst_id2_ll *id2_head = m_head; pst_id2_ll *id2_ptr = NULL; pst_item *item = NULL; @@ -1092,7 +1092,7 @@ } pst_printID2ptr(id2_head); - list = pst_parse_block(pf, d_ptr->desc->id, id2_head, NULL); + list = pst_parse_block(pf, d_ptr->desc->id, id2_head); if (!list) { DEBUG_WARN(("pst_parse_block() returned an error for d_ptr->desc->id [%#"PRIx64"]\n", d_ptr->desc->id)); if (!m_head) pst_free_id2(id2_head); @@ -1116,14 +1116,14 @@ if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x692))) { // DSN/MDN reports? DEBUG_EMAIL(("DSN/MDN processing\n")); - list = pst_parse_block(pf, id2_ptr->id->id, id2_head, NULL); + list = pst_parse_block(pf, id2_ptr->id->id, id2_head); if (!list) { DEBUG_WARN(("ERROR error processing main DSN/MDN record\n")); if (!m_head) pst_free_id2(id2_head); DEBUG_RET(); return item; } - for (x=0; x < list->count_array; x++) { + for (x=0; x < list->count_objects; x++) { attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach)); memset(attach, 0, sizeof(pst_item_attach)); attach->next = item->attach; @@ -1142,14 +1142,14 @@ if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x671))) { DEBUG_EMAIL(("ATTACHMENT processing attachment\n")); - list = pst_parse_block(pf, id2_ptr->id->id, id2_head, NULL); + list = pst_parse_block(pf, id2_ptr->id->id, id2_head); if (!list) { DEBUG_WARN(("ERROR error processing main attachment record\n")); if (!m_head) pst_free_id2(id2_head); DEBUG_RET(); return item; } - for (x=0; x < list->count_array; x++) { + for (x=0; x < list->count_objects; x++) { attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach)); memset(attach, 0, sizeof(pst_item_attach)); attach->next = item->attach; @@ -1176,13 +1176,13 @@ // id_ptr is a record describing the attachment // we pass NULL instead of id2_head cause we don't want it to // load all the extra stuff here. - list = pst_parse_block(pf, id2_ptr->id->id, NULL, NULL); + list = pst_parse_block(pf, id2_ptr->id->id, NULL); if (!list) { DEBUG_WARN(("ERROR error processing an attachment record\n")); attach = attach->next; continue; } - if (list->count_array > 1) { + if (list->count_objects > 1) { DEBUG_WARN(("ERROR probably fatal, list count array will overrun attach structure.\n")); } if (pst_process(list, item, attach)) { @@ -1246,15 +1246,16 @@ /** Process a low level descriptor block (0x0101, 0xbcec, 0x7cec) into a - * list of objects, each of which contains a list of MAPI elements. + * list of MAPI objects, each of which contains a list of MAPI elements. * - * @return list of objects + * @return list of MAPI objects */ -pst_num_array * pst_parse_block(pst_file *pf, uint64_t block_id, pst_id2_ll *i2_head, pst_num_array *na_head) { +pst_mapi_object * pst_parse_block(pst_file *pf, uint64_t block_id, pst_id2_ll *i2_head) { + pst_mapi_object *mo_head = NULL; char *buf = NULL; size_t read_size = 0; pst_subblocks subblocks; - pst_num_array *na_ptr = NULL; + pst_mapi_object *mo_ptr = NULL; pst_block_offset_pointer block_offset1; pst_block_offset_pointer block_offset2; pst_block_offset_pointer block_offset3; @@ -1480,19 +1481,19 @@ DEBUG_EMAIL(("Mallocing number of records %i\n", num_recs)); for (count_rec=0; count_recnext = na_head; - na_head = na_ptr; - // allocate an array of count num_recs to contain sizeof(pst_num_item) - na_ptr->items = (pst_num_item**) xmalloc(sizeof(pst_num_item)*num_list); - na_ptr->count_item = num_list; - na_ptr->orig_count = num_list; - na_ptr->count_array = (int32_t)num_recs; // each record will have a record of the total number of records - for (x=0; xitems[x] = NULL; + mo_ptr = (pst_mapi_object*) xmalloc(sizeof(pst_mapi_object)); + memset(mo_ptr, 0, sizeof(pst_mapi_object)); + mo_ptr->next = mo_head; + mo_head = mo_ptr; + // allocate an array of count num_recs to contain sizeof(pst_mapi_element) + mo_ptr->elements = (pst_mapi_element**) xmalloc(sizeof(pst_mapi_element)*num_list); + mo_ptr->count_elements = num_list; + mo_ptr->orig_count = num_list; + mo_ptr->count_objects = (int32_t)num_recs; // each record will have a record of the total number of records + for (x=0; xelements[x] = NULL; x = 0; - DEBUG_EMAIL(("going to read %i (%#x) items\n", na_ptr->count_item, na_ptr->count_item)); + DEBUG_EMAIL(("going to read %i (%#x) items\n", mo_ptr->count_elements, mo_ptr->count_elements)); fr_ptr = list_start; // initialize fr_ptr to the start of the list. for (cur_list=0; cur_listitems[x]) { - na_ptr->items[x] = (pst_num_item*) xmalloc(sizeof(pst_num_item)); + if (!mo_ptr->elements[x]) { + mo_ptr->elements[x] = (pst_mapi_element*) xmalloc(sizeof(pst_mapi_element)); } - memset(na_ptr->items[x], 0, sizeof(pst_num_item)); //init it + memset(mo_ptr->elements[x], 0, sizeof(pst_mapi_element)); //init it // check here to see if the id of the attribute is a mapped one mapptr = pf->x_head; while (mapptr && (mapptr->map < table_rec.type)) mapptr = mapptr->next; if (mapptr && (mapptr->map == table_rec.type)) { if (mapptr->mytype == PST_MAP_ATTRIB) { - na_ptr->items[x]->id = *((uint32_t*)mapptr->data); - DEBUG_EMAIL(("Mapped attrib %#x to %#x\n", table_rec.type, na_ptr->items[x]->id)); + mo_ptr->elements[x]->mapi_id = *((uint32_t*)mapptr->data); + DEBUG_EMAIL(("Mapped attrib %#x to %#x\n", table_rec.type, mo_ptr->elements[x]->mapi_id)); } else if (mapptr->mytype == PST_MAP_HEADER) { DEBUG_EMAIL(("Internet Header mapping found %#x\n", table_rec.type)); - na_ptr->items[x]->id = (uint32_t)PST_ATTRIB_HEADER; - na_ptr->items[x]->extra = mapptr->data; + mo_ptr->elements[x]->mapi_id = (uint32_t)PST_ATTRIB_HEADER; + mo_ptr->elements[x]->extra = mapptr->data; } else { DEBUG_WARN(("Missing assertion failure\n")); // nothing, should be assertion failure here } } else { - na_ptr->items[x]->id = table_rec.type; + mo_ptr->elements[x]->mapi_id = table_rec.type; } - na_ptr->items[x]->type = 0; // checked later before it is set + mo_ptr->elements[x]->type = 0; // checked later before it is set /* Reference Types 0x0002 - Signed 16bit value 0x0003 - Signed 32bit value @@ -1593,10 +1594,10 @@ table_rec.ref_type == (uint16_t)0x0003 || table_rec.ref_type == (uint16_t)0x000b) { //contains 32 bits of data - na_ptr->items[x]->size = sizeof(int32_t); - na_ptr->items[x]->type = table_rec.ref_type; - na_ptr->items[x]->data = xmalloc(sizeof(int32_t)); - memcpy(na_ptr->items[x]->data, &(table_rec.value), sizeof(int32_t)); + mo_ptr->elements[x]->size = sizeof(int32_t); + mo_ptr->elements[x]->type = table_rec.ref_type; + mo_ptr->elements[x]->data = xmalloc(sizeof(int32_t)); + memcpy(mo_ptr->elements[x]->data, &(table_rec.value), sizeof(int32_t)); // are we missing an LE32_CPU() call here? table_rec.value is still // in the original order. @@ -1618,44 +1619,44 @@ if (value_pointer) { // in a type 2 block, with a value that is more than 4 bytes // directly stored in this block. - na_ptr->items[x]->size = value_size; - na_ptr->items[x]->type = table_rec.ref_type; - na_ptr->items[x]->data = xmalloc(value_size); - memcpy(na_ptr->items[x]->data, value_pointer, value_size); + mo_ptr->elements[x]->size = value_size; + mo_ptr->elements[x]->type = table_rec.ref_type; + mo_ptr->elements[x]->data = xmalloc(value_size); + memcpy(mo_ptr->elements[x]->data, value_pointer, value_size); } else if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset7)) { if ((table_rec.value & 0xf) == (uint32_t)0xf) { DEBUG_WARN(("failed to get block offset for table_rec.value of %#x to be read later.\n", table_rec.value)); - na_ptr->items[x]->size = 0; - na_ptr->items[x]->data = NULL; - na_ptr->items[x]->type = table_rec.value; + mo_ptr->elements[x]->size = 0; + mo_ptr->elements[x]->data = NULL; + mo_ptr->elements[x]->type = table_rec.value; } else { if (table_rec.value) { DEBUG_WARN(("failed to get block offset for table_rec.value of %#x\n", table_rec.value)); } - na_ptr->count_item --; //we will be skipping a row + mo_ptr->count_elements --; //we will be skipping a row continue; } } else { value_size = (size_t)(block_offset7.to - block_offset7.from); - na_ptr->items[x]->size = value_size; - na_ptr->items[x]->type = table_rec.ref_type; - na_ptr->items[x]->data = xmalloc(value_size+1); - memcpy(na_ptr->items[x]->data, block_offset7.from, value_size); - na_ptr->items[x]->data[value_size] = '\0'; // it might be a string, null terminate it. + mo_ptr->elements[x]->size = value_size; + mo_ptr->elements[x]->type = table_rec.ref_type; + mo_ptr->elements[x]->data = xmalloc(value_size+1); + memcpy(mo_ptr->elements[x]->data, block_offset7.from, value_size); + mo_ptr->elements[x]->data[value_size] = '\0'; // it might be a string, null terminate it. } if (table_rec.ref_type == (uint16_t)0xd) { // there is still more to do for the type of 0xD embedded objects - type_d_rec = (struct _type_d_rec*) na_ptr->items[x]->data; + type_d_rec = (struct _type_d_rec*) mo_ptr->elements[x]->data; LE32_CPU(type_d_rec->id); - na_ptr->items[x]->size = pst_ff_getID2block(pf, type_d_rec->id, i2_head, &(na_ptr->items[x]->data)); - if (!na_ptr->items[x]->size){ + mo_ptr->elements[x]->size = pst_ff_getID2block(pf, type_d_rec->id, i2_head, &(mo_ptr->elements[x]->data)); + if (!mo_ptr->elements[x]->size){ DEBUG_WARN(("not able to read the ID2 data. Setting to be read later. %#x\n", type_d_rec->id)); - na_ptr->items[x]->type = type_d_rec->id; // fetch before freeing data, alias pointer - free(na_ptr->items[x]->data); - na_ptr->items[x]->data = NULL; + mo_ptr->elements[x]->type = type_d_rec->id; // fetch before freeing data, alias pointer + free(mo_ptr->elements[x]->data); + mo_ptr->elements[x]->data = NULL; } } if (table_rec.ref_type == (uint16_t)0x1f) { @@ -1671,7 +1672,7 @@ //VBUF_STATIC(unibuf, 1024); //need UTF-16 zero-termination - vbset(strbuf, na_ptr->items[x]->data, na_ptr->items[x]->size); + vbset(strbuf, mo_ptr->elements[x]->data, mo_ptr->elements[x]->size); vbappend(strbuf, "\0\0", (size_t)2); DEBUG_INDEX(("Iconv in:\n")); DEBUG_HEXDUMPC(strbuf->b, strbuf->dlen, 0x10); @@ -1681,19 +1682,19 @@ DEBUG_EMAIL(("Failed to convert utf-16 to utf-8\n")); } else { - free(na_ptr->items[x]->data); - na_ptr->items[x]->size = unibuf->dlen; - na_ptr->items[x]->data = xmalloc(unibuf->dlen); - memcpy(na_ptr->items[x]->data, unibuf->b, unibuf->dlen); + free(mo_ptr->elements[x]->data); + mo_ptr->elements[x]->size = unibuf->dlen; + mo_ptr->elements[x]->data = xmalloc(unibuf->dlen); + memcpy(mo_ptr->elements[x]->data, unibuf->b, unibuf->dlen); } DEBUG_INDEX(("Iconv out:\n")); - DEBUG_HEXDUMPC(na_ptr->items[x]->data, na_ptr->items[x]->size, 0x10); + DEBUG_HEXDUMPC(mo_ptr->elements[x]->data, mo_ptr->elements[x]->size, 0x10); } - if (na_ptr->items[x]->type == 0) na_ptr->items[x]->type = table_rec.ref_type; + if (mo_ptr->elements[x]->type == 0) mo_ptr->elements[x]->type = table_rec.ref_type; } else { WARN(("ERROR Unknown ref_type %#hx\n", table_rec.ref_type)); freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); - pst_free_list(na_head); + pst_free_list(mo_head); DEBUG_RET(); return NULL; } @@ -1704,7 +1705,7 @@ } freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); DEBUG_RET(); - return na_head; + return mo_head; } @@ -1722,13 +1723,13 @@ // malloc space and copy the current item's data null terminated #define LIST_COPY(targ, type) { \ - targ = type realloc(targ, list->items[x]->size+1); \ - memcpy(targ, list->items[x]->data, list->items[x]->size); \ - memset(((char*)targ)+list->items[x]->size, 0, (size_t)1); \ + targ = type realloc(targ, list->elements[x]->size+1); \ + memcpy(targ, list->elements[x]->data, list->elements[x]->size); \ + memset(((char*)targ)+list->elements[x]->size, 0, (size_t)1); \ } #define LIST_COPY_BOOL(label, targ) { \ - if (*(int16_t*)list->items[x]->data) { \ + if (*(int16_t*)list->elements[x]->data) { \ DEBUG_EMAIL((label" - True\n")); \ targ = 1; \ } else { \ @@ -1753,7 +1754,7 @@ } #define LIST_COPY_INT16_N(label, targ) { \ - memcpy(&(targ), list->items[x]->data, sizeof(targ)); \ + memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \ LE16_CPU(targ); \ } @@ -1763,7 +1764,7 @@ } #define LIST_COPY_INT32_N(label, targ) { \ - memcpy(&(targ), list->items[x]->data, sizeof(targ)); \ + memcpy(&(targ), list->elements[x]->data, sizeof(targ)); \ LE32_CPU(targ); \ } @@ -1850,7 +1851,7 @@ // including the utf8 flag #define LIST_COPY_STR(label, targ) { \ LIST_COPY(targ.str, (char*)); \ - targ.is_utf8 = (list->items[x]->type == 0x1f) ? 1 : 0; \ + targ.is_utf8 = (list->elements[x]->type == 0x1f) ? 1 : 0; \ DEBUG_EMAIL((label" - unicode %d - %s\n", targ.is_utf8, targ.str)); \ } @@ -1877,7 +1878,7 @@ // malloc space and copy the item filetime #define LIST_COPY_TIME(label, targ) { \ targ = (FILETIME*) realloc(targ, sizeof(FILETIME)); \ - memcpy(targ, list->items[x]->data, list->items[x]->size); \ + memcpy(targ, list->elements[x]->data, list->elements[x]->size); \ LE32_CPU(targ->dwLowDateTime); \ LE32_CPU(targ->dwHighDateTime); \ DEBUG_EMAIL((label" - %s", fileTimeToAscii(targ))); \ @@ -1905,10 +1906,10 @@ // malloc space and copy the current item's data and size #define LIST_COPY_SIZE(targ, type, mysize) { \ - mysize = list->items[x]->size; \ + mysize = list->elements[x]->size; \ if (mysize) { \ targ = type realloc(targ, mysize); \ - memcpy(targ, list->items[x]->data, mysize); \ + memcpy(targ, list->elements[x]->data, mysize); \ } \ else { \ SAFE_FREE(targ); \ @@ -1926,20 +1927,20 @@ /** - * process the list of objects produced from parse_block() + * process the list of MAPI objects produced from parse_block() * - * @param list pointer to the list of objects from parse_block() + * @param list pointer to the list of MAPI objects from parse_block() * @param item pointer to the high level item to be updated from the list. * this item may be an email, contact or other sort of item. * the type of this item is generally set by the MAPI elements * from the list. * @param attach pointer to the list of attachment records. If * this is non-null, the length of the this attachment list - * must be at least as large as the length of the objects list. + * must be at least as large as the length of the MAPI objects list. * * @return 0 for ok, -1 for error. */ -int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach) { +int pst_process(pst_mapi_object *list, pst_item *item, pst_item_attach *attach) { DEBUG_ENT("pst_process"); if (!item) { DEBUG_EMAIL(("item cannot be NULL.\n")); @@ -1949,19 +1950,19 @@ while (list) { int32_t x; - for (x=0; xcount_item; x++) { + for (x=0; xcount_elements; x++) { int32_t t; pst_item_extra_field *ef; // check here to see if the id is one that is mapped. - DEBUG_EMAIL(("#%d - id: %#x type: %#x length: %#x\n", x, list->items[x]->id, list->items[x]->type, list->items[x]->size)); - - switch (list->items[x]->id) { + DEBUG_EMAIL(("#%d - mapi-id: %#x type: %#x length: %#x\n", x, list->elements[x]->mapi_id, list->elements[x]->type, list->elements[x]->size)); + + switch (list->elements[x]->mapi_id) { case PST_ATTRIB_HEADER: // CUSTOM attribute for saying the Extra Headers - if (list->items[x]->extra) { + if (list->elements[x]->extra) { ef = (pst_item_extra_field*) xmalloc(sizeof(pst_item_extra_field)); memset(ef, 0, sizeof(pst_item_extra_field)); - ef->field_name = (char*) xmalloc(strlen(list->items[x]->extra)+1); - strcpy(ef->field_name, list->items[x]->extra); + ef->field_name = (char*) xmalloc(strlen(list->elements[x]->extra)+1); + strcpy(ef->field_name, list->elements[x]->extra); LIST_COPY(ef->value, (char*)); ef->next = item->extra_fields; item->extra_fields = ef; @@ -2053,14 +2054,14 @@ case 0x0037: // PR_SUBJECT raw subject { int off = 0; - if ((list->items[x]->size > 2) && (((uint8_t)list->items[x]->data[0]) < 0x20)) { + if ((list->elements[x]->size > 2) && (((uint8_t)list->elements[x]->data[0]) < 0x20)) { off = 2; } - list->items[x]->data += off; - list->items[x]->size -= off; + list->elements[x]->data += off; + list->elements[x]->size -= off; LIST_COPY_STR("Raw Subject", item->subject); - list->items[x]->size += off; - list->items[x]->data -= off; + list->elements[x]->size += off; + list->elements[x]->data -= off; } break; case 0x0039: // PR_CLIENT_SUBMIT_TIME Date Email Sent/Created @@ -2212,7 +2213,7 @@ LIST_COPY_EMAIL_INT32("Message Flags", item->email->flag); break; case 0x0E08: // PR_MESSAGE_SIZE Total size of a message object - LIST_COPY_EMAIL_INT32("Message Size", item->message_size); + LIST_COPY_INT32("Message Size", item->message_size); break; case 0x0E0A: // PR_SENTMAIL_ENTRYID // folder that this message is sent to after submission @@ -2234,12 +2235,12 @@ case 0x0FF9: // PR_RECORD_KEY Record Header 1 DEBUG_EMAIL(("Record Key 1 - ")); LIST_COPY(item->record_key, (char*)); - item->record_key_size = list->items[x]->size; + item->record_key_size = list->elements[x]->size; DEBUG_EMAIL_HEXPRINT(item->record_key, item->record_key_size); DEBUG_EMAIL(("\n")); break; case 0x1000: // PR_BODY - LIST_COPY_EMAIL_STR("Plain Text body", item->body); + LIST_COPY_STR("Plain Text body", item->body); break; case 0x1001: // PR_REPORT_TEXT LIST_COPY_EMAIL_STR("Report Text", item->email->report_text); @@ -2293,10 +2294,10 @@ LIST_COPY_STR("Comment", item->comment); break; case 0x3007: // PR_CREATION_TIME Date 4 - Creation Date? - LIST_COPY_EMAIL_TIME("Date 4 (Item Creation Date)", item->create_date); + LIST_COPY_TIME("Date 4 (Item Creation Date)", item->create_date); break; case 0x3008: // PR_LAST_MODIFICATION_TIME Date 5 - Modify Date - LIST_COPY_EMAIL_TIME("Date 5 (Modify Date)", item->modify_date); + LIST_COPY_TIME("Date 5 (Modify Date)", item->modify_date); break; case 0x300B: // PR_SEARCH_KEY Record Header 2 DEBUG_EMAIL(("Record Search 2 -- NOT HANDLED\n")); @@ -2370,15 +2371,15 @@ LIST_COPY_FOLDER_INT32("Associate Content count", item->folder->assoc_count); break; case 0x3701: // PR_ATTACH_DATA_OBJ binary data of attachment - DEBUG_EMAIL(("Binary Data [Size %i] - ", list->items[x]->size)); + DEBUG_EMAIL(("Binary Data [Size %i] - ", list->elements[x]->size)); NULL_CHECK(attach); - if (!list->items[x]->data) { //special case - attach->id2_val = list->items[x]->type; + if (!list->elements[x]->data) { //special case + attach->id2_val = list->elements[x]->type; DEBUG_EMAIL(("Seen a Reference. The data hasn't been loaded yet. [%#"PRIx64"][%#x]\n", - attach->id2_val, list->items[x]->type)); + attach->id2_val, list->elements[x]->type)); } else { LIST_COPY(attach->data, (char*)); - attach->size = list->items[x]->size; + attach->size = list->elements[x]->size; DEBUG_EMAIL(("NOT PRINTED\n")); } break; @@ -2664,7 +2665,7 @@ case 0x65E3: // Entry ID? DEBUG_EMAIL(("Entry ID - ")); item->record_key = (char*) xmalloc(16+1); - memcpy(item->record_key, &(list->items[x]->data[1]), 16); //skip first byte + memcpy(item->record_key, &(list->elements[x]->data[1]), 16); //skip first byte item->record_key[16]='\0'; item->record_key_size=16; DEBUG_EMAIL_HEXPRINT((char*)item->record_key, 16); @@ -2673,12 +2674,12 @@ DEBUG_EMAIL(("Attachment ID2 value - ")); if (attach) { uint32_t tempid; - memcpy(&(tempid), list->items[x]->data, sizeof(tempid)); + memcpy(&(tempid), list->elements[x]->data, sizeof(tempid)); LE32_CPU(tempid); attach->id2_val = tempid; DEBUG_EMAIL(("%#"PRIx64"\n", attach->id2_val)); } else { - DEBUG_EMAIL(("NOT AN ATTACHMENT: %#x\n", list->items[x]->id)); + DEBUG_EMAIL(("NOT AN ATTACHMENT: %#x\n", list->elements[x]->mapi_id)); } break; case 0x67FF: // Extra Property Identifier (Password CheckSum) @@ -2818,10 +2819,10 @@ LIST_COPY_APPT_BOOL("Reminder alarm", item->appointment->alarm); break; case 0x8516: // Common start - DEBUG_EMAIL(("Common Start Date - %s\n", fileTimeToAscii((FILETIME*)list->items[x]->data))); + DEBUG_EMAIL(("Common Start Date - %s\n", fileTimeToAscii((FILETIME*)list->elements[x]->data))); break; case 0x8517: // Common end - DEBUG_EMAIL(("Common End Date - %s\n", fileTimeToAscii((FILETIME*)list->items[x]->data))); + DEBUG_EMAIL(("Common End Date - %s\n", fileTimeToAscii((FILETIME*)list->elements[x]->data))); break; case 0x851f: // Play reminder sound filename LIST_COPY_APPT_STR("Appointment reminder sound filename", item->appointment->alarm_filename); @@ -2854,110 +2855,110 @@ LIST_COPY_JOURNAL_STR("Journal description", item->journal->description); break; default: - if (list->items[x]->type == (uint32_t)0x0002) { - DEBUG_EMAIL(("Unknown type %#x 16bit int = %hi\n", list->items[x]->id, - *(int16_t*)list->items[x]->data)); - - } else if (list->items[x]->type == (uint32_t)0x0003) { - DEBUG_EMAIL(("Unknown type %#x 32bit int = %i\n", list->items[x]->id, - *(int32_t*)list->items[x]->data)); - - } else if (list->items[x]->type == (uint32_t)0x0004) { - DEBUG_EMAIL(("Unknown type %#x 4-byte floating [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0005) { - DEBUG_EMAIL(("Unknown type %#x double floating [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0006) { - DEBUG_EMAIL(("Unknown type %#x signed 64bit int = %"PRIi64"\n", list->items[x]->id, - *(int64_t*)list->items[x]->data)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0007) { - DEBUG_EMAIL(("Unknown type %#x application time [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x000a) { - DEBUG_EMAIL(("Unknown type %#x 32bit error value = %i\n", list->items[x]->id, - *(int32_t*)list->items[x]->data)); - - } else if (list->items[x]->type == (uint32_t)0x000b) { - DEBUG_EMAIL(("Unknown type %#x 16bit boolean = %s [%hi]\n", list->items[x]->id, - (*((int16_t*)list->items[x]->data)!=0?"True":"False"), - *((int16_t*)list->items[x]->data))); - - } else if (list->items[x]->type == (uint32_t)0x000d) { - DEBUG_EMAIL(("Unknown type %#x Embedded object [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0014) { - DEBUG_EMAIL(("Unknown type %#x signed 64bit int = %"PRIi64"\n", list->items[x]->id, - *(int64_t*)list->items[x]->data)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x001e) { - DEBUG_EMAIL(("Unknown type %#x String Data = \"%s\"\n", list->items[x]->id, - list->items[x]->data)); - - } else if (list->items[x]->type == (uint32_t)0x001f) { - DEBUG_EMAIL(("Unknown type %#x Unicode String Data [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0040) { - DEBUG_EMAIL(("Unknown type %#x Date = \"%s\"\n", list->items[x]->id, - fileTimeToAscii((FILETIME*)list->items[x]->data))); - - } else if (list->items[x]->type == (uint32_t)0x0048) { - DEBUG_EMAIL(("Unknown type %#x OLE GUID [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x0102) { - DEBUG_EMAIL(("Unknown type %#x Binary Data [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x1003) { - DEBUG_EMAIL(("Unknown type %#x Array of 32 bit values [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x1014) { - DEBUG_EMAIL(("Unknown type %#x Array of 64 bit values [siize = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x101E) { - DEBUG_EMAIL(("Unknown type %#x Array of Strings [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x101F) { - DEBUG_EMAIL(("Unknown type %#x Array of Unicode Strings [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); - - } else if (list->items[x]->type == (uint32_t)0x1102) { - DEBUG_EMAIL(("Unknown type %#x Array of binary data blobs [size = %#x]\n", list->items[x]->id, - list->items[x]->size)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); + if (list->elements[x]->type == (uint32_t)0x0002) { + DEBUG_EMAIL(("Unknown type %#x 16bit int = %hi\n", list->elements[x]->mapi_id, + *(int16_t*)list->elements[x]->data)); + + } else if (list->elements[x]->type == (uint32_t)0x0003) { + DEBUG_EMAIL(("Unknown type %#x 32bit int = %i\n", list->elements[x]->mapi_id, + *(int32_t*)list->elements[x]->data)); + + } else if (list->elements[x]->type == (uint32_t)0x0004) { + DEBUG_EMAIL(("Unknown type %#x 4-byte floating [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0005) { + DEBUG_EMAIL(("Unknown type %#x double floating [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0006) { + DEBUG_EMAIL(("Unknown type %#x signed 64bit int = %"PRIi64"\n", list->elements[x]->mapi_id, + *(int64_t*)list->elements[x]->data)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0007) { + DEBUG_EMAIL(("Unknown type %#x application time [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x000a) { + DEBUG_EMAIL(("Unknown type %#x 32bit error value = %i\n", list->elements[x]->mapi_id, + *(int32_t*)list->elements[x]->data)); + + } else if (list->elements[x]->type == (uint32_t)0x000b) { + DEBUG_EMAIL(("Unknown type %#x 16bit boolean = %s [%hi]\n", list->elements[x]->mapi_id, + (*((int16_t*)list->elements[x]->data)!=0?"True":"False"), + *((int16_t*)list->elements[x]->data))); + + } else if (list->elements[x]->type == (uint32_t)0x000d) { + DEBUG_EMAIL(("Unknown type %#x Embedded object [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0014) { + DEBUG_EMAIL(("Unknown type %#x signed 64bit int = %"PRIi64"\n", list->elements[x]->mapi_id, + *(int64_t*)list->elements[x]->data)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x001e) { + DEBUG_EMAIL(("Unknown type %#x String Data = \"%s\"\n", list->elements[x]->mapi_id, + list->elements[x]->data)); + + } else if (list->elements[x]->type == (uint32_t)0x001f) { + DEBUG_EMAIL(("Unknown type %#x Unicode String Data [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0040) { + DEBUG_EMAIL(("Unknown type %#x Date = \"%s\"\n", list->elements[x]->mapi_id, + fileTimeToAscii((FILETIME*)list->elements[x]->data))); + + } else if (list->elements[x]->type == (uint32_t)0x0048) { + DEBUG_EMAIL(("Unknown type %#x OLE GUID [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x0102) { + DEBUG_EMAIL(("Unknown type %#x Binary Data [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x1003) { + DEBUG_EMAIL(("Unknown type %#x Array of 32 bit values [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x1014) { + DEBUG_EMAIL(("Unknown type %#x Array of 64 bit values [siize = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x101E) { + DEBUG_EMAIL(("Unknown type %#x Array of Strings [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x101F) { + DEBUG_EMAIL(("Unknown type %#x Array of Unicode Strings [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); + + } else if (list->elements[x]->type == (uint32_t)0x1102) { + DEBUG_EMAIL(("Unknown type %#x Array of binary data blobs [size = %#x]\n", list->elements[x]->mapi_id, + list->elements[x]->size)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); } else { - DEBUG_EMAIL(("Unknown type %#x Not Printable [%#x]\n", list->items[x]->id, - list->items[x]->type)); - DEBUG_HEXDUMP(list->items[x]->data, list->items[x]->size); + DEBUG_EMAIL(("Unknown type %#x Not Printable [%#x]\n", list->elements[x]->mapi_id, + list->elements[x]->type)); + DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); } - if (list->items[x]->data) { - free(list->items[x]->data); - list->items[x]->data = NULL; + if (list->elements[x]->data) { + free(list->elements[x]->data); + list->elements[x]->data = NULL; } } } @@ -2969,19 +2970,19 @@ } -void pst_free_list(pst_num_array *list) { - pst_num_array *l; +void pst_free_list(pst_mapi_object *list) { + pst_mapi_object *l; DEBUG_ENT("pst_free_list"); while (list) { - if (list->items) { + if (list->elements) { int32_t x; for (x=0; x < list->orig_count; x++) { - if (list->items[x]) { - if (list->items[x]->data) free(list->items[x]->data); - free(list->items[x]); + if (list->elements[x]) { + if (list->elements[x]->data) free(list->elements[x]->data); + free(list->elements[x]); } } - free(list->items); + free(list->elements); } l = list->next; free (list); @@ -4121,6 +4122,13 @@ case 28597 : return "iso-8859-7"; case 28598 : return "iso-8859-8"; case 28599 : return "iso-8859-9"; + case 28600 : return "iso-8859-10"; + case 28601 : return "iso-8859-11"; + case 28602 : return "iso-8859-12"; + case 28603 : return "iso-8859-13"; + case 28604 : return "iso-8859-14"; + case 28605 : return "iso-8859-15"; + case 28606 : return "iso-8859-16"; case 50220 : return "iso-2022-jp"; case 50221 : return "csiso2022jp"; case 51932 : return "euc-jp"; @@ -4148,10 +4156,10 @@ } -/** Convert str to utf8 if possible. Null strings are preserved +/** Convert str to utf8 if possible; null strings are preserved. * * @param item pointer to the mapi item of interest - * ¶m str pointer to the mapi string of interest + * @param str pointer to the mapi string of interest */ void pst_convert_utf8_null(pst_item *item, pst_string *str) { @@ -4160,10 +4168,10 @@ } -/** Convert str to utf8 if possible. Null strings are converted into empty strings. +/** Convert str to utf8 if possible; null strings are converted into empty strings. * * @param item pointer to the mapi item of interest - * ¶m str pointer to the mapi string of interest + * @param str pointer to the mapi string of interest */ void pst_convert_utf8(pst_item *item, pst_string *str) { diff -r edebaf0e87d2 -r 0b1766da9be8 src/libpst.h --- a/src/libpst.h Tue Mar 10 13:09:20 2009 -0700 +++ b/src/libpst.h Thu Mar 12 15:17:32 2009 -0700 @@ -494,22 +494,22 @@ } pst_block_offset_pointer; -typedef struct pst_num_item { - uint32_t id; // not an id1 or id2, this is actually some sort of type code +typedef struct pst_mapi_element { + uint32_t mapi_id; char *data; uint32_t type; size_t size; char *extra; -} pst_num_item; +} pst_mapi_element; -typedef struct pst_num_array { - int32_t count_item; - int32_t orig_count; - int32_t count_array; - struct pst_num_item ** items; - struct pst_num_array *next; -} pst_num_array; +typedef struct pst_mapi_object { + int32_t count_elements; // count of active elements + int32_t orig_count; // originally allocated elements + int32_t count_objects; // number of mapi objects in the list + struct pst_mapi_element **elements; + struct pst_mapi_object *next; +} pst_mapi_object; typedef struct pst_holder { @@ -547,9 +547,9 @@ int pst_build_desc_ptr(pst_file *pf, int64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val); pst_item* pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); pst_item* pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr, pst_id2_ll *m_head); -pst_num_array* pst_parse_block(pst_file *pf, uint64_t block_id, pst_id2_ll *i2_head, pst_num_array *na_head); -int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach); -void pst_free_list(pst_num_array *list); +pst_mapi_object* pst_parse_block(pst_file *pf, uint64_t block_id, pst_id2_ll *i2_head); +int pst_process(pst_mapi_object *list, pst_item *item, pst_item_attach *attach); +void pst_free_list(pst_mapi_object *list); void pst_freeItem(pst_item *item); void pst_free_id2(pst_id2_ll * head); void pst_free_id (pst_index_ll *head); diff -r edebaf0e87d2 -r 0b1766da9be8 xml/libpst.in --- a/xml/libpst.in Tue Mar 10 13:09:20 2009 -0700 +++ b/xml/libpst.in Thu Mar 12 15:17:32 2009 -0700 @@ -33,7 +33,7 @@ - 2009-02-28 + 2009-03-11 @@ -233,7 +233,7 @@ - 2009-02-28 + 2009-03-11 @@ -336,7 +336,7 @@ - 2009-02-28 + 2009-03-11 @@ -520,7 +520,7 @@ - 2009-02-28 + 2009-03-11 @@ -541,7 +541,6 @@ - @@ -576,12 +575,6 @@ - -C character-set - - Specify the name of the character set used in your pst file for contacts. - - - -d debug-file Specify name of debug log file. The @@ -696,7 +689,7 @@ - 2009-02-28 + 2009-03-11 @@ -830,7 +823,7 @@ - 2009-02-28 + 2009-03-11