summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--berkeleydb/db-4.2.52-mingw.patch233
-rw-r--r--berkeleydb/db-4.2.52.patch1981
-rw-r--r--berkeleydb/db-4.7.25-mingw.patch184
-rw-r--r--berkeleydb/db-4.7.25.patch1052
-rw-r--r--berkeleydb/makefile.mk59
-rw-r--r--berkeleydb/prj/d.lst14
-rw-r--r--cairo/cairo/makefile.mk11
-rw-r--r--curl/makefile.mk10
-rw-r--r--graphite/graphite-2.3.1.patch2014
-rw-r--r--graphite/makefile.mk184
-rw-r--r--graphite/prj/build.lst3
-rw-r--r--graphite/prj/d.lst15
-rw-r--r--icu/icu-4.0.patch13
-rw-r--r--icu/makefile.mk13
-rw-r--r--libxml2/libxml2-2.6.31-mingw.patch13
-rw-r--r--libxml2/libxml2-2.6.31.patch128
-rw-r--r--libxml2/makefile.mk11
-rw-r--r--libxslt/makefile.mk10
-rw-r--r--moz/README4
-rw-r--r--moz/extractfiles.mk177
-rw-r--r--moz/makefile.mk149
-rw-r--r--moz/mozilla-source-1.0.patch4499
-rw-r--r--moz/mozilla-source-1.7.5.patch9658
-rw-r--r--moz/patches/consecutive_ldap_queries.patch13
-rw-r--r--moz/patches/cygwin_paths_in_ldap_sdk.patch12
-rw-r--r--moz/patches/embed_manifest.patch142
-rw-r--r--moz/patches/index.txt65
-rw-r--r--moz/patches/no_core_abspath_in_nss.patch52
-rw-r--r--moz/patches/wchart_on_msvc8.patch20
-rw-r--r--moz/prj/build.lst2
-rw-r--r--moz/seamonkey-source-1.1.14.patch (renamed from moz/mozilla-source-1.7b.patch)3913
-rw-r--r--moz/zipped/makefile.mk119
-rw-r--r--neon/makefile.mk2
-rw-r--r--neon/neon.patch1008
-rw-r--r--nss/makefile.mk179
-rw-r--r--nss/nss_3_12_3.patch131
-rw-r--r--nss/nss_3_12_3.patch.mingw166
-rw-r--r--nss/prj/build.lst3
-rw-r--r--nss/prj/d.lst10
-rw-r--r--nss/readme.txt56
-rw-r--r--python/Python-2.6.1-mingw.patch6
-rw-r--r--python/makefile.mk3
-rw-r--r--zlib/makefile.mk3
-rw-r--r--zlib/prj/d.lst1
-rw-r--r--zlib/zlib-1.1.4.patch3103
45 files changed, 11520 insertions, 17924 deletions
diff --git a/berkeleydb/db-4.2.52-mingw.patch b/berkeleydb/db-4.2.52-mingw.patch
deleted file mode 100644
index af8848d9d2b2..000000000000
--- a/berkeleydb/db-4.2.52-mingw.patch
+++ /dev/null
@@ -1,233 +0,0 @@
-*** misc/db-4.2.52.NC/dist/configure 2003-12-04 06:10:02.000000000 +0900
---- misc/build/db-4.2.52.NC/dist/configure Thu Dec 20 23:08:25 2007
-***************
-*** 8301,8307 ****
- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
-
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
- # If the export-symbols file already is a .def file (1st line
- # is EXPORTS), use it as is; otherwise, prepend...
- archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
---- 8301,8307 ----
- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
-
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-! archive_cmds='$DLLTOOL $add_underscore --export-all-symbols --dllname $soname --output-lib $lib --output-exp $output_objdir/$soname.exp $libobjs; $CC -shared $output_objdir/$soname.exp $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000'
- # If the export-symbols file already is a .def file (1st line
- # is EXPORTS), use it as is; otherwise, prepend...
- archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-***************
-*** 8310,8316 ****
- echo EXPORTS > $output_objdir/$soname.def;
- cat $export_symbols >> $output_objdir/$soname.def;
- fi~
-! $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
- else
- ld_shlibs=no
- fi
---- 8310,8316 ----
- echo EXPORTS > $output_objdir/$soname.def;
- cat $export_symbols >> $output_objdir/$soname.def;
- fi~
-! $DLLTOOL $add_underscore --dllname $soname --output-lib $lib --output-exp $output_objdir/$soname.exp --input-def $output_objdir/$soname.def; $CC -shared $output_objdir/$soname.exp $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000'
- else
- ld_shlibs=no
- fi
-***************
-*** 12077,12091 ****
-
- if test "$pre_test_object_deps_done" = no; then
- if test -z "$predep_objects_CXX"; then
-! predep_objects_CXX="$p"
- else
-! predep_objects_CXX="$predep_objects_CXX $p"
- fi
- else
- if test -z "$postdep_objects_CXX"; then
-! postdep_objects_CXX="$p"
- else
-! postdep_objects_CXX="$postdep_objects_CXX $p"
- fi
- fi
- ;;
---- 12077,12091 ----
-
- if test "$pre_test_object_deps_done" = no; then
- if test -z "$predep_objects_CXX"; then
-! predep_objects_CXX=`cygpath -m "$p"`
- else
-! predep_objects_CXX="$predep_objects_CXX "`cygpath -m "$p"`
- fi
- else
- if test -z "$postdep_objects_CXX"; then
-! postdep_objects_CXX=`cygpath -m "$p"`
- else
-! postdep_objects_CXX="$postdep_objects_CXX "`cygpath -m "$p"`
- fi
- fi
- ;;
-***************
-*** 26252,26257 ****
---- 26252,26268 ----
-
-
-
-+ ac_cv_sizeof_char_p=`echo $ac_cv_sizeof_char_p | tr -d '\015'`
-+ ac_cv_sizeof_unsigned_int=`echo $ac_cv_sizeof_unsigned_int | tr -d '\015'`
-+ ac_cv_sizeof_unsigned_char=`echo $ac_cv_sizeof_unsigned_char | tr -d '\015'`
-+ ac_cv_sizeof_unsigned_short=`echo $ac_cv_sizeof_unsigned_short | tr -d '\015'`
-+ ac_cv_sizeof_unsigned_long=`echo $ac_cv_sizeof_unsigned_long | tr -d '\015'`
-+ ac_cv_sizeof_size_t=`echo $ac_cv_sizeof_size_t | tr -d '\015'`
-+ ac_cv_sizeof_int=`echo $ac_cv_sizeof_int | tr -d '\015'`
-+ ac_cv_sizeof_char=`echo $ac_cv_sizeof_char | tr -d '\015'`
-+ ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
-+ ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
-+
- echo "$as_me:$LINENO: checking for u_int8_t" >&5
- echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6
- if test "${ac_cv_type_u_int8_t+set}" = set; then
---- misc/build/db-4.2.52.NC/dist/ltmain.sh.orig 2003-04-27 02:45:38.000000000 +0900
-+++ misc/build/db-4.2.52.NC/dist/ltmain.sh 2005-04-08 00:03:16.000000000 +0900
-@@ -853,6 +853,7 @@
- lib_search_path=`pwd`
- inst_prefix_dir=
-
-+ add_underscore=
- avoid_version=no
- dlfiles=
- dlprefiles=
-@@ -1159,6 +1160,11 @@
- prevarg="$arg"
-
- case $arg in
-+ -add-underscore)
-+ add_underscore="--add-underscore"
-+ continue
-+ ;;
-+
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
-@@ -4474,7 +4480,7 @@
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
-- *cygwin*)
-+ *cygwin* | *mingw*)
- exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
- *) exeext= ;;
---- misc/build/db-4.2.52.NC/dist/Makefile.in.orig 2003-11-29 03:50:06.000000000 +0900
-+++ misc/build/db-4.2.52.NC/dist/Makefile.in 2005-04-03 13:51:34.000000000 +0900
-@@ -45,7 +45,7 @@
- SOLINK= @MAKEFILE_SOLINK@
- SOFLAGS= @SOFLAGS@
- LIBMAJOR= @DB_VERSION_MAJOR@
--LIBVERSION= @DB_VERSION_MAJOR@.@DB_VERSION_MINOR@
-+LIBVERSION= @DB_VERSION_MAJOR@@DB_VERSION_MINOR@
-
- CPPFLAGS= -I$(builddir) -I$(srcdir) @CPPFLAGS@
-
-@@ -62,18 +62,18 @@
-
- libdb_base= libdb
- libdb= $(libdb_base).a
--libdb_version= $(libdb_base)-$(LIBVERSION).a
--libso= $(libdb_base)-$(LIBVERSION)@SOSUFFIX@
--libso_target= $(libdb_base)-$(LIBVERSION).la
-+libdb_version= $(libdb_base)$(LIBVERSION).a
-+libso= $(libdb_base)$(LIBVERSION)@SOSUFFIX@
-+libso_target= $(libdb_base)$(LIBVERSION).la
- libso_default= $(libdb_base)@SOSUFFIX@
--libso_major= $(libdb_base)-$(LIBMAJOR)@SOSUFFIX@
-+libso_major= $(libdb_base)$(LIBMAJOR)@SOSUFFIX@
-
- ##################################################
- # C++ API.
- #
- # C++ support is optional, and can be built with static or shared libraries.
- ##################################################
--CXXFLAGS= -c $(CPPFLAGS) @CXXFLAGS@
-+CXXFLAGS= -c $(SOLARINC) $(CPPFLAGS) -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) @CXXFLAGS@
- CXX= @MAKEFILE_CXX@
- CXXLINK= @MAKEFILE_CXXLINK@
- XSOLINK= @MAKEFILE_XSOLINK@
-@@ -81,11 +81,11 @@
-
- libcxx_base= libdb_cxx
- libcxx= $(libcxx_base).a
--libcxx_version= $(libcxx_base)-$(LIBVERSION).a
--libxso= $(libcxx_base)-$(LIBVERSION)@SOSUFFIX@
--libxso_target= $(libcxx_base)-$(LIBVERSION).la
-+libcxx_version= $(libcxx_base)$(LIBVERSION).a
-+libxso= $(libcxx_base)$(LIBVERSION)@SOSUFFIX@
-+libxso_target= $(libcxx_base)$(LIBVERSION).la
- libxso_default= $(libcxx_base)@SOSUFFIX@
--libxso_major= $(libcxx_base)-$(LIBMAJOR)@SOSUFFIX@
-+libxso_major= $(libcxx_base)$(LIBMAJOR)@SOSUFFIX@
-
- ##################################################
- # Java API.
-@@ -112,12 +112,12 @@
- libj_exjarfile= dbexamples.jar
- rpc_jarfile= dbsvc.jar
- libjso_base= libdb_java
--libjso= $(libjso_base)-$(LIBVERSION)@JMODSUFFIX@
--libjso_static= $(libjso_base)-$(LIBVERSION).a
--libjso_target= $(libjso_base)-$(LIBVERSION).la
-+libjso= $(libjso_base)$(LIBVERSION)@JMODSUFFIX@
-+libjso_static= $(libjso_base)$(LIBVERSION).a
-+libjso_target= $(libjso_base)$(LIBVERSION).la
- libjso_default= $(libjso_base)@JMODSUFFIX@
--libjso_major= $(libjso_base)-$(LIBMAJOR)@JMODSUFFIX@
--libjso_g= $(libjso_base)-$(LIBVERSION)_g@JMODSUFFIX@
-+libjso_major= $(libjso_base)$(LIBMAJOR)@JMODSUFFIX@
-+libjso_g= $(libjso_base)$(LIBVERSION)_g@JMODSUFFIX@
-
- ##################################################
- # TCL API.
-@@ -127,11 +127,11 @@
- TCFLAGS= @TCFLAGS@
- LIBTSO_LIBS= @LIBTSO_LIBS@
- libtso_base= libdb_tcl
--libtso= $(libtso_base)-$(LIBVERSION)@MODSUFFIX@
--libtso_static= $(libtso_base)-$(LIBVERSION).a
--libtso_target= $(libtso_base)-$(LIBVERSION).la
-+libtso= $(libtso_base)$(LIBVERSION)@MODSUFFIX@
-+libtso_static= $(libtso_base)$(LIBVERSION).a
-+libtso_target= $(libtso_base)$(LIBVERSION).la
- libtso_default= $(libtso_base)@MODSUFFIX@
--libtso_major= $(libtso_base)-$(LIBMAJOR)@MODSUFFIX@
-+libtso_major= $(libtso_base)$(LIBMAJOR)@MODSUFFIX@
-
- ##################################################
- # db_dump185 UTILITY
-@@ -666,7 +666,7 @@
-
- # Shared Java library.
- $(libjso_target): $(JAVA_OBJS) $(C_OBJS)
-- $(SOLINK) -shrext @JMODSUFFIX@ $(SOFLAGS) $(LDFLAGS) \
-+ $(SOLINK) -shrext @JMODSUFFIX@ -add-underscore $(SOFLAGS) $(LDFLAGS) \
- -o $@ $(JAVA_OBJS) $(C_OBJS) $(LIBJSO_LIBS)
-
- # Shared Tcl library.
-*** misc/build/db-4.2.52.NC/btree/bt_put.c.orig 2003-11-17 19:58:20.000000000 +0000
---- misc/build/db-4.2.52.NC/btree/bt_put.c 2007-06-17 15:05:09.000000000 +0100
-***************
-*** 702,708 ****
-
- /* Sum up all the data items. */
- for (cnt = 0, first = indx;
-! inp[first] == inp[indx] && indx < NUM_ENT(h);
- ++cnt, indx += P_INDX) {
- bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
- sz += B_TYPE(bk->type) == B_KEYDATA ?
---- 702,708 ----
-
- /* Sum up all the data items. */
- for (cnt = 0, first = indx;
-! indx < NUM_ENT(h) && inp[first] == inp[indx];
- ++cnt, indx += P_INDX) {
- bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
- sz += B_TYPE(bk->type) == B_KEYDATA ?
diff --git a/berkeleydb/db-4.2.52.patch b/berkeleydb/db-4.2.52.patch
deleted file mode 100644
index 8f62c4f89406..000000000000
--- a/berkeleydb/db-4.2.52.patch
+++ /dev/null
@@ -1,1981 +0,0 @@
-*** misc/db-4.2.52.NC/btree/bt_put.c Mon Nov 17 20:58:20 2003
---- misc/build/db-4.2.52.NC/btree/bt_put.c Fri Sep 28 11:12:11 2007
-***************
-*** 702,708 ****
-
- /* Sum up all the data items. */
- for (cnt = 0, first = indx;
-! inp[first] == inp[indx] && indx < NUM_ENT(h);
- ++cnt, indx += P_INDX) {
- bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
- sz += B_TYPE(bk->type) == B_KEYDATA ?
---- 702,708 ----
-
- /* Sum up all the data items. */
- for (cnt = 0, first = indx;
-! indx < NUM_ENT(h) && inp[first] == inp[indx];
- ++cnt, indx += P_INDX) {
- bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
- sz += B_TYPE(bk->type) == B_KEYDATA ?
-*** misc/db-4.2.52.NC/btree/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/btree/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,31 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=btree
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/bt_compare.obj \
-! $(SLO)$/bt_conv.obj \
-! $(SLO)$/bt_curadj.obj \
-! $(SLO)$/bt_cursor.obj \
-! $(SLO)$/bt_delete.obj \
-! $(SLO)$/bt_method.obj \
-! $(SLO)$/bt_open.obj \
-! $(SLO)$/bt_put.obj \
-! $(SLO)$/bt_rec.obj \
-! $(SLO)$/bt_reclaim.obj \
-! $(SLO)$/bt_recno.obj \
-! $(SLO)$/bt_rsearch.obj \
-! $(SLO)$/bt_search.obj \
-! $(SLO)$/bt_split.obj \
-! $(SLO)$/bt_stat.obj \
-! $(SLO)$/bt_upgrade.obj \
-! $(SLO)$/bt_verify.obj \
-! $(SLO)$/btree_auto.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/clib/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/clib/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,13 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=clib
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ../include
-! SLOFILES= $(SLO)$/strcasecmp.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/common/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/common/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,23 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=common
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/db_byteorder.obj \
-! $(SLO)$/db_err.obj \
-! $(SLO)$/crypto_stub.obj \
-! $(SLO)$/db_getlong.obj \
-! $(SLO)$/db_idspace.obj \
-! $(SLO)$/db_log2.obj \
-! $(SLO)$/util_arg.obj \
-! $(SLO)$/util_cache.obj \
-! $(SLO)$/util_log.obj \
-! $(SLO)$/util_sig.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/cxx/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/cxx/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,25 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=cxx
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! CDEFS+=-DDB_CREATE_DLL
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/cxx_db.obj \
-! $(SLO)$/cxx_dbc.obj \
-! $(SLO)$/cxx_dbt.obj \
-! $(SLO)$/cxx_env.obj \
-! $(SLO)$/cxx_except.obj \
-! $(SLO)$/cxx_lock.obj \
-! $(SLO)$/cxx_logc.obj \
-! $(SLO)$/cxx_mpool.obj \
-! $(SLO)$/cxx_multi.obj \
-! $(SLO)$/cxx_txn.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/db/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/db/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,40 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=db_src
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/crdel_auto.obj \
-! $(SLO)$/crdel_rec.obj \
-! $(SLO)$/db.obj \
-! $(SLO)$/db_am.obj \
-! $(SLO)$/db_rename.obj \
-! $(SLO)$/db_auto.obj \
-! $(SLO)$/db_cam.obj \
-! $(SLO)$/db_conv.obj \
-! $(SLO)$/db_dispatch.obj \
-! $(SLO)$/db_dup.obj \
-! $(SLO)$/db_iface.obj \
-! $(SLO)$/db_join.obj \
-! $(SLO)$/db_meta.obj \
-! $(SLO)$/db_method.obj \
-! $(SLO)$/db_open.obj \
-! $(SLO)$/db_overflow.obj \
-! $(SLO)$/db_ovfl_vrfy.obj \
-! $(SLO)$/db_pr.obj \
-! $(SLO)$/db_rec.obj \
-! $(SLO)$/db_reclaim.obj \
-! $(SLO)$/db_remove.obj \
-! $(SLO)$/db_ret.obj \
-! $(SLO)$/db_truncate.obj \
-! $(SLO)$/db_upg.obj \
-! $(SLO)$/db_upg_opd.obj \
-! $(SLO)$/db_vrfy.obj \
-! $(SLO)$/db_vrfyutil.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/db_4_2_gcc3.map Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/db_4_2_gcc3.map Fri Sep 28 11:14:26 2007
-***************
-*** 1 ****
-! dummy
---- 1,1011 ----
-! DB_4_2 {
-! global:
-!
-! __bam_30_btreemeta;
-! __bam_31_btreemeta;
-! __bam_31_lbtree;
-! __bam_adj_getpgnos;
-! __bam_adjindx;
-! __bam_adj_log;
-! __bam_adj_print;
-! __bam_adj_read;
-! __bam_adj_recover;
-! __bam_adjust;
-! __bam_bulk_duplicates;
-! __bam_bulk_overflow;
-! __bam_ca_delete;
-! __bam_ca_di;
-! __bam_cadjust_getpgnos;
-! __bam_cadjust_log;
-! __bam_cadjust_print;
-! __bam_cadjust_read;
-! __bam_cadjust_recover;
-! __bam_ca_dup;
-! __bam_ca_rsplit;
-! __bam_ca_split;
-! __bam_ca_undodup;
-! __bam_ca_undosplit;
-! __bam_c_count;
-! __bam_cdel_getpgnos;
-! __bam_cdel_log;
-! __bam_cdel_print;
-! __bam_cdel_read;
-! __bam_cdel_recover;
-! __bam_c_dup;
-! __bam_c_init;
-! __bam_cmp;
-! __bam_copy;
-! __bam_c_refresh;
-! __bam_c_rget;
-! __bam_curadj_getpgnos;
-! __bam_curadj_log;
-! __bam_curadj_print;
-! __bam_curadj_read;
-! __bam_curadj_recover;
-! __bam_db_close;
-! __bam_db_create;
-! __bam_defcmp;
-! __bam_defpfx;
-! __bam_ditem;
-! __bam_dpages;
-! __bam_iitem;
-! __bam_init_getpgnos;
-! __bam_init_print;
-! __bam_init_recover;
-! __bam_key_range;
-! __bam_map_flags;
-! __bam_meta2pgset;
-! __bam_metachk;
-! __bam_mswap;
-! __bam_new_file;
-! __bam_new_subdb;
-! __bam_nrecs;
-! __bam_open;
-! __bam_pgin;
-! __bam_pgout;
-! __bam_rcuradj_getpgnos;
-! __bam_rcuradj_log;
-! __bam_rcuradj_print;
-! __bam_rcuradj_read;
-! __bam_rcuradj_recover;
-! __bam_read_root;
-! __bam_reclaim;
-! __bam_repl_getpgnos;
-! __bam_repl_log;
-! __bam_repl_print;
-! __bam_repl_read;
-! __bam_repl_recover;
-! __bam_ritem;
-! __bam_root_getpgnos;
-! __bam_root_log;
-! __bam_root_print;
-! __bam_root_read;
-! __bam_root_recover;
-! __bam_rsearch;
-! __bam_rsplit_getpgnos;
-! __bam_rsplit_log;
-! __bam_rsplit_print;
-! __bam_rsplit_read;
-! __bam_rsplit_recover;
-! __bam_salvage;
-! __bam_salvage_walkdupint;
-! __bam_search;
-! __bam_set_bt_compare;
-! __bam_set_flags;
-! __bam_split;
-! __bam_split_getpgnos;
-! __bam_split_log;
-! __bam_split_print;
-! __bam_split_read;
-! __bam_split_recover;
-! __bam_stat;
-! __bam_stat_callback;
-! __bam_stkgrow;
-! __bam_stkrel;
-! __bam_total;
-! __bam_traverse;
-! __bam_truncate;
-! __bam_vrfy;
-! __bam_vrfy_itemorder;
-! __bam_vrfy_meta;
-! __bam_vrfy_structure;
-! __bam_vrfy_subtree;
-! __bss_start;
-! __crdel_init_getpgnos;
-! __crdel_init_print;
-! __crdel_init_recover;
-! __crdel_metasub_getpgnos;
-! __crdel_metasub_log;
-! __crdel_metasub_print;
-! __crdel_metasub_read;
-! __crdel_metasub_recover;
-! __crypto_region_init;
-! __db185_open;
-! __db_31_offdup;
-! __db_add_limbo;
-! __db_add_recovery;
-! __db_addrem_getpgnos;
-! __db_addrem_log;
-! __db_addrem_print;
-! __db_addrem_read;
-! __db_addrem_recover;
-! __db_appname;
-! __db_apprec;
-! __db_associate;
-! __db_associate_pp;
-! __db_backup_name;
-! __db_big_getpgnos;
-! __db_big_log;
-! __db_big_print;
-! __db_big_read;
-! __db_big_recover;
-! __db_byteorder;
-! __db_byteswap;
-! __db_c_close;
-! __db_c_close_pp;
-! __db_c_count;
-! __db_c_count_pp;
-! __db_c_del;
-! __db_c_del_arg;
-! __db_c_del_pp;
-! __db_c_del_primary;
-! __db_c_destroy;
-! __db_c_dup;
-! __db_c_dup_pp;
-! __db_c_get;
-! __db_c_get_pp;
-! __db_check_chksum;
-! __db_check_txn;
-! __db_chk_meta;
-! __db_chksum;
-! __db_c_idup;
-! __db_cksum_getpgnos;
-! __db_cksum_log;
-! __db_cksum_print;
-! __db_cksum_read;
-! __db_cksum_recover;
-! __db_close;
-! __db_close_pp;
-! __db_c_newopd;
-! __db_c_pget;
-! __db_c_pget_pp;
-! __db_c_put;
-! __db_c_put_pp;
-! db_create;
-! __db_c_secondary_get_pp;
-! __db_cursor;
-! __db_cursor_int;
-! __db_cursor_pp;
-! __db_dbenv_setup;
-! __db_dbm_close;
-! __db_dbm_delete;
-! __db_dbm_fetch;
-! __db_dbm_firstkey;
-! __db_dbm_init;
-! __db_dbm_nextkey;
-! __db_dbm_store;
-! __db_dbtype_to_string;
-! __db_debug_getpgnos;
-! __db_debug_log;
-! __db_debug_print;
-! __db_debug_read;
-! __db_debug_recover;
-! __db_default_getpgnos;
-! __db_del;
-! __db_del_pp;
-! __db_derive_mac;
-! __db_dispatch;
-! __db_ditem;
-! __db_doff;
-! __db_do_the_limbo;
-! __db_dump;
-! __db_duperr;
-! __db_e_attach;
-! __db_e_detach;
-! __dbenv_close;
-! __dbenv_close_pp;
-! __db_env_config;
-! db_env_create;
-! __dbenv_dbremove_pp;
-! __dbenv_dbrename_pp;
-! __dbenv_get_encrypt_flags;
-! __dbenv_get_errfile;
-! __dbenv_get_errpfx;
-! __dbenv_get_open_flags;
-! __dbenv_open;
-! __dbenv_remove;
-! __dbenv_set_alloc;
-! __dbenv_set_data_dir;
-! __dbenv_set_encrypt;
-! __dbenv_set_errcall;
-! __dbenv_set_errfile;
-! __dbenv_set_errpfx;
-! __dbenv_set_flags;
-! db_env_set_func_close;
-! db_env_set_func_dirfree;
-! db_env_set_func_dirlist;
-! db_env_set_func_exists;
-! db_env_set_func_free;
-! db_env_set_func_fsync;
-! db_env_set_func_ioinfo;
-! db_env_set_func_malloc;
-! db_env_set_func_map;
-! db_env_set_func_open;
-! db_env_set_func_read;
-! db_env_set_func_realloc;
-! db_env_set_func_rename;
-! db_env_set_func_seek;
-! db_env_set_func_sleep;
-! db_env_set_func_unlink;
-! db_env_set_func_unmap;
-! db_env_set_func_write;
-! db_env_set_func_yield;
-! __dbenv_set_paniccall;
-! __dbenv_set_shm_key;
-! __dbenv_set_tas_spins;
-! __dbenv_set_tmp_dir;
-! __dbenv_set_verbose;
-! __db_e_remove;
-! __db_err;
-! __db_errcall;
-! __db_errfile;
-! __db_e_stat;
-! __db_fcchk;
-! __db_fchk;
-! __db_fd_pp;
-! __db_ferr;
-! __db_fileinit;
-! __db_fnl;
-! __db_free;
-! __db_get;
-! __db_getlong;
-! __db_get_open_flags;
-! __db_get_pp;
-! __db_getulong;
-! __db_global_values;
-! __db_goff;
-! __dbh_am_chk;
-! __db_hashinit;
-! __db_hcreate;
-! __db_hdestroy;
-! __db_home;
-! __db_hsearch;
-! __db_idspace;
-! __db_init_getpgnos;
-! __db_init_print;
-! __db_init_recover;
-! __db_init_subdb;
-! __db_inmemdbflags;
-! __db_isbigendian;
-! __db_join;
-! __db_join_close;
-! __db_join_pp;
-! __db_key_range_pp;
-! __db_lastpgno;
-! __db_lget;
-! __dblist_get;
-! __db_loadme;
-! __db_log2;
-! __db_logmsg;
-! __db_log_page;
-! __db_lput;
-! __db_map_rmid;
-! __db_map_xid;
-! __db_master_open;
-! __db_master_update;
-! __db_meta_setup;
-! __db_metaswap;
-! __db_mi_env;
-! __db_mi_open;
-! __db_moff;
-! __db_mutex_free;
-! __db_mutex_setup;
-! __db_ndbm_clearerr;
-! __db_ndbm_close;
-! __db_ndbm_delete;
-! __db_ndbm_dirfno;
-! __db_ndbm_error;
-! __db_ndbm_fetch;
-! __db_ndbm_firstkey;
-! __db_ndbm_nextkey;
-! __db_ndbm_open;
-! __db_ndbm_pagfno;
-! __db_ndbm_rdonly;
-! __db_ndbm_store;
-! __db_new;
-! __db_new_file;
-! __db_noop_getpgnos;
-! __db_noop_log;
-! __db_noop_print;
-! __db_noop_read;
-! __db_noop_recover;
-! __db_not_txn_env;
-! __db_oflags;
-! __db_omode;
-! __db_open;
-! __db_open_pp;
-! __db_overwrite;
-! __db_ovref;
-! __db_ovref_getpgnos;
-! __db_ovref_log;
-! __db_ovref_print;
-! __db_ovref_read;
-! __db_ovref_recover;
-! __db_panic;
-! __db_panic_msg;
-! __db_partsize;
-! __db_pg_alloc_getpgnos;
-! __db_pg_alloc_log;
-! __db_pg_alloc_print;
-! __db_pg_alloc_read;
-! __db_pg_alloc_recover;
-! __db_pgerr;
-! __db_pget;
-! __db_pget_pp;
-! __db_pgfmt;
-! __db_pg_freedata_getpgnos;
-! __db_pg_freedata_log;
-! __db_pg_freedata_print;
-! __db_pg_freedata_read;
-! __db_pg_freedata_recover;
-! __db_pg_free_getpgnos;
-! __db_pg_free_log;
-! __db_pg_free_print;
-! __db_pg_free_read;
-! __db_pg_free_recover;
-! __db_pgin;
-! __db_pg_new_getpgnos;
-! __db_pg_new_log;
-! __db_pg_new_print;
-! __db_pg_new_read;
-! __db_pg_new_recover;
-! __db_pgout;
-! __db_pg_prepare_getpgnos;
-! __db_pg_prepare_log;
-! __db_pg_prepare_print;
-! __db_pg_prepare_read;
-! __db_pg_prepare_recover;
-! __db_pitem;
-! __db_poff;
-! __db_pr;
-! __db_pr_callback;
-! __db_prdbt;
-! __db_prflags;
-! __db_prfooter;
-! __db_prheader;
-! __db_prnpage;
-! __db_prpage;
-! __db_prqueue;
-! __db_put;
-! __db_put_pp;
-! __db_r_attach;
-! __db_r_detach;
-! __db_reclaim_callback;
-! __db_rec_repl;
-! __db_rec_toobig;
-! __db_refresh;
-! __dbreg_add_dbentry;
-! __dbreg_assign_id;
-! __dbreg_close_files;
-! __dbreg_close_id;
-! __dbreg_do_open;
-! __dbreg_fid_to_fname;
-! __dbreg_get_id;
-! __dbreg_get_name;
-! __dbreg_id_to_db;
-! __dbreg_id_to_db_int;
-! __dbreg_id_to_fname;
-! __dbreg_init_getpgnos;
-! __dbreg_init_print;
-! __dbreg_init_recover;
-! __dbreg_lazy_id;
-! __dbreg_new_id;
-! __dbreg_open_files;
-! __dbreg_pluck_id;
-! __dbreg_pop_id;
-! __dbreg_push_id;
-! __dbreg_register_getpgnos;
-! __dbreg_register_log;
-! __dbreg_register_print;
-! __dbreg_register_read;
-! __dbreg_register_recover;
-! __dbreg_rem_dbentry;
-! __dbreg_revoke_id;
-! __dbreg_setup;
-! __dbreg_teardown;
-! __db_relink;
-! __db_relink_getpgnos;
-! __db_relink_log;
-! __db_relink_print;
-! __db_relink_read;
-! __db_relink_recover;
-! __db_remove;
-! __db_remove_int;
-! __db_remove_pp;
-! __db_rename;
-! __db_rename_int;
-! __db_rename_pp;
-! __db_rep_enter;
-! __db_rep_exit;
-! __db_ret;
-! __db_retcopy;
-! __db_rmid_to_env;
-! __db_rpath;
-! __db_safe_goff;
-! __db_salvage;
-! __db_salvage_destroy;
-! __db_salvage_duptree;
-! __db_salvage_getnext;
-! __db_salvage_init;
-! __db_salvage_isdone;
-! __db_salvage_markdone;
-! __db_salvage_markneeded;
-! __db_s_done;
-! __db_secondary_corrupt;
-! __db_set_flags;
-! __db_set_lorder;
-! __db_set_pagesize;
-! __db_s_first;
-! __db_SHA1Final;
-! __db_SHA1Init;
-! __db_SHA1Transform;
-! __db_SHA1Update;
-! __db_shalloc;
-! __db_shalloc_dump;
-! __db_shalloc_free;
-! __db_shalloc_init;
-! __db_shalloc_size;
-! __db_shsizeof;
-! __db_s_next;
-! __db_stat;
-! __db_stat_pp;
-! db_strerror;
-! __db_sync;
-! __db_sync_pp;
-! __db_tablesize;
-! __db_tas_mutex_destroy;
-! __db_tas_mutex_init;
-! __db_tas_mutex_lock;
-! __db_tas_mutex_unlock;
-! __db_traverse_big;
-! __db_truncate;
-! __db_truncate_callback;
-! __db_truncate_pp;
-! __db_txn_auto_init;
-! __db_txn_auto_resolve;
-! __db_txnlist_add;
-! __db_txnlist_ckp;
-! __db_txnlist_end;
-! __db_txnlist_find;
-! __db_txnlist_gen;
-! __db_txnlist_init;
-! __db_txnlist_lsnadd;
-! __db_txnlist_lsninit;
-! __db_txnlist_remove;
-! __db_txnlist_update;
-! __db_unknown_flag;
-! __db_unknown_type;
-! __db_unmap_rmid;
-! __db_unmap_xid;
-! __db_upgrade;
-! __db_upgrade_pp;
-! __db_verify;
-! __db_verify_internal;
-! __db_verify_pp;
-! db_version;
-! __db_vrfy_ccclose;
-! __db_vrfy_ccnext;
-! __db_vrfy_ccset;
-! __db_vrfy_childcursor;
-! __db_vrfy_childput;
-! __db_vrfy_common;
-! __db_vrfy_datapage;
-! __db_vrfy_dbinfo_create;
-! __db_vrfy_dbinfo_destroy;
-! __db_vrfy_duptype;
-! __db_vrfy_getpageinfo;
-! __db_vrfy_inpitem;
-! __db_vrfy_meta;
-! __db_vrfy_overflow;
-! __db_vrfy_ovfl_structure;
-! __db_vrfy_pgset;
-! __db_vrfy_pgset_get;
-! __db_vrfy_pgset_inc;
-! __db_vrfy_pgset_next;
-! __db_vrfy_putpageinfo;
-! __db_vrfy_struct_feedback;
-! __db_xa_create;
-! db_xa_switch;
-! __db_xid_to_txn;
-! _DYNAMIC;
-! _edata;
-! _end;
-! __env_openfiles;
-! __env_rep_enter;
-! __env_rep_exit;
-! _fini;
-! __fop_create;
-! __fop_create_getpgnos;
-! __fop_create_log;
-! __fop_create_print;
-! __fop_create_read;
-! __fop_create_recover;
-! __fop_dbrename;
-! __fop_dummy;
-! __fop_file_remove_getpgnos;
-! __fop_file_remove_log;
-! __fop_file_remove_print;
-! __fop_file_remove_read;
-! __fop_file_remove_recover;
-! __fop_file_setup;
-! __fop_init_getpgnos;
-! __fop_init_print;
-! __fop_init_recover;
-! __fop_lock_handle;
-! __fop_read_meta;
-! __fop_remove;
-! __fop_remove_getpgnos;
-! __fop_remove_log;
-! __fop_remove_print;
-! __fop_remove_read;
-! __fop_remove_recover;
-! __fop_remove_setup;
-! __fop_rename;
-! __fop_rename_getpgnos;
-! __fop_rename_log;
-! __fop_rename_print;
-! __fop_rename_read;
-! __fop_rename_recover;
-! __fop_subdb_setup;
-! __fop_write;
-! __fop_write_getpgnos;
-! __fop_write_log;
-! __fop_write_print;
-! __fop_write_read;
-! __fop_write_recover;
-! _GLOBAL_OFFSET_TABLE_;
-! __ham_30_hashmeta;
-! __ham_30_sizefix;
-! __ham_31_hash;
-! __ham_31_hashmeta;
-! __ham_add_dup;
-! __ham_add_el;
-! __ham_add_ovflpage;
-! __ham_call_hash;
-! __ham_c_count;
-! __ham_c_dup;
-! __ham_chgpg_getpgnos;
-! __ham_chgpg_log;
-! __ham_chgpg_print;
-! __ham_chgpg_read;
-! __ham_chgpg_recover;
-! __ham_c_init;
-! __ham_copy_item;
-! __ham_copypage_getpgnos;
-! __ham_copypage_log;
-! __ham_copypage_print;
-! __ham_copypage_read;
-! __ham_copypage_recover;
-! __ham_c_update;
-! __ham_curadj_getpgnos;
-! __ham_curadj_log;
-! __ham_curadj_print;
-! __ham_curadj_read;
-! __ham_curadj_recover;
-! __ham_db_close;
-! __ham_db_create;
-! __ham_del_pair;
-! __ham_dirty_meta;
-! __ham_dpair;
-! __ham_dsearch;
-! __ham_dup_convert;
-! __ham_func2;
-! __ham_func3;
-! __ham_func4;
-! __ham_func5;
-! __ham_get_clist;
-! __ham_get_cpage;
-! __ham_get_meta;
-! __ham_groupalloc_getpgnos;
-! __ham_groupalloc_log;
-! __ham_groupalloc_print;
-! __ham_groupalloc_read;
-! __ham_groupalloc_recover;
-! __ham_init_dbt;
-! __ham_init_getpgnos;
-! __ham_init_print;
-! __ham_init_recover;
-! __ham_insdel_getpgnos;
-! __ham_insdel_log;
-! __ham_insdel_print;
-! __ham_insdel_read;
-! __ham_insdel_recover;
-! __ham_item;
-! __ham_item_first;
-! __ham_item_init;
-! __ham_item_last;
-! __ham_item_next;
-! __ham_item_prev;
-! __ham_item_reset;
-! __ham_lock_bucket;
-! __ham_make_dup;
-! __ham_meta2pgset;
-! __ham_metachk;
-! __ham_metagroup_getpgnos;
-! __ham_metagroup_log;
-! __ham_metagroup_print;
-! __ham_metagroup_read;
-! __ham_metagroup_recover;
-! __ham_mswap;
-! __ham_new_file;
-! __ham_newpage_getpgnos;
-! __ham_newpage_log;
-! __ham_newpage_print;
-! __ham_newpage_read;
-! __ham_newpage_recover;
-! __ham_new_subdb;
-! __ham_next_cpage;
-! __ham_onpage_replace;
-! __ham_open;
-! __ham_pgin;
-! __ham_pgout;
-! __ham_putitem;
-! __ham_quick_delete;
-! __ham_reclaim;
-! __ham_release_meta;
-! __ham_replace_getpgnos;
-! __ham_replace_log;
-! __ham_replace_print;
-! __ham_replace_read;
-! __ham_replace_recover;
-! __ham_replpair;
-! __ham_reputpair;
-! __ham_salvage;
-! __ham_splitdata_getpgnos;
-! __ham_splitdata_log;
-! __ham_splitdata_print;
-! __ham_splitdata_read;
-! __ham_splitdata_recover;
-! __ham_split_page;
-! __ham_stat;
-! __ham_test;
-! __ham_traverse;
-! __ham_truncate;
-! __ham_vrfy;
-! __ham_vrfy_hashing;
-! __ham_vrfy_meta;
-! __ham_vrfy_structure;
-! _init;
-! __lock_addfamilylocker;
-! __lock_cmp;
-! __lock_dbenv_close;
-! __lock_dbenv_create;
-! __lock_dbenv_refresh;
-! __lock_detect;
-! __lock_detect_pp;
-! __lock_downgrade;
-! __lock_dump_region;
-! __lock_expired;
-! __lock_freefamilylocker;
-! __lock_get;
-! __lock_get_list;
-! __lock_getlocker;
-! __lock_get_pp;
-! __lock_id;
-! __lock_id_free;
-! __lock_id_free_pp;
-! __lock_id_pp;
-! __lock_id_set;
-! __lock_inherit_timeout;
-! __lock_lhash;
-! __lock_locker_cmp;
-! __lock_locker_hash;
-! __lock_ohash;
-! __lock_open;
-! __lock_printlock;
-! __lock_promote;
-! __lock_put;
-! __lock_put_pp;
-! __lock_region_destroy;
-! __lock_set_env_timeout;
-! __lock_set_lk_detect;
-! __lock_set_lk_max;
-! __lock_set_lk_max_lockers;
-! __lock_set_lk_max_locks;
-! __lock_set_lk_max_objects;
-! __lock_set_timeout;
-! __lock_stat_pp;
-! __lock_vec;
-! __lock_vec_pp;
-! __log_archive;
-! __log_archive_pp;
-! __log_autoremove;
-! __log_c_close;
-! __log_c_get;
-! log_compare;
-! __log_cursor;
-! __log_cursor_pp;
-! __log_dbenv_create;
-! __log_dbenv_refresh;
-! __log_file_pp;
-! __log_find;
-! __log_flush;
-! __log_flush_int;
-! __log_flush_pp;
-! __log_get_cached_ckp_lsn;
-! __log_is_outdated;
-! __log_name;
-! __log_newfile;
-! __log_open;
-! __log_put;
-! __log_put_pp;
-! __log_region_destroy;
-! __log_rep_put;
-! __log_set_lg_bsize;
-! __log_set_lg_dir;
-! __log_set_lg_max;
-! __log_set_lg_regionmax;
-! __log_stat_pp;
-! __log_txn_lsn;
-! __log_valid;
-! __log_vtruncate;
-! __memp_alloc;
-! __memp_bhfree;
-! __memp_bhwrite;
-! __memp_dbenv_create;
-! __memp_dbenv_refresh;
-! __memp_dump_region;
-! __memp_fclose;
-! __memp_fcreate;
-! __memp_fcreate_pp;
-! __memp_fget;
-! __memp_fget_pp;
-! __memp_fn;
-! __memp_fns;
-! __memp_fopen;
-! __memp_fput;
-! __memp_fput_pp;
-! __memp_fset;
-! __memp_fset_pp;
-! __memp_fsync;
-! __memp_fsync_pp;
-! __memp_get_cachesize;
-! __memp_get_fileid;
-! __memp_get_ftype;
-! __memp_get_refcnt;
-! __memp_last_pgno;
-! __memp_mf_discard;
-! __memp_mf_sync;
-! __memp_nameop;
-! __memp_open;
-! __memp_pg;
-! __memp_pgread;
-! __memp_register;
-! __memp_register_pp;
-! __memp_set_cachesize;
-! __memp_set_clear_len;
-! __memp_set_fileid;
-! __memp_set_flags;
-! __memp_set_ftype;
-! __memp_set_lsn_offset;
-! __memp_set_mp_mmapsize;
-! __memp_set_pgcookie;
-! __memp_stat_hash;
-! __memp_stat_pp;
-! __memp_sync;
-! __memp_sync_int;
-! __memp_sync_pp;
-! __memp_trickle_pp;
-! __mpool_region_destroy;
-! __mp_xxx_fh;
-! __op_rep_enter;
-! __op_rep_exit;
-! __os_abspath;
-! __os_calloc;
-! __os_clock;
-! __os_closehandle;
-! __os_dirfree;
-! __os_dirlist;
-! __os_exists;
-! __os_fileid;
-! __os_free;
-! __os_fs_notzero;
-! __os_fsync;
-! __os_get_errno;
-! __os_get_errno_ret_zero;
-! __os_have_direct;
-! __os_id;
-! __os_io;
-! __os_ioinfo;
-! __os_isroot;
-! __os_malloc;
-! __os_mapfile;
-! __os_open;
-! __os_open_extend;
-! __os_openhandle;
-! __os_r_attach;
-! __os_r_detach;
-! __os_read;
-! __os_realloc;
-! __os_region_unlink;
-! __os_rename;
-! __os_r_sysattach;
-! __os_r_sysdetach;
-! __os_seek;
-! __os_set_errno;
-! __os_sleep;
-! __os_spin;
-! __os_strdup;
-! __os_tmpdir;
-! __os_ufree;
-! __os_umalloc;
-! __os_unlink;
-! __os_unmapfile;
-! __os_urealloc;
-! __os_write;
-! __os_yield;
-! __qam_31_qammeta;
-! __qam_32_qammeta;
-! __qam_add_getpgnos;
-! __qam_add_log;
-! __qam_add_print;
-! __qam_add_read;
-! __qam_add_recover;
-! __qam_append;
-! __qam_c_dup;
-! __qam_c_init;
-! __qam_db_close;
-! __qam_db_create;
-! __qam_delext_getpgnos;
-! __qam_delext_log;
-! __qam_delext_print;
-! __qam_delext_read;
-! __qam_delext_recover;
-! __qam_del_getpgnos;
-! __qam_del_log;
-! __qam_del_print;
-! __qam_del_read;
-! __qam_del_recover;
-! __qam_exid;
-! __qam_extent_names;
-! __qam_fclose;
-! __qam_fprobe;
-! __qam_fremove;
-! __qam_gen_filelist;
-! __qam_incfirst_getpgnos;
-! __qam_incfirst_log;
-! __qam_incfirst_print;
-! __qam_incfirst_read;
-! __qam_incfirst_recover;
-! __qam_init_getpgnos;
-! __qam_init_print;
-! __qam_init_recover;
-! __qam_metachk;
-! __qam_mswap;
-! __qam_mvptr_getpgnos;
-! __qam_mvptr_log;
-! __qam_mvptr_print;
-! __qam_mvptr_read;
-! __qam_mvptr_recover;
-! __qam_nameop;
-! __qam_new_file;
-! __qam_open;
-! __qam_pgin_out;
-! __qam_pitem;
-! __qam_position;
-! __qam_remove;
-! __qam_rename;
-! __qam_salvage;
-! __qam_set_ext_data;
-! __qam_stat;
-! __qam_sync;
-! __qam_truncate;
-! __qam_vrfy_data;
-! __qam_vrfy_meta;
-! __qam_vrfy_structure;
-! __qam_vrfy_walkqueue;
-! __ram_append;
-! __ram_ca;
-! __ram_ca_delete;
-! __ram_c_del;
-! __ram_c_get;
-! __ram_c_put;
-! __ram_getno;
-! __ram_map_flags;
-! __ram_open;
-! __ram_set_flags;
-! __ram_vrfy_leaf;
-! __ram_writeback;
-! __rep_check_alloc;
-! __rep_cmp_vote;
-! __rep_cmp_vote2;
-! __rep_dbenv_close;
-! __rep_dbenv_create;
-! __rep_dbenv_refresh;
-! __rep_elect_done;
-! __rep_elect_master;
-! __rep_get_gen;
-! __rep_grow_sites;
-! __rep_is_client;
-! __rep_new_master;
-! __rep_noarchive;
-! __rep_open;
-! __rep_preclose;
-! __rep_process_message;
-! __rep_process_txn;
-! __rep_region_destroy;
-! __rep_region_init;
-! __rep_send_message;
-! __rep_send_vote;
-! __rep_tally;
-! __txn_abort;
-! __txn_activekids;
-! __txn_begin;
-! __txn_begin_pp;
-! __txn_checkpoint;
-! __txn_checkpoint_pp;
-! __txn_child_getpgnos;
-! __txn_child_log;
-! __txn_child_print;
-! __txn_child_read;
-! __txn_child_recover;
-! __txn_ckp_getpgnos;
-! __txn_ckp_log;
-! __txn_ckp_print;
-! __txn_ckp_read;
-! __txn_ckp_recover;
-! __txn_closeevent;
-! __txn_commit;
-! __txn_compensate_begin;
-! __txn_continue;
-! __txn_dbenv_create;
-! __txn_dbenv_refresh;
-! __txn_discard;
-! __txn_doevents;
-! __txn_force_abort;
-! __txn_getckp;
-! __txn_get_prepared;
-! __txn_id;
-! __txn_id_set;
-! __txn_init_getpgnos;
-! __txn_init_print;
-! __txn_init_recover;
-! __txn_lockevent;
-! __txn_map_gid;
-! __txn_open;
-! __txn_preclose;
-! __txn_prepare;
-! __txn_recover;
-! __txn_recover_pp;
-! __txn_recycle_getpgnos;
-! __txn_recycle_log;
-! __txn_recycle_print;
-! __txn_recycle_read;
-! __txn_recycle_recover;
-! __txn_region_destroy;
-! __txn_regop_getpgnos;
-! __txn_regop_log;
-! __txn_regop_print;
-! __txn_regop_read;
-! __txn_regop_recover;
-! __txn_remevent;
-! __txn_remlock;
-! __txn_remrem;
-! __txn_reset;
-! __txn_restore_txn;
-! __txn_set_timeout;
-! __txn_set_tx_max;
-! __txn_stat_pp;
-! __txn_updateckp;
-! __txn_xa_begin;
-! __txn_xa_regop_getpgnos;
-! __txn_xa_regop_log;
-! __txn_xa_regop_print;
-! __txn_xa_regop_read;
-! __txn_xa_regop_recover;
-! __ua_memcpy;
-! __xa_get_txn;
-!
-! local:
-! *;
-! };
-*** misc/db-4.2.52.NC/db_printlog/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/db_printlog/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,13 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=db_printlog
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= $(SLO)$/db_printlog.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/dbm/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/dbm/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,13 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=dbm
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= $(SLO)$/dbm.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/dbreg/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/dbreg/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,17 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=dbreg
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/dbreg_auto.obj \
-! $(SLO)$/dbreg.obj \
-! $(SLO)$/dbreg_rec.obj \
-! $(SLO)$/dbreg_util.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/dist/Makefile.in Fri Nov 28 19:50:06 2003
---- misc/build/db-4.2.52.NC/dist/Makefile.in Fri Sep 28 11:13:44 2007
-***************
-*** 13,19 ****
- libdir= @libdir@
- docdir= $(prefix)/docs
-
-! dmode= 755
- emode= 555
- fmode= 444
-
---- 13,19 ----
- libdir= @libdir@
- docdir= $(prefix)/docs
-
-! dmode= 775
- emode= 555
- fmode= 444
-
-***************
-*** 57,62 ****
---- 57,63 ----
- CCLINK= @MAKEFILE_CCLINK@
-
- LDFLAGS= @LDFLAGS@
-+ LDFLAGSVERSION= @LDFLAGSVERSION@
- LIBS= @LIBS@
- LIBSO_LIBS= @LIBSO_LIBS@
-
-***************
-*** 644,650 ****
-
- # Shared C library.
- $(libso_target): $(C_OBJS)
-! $(SOLINK) $(SOFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(LIBSO_LIBS)
-
- # Static C++ library named libdb_cxx.a.
- $(libcxx): $(DEF_LIB_CXX)
---- 645,651 ----
-
- # Shared C library.
- $(libso_target): $(C_OBJS)
-! $(SOLINK) $(SOFLAGS) $(LDFLAGS) $(LDFLAGSVERSION) -o $@ $(C_OBJS) $(LIBSO_LIBS)
-
- # Static C++ library named libdb_cxx.a.
- $(libcxx): $(DEF_LIB_CXX)
-*** misc/db-4.2.52.NC/dist/configure Wed Dec 3 22:10:02 2003
---- misc/build/db-4.2.52.NC/dist/configure Fri Sep 28 11:13:08 2007
-***************
-*** 3518,3525 ****
- # Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf
- # compiler configuration macros, because if we don't, they set CFLAGS
- # to no optimization and -g, which isn't what we want.
-! CFLAGS=${CFLAGS-$optimize_def}
-! CXXFLAGS=${CXXFLAGS-"$CFLAGS"}
-
- # If the user wants a debugging environment, add -g to the CFLAGS value.
- #
---- 3518,3527 ----
- # Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf
- # compiler configuration macros, because if we don't, they set CFLAGS
- # to no optimization and -g, which isn't what we want.
-! #CFLAGS=${CFLAGS-$optimize_def}
-! #CXXFLAGS=${CXXFLAGS-"$CFLAGS"}
-! CFLAGS="$CFLAGS $optimize_def"
-! CXXFLAGS="$CXXFLAGS $CFLAGS"
-
- # If the user wants a debugging environment, add -g to the CFLAGS value.
- #
-***************
-*** 5624,5630 ****
- # 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.
-! case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
---- 5626,5632 ----
- # 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.
-! case `$lt_cv_path_LD -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
-***************
-*** 9328,9334 ****
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
---- 9330,9336 ----
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
-***************
-*** 10398,10404 ****
- # yet detect zsh echo's removal of \ escapes. Also zsh mangles
- # `"' quotes if we put them in here... so don't!
- output_verbose_link_cmd='echo'
-! archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
- module_cmds='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
---- 10400,10406 ----
- # yet detect zsh echo's removal of \ escapes. Also zsh mangles
- # `"' quotes if we put them in here... so don't!
- output_verbose_link_cmd='echo'
-! archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name @executable_path/$soname $verstring'
- module_cmds='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-***************
-*** 11180,11186 ****
- # linker, instead of GNU ld. If possible, this setting should
- # overridden to take advantage of the native linker features on
- # the platform it is being used on.
-! archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- fi
-
- # Commands to make compiler produce verbose output that lists
---- 11182,11188 ----
- # linker, instead of GNU ld. If possible, this setting should
- # overridden to take advantage of the native linker features on
- # the platform it is being used on.
-! archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- fi
-
- # Commands to make compiler produce verbose output that lists
-***************
-*** 11671,11679 ****
- icpc)
- # Intel C++
- with_gnu_ld=yes
- archive_cmds_need_lc_CXX=no
-- archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
- whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
---- 11673,11692 ----
- icpc)
- # Intel C++
- with_gnu_ld=yes
-+ # version 8.0 and above of icpc choke on multiply defined symbols
-+ # if we add $predep_objects and $postdep_objects, however 7.1 and
-+ # earlier do not add the objects themselves.
-+ case `$CC -V 2>&1` in
-+ *"Version 7."*)
-+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-+ ;;
-+ *) # Version 8.0 or newer
-+ archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-+ archive_expsym_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-+ ;;
-+ esac
- archive_cmds_need_lc_CXX=no
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
- whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-***************
-*** 12872,12878 ****
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
---- 12885,12891 ----
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
-***************
-*** 15849,15855 ****
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
---- 15862,15868 ----
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
-***************
-*** 18114,18120 ****
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
---- 18127,18133 ----
- ;;
-
- freebsd*)
-! objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
-***************
-*** 31031,31036 ****
---- 31044,31050 ----
- s,@JAR@,$JAR,;t t
- s,@JAVACFLAGS@,$JAVACFLAGS,;t t
- s,@LDFLAGS@,$LDFLAGS,;t t
-+ s,@LDFLAGSVERSION@,$LDFLAGSVERSION,;t t
- s,@LIBJSO_LIBS@,$LIBJSO_LIBS,;t t
- s,@LIBSO_LIBS@,$LIBSO_LIBS,;t t
- s,@LIBTOOL@,$LIBTOOL,;t t
-*** misc/db-4.2.52.NC/dist/ltmain.sh Sat Apr 26 19:45:37 2003
---- misc/build/db-4.2.52.NC/dist/ltmain.sh Fri Sep 28 11:12:11 2007
-***************
-*** 1371,1376 ****
---- 1371,1378 ----
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
-+ # or $ORIGIN altenatively
-+ *\$ORIGIN*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit 1
-***************
-*** 2188,2194 ****
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
-! *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
---- 2190,2196 ----
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
-! # *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
-*** misc/db-4.2.52.NC/env/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/env/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,20 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=env
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/db_salloc.obj \
-! $(SLO)$/db_shash.obj \
-! $(SLO)$/env_file.obj \
-! $(SLO)$/env_method.obj \
-! $(SLO)$/env_open.obj \
-! $(SLO)$/env_recover.obj \
-! $(SLO)$/env_region.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/fileops/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/fileops/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,17 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=fileops
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/fileops_auto.obj \
-! $(SLO)$/fop_basic.obj \
-! $(SLO)$/fop_rec.obj \
-! $(SLO)$/fop_util.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/hash/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/hash/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,27 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=hash
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/hash.obj \
-! $(SLO)$/hash_auto.obj \
-! $(SLO)$/hash_conv.obj \
-! $(SLO)$/hash_dup.obj \
-! $(SLO)$/hash_func.obj \
-! $(SLO)$/hash_meta.obj \
-! $(SLO)$/hash_method.obj \
-! $(SLO)$/hash_open.obj \
-! $(SLO)$/hash_page.obj \
-! $(SLO)$/hash_rec.obj \
-! $(SLO)$/hash_reclaim.obj\
-! $(SLO)$/hash_stat.obj \
-! $(SLO)$/hash_upgrade.obj\
-! $(SLO)$/hash_verify.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/hmac/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/hmac/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,15 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=hmac
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/hmac.obj \
-! $(SLO)$/sha1.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/hsearch/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/hsearch/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,13 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=hsearch
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= $(SLO)$/hsearch.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/lock/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/lock/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,19 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=lock
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/lock.obj \
-! $(SLO)$/lock_deadlock.obj \
-! $(SLO)$/lock_method.obj \
-! $(SLO)$/lock_region.obj \
-! $(SLO)$/lock_stat.obj \
-! $(SLO)$/lock_util.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/log/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/log/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,19 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=log
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/log.obj \
-! $(SLO)$/log_archive.obj \
-! $(SLO)$/log_compare.obj \
-! $(SLO)$/log_get.obj \
-! $(SLO)$/log_method.obj \
-! $(SLO)$/log_put.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,65 ----
-! PRJ=..$/..$/..$/..
-! PRJNAME=libdb42
-! TARGET=libdb42
-! USE_DEFFILE=true
-!
-! .INCLUDE : settings.mk
-! CFLAGS+=-GS -EHsc -Gy
-!
-! #LINKFLAGS!:=$(LINKFLAGS:s/NODEFAULTLIB/NOLOGO/)
-! .IF "$(USE_SHELL)"!="4nt"
-! BUILD_ACTION_SEP=;
-! .ELSE # "$(USE_SHELL)"!="4nt"
-! BUILD_ACTION_SEP=^
-! .ENDIF # "$(USE_SHELL)"!="4nt"
-!
-! CHILDREN=btree clib common cxx db dbm dbreg db_printlog env fileops hash hsearch \
-! lock log mp mutex os os_win32 qam rep txn xa hmac
-!
-! LIB1TARGET= $(SLB)$/$(TARGET).lib
-! LIB1FILES= $(SLB)$/btree.lib \
-! $(SLB)$/clib.lib \
-! $(SLB)$/common.lib \
-! $(SLB)$/cxx.lib \
-! $(SLB)$/db_src.lib \
-! $(SLB)$/db_printlog.lib \
-! $(SLB)$/dbreg.lib \
-! $(SLB)$/dbm.lib \
-! $(SLB)$/env.lib \
-! $(SLB)$/fileops.lib \
-! $(SLB)$/hash.lib \
-! $(SLB)$/hsearch.lib \
-! $(SLB)$/lock.lib \
-! $(SLB)$/log.lib \
-! $(SLB)$/mp.lib \
-! $(SLB)$/mutex.lib \
-! $(SLB)$/os.lib \
-! $(SLB)$/os_win32.lib \
-! $(SLB)$/qam.lib \
-! $(SLB)$/rep.lib \
-! $(SLB)$/txn.lib \
-! $(SLB)$/xa.lib \
-! $(SLB)$/hmac.lib
-!
-! SHL1LIBS=$(LIB1TARGET)
-! SHL1TARGET = $(TARGET)
-! SHL1DEF = $(MISC)$/$(SHL1TARGET).def
-! SHL1IMPLIB = $(SHL1TARGET)
-! SHL1LIBS = $(SLB)$/$(TARGET).lib
-! SHL1DEPN = $(CHILDREN)
-!
-! #DEF1NAME=$(SHL1TARGET)
-! #DEF1EXPORTFILE=$(TARGET).dxp
-!
-! # dmake builds the first rule
-! ALLTAR : $(CHILDREN)
-!
-! $(CHILDREN) .PHONY :
-! cd $@ $(BUILD_ACTION_SEP) $(MAKECMD) subdmake=true $(MFLAGS) $(CALLMACROS)
-!
-! .INCLUDE : target.mk
-!
-! $(MISC)$/$(SHL1TARGET).def : build_win32$/libdb.def
-! $(COPY) $< $@
-! $(DUMPBIN) -DIRECTIVES $(SLB)$/$(TARGET).lib | $(GREP) EXPORT: | $(GREP) -v ",DATA" | $(SED) "s/.*EXPORT://" >> $@
-!
-*** misc/db-4.2.52.NC/mp/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/mp/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,25 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=mp
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/mp_alloc.obj \
-! $(SLO)$/mp_bh.obj \
-! $(SLO)$/mp_fget.obj \
-! $(SLO)$/mp_fopen.obj \
-! $(SLO)$/mp_fput.obj \
-! $(SLO)$/mp_fset.obj \
-! $(SLO)$/mp_method.obj \
-! $(SLO)$/mp_region.obj \
-! $(SLO)$/mp_register.obj \
-! $(SLO)$/mp_stat.obj \
-! $(SLO)$/mp_sync.obj \
-! $(SLO)$/mp_trickle.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/mutex/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/mutex/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,17 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=mutex
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! SOLARINC=-I..$/build_win32 -I..$/ -I$(PSDK_HOME)$/include $(PSDKINC) -I$(COMPATH)$/include
-! .INCLUDE : settings.mk
-!
-!
-! CFLAGS+=-Od
-! SLOFILES= \
-! $(SLO)$/mut_win32.obj \
-! $(SLO)$/mutex.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/os/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/os/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,22 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=os
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/os_alloc.obj \
-! $(SLO)$/os_id.obj \
-! $(SLO)$/os_method.obj \
-! $(SLO)$/os_oflags.obj \
-! $(SLO)$/os_region.obj \
-! $(SLO)$/os_root.obj \
-! $(SLO)$/os_rpath.obj \
-! $(SLO)$/os_tmpdir.obj \
-! $(SLO)$/os_unlink.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/os_win32/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/os_win32/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,29 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=os_win32
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/os_abs.obj \
-! $(SLO)$/os_clock.obj \
-! $(SLO)$/os_config.obj \
-! $(SLO)$/os_dir.obj \
-! $(SLO)$/os_errno.obj \
-! $(SLO)$/os_fid.obj \
-! $(SLO)$/os_fsync.obj \
-! $(SLO)$/os_handle.obj \
-! $(SLO)$/os_map.obj \
-! $(SLO)$/os_open.obj \
-! $(SLO)$/os_rename.obj \
-! $(SLO)$/os_rw.obj \
-! $(SLO)$/os_seek.obj \
-! $(SLO)$/os_sleep.obj \
-! $(SLO)$/os_spin.obj \
-! $(SLO)$/os_stat.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/qam/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/qam/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,23 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=qam
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/qam.obj \
-! $(SLO)$/qam_auto.obj \
-! $(SLO)$/qam_conv.obj \
-! $(SLO)$/qam_files.obj \
-! $(SLO)$/qam_method.obj \
-! $(SLO)$/qam_open.obj \
-! $(SLO)$/qam_rec.obj \
-! $(SLO)$/qam_stat.obj \
-! $(SLO)$/qam_upgrade.obj \
-! $(SLO)$/qam_verify.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/rep/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/rep/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,18 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=rep
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/rep_method.obj \
-! $(SLO)$/rep_record.obj \
-! $(SLO)$/rep_region.obj \
-! $(SLO)$/rep_util.obj
-!
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/txn/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/txn/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,21 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=txn
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/txn.obj \
-! $(SLO)$/txn_auto.obj \
-! $(SLO)$/txn_method.obj \
-! $(SLO)$/txn_rec.obj \
-! $(SLO)$/txn_recover.obj \
-! $(SLO)$/txn_region.obj \
-! $(SLO)$/txn_stat.obj \
-! $(SLO)$/txn_util.obj
-!
-! .INCLUDE : target.mk
-*** misc/db-4.2.52.NC/xa/makefile.mk Fri Sep 28 11:14:47 2007
---- misc/build/db-4.2.52.NC/xa/makefile.mk Fri Sep 28 11:12:11 2007
-***************
-*** 1 ****
-! dummy
---- 1,16 ----
-! PRJ=..$/..$/..$/..$/..
-!
-! PRJNAME=berkeleydb
-! TARGET=xa
-!
-! EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-!
-! .INCLUDE : settings.mk
-!
-! INCPRE+=..$/build_win32 ..$/
-! SLOFILES= \
-! $(SLO)$/xa.obj \
-! $(SLO)$/xa_db.obj \
-! $(SLO)$/xa_map.obj
-!
-! .INCLUDE : target.mk
diff --git a/berkeleydb/db-4.7.25-mingw.patch b/berkeleydb/db-4.7.25-mingw.patch
new file mode 100644
index 000000000000..cd1cf3a1d41d
--- /dev/null
+++ b/berkeleydb/db-4.7.25-mingw.patch
@@ -0,0 +1,184 @@
+--- misc/db-4.7.25.NC/dist/Makefile.in 2008-05-06 12:03:36.000000000 +0900
++++ misc/build/db-4.7.25.NC/dist/Makefile.in 2009-07-11 13:38:07.419875000 +0900
+@@ -44,7 +44,7 @@
+ SOLINK= @MAKEFILE_SOLINK@ @CFLAGS@
+ SOFLAGS= @SOFLAGS@
+ LIBMAJOR= @DB_VERSION_MAJOR@
+-LIBVERSION= @DB_VERSION_MAJOR@.@DB_VERSION_MINOR@
++LIBVERSION= @DB_VERSION_MAJOR@@DB_VERSION_MINOR@
+
+ CPPFLAGS= -I$(builddir) -I$(srcdir) @CPPFLAGS@
+
+@@ -62,18 +62,18 @@
+
+ libdb_base= libdb
+ libdb= $(libdb_base).a
+-libdb_version= $(libdb_base)-$(LIBVERSION).a
+-libso= $(libdb_base)-$(LIBVERSION)@SOSUFFIX@
+-libso_target= $(libdb_base)-$(LIBVERSION).la
++libdb_version= $(libdb_base)$(LIBVERSION).a
++libso= $(libdb_base)$(LIBVERSION)@SOSUFFIX@
++libso_target= $(libdb_base)$(LIBVERSION).la
+ libso_default= $(libdb_base)@SOSUFFIX@
+-libso_major= $(libdb_base)-$(LIBMAJOR)@SOSUFFIX@
++libso_major= $(libdb_base)$(LIBMAJOR)@SOSUFFIX@
+
+ ##################################################
+ # C++ API.
+ #
+ # C++ support is optional, and can be built with static or shared libraries.
+ ##################################################
+-CXXFLAGS= -c $(CPPFLAGS) @CXXFLAGS@
++CXXFLAGS= -c $(SOLARINC) $(CPPFLAGS) -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) @CXXFLAGS@
+ CXX= @MAKEFILE_CXX@
+ CXXLINK= @MAKEFILE_CXXLINK@ @CXXFLAGS@
+ XSOLINK= @MAKEFILE_XSOLINK@ @CXXFLAGS@
+@@ -81,11 +81,11 @@
+
+ libcxx_base= libdb_cxx
+ libcxx= $(libcxx_base).a
+-libcxx_version= $(libcxx_base)-$(LIBVERSION).a
+-libxso= $(libcxx_base)-$(LIBVERSION)@SOSUFFIX@
+-libxso_target= $(libcxx_base)-$(LIBVERSION).la
++libcxx_version= $(libcxx_base)$(LIBVERSION).a
++libxso= $(libcxx_base)$(LIBVERSION)@SOSUFFIX@
++libxso_target= $(libcxx_base)$(LIBVERSION).la
+ libxso_default= $(libcxx_base)@SOSUFFIX@
+-libxso_major= $(libcxx_base)-$(LIBMAJOR)@SOSUFFIX@
++libxso_major= $(libcxx_base)$(LIBMAJOR)@SOSUFFIX@
+
+ ##################################################
+ # Java API.
+@@ -108,12 +108,12 @@
+ libj_jarfile= db.jar
+ libj_exjarfile= dbexamples.jar
+ libjso_base= libdb_java
+-libjso= $(libjso_base)-$(LIBVERSION)@JMODSUFFIX@
+-libjso_static= $(libjso_base)-$(LIBVERSION).a
+-libjso_target= $(libjso_base)-$(LIBVERSION).la
++libjso= $(libjso_base)$(LIBVERSION)@JMODSUFFIX@
++libjso_static= $(libjso_base)$(LIBVERSION).a
++libjso_target= $(libjso_base)$(LIBVERSION).la
+ libjso_default= $(libjso_base)@JMODSUFFIX@
+-libjso_major= $(libjso_base)-$(LIBMAJOR)@JMODSUFFIX@
+-libjso_g= $(libjso_base)-$(LIBVERSION)_g@JMODSUFFIX@
++libjso_major= $(libjso_base)$(LIBMAJOR)@JMODSUFFIX@
++libjso_g= $(libjso_base)$(LIBVERSION)_g@JMODSUFFIX@
+
+ ##################################################
+ # TCL API.
+@@ -123,11 +123,11 @@
+ TCL_INCLUDE_SPEC= @TCL_INCLUDE_SPEC@
+ LIBTSO_LIBS= @LIBTSO_LIBS@ @LIBSO_LIBS@
+ libtso_base= libdb_tcl
+-libtso= $(libtso_base)-$(LIBVERSION)@MODSUFFIX@
+-libtso_static= $(libtso_base)-$(LIBVERSION).a
+-libtso_target= $(libtso_base)-$(LIBVERSION).la
++libtso= $(libtso_base)$(LIBVERSION)@MODSUFFIX@
++libtso_static= $(libtso_base)$(LIBVERSION).a
++libtso_target= $(libtso_base)$(LIBVERSION).la
+ libtso_default= $(libtso_base)@MODSUFFIX@
+-libtso_major= $(libtso_base)-$(LIBMAJOR)@MODSUFFIX@
++libtso_major= $(libtso_base)$(LIBMAJOR)@MODSUFFIX@
+
+ ##################################################
+ # db_dump185 UTILITY
+@@ -756,7 +756,7 @@
+
+ # Shared Java library.
+ $(libjso_target): $(JAVA_OBJS) $(C_OBJS)
+- $(SOLINK) -shrext @JMODSUFFIX@ $(SOFLAGS) $(LDFLAGS) \
++ $(SOLINK) -shrext @JMODSUFFIX@ -add-underscore $(SOFLAGS) $(LDFLAGS) \
+ -o $@ $(JAVA_OBJS) $(C_OBJS) $(LIBJSO_LIBS)
+
+ # Shared Tcl library.
+--- misc/db-4.7.25.NC/dist/configure 2008-05-16 06:12:41.000000000 +0900
++++ misc/build/db-4.7.25.NC/dist/configure 2009-07-11 16:00:39.255625000 +0900
+@@ -9488,7 +9488,7 @@
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
++ archive_cmds='$DLLTOOL $add_underscore --export-all-symbols --dllname $soname --output-lib $lib --output-exp $output_objdir/$soname.exp $libobjs; $CC -shared $output_objdir/$soname.exp $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base ${wl}--image-base=0x10000000'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+@@ -9497,7 +9497,7 @@
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+- $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
++ $DLLTOOL $add_underscore --dllname $soname --output-lib $lib --output-exp $output_objdir/$soname.exp --input-def $output_objdir/$soname.def; $CC -shared $output_objdir/$soname.exp $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base ${wl}--image-base=0x10000000'
+ else
+ ld_shlibs=no
+ fi
+@@ -13680,15 +13680,15 @@
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+- predep_objects_CXX="$p"
++ predep_objects_CXX=`cygpath -m "$p"`
+ else
+- predep_objects_CXX="$predep_objects_CXX $p"
++ predep_objects_CXX="$predep_objects_CXX "`cygpath -m "$p"`
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+- postdep_objects_CXX="$p"
++ postdep_objects_CXX=`cygpath -m "$p"`
+ else
+- postdep_objects_CXX="$postdep_objects_CXX $p"
++ postdep_objects_CXX="$postdep_objects_CXX "`cygpath -m "$p"`
+ fi
+ fi
+ ;;
+@@ -27697,6 +27697,18 @@
+
+
+
++ac_cv_sizeof_char_p=`echo $ac_cv_sizeof_char_p | tr -d '\015'`
++ac_cv_sizeof_unsigned_int=`echo $ac_cv_sizeof_unsigned_int | tr -d '\015'`
++ac_cv_sizeof_unsigned_char=`echo $ac_cv_sizeof_unsigned_char | tr -d '\015'`
++ac_cv_sizeof_unsigned_short=`echo $ac_cv_sizeof_unsigned_short | tr -d '\015'`
++ac_cv_sizeof_unsigned_long=`echo $ac_cv_sizeof_unsigned_long | tr -d '\015'`
++ac_cv_sizeof_unsigned_long_long=`echo $ac_cv_sizeof_unsigned_long_long | tr -d '\015'`
++ac_cv_sizeof_int=`echo $ac_cv_sizeof_int | tr -d '\015'`
++ac_cv_sizeof_char=`echo $ac_cv_sizeof_char | tr -d '\015'`
++ac_cv_sizeof_short=`echo $ac_cv_sizeof_short | tr -d '\015'`
++ac_cv_sizeof_long=`echo $ac_cv_sizeof_long | tr -d '\015'`
++ac_cv_sizeof_long_long=`echo $ac_cv_sizeof_long_long | tr -d '\015'`
++
+ # We look for u_char, u_short, u_int, u_long -- if we can't find them,
+ # we create our own.
+
+--- misc/db-4.7.25.NC/dist/ltmain.sh 2006-06-27 10:03:33.000000000 +0900
++++ misc/build/db-4.7.25.NC/dist/ltmain.sh 2009-07-11 13:38:07.388625000 +0900
+@@ -1103,6 +1103,7 @@
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
++ add_underscore=
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+@@ -1435,6 +1436,11 @@
+ prevarg="$arg"
+
+ case $arg in
++ -add-underscore)
++ add_underscore="--add-underscore"
++ continue
++ ;;
++
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+@@ -4869,7 +4875,7 @@
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+- *cygwin*)
++ *cygwin* | *mingw*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
diff --git a/berkeleydb/db-4.7.25.patch b/berkeleydb/db-4.7.25.patch
new file mode 100644
index 000000000000..30f252ef589c
--- /dev/null
+++ b/berkeleydb/db-4.7.25.patch
@@ -0,0 +1,1052 @@
+--- misc/db-4.7.25.NC/btree/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/btree/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,35 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=btree
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/bt_compact.obj \
++ $(SLO)$/bt_compare.obj \
++ $(SLO)$/bt_conv.obj \
++ $(SLO)$/bt_curadj.obj \
++ $(SLO)$/bt_cursor.obj \
++ $(SLO)$/bt_delete.obj \
++ $(SLO)$/bt_method.obj \
++ $(SLO)$/bt_open.obj \
++ $(SLO)$/bt_put.obj \
++ $(SLO)$/bt_rec.obj \
++ $(SLO)$/bt_reclaim.obj \
++ $(SLO)$/bt_recno.obj \
++ $(SLO)$/bt_rsearch.obj \
++ $(SLO)$/bt_search.obj \
++ $(SLO)$/bt_split.obj \
++ $(SLO)$/bt_stat.obj \
++ $(SLO)$/bt_upgrade.obj \
++ $(SLO)$/bt_verify.obj \
++ $(SLO)$/btree_auto.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/clib/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/clib/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,16 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=clib
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/dbinc ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= $(SLO)$/strsep.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/common/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/common/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,31 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=common
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/crypto_stub.obj \
++ $(SLO)$/db_byteorder.obj \
++ $(SLO)$/db_err.obj \
++ $(SLO)$/db_getlong.obj \
++ $(SLO)$/db_idspace.obj \
++ $(SLO)$/db_log2.obj \
++ $(SLO)$/db_shash.obj \
++ $(SLO)$/dbt.obj \
++ $(SLO)$/mkpath.obj \
++ $(SLO)$/openflags.obj \
++ $(SLO)$/os_method.obj \
++ $(SLO)$/util_cache.obj \
++ $(SLO)$/util_log.obj \
++ $(SLO)$/util_sig.obj \
++ $(SLO)$/zerofill.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/cxx/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/cxx/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,27 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=cxx
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/cxx_db.obj \
++ $(SLO)$/cxx_dbc.obj \
++ $(SLO)$/cxx_dbt.obj \
++ $(SLO)$/cxx_env.obj \
++ $(SLO)$/cxx_except.obj \
++ $(SLO)$/cxx_lock.obj \
++ $(SLO)$/cxx_logc.obj \
++ $(SLO)$/cxx_mpool.obj \
++ $(SLO)$/cxx_multi.obj \
++ $(SLO)$/cxx_seq.obj \
++ $(SLO)$/cxx_txn.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/db/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/db/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,47 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=db_src
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/crdel_auto.obj \
++ $(SLO)$/crdel_rec.obj \
++ $(SLO)$/db.obj \
++ $(SLO)$/db_am.obj \
++ $(SLO)$/db_auto.obj \
++ $(SLO)$/db_cam.obj \
++ $(SLO)$/db_cds.obj \
++ $(SLO)$/db_conv.obj \
++ $(SLO)$/db_dispatch.obj \
++ $(SLO)$/db_dup.obj \
++ $(SLO)$/db_iface.obj \
++ $(SLO)$/db_join.obj \
++ $(SLO)$/db_meta.obj \
++ $(SLO)$/db_method.obj \
++ $(SLO)$/db_open.obj \
++ $(SLO)$/db_overflow.obj \
++ $(SLO)$/db_ovfl_vrfy.obj \
++ $(SLO)$/db_pr.obj \
++ $(SLO)$/db_rec.obj \
++ $(SLO)$/db_reclaim.obj \
++ $(SLO)$/db_remove.obj \
++ $(SLO)$/db_rename.obj \
++ $(SLO)$/db_ret.obj \
++ $(SLO)$/db_setid.obj \
++ $(SLO)$/db_setlsn.obj \
++ $(SLO)$/db_stati.obj \
++ $(SLO)$/db_truncate.obj \
++ $(SLO)$/db_upg.obj \
++ $(SLO)$/db_upg_opd.obj \
++ $(SLO)$/db_vrfy.obj \
++ $(SLO)$/db_vrfyutil.obj
++
++.INCLUDE: target.mk
++
+--- misc/db-4.7.25.NC/db_4_7_gcc4.map 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/db_4_7_gcc4.map 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,147 @@
+-dummy
++DB_4_7 {
++ global:
++__bam_adj_read;
++__bam_cadjust_read;
++__bam_cdel_read;
++__bam_curadj_read;
++__bam_merge_44_read;
++__bam_merge_read;
++__bam_pgno_read;
++__bam_relink_read;
++__bam_relink_43_read;
++__bam_repl_read;
++__bam_root_read;
++__bam_rcuradj_read;
++__bam_rsplit_read;
++__bam_split_read;
++__config_split;
++__crdel_inmem_create_read;
++__crdel_inmem_rename_read;
++__crdel_inmem_remove_read;
++__crdel_metasub_read;
++__db_add_recovery_int;
++__db_addrem_read;
++__db_big_read;
++__db_cksum_read;
++__db_dbm_close;
++__db_dbm_delete;
++__db_dbm_fetch;
++__db_dbm_firstkey;
++__db_dbm_init;
++__db_dbm_nextkey;
++__db_dbm_store;
++__db_debug_read;
++__db_dispatch;
++__db_dumptree;
++__db_hcreate;
++__db_hdestroy;
++__db_hsearch;
++__db_idspace;
++__db_mkpath;
++__db_ndbm_clearerr;
++__db_ndbm_close;
++__db_ndbm_delete;
++__db_ndbm_dirfno;
++__db_ndbm_error;
++__db_ndbm_fetch;
++__db_ndbm_firstkey;
++__db_ndbm_nextkey;
++__db_ndbm_open;
++__db_ndbm_pagfno;
++__db_ndbm_rdonly;
++__db_ndbm_store;
++__db_noop_read;
++__db_pg_alloc_42_read;
++__db_pg_alloc_read;
++__db_pg_free_42_read;
++__db_pg_free_read;
++__db_pg_freedata_42_read;
++__db_pg_freedata_read;
++__db_pg_init_read;
++__db_pg_sort_read;
++__db_pr_callback;
++__db_relink_42_read;
++__db_rpath;
++__db_getlong;
++__db_getulong;
++__db_ovref_read;
++__dbreg_register_read;
++__fop_create_read;
++__fop_file_remove_read;
++__fop_remove_read;
++__fop_rename_read;
++__fop_write_read;
++__ham_chgpg_read;
++__ham_copypage_read;
++__ham_curadj_read;
++__ham_groupalloc_42_read;
++__ham_groupalloc_read;
++__ham_insdel_read;
++__ham_metagroup_42_read;
++__ham_metagroup_read;
++__ham_newpage_read;
++__ham_replace_read;
++__ham_splitdata_read;
++__lock_list_print;
++__os_abspath;
++__os_calloc;
++__os_closehandle;
++__os_ctime;
++__os_dirfree;
++__os_dirlist;
++__os_free;
++__os_fsync;
++__os_getenv;
++__os_mkdir;
++__os_open;
++__os_read;
++__os_rename;
++__os_strdup;
++__os_unlink;
++__os_write;
++__os_yield;
++__os_id;
++__qam_add_read;
++__qam_del_read;
++__qam_delext_read;
++__qam_incfirst_read;
++__qam_mvptr_read;
++__txn_ckp_read;
++__txn_ckp_42_read;
++__txn_child_read;
++__txn_recycle_read;
++__txn_regop_42_read;
++__txn_regop_read;
++__txn_xa_regop_read;
++db_create;
++db_env_create;
++db_env_set_func_close;
++db_env_set_func_dirfree;
++db_env_set_func_dirlist;
++db_env_set_func_exists;
++db_env_set_func_file_map;
++db_env_set_func_free;
++db_env_set_func_fsync;
++db_env_set_func_ftruncate;
++db_env_set_func_ioinfo;
++db_env_set_func_malloc;
++db_env_set_func_open;
++db_env_set_func_pread;
++db_env_set_func_pwrite;
++db_env_set_func_read;
++db_env_set_func_realloc;
++db_env_set_func_region_map;
++db_env_set_func_rename;
++db_env_set_func_seek;
++db_env_set_func_unlink;
++db_env_set_func_write;
++db_env_set_func_yield;
++db_sequence_create;
++db_strerror;
++db_version;
++db_xa_switch;
++log_compare;
++
++ local:
++ *;
++};
+--- misc/db-4.7.25.NC/dbm/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/dbm/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,16 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=dbm
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= $(SLO)$/dbm.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/dbreg/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/dbreg/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,21 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=dbreg
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/dbreg.obj \
++ $(SLO)$/dbreg_auto.obj \
++ $(SLO)$/dbreg_rec.obj \
++ $(SLO)$/dbreg_stat.obj \
++ $(SLO)$/dbreg_util.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/dist/Makefile.in 2008-05-06 05:03:36.000000000 +0200
++++ misc/build/db-4.7.25.NC/dist/Makefile.in 2009-07-21 11:39:25.000000000 +0200
+@@ -13,7 +13,7 @@
+ libdir= @libdir@
+ docdir= $(prefix)/docs
+
+-dmode= 755
++dmode= 775
+ emode= 555
+ fmode= 444
+
+@@ -56,6 +56,7 @@
+ CCLINK= @MAKEFILE_CCLINK@ @CFLAGS@
+
+ LDFLAGS= @LDFLAGS@
++LDFLAGSVERSION= @LDFLAGSVERSION@
+ LIBS= @LIBSO_LIBS@
+ TEST_LIBS= @TEST_LIBS@
+ LIBCSO_LIBS= @LIBCSO_LIBS@ @LIBSO_LIBS@
+@@ -733,7 +734,7 @@
+
+ # Shared C library.
+ $(libso_target): $(C_OBJS)
+- $(SOLINK) $(SOFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(LIBCSO_LIBS)
++ $(SOLINK) $(SOFLAGS) $(LDFLAGS) $(LDFLAGSVERSION) -o $@ $(C_OBJS) $(LIBCSO_LIBS)
+ $(RM) -f $(libdb)
+ $(LN) -s .libs/$(libdb_version) $(libdb)
+
+--- misc/db-4.7.25.NC/dist/configure 2008-05-15 23:12:41.000000000 +0200
++++ misc/build/db-4.7.25.NC/dist/configure 2009-07-21 11:39:25.000000000 +0200
+@@ -3757,8 +3757,10 @@
+ # Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf
+ # compiler configuration macros, because if we don't, they set CFLAGS
+ # to no optimization and -g, which isn't what we want.
+-CFLAGS=${CFLAGS-$optimize_debug}
+-CXXFLAGS=${CXXFLAGS-"$CFLAGS"}
++#CFLAGS=${CFLAGS-$optimize_debug}
++#CXXFLAGS=${CXXFLAGS-"$CFLAGS"}
++CFLAGS="$CFLAGS $optimize_def"
++CXXFLAGS="$CXXFLAGS $CFLAGS"
+
+ # The default compiler is cc (NOT gcc), the default CFLAGS is as specified
+ # above, NOT what is set by AC_PROG_CC, as it won't set optimization flags
+@@ -12566,7 +12568,8 @@
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+- case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
++# case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
++ case `$lt_cv_path_LD -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+@@ -36624,6 +36627,7 @@
+ JAR!$JAR$ac_delim
+ JAVACFLAGS!$JAVACFLAGS$ac_delim
+ LDFLAGS!$LDFLAGS$ac_delim
++LDFLAGSVERSION!$LDFLAGSVERSION$ac_delim
+ LIBCSO_LIBS!$LIBCSO_LIBS$ac_delim
+ LIBJSO_LIBS!$LIBJSO_LIBS$ac_delim
+ LIBSO_LIBS!$LIBSO_LIBS$ac_delim
+@@ -36655,7 +36659,7 @@
+ DB_VERSION_PATCH!$DB_VERSION_PATCH$ac_delim
+ _ACEOF
+
+- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 98; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+--- misc/db-4.7.25.NC/dist/ltmain.sh 2006-06-27 03:03:33.000000000 +0200
++++ misc/build/db-4.7.25.NC/dist/ltmain.sh 2009-07-21 11:39:25.000000000 +0200
+@@ -1700,7 +1700,9 @@
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+- *)
++ # or $ORIGIN altenatively
++ *\$ORIGIN*) ;;
++ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+--- misc/db-4.7.25.NC/env/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/env/makefile.mk 2009-07-21 11:39:25.000000000 +0200
+@@ -1 +1,29 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=env
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/env_alloc.obj \
++ $(SLO)$/env_config.obj \
++ $(SLO)$/env_failchk.obj \
++ $(SLO)$/env_file.obj \
++ $(SLO)$/env_globals.obj \
++ $(SLO)$/env_method.obj \
++ $(SLO)$/env_name.obj \
++ $(SLO)$/env_open.obj \
++ $(SLO)$/env_recover.obj \
++ $(SLO)$/env_region.obj \
++ $(SLO)$/env_register.obj \
++ $(SLO)$/env_sig.obj \
++ $(SLO)$/env_stat.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/fileops/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/fileops/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,20 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=fileops
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/fileops_auto.obj \
++ $(SLO)$/fop_basic.obj \
++ $(SLO)$/fop_rec.obj \
++ $(SLO)$/fop_util.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/hash/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/hash/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,30 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=hash
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/hash.obj \
++ $(SLO)$/hash_auto.obj \
++ $(SLO)$/hash_conv.obj \
++ $(SLO)$/hash_dup.obj \
++ $(SLO)$/hash_func.obj \
++ $(SLO)$/hash_meta.obj \
++ $(SLO)$/hash_method.obj \
++ $(SLO)$/hash_open.obj \
++ $(SLO)$/hash_page.obj \
++ $(SLO)$/hash_rec.obj \
++ $(SLO)$/hash_reclaim.obj \
++ $(SLO)$/hash_stat.obj \
++ $(SLO)$/hash_upgrade.obj \
++ $(SLO)$/hash_verify.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/hmac/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/hmac/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,18 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=hmac
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/hmac.obj \
++ $(SLO)$/sha1.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/hsearch/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/hsearch/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,16 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=hsearch
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= $(SLO)$/hsearch.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/lock/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/lock/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,26 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=lock
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/lock.obj \
++ $(SLO)$/lock_deadlock.obj \
++ $(SLO)$/lock_failchk.obj \
++ $(SLO)$/lock_id.obj \
++ $(SLO)$/lock_list.obj \
++ $(SLO)$/lock_method.obj \
++ $(SLO)$/lock_region.obj \
++ $(SLO)$/lock_stat.obj \
++ $(SLO)$/lock_timer.obj \
++ $(SLO)$/lock_util.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/log/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/log/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,24 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=log
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/log.obj \
++ $(SLO)$/log_archive.obj \
++ $(SLO)$/log_compare.obj \
++ $(SLO)$/log_debug.obj \
++ $(SLO)$/log_get.obj \
++ $(SLO)$/log_method.obj \
++ $(SLO)$/log_put.obj \
++ $(SLO)$/log_stat.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,80 @@
+-dummy
++PRJ=..$/..$/..$/..
++PRJNAME=libdb47
++TARGET=libdb47
++USE_DEFFILE=true
++
++.INCLUDE : settings.mk
++CFLAGS+=-GS -EHsc -Gy
++
++#LINKFLAGS!:=$(LINKFLAGS:s/NODEFAULTLIB/NOLOGO/)
++.IF "$(USE_SHELL)"!="4nt"
++BUILD_ACTION_SEP=;
++.ELSE # "$(USE_SHELL)"!="4nt"
++BUILD_ACTION_SEP=^
++.ENDIF # "$(USE_SHELL)"!="4nt"
++
++CHILDREN= \
++ btree clib common cxx \
++ db dbm dbreg env fileops \
++ hash hmac hsearch lock \
++ log mp mutex os os_windows \
++ qam rep repmgr sequence \
++ txn xa
++
++LIB1TARGET= $(SLB)$/$(TARGET).lib
++LIB1FILES= \
++ $(SLB)$/btree.lib \
++ $(SLB)$/clib.lib \
++ $(SLB)$/common.lib \
++ $(SLB)$/cxx.lib \
++ $(SLB)$/db_src.lib \
++ $(SLB)$/dbm.lib \
++ $(SLB)$/dbreg.lib \
++ $(SLB)$/env.lib \
++ $(SLB)$/fileops.lib \
++ $(SLB)$/hash.lib \
++ $(SLB)$/hmac.lib \
++ $(SLB)$/hsearch.lib \
++ $(SLB)$/lock.lib \
++ $(SLB)$/log.lib \
++ $(SLB)$/mp.lib \
++ $(SLB)$/mutex.lib \
++ $(SLB)$/os.lib \
++ $(SLB)$/os_windows.lib \
++ $(SLB)$/qam.lib \
++ $(SLB)$/rep.lib \
++ $(SLB)$/repmgr.lib \
++ $(SLB)$/sequence.lib \
++ $(SLB)$/txn.lib \
++ $(SLB)$/xa.lib
++
++SHL1LIBS=$(LIB1TARGET)
++SHL1STDLIBS = $(WS2_32LIB) $(ADVAPI32LIB)
++SHL1TARGET = $(TARGET)
++SHL1DEF = $(MISC)$/$(SHL1TARGET).def
++SHL1IMPLIB = $(SHL1TARGET)
++SHL1LIBS = $(SLB)$/$(TARGET).lib
++SHL1DEPN = $(CHILDREN)
++
++#The following line prevents that the resource file is automatically generated
++use_shl_versions:=
++#use the berkeley's resource file
++RCFILES = build_windows$/libdb.rc
++SHL1RES= $(RES)$/libdb47.res
++
++#DEF1NAME=$(SHL1TARGET)
++#DEF1EXPORTFILE=$(TARGET).dxp
++
++# dmake builds the first rule
++ALLTAR : $(CHILDREN)
++
++$(CHILDREN) .PHONY :
++ cd $@ $(BUILD_ACTION_SEP) $(MAKECMD) subdmake=true $(MFLAGS) $(CALLMACROS)
++
++.INCLUDE : target.mk
++
++$(MISC)$/$(SHL1TARGET).def : build_windows$/libdb.def
++ $(COPY) $< $@
++
++ #$(DUMPBIN) -DIRECTIVES $(SLB)$/$(TARGET).lib | $(GREP) EXPORT: | $(GREP) -v ",DATA" | $(SED) "s/.*EXPORT://" >> $@
++
+--- misc/db-4.7.25.NC/mp/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/mp/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,31 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=mp
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/mp_alloc.obj \
++ $(SLO)$/mp_bh.obj \
++ $(SLO)$/mp_fget.obj \
++ $(SLO)$/mp_fmethod.obj \
++ $(SLO)$/mp_fopen.obj \
++ $(SLO)$/mp_fput.obj \
++ $(SLO)$/mp_fset.obj \
++ $(SLO)$/mp_method.obj \
++ $(SLO)$/mp_mvcc.obj \
++ $(SLO)$/mp_region.obj \
++ $(SLO)$/mp_register.obj \
++ $(SLO)$/mp_resize.obj \
++ $(SLO)$/mp_stat.obj \
++ $(SLO)$/mp_sync.obj \
++ $(SLO)$/mp_trickle.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/mutex/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/mutex/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,23 @@
+-dummy
++
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=mutex
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=-I..$/build_windows -I..$/ -I$(COMPATH)$/include $(PSDKINC)
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/mut_alloc.obj \
++ $(SLO)$/mut_failchk.obj \
++ $(SLO)$/mut_method.obj \
++ $(SLO)$/mut_region.obj \
++ $(SLO)$/mut_stat.obj \
++ $(SLO)$/mut_win32.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/os/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/os/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,26 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=os
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/os_abort.obj \
++ $(SLO)$/os_addrinfo.obj \
++ $(SLO)$/os_alloc.obj \
++ $(SLO)$/os_ctime.obj \
++ $(SLO)$/os_pid.obj \
++ $(SLO)$/os_root.obj \
++ $(SLO)$/os_rpath.obj \
++ $(SLO)$/os_stack.obj \
++ $(SLO)$/os_tmpdir.obj \
++ $(SLO)$/os_uid.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/os/os_fsync.c 2008-05-06 05:03:37.000000000 +0200
++++ misc/build/db-4.7.25.NC/os/os_fsync.c 2009-07-21 11:42:03.000000000 +0200
+@@ -79,13 +79,17 @@
+ ret = DB_GLOBAL(j_fsync)(fhp->fd);
+ else {
+ #if defined(F_FULLFSYNC)
++/* When running OOo on MacOS using an NFS mounted disk, fcntl failed with errno
++ ENOTTY (25). Since full sync only works on HFS, FAT and UDF (according to the
++ man page) and also is more time consuming we just use the fallback.
+ RETRY_CHK((fcntl(fhp->fd, F_FULLFSYNC, 0)), ret);
+- /*
++*/ /*
+ * On OS X, F_FULLSYNC only works on HFS+, so we need to fall
+ * back to regular fsync on other filesystems.
+ */
+- if (ret == ENOTSUP)
+- RETRY_CHK((fsync(fhp->fd)), ret);
++/* if (ret == ENOTSUP)
++*/
++ RETRY_CHK((fsync(fhp->fd)), ret);
+ #elif defined(HAVE_QNX)
+ ret = __qnx_fsync(fhp);
+ #elif defined(HAVE_FDATASYNC)
+--- misc/db-4.7.25.NC/os_windows/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/os_windows/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,37 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=os_windows
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/os_abs.obj \
++ $(SLO)$/os_clock.obj \
++ $(SLO)$/os_config.obj \
++ $(SLO)$/os_cpu.obj \
++ $(SLO)$/os_dir.obj \
++ $(SLO)$/os_errno.obj \
++ $(SLO)$/os_fid.obj \
++ $(SLO)$/os_flock.obj \
++ $(SLO)$/os_fsync.obj \
++ $(SLO)$/os_getenv.obj \
++ $(SLO)$/os_handle.obj \
++ $(SLO)$/os_map.obj \
++ $(SLO)$/os_mkdir.obj \
++ $(SLO)$/os_open.obj \
++ $(SLO)$/os_rename.obj \
++ $(SLO)$/os_rw.obj \
++ $(SLO)$/os_seek.obj \
++ $(SLO)$/os_stat.obj \
++ $(SLO)$/os_truncate.obj \
++ $(SLO)$/os_unlink.obj \
++ $(SLO)$/os_yield.obj \
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/qam/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/qam/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,26 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=qam
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/qam.obj \
++ $(SLO)$/qam_auto.obj \
++ $(SLO)$/qam_conv.obj \
++ $(SLO)$/qam_files.obj \
++ $(SLO)$/qam_method.obj \
++ $(SLO)$/qam_open.obj \
++ $(SLO)$/qam_rec.obj \
++ $(SLO)$/qam_stat.obj \
++ $(SLO)$/qam_upgrade.obj \
++ $(SLO)$/qam_verify.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/rep/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/rep/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,27 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=rep
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/rep_auto.obj \
++ $(SLO)$/rep_backup.obj \
++ $(SLO)$/rep_elect.obj \
++ $(SLO)$/rep_lease.obj \
++ $(SLO)$/rep_log.obj \
++ $(SLO)$/rep_method.obj \
++ $(SLO)$/rep_record.obj \
++ $(SLO)$/rep_region.obj \
++ $(SLO)$/rep_stat.obj \
++ $(SLO)$/rep_util.obj \
++ $(SLO)$/rep_verify.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/repmgr/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/repmgr/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,26 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=repmgr
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/repmgr_auto.obj \
++ $(SLO)$/repmgr_elect.obj \
++ $(SLO)$/repmgr_method.obj \
++ $(SLO)$/repmgr_msg.obj \
++ $(SLO)$/repmgr_net.obj \
++ $(SLO)$/repmgr_queue.obj \
++ $(SLO)$/repmgr_sel.obj \
++ $(SLO)$/repmgr_stat.obj \
++ $(SLO)$/repmgr_util.obj \
++ $(SLO)$/repmgr_windows.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/sequence/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/sequence/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,18 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=sequence
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/seq_stat.obj \
++ $(SLO)$/sequence.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/txn/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/txn/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,26 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=txn
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/txn.obj \
++ $(SLO)$/txn_auto.obj \
++ $(SLO)$/txn_chkpt.obj \
++ $(SLO)$/txn_failchk.obj \
++ $(SLO)$/txn_method.obj \
++ $(SLO)$/txn_rec.obj \
++ $(SLO)$/txn_recover.obj \
++ $(SLO)$/txn_region.obj \
++ $(SLO)$/txn_stat.obj \
++ $(SLO)$/txn_util.obj
++
++.INCLUDE : target.mk
++
+--- misc/db-4.7.25.NC/xa/makefile.mk 2009-07-21 11:42:40.000000000 +0200
++++ misc/build/db-4.7.25.NC/xa/makefile.mk 2009-07-21 11:39:26.000000000 +0200
+@@ -1 +1,19 @@
+-dummy
++PRJ=..$/..$/..$/..$/..
++
++PRJNAME=berkeleydb
++TARGET=xa
++
++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
++
++.INCLUDE : settings.mk
++
++INCPRE+=..$/build_windows ..$/
++CDEFS+=-D_WINDLL -DUNICODE -D_UNICODE -DDB_CREATE_DLL -D_WINDOWS
++
++SLOFILES= \
++ $(SLO)$/xa.obj \
++ $(SLO)$/xa_db.obj \
++ $(SLO)$/xa_map.obj
++
++.INCLUDE : target.mk
++
diff --git a/berkeleydb/makefile.mk b/berkeleydb/makefile.mk
index b3cf36e6365d..fd9f4d7f1b64 100644
--- a/berkeleydb/makefile.mk
+++ b/berkeleydb/makefile.mk
@@ -46,25 +46,26 @@ all:
# --- Files --------------------------------------------------------
-TARFILE_NAME=db-4.2.52.NC-custom
-TARFILE_ROOTDIR=db-4.2.52.NC
+TARFILE_NAME=db-4.7.25.NC-custom
+TARFILE_ROOTDIR=db-4.7.25.NC
-ADDITIONAL_FILES= \
- makefile.mk btree$/makefile.mk clib$/makefile.mk common$/makefile.mk \
- cxx$/makefile.mk db$/makefile.mk dbm$/makefile.mk dbreg$/makefile.mk \
- db_printlog$/makefile.mk env$/makefile.mk fileops$/makefile.mk hash$/makefile.mk \
- hmac$/makefile.mk hsearch$/makefile.mk lock$/makefile.mk \
- log$/makefile.mk mp$/makefile.mk mutex$/makefile.mk os$/makefile.mk \
- os_win32$/makefile.mk qam$/makefile.mk rep$/makefile.mk txn$/makefile.mk \
- xa$/makefile.mk libdb42.dxp db_4_2_gcc3.map
+ADDITIONAL_FILES= \
+ makefile.mk btree$/makefile.mk clib$/makefile.mk common$/makefile.mk \
+ cxx$/makefile.mk db$/makefile.mk dbm$/makefile.mk dbreg$/makefile.mk \
+ env$/makefile.mk fileops$/makefile.mk hash$/makefile.mk hmac$/makefile.mk \
+ hsearch$/makefile.mk lock$/makefile.mk log$/makefile.mk mp$/makefile.mk \
+ mutex$/makefile.mk os$/makefile.mk os_windows$/makefile.mk \
+ qam$/makefile.mk rep$/makefile.mk repmgr$/makefile.mk \
+ sequence$/makefile.mk txn$/makefile.mk xa$/makefile.mk \
+ db_4_7_gcc4.map
# not needed for win32. comment out when causing problems...
.IF "$(GUI)$(COM)"=="WNTGCC"
-PATCH_FILES=db-4.2.52-mingw.patch
+PATCH_FILES=db-4.7.25-mingw.patch
.ELSE
-PATCH_FILES=db-4.2.52.patch
+PATCH_FILES=db-4.7.25.patch
.ENDIF
# clean compiler flags
@@ -84,7 +85,7 @@ LDFLAGS:=-Wl,-rpath,'$$$$ORIGIN' -Wl,-z,noexecstack
.EXPORT: LDFLAGS
#The current dir when linking is unxlngi6.pro/misc/build/db-4.2.52.NC/out
# the map file is in unxlngi6.pro/misc/build/db-4.2.52.NC
-LDFLAGSVERSION:= -Wl,--version-script=../db_4_2_gcc3.map
+LDFLAGSVERSION:= -Wl,--version-script=../db_4_7_gcc4.map
.EXPORT: LDFLAGSVERSION
.ENDIF # "$(OS)$(COM)"=="LINUXGCC"
.IF "$(OS)$(COM)"=="SOLARISC52"
@@ -95,6 +96,7 @@ LDFLAGSVERSION:= -Wl,--version-script=../db_4_2_gcc3.map
LDFLAGS:=$(ARCH_FLAGS) -R\''$$$$ORIGIN'\'
.EXPORT: LDFLAGS
.ENDIF # "$(OS)$(COM)"=="SOLARISC52"
+
CONFIGURE_DIR=out
#relative to CONFIGURE_DIR
CONFIGURE_ACTION= \
@@ -108,6 +110,7 @@ CXXFLAGS+:=$(ARCH_FLAGS)
BUILD_DIR=$(CONFIGURE_DIR)
BUILD_DIR_OUT=$(CONFIGURE_DIR)
+
.IF "$(OS)"=="IRIX"
CONFIGURE_ACTION= $(CONFIG_SHELL) ..$/dist$/configure
BUILD_ACTION=gmake
@@ -127,20 +130,34 @@ CONFIGURE_DIR=out
#relative to CONFIGURE_DIR
# TODO needs clean up
CFLAGS+=-nostdinc -D_MT
-CONFIGURE_ACTION=..$/dist$/configure
-CONFIGURE_FLAGS=--enable-cxx --enable-dynamic --enable-shared --build=i586-pc-mingw32 --host=i586-pc-mingw32 --enable-mingw LN_S=ln NM="$(WRAPCMD) nm" OBJDUMP="$(WRAPCMD) objdump" JAVA="$(WRAPCMD) -env java" JAVAC="$(WRAPCMD) -env javac" CFLAGS="$(CFLAGS)" CPPFLAGS="$(INCLUDE)" LIBS="-lmingwthrd" LIBSO_LIBS="-lmingwthrd" LIBJSO_LIBS="-lmingwthrd" LIBXSO_LIBS="-lmingwthrd $(LIBSTLPORT)"
+db_CC=$(CC)
+db_CXX=$(CXX)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+db_CC+=-shared-libgcc
+db_CXX+=-shared-libgcc
+.ENDIF
+db_LDFLAGS=-no-undefined -L$(SOLARVER)/$(INPATH)/lib -L$(SOLARVER)/$(INPATH)/bin
.IF "$(USE_MINGW)"=="cygwin"
-CONFIGURE_FLAGS+=LDFLAGS="-no-undefined -L$(SOLARVER)/$(INPATH)/lib -L$(SOLARVER)/$(INPATH)/bin -L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api -L$(COMPATH)/lib"
-.ELSE
-CONFIGURE_FLAGS+=LDFLAGS="-no-undefined -L$(SOLARVER)/$(INPATH)/lib -L$(SOLARVER)/$(INPATH)/bin -L$(COMPATH)/lib"
+db_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
+.ENDIF
+db_LDFLAGS+=-L$(COMPATH)/lib -L$(MINGW_CLIB_DIR)
+db_LIBS=-lmingwthrd
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+db_LIBS+=-lstdc++_s
.ENDIF
+db_LIBXSO_LIBS=$(LIBSTLPORT) $(db_LIBS)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+db_LIBXSO_LIBS+=-lgcc_s
+.ENDIF
+CONFIGURE_ACTION=..$/dist$/configure
+CONFIGURE_FLAGS=--enable-cxx --enable-dynamic --enable-shared --build=i586-pc-mingw32 --host=i586-pc-mingw32 --enable-mingw CC="$(db_CC)" CXX="$(db_CXX)" LN_S=ln NM="$(WRAPCMD) nm" OBJDUMP="$(WRAPCMD) objdump" JAVA="$(WRAPCMD) -env java" JAVAC="$(WRAPCMD) -env javac" CFLAGS="$(CFLAGS)" CPPFLAGS="$(INCLUDE)" LDFLAGS="$(db_LDFLAGS)" LIBS="$(db_LIBS)" LIBSO_LIBS="$(db_LIBS)" LIBJSO_LIBS="$(db_LIBS)" LIBXSO_LIBS="$(db_LIBXSO_LIBS)"
BUILD_DIR=$(CONFIGURE_DIR)
BUILD_DIR_OUT=$(CONFIGURE_DIR)
BUILD_ACTION=make
-OUT2LIB=$(BUILD_DIR)$/.libs$/libdb*42.a
-OUT2BIN=$(BUILD_DIR)$/.libs$/libdb*42.dll
+OUT2LIB=$(BUILD_DIR)$/.libs$/libdb47.dll.a
+OUT2BIN=$(BUILD_DIR)$/.libs$/libdb47.dll
OUT2INC= \
$(BUILD_DIR)$/db.h
@@ -160,7 +177,7 @@ BUILD_ACTION_SEP=^
BUILD_DIR=
BUILD_ACTION=dmake
-BUILD_DIR_OUT=build_win32
+BUILD_DIR_OUT=build_windows
#OUT2LIB= \
# $(BUILD_DIR_OUT)$/Release$/libdb42.lib
#OUT2BIN=$(BUILD_DIR_OUT)$/Release$/libdb42.dll
diff --git a/berkeleydb/prj/d.lst b/berkeleydb/prj/d.lst
index ba25f1b4b576..78682f825e0b 100644
--- a/berkeleydb/prj/d.lst
+++ b/berkeleydb/prj/d.lst
@@ -1,17 +1,15 @@
mkdir: %_DEST%\inc%_EXT%\berkeleydb
-..\%__SRC%\inc\db_cxx.h %_DEST%\inc%_EXT%\berkeleydb\db_cxx.h
-..\%__SRC%\inc\db_185.h %_DEST%\inc%_EXT%\berkeleydb\db_185.h
..\%__SRC%\inc\db.h %_DEST%\inc%_EXT%\berkeleydb\db.h
-..\%__SRC%\lib\libdb42.lib %_DEST%\lib%_EXT%\libdb42.lib
+..\%__SRC%\lib\libdb47.lib %_DEST%\lib%_EXT%\libdb47.lib
-..\%__SRC%\lib\libdb-4.2.so %_DEST%\lib%_EXT%\libdb-4.2.so
+..\%__SRC%\lib\libdb-4.7.so %_DEST%\lib%_EXT%\libdb-4.7.so
-..\%__SRC%\lib\libdb-4.2.dylib %_DEST%\lib%_EXT%\libdb-4.2.dylib
+..\%__SRC%\lib\libdb-4.7.dylib %_DEST%\lib%_EXT%\libdb-4.7.dylib
-..\%__SRC%\lib\libdb42.a %_DEST%\lib%_EXT%\libdb-4.2.a
+..\%__SRC%\lib\libdb47.dll.a %_DEST%\lib%_EXT%\libdb-4.7.a
+
+..\%__SRC%\bin\libdb47.dll %_DEST%\bin%_EXT%\libdb47.dll
-..\%__SRC%\bin\libdb42.dll %_DEST%\bin%_EXT%\libdb42.dll
-..\%__SRC%\bin\libdb_cxx42.dll %_DEST%\bin%_EXT%\libdb_cxx42.dll
diff --git a/cairo/cairo/makefile.mk b/cairo/cairo/makefile.mk
index 59a3a3538e9d..16dcb4fc0700 100644
--- a/cairo/cairo/makefile.mk
+++ b/cairo/cairo/makefile.mk
@@ -74,10 +74,19 @@ cairo_CPPFLAGS+=$(INCLUDE)
cairo_CFLAGS+=-D_MT
cairo_LDFLAGS+=-no-undefined -L$(ILIB:s/;/ -L/)
cairo_CPPFLAGS+=-nostdinc
+cairo_CC=$(CC)
+cairo_LIBS+=-lmingwthrd
+
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+cairo_CC+=-shared-libgcc
+.ENDIF
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+cairo_LIBS+=-lstdc++_s
+.ENDIF
CONFIGURE_DIR=
CONFIGURE_ACTION=cp $(SRC_ROOT)$/$(PRJNAME)$/cairo$/dummy_pkg_config . && .$/configure
-CONFIGURE_FLAGS=--disable-xlib --disable-ft --disable-pthread --disable-svg --disable-png --enable-gtk-doc=no --enable-test-surfaces=no --enable-static=no --build=i586-pc-mingw32 --host=i586-pc-mingw32 PKG_CONFIG=./dummy_pkg_config LIBS=-lmingwthrd ZLIB3RDLIB=$(ZLIB3RDLIB) COMPRESS=$(cairo_COMPRESS) OBJDUMP="$(WRAPCMD) objdump"
+CONFIGURE_FLAGS=--disable-xlib --disable-ft --disable-pthread --disable-svg --disable-png --enable-gtk-doc=no --enable-test-surfaces=no --enable-static=no --build=i586-pc-mingw32 --host=i586-pc-mingw32 PKG_CONFIG=./dummy_pkg_config CC="$(cairo_CC)" LIBS="$(cairo_LIBS)" ZLIB3RDLIB=$(ZLIB3RDLIB) COMPRESS=$(cairo_COMPRESS) OBJDUMP="$(WRAPCMD) objdump"
BUILD_ACTION=$(GNUMAKE)
BUILD_FLAGS+= -j$(EXTMAXPROCESS)
BUILD_DIR=$(CONFIGURE_DIR)
diff --git a/curl/makefile.mk b/curl/makefile.mk
index f836e046c486..d3ad3ba28bae 100644
--- a/curl/makefile.mk
+++ b/curl/makefile.mk
@@ -87,10 +87,18 @@ OUT2LIB=$(BUILD_DIR)$/.libs$/libcurl$(DLLPOST).3
.IF "$(GUI)"=="WNT"
.IF "$(COM)"=="GCC"
+curl_CC=$(CC)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+curl_CC+=-shared-libgcc
+.ENDIF
+curl_LIBS=-lws2_32 -lwinmm -lmingwthrd
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+curl_LIBS+=-lstdc++_s
+.ENDIF
CONFIGURE_DIR=.$/
#relative to CONFIGURE_DIR
CONFIGURE_ACTION=.$/configure
-CONFIGURE_FLAGS= --without-ssl --enable-ftp --enable-ipv6 --disable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 OBJDUMP="$(WRAPCMD) objdump" CFLAGS=-D_MT LDFLAGS="-L$(ILIB:s/;/ -L/)" LIBS="-lws2_32 -lwinmm -lmingwthrd"
+CONFIGURE_FLAGS= --without-ssl --enable-ftp --enable-ipv6 --disable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 CC="$(curl_CC)" OBJDUMP="$(WRAPCMD) objdump" CFLAGS=-D_MT LDFLAGS="-L$(ILIB:s/;/ -L/)" LIBS="$(curl_LIBS)"
BUILD_DIR=$(CONFIGURE_DIR)$/lib
BUILD_ACTION=make
OUT2BIN=$(BUILD_DIR)$/.libs$/libcurl*.dll
diff --git a/graphite/graphite-2.3.1.patch b/graphite/graphite-2.3.1.patch
new file mode 100644
index 000000000000..badbd92ae740
--- /dev/null
+++ b/graphite/graphite-2.3.1.patch
@@ -0,0 +1,2014 @@
+--- misc/silgraphite-2.3.1/engine/include/graphite/GrCommon.h Thu Jan 22 00:36:40 2009
++++ misc/build/silgraphite-2.3.1/engine/include/graphite/GrCommon.h Sat Aug 22 19:36:32 2009
+@@ -18,6 +18,8 @@
+ #ifndef GRCOMMON_INCLUDED
+ #define GRCOMMON_INCLUDED
+
++#define _SECURE_SCL 0 // to allow GlyphSetIterator to work, which points off the end of a vector
++#define _HAS_ITERATOR_DEBUGGING 0
+
+ // Standard Headers.
+
+@@ -33,6 +35,7 @@
+ #include <vector>
+ #include <algorithm>
+ #include <string>
++///#include <stdexcept> -- possibly needed for std::string Xran and Xlen functions??
+
+ // Uncomment this to allow multiple versions of gr to coexist
+ // in the same program e.g. pangographite with gtk uses namespace gr
+@@ -41,7 +44,7 @@
+ // Provided the client includes GrClient.h first this #define is
+ // picked up by all files.
+
+-//#define gr gr2
++#define gr gr3ooo
+
+ // Project headers
+ #include "GrPlatform.h"
+--- misc/silgraphite-2.3.1/engine/include/graphite/GrMstypes.h Thu Jan 22 00:36:40 2009
++++ misc/build/silgraphite-2.3.1/engine/include/graphite/GrMstypes.h Sat Aug 22 19:36:32 2009
+@@ -24,11 +24,11 @@
+
+ typedef signed long HRESULT;
+
+-inline const long InterlockedIncrement(long *const intr_lck) {
++inline long InterlockedIncrement(long *const intr_lck) {
+ return ++*intr_lck;
+ }
+
+-inline const long InterlockedDecrement(long *const intr_lck) {
++inline long InterlockedDecrement(long *const intr_lck) {
+ return --*intr_lck;
+ }
+
+--- misc/silgraphite-2.3.1/engine/makefile.vc7 Thu Aug 21 16:24:32 2008
++++ misc/build/silgraphite-2.3.1/engine/makefile.vc7 Sat Aug 22 19:36:32 2009
+@@ -48,11 +48,7 @@
+ CPP_DEBUG=/D "TRACING" $(CPP_DEBUG)
+ !ENDIF
+
+-!IF "$(OS)" == "Windows_NT"
+ NULL=
+-!ELSE
+-NULL=nul
+-!ENDIF
+
+ clean :
+ @- rd /s/q .\release_temp
+--- misc/silgraphite-2.3.1/engine/makefile.vc8 Sat Aug 22 21:58:25 2009
++++ misc/build/silgraphite-2.3.1/engine/makefile.vc8 Sat Aug 22 21:57:42 2009
+@@ -2,11 +2,16 @@
+ TARGET=graphite
+
+ CPP=cl.exe
+-CPPFLAGS=/Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c
++### HDU: disabled building with the normal compile flags
++###CPPFLAGS= /Zc:wchar_t- /nologo /W4 /GR /EHsc /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c
++### HDU: because for full binary compatibility with the rest of OOo all compile flags must match exactly
++### which is especially true for template-heavy C++ code with non-default config (e.g. _STLP_DEBUG enabled)
++CPPFLAGS= $(CFLAGS4MSC) /nologo /W4 /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /Fd"$(INTDIR)\\" /FD /c
++
+ # /Wp62
+
+ LINK=link.exe
+-LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib"
++LINK_FLAGS=$(ADDLIBS) kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib"
+
+ BSC32=bscmake.exe
+ BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc"
+@@ -48,11 +52,7 @@
+ CPP_DEBUG=/D "TRACING" $(CPP_DEBUG)
+ !ENDIF
+
+-!IF "$(OS)" == "Windows_NT"
+ NULL=
+-!ELSE
+-NULL=nul
+-!ENDIF
+
+ clean :
+ @- rd /s/q .\release_temp
+@@ -779,7 +779,7 @@
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $?
+
+ "$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp"
+- @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
++ $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
+
+ !ENDIF
+
+--- misc/silgraphite-2.3.1/engine/src/font/FileFont.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/font/FileFont.cpp Sat Aug 22 19:36:32 2009
+@@ -207,11 +207,11 @@
+ cch16 += cch16Used;
+ }
+ // }
+-#else
++#elif 1
+ m_stuFaceName.assign(rgchwFace);
+- // VS 2005 needs this:
+- //for (int cch16 = 0; cch16 < cchw; cch16++)
+- // m_stuFaceName.push_back(rgchwFace[cch16]);
++#else // VS 2005 needs this:
++ for (int cch16 = 0; cch16 < cchw; cch16++)
++ m_stuFaceName.push_back(rgchwFace[cch16]);
+ #endif
+ pTable = readTable(ktiHead, lSize);
+ if (!m_fIsValid || !pTable)
+@@ -233,7 +233,7 @@
+ FileFont::readTable(int /*TableId*/ tid, size_t & size)
+ {
+ const TableId tableId = TableId(tid);
+- bool isValid = true;
++ bool isTableValid = true;
+ size_t lOffset = 0, lSize = 0;
+ if (!m_pTableCache)
+ {
+@@ -245,9 +245,9 @@
+ size = m_pTableCache->getTableSize(tableId);
+ // check whether it is already in the cache
+ if (pTable) return pTable;
+- isValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir,
++ isTableValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir,
+ lOffset, lSize);
+- if (!isValid)
++ if (!isTableValid)
+ return NULL;
+ fseek(m_pfile, lOffset, SEEK_SET);
+ // only allocate if needed
+@@ -255,16 +255,16 @@
+
+ if (!pTable)
+ {
+- isValid = false;
++ isTableValid = false;
+ return NULL;
+ }
+ size_t bytesRead = fread(pTable, 1, lSize, m_pfile);
+- isValid = bytesRead == lSize;
+- if (isValid)
++ isTableValid = bytesRead == lSize;
++ if (isTableValid)
+ {
+- isValid &= TtfUtil::CheckTable(tableId, pTable, lSize);
++ isTableValid &= TtfUtil::CheckTable(tableId, pTable, lSize);
+ }
+- if (!isValid)
++ if (!isTableValid)
+ {
+ return 0;
+ }
+--- misc/silgraphite-2.3.1/engine/src/font/Font.cpp Tue May 20 08:04:16 2008
++++ misc/build/silgraphite-2.3.1/engine/src/font/Font.cpp Sat Aug 22 19:36:33 2009
+@@ -626,7 +626,7 @@
+ Assert(false);
+ m_ifeat = m_cfeat;
+ }
+- else if (m_ifeat + n < 0)
++ else if (static_cast<int>(m_ifeat) + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+@@ -727,7 +727,7 @@
+ Assert(false);
+ m_ifset = m_cfset;
+ }
+- if (m_ifset + n < 0)
++ if (static_cast<int>(m_ifset) + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+@@ -820,7 +820,7 @@
+ Assert(false);
+ m_ilang = m_clang;
+ }
+- else if (m_ilang + n < 0)
++ else if (static_cast<int>(m_ilang) + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+@@ -906,7 +906,7 @@
+ Assert(false);
+ m_ilang = m_clang;
+ }
+- else if (m_ilang + n < 0)
++ else if (static_cast<int>(m_ilang) + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+--- misc/silgraphite-2.3.1/engine/src/font/TtfUtil.cpp Thu Jan 29 10:33:19 2009
++++ misc/build/silgraphite-2.3.1/engine/src/font/TtfUtil.cpp Sat Aug 22 19:36:33 2009
+@@ -492,7 +492,7 @@
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+- return read(((pTable->mac_style) & 0x00000002) != 0);
++ return ((read(pTable->mac_style) & 0x00000002) != 0);
+ }
+
+ /*----------------------------------------------------------------------------------------------
+@@ -1108,8 +1108,8 @@
+ { // loca entries are two bytes and have been divided by two
+ if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed
+ {
+- const uint16 * pTable = reinterpret_cast<const uint16 *>(pLoca);
+- return (read(pTable[nGlyphId]) << 1);
++ const uint16 * pTableLoca = reinterpret_cast<const uint16 *>(pLoca);
++ return (read(pTableLoca[nGlyphId]) << 1);
+ }
+ }
+
+@@ -1117,8 +1117,8 @@
+ { // loca entries are four bytes
+ if (nGlyphId <= (lLocaSize >> 2) - 1)
+ {
+- const uint32 * pTable = reinterpret_cast<const uint32 *>(pLoca);
+- return read(pTable[nGlyphId]);
++ const uint32 * pTableLoca = reinterpret_cast<const uint32 *>(pLoca);
++ return read(pTableLoca[nGlyphId]);
+ }
+ }
+
+@@ -1586,7 +1586,7 @@
+
+ for (size_t i = 0; i < cCompId; i++)
+ {
+- void * pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
++ pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
+ pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+
+@@ -1748,7 +1748,7 @@
+ ----------------------------------------------------------------------------------------------*/
+ bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf,
+ const void * pLoca, size_t lLocaSize, const void * pHead,
+- const int * prgnContourEndPoint, size_t cnEndPoints,
++ const int * /*prgnContourEndPoint*/, size_t /*cnEndPoints*/,
+ int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints)
+ {
+ std::fill_n(prgnX, cnPoints, INT_MAX);
+--- misc/silgraphite-2.3.1/engine/src/painter/SegmentPainter.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/painter/SegmentPainter.cpp Sat Aug 22 19:36:33 2009
+@@ -353,7 +353,7 @@
+ @param bOn - true if we are turning on (ignored in this implementation)
+ ----------------------------------------------------------------------------------------------*/
+ bool SegmentPainter::drawSelectionRange(int ichwAnchor, int ichwEnd,
+- float ydLineTop, float ydLineBottom, bool bOn)
++ float ydLineTop, float ydLineBottom, bool /*bOn*/)
+ {
+ if (g_fDrawing)
+ return true;
+@@ -993,7 +993,7 @@
+ an I-beam (std selection)
+ ----------------------------------------------------------------------------------------------*/
+ void SegmentPainter::CalcOrDrawInsertionPoint(
+- int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit,
++ int ichwIP, bool fAssocPrev, bool /*bOn*/, bool fForceSplit,
+ Rect * prdPrimary, Rect * prdSecondary)
+ {
+ GrResult res = kresOk;
+@@ -1277,7 +1277,7 @@
+ if NULL, do the drawing
+ ----------------------------------------------------------------------------------------------*/
+ void SegmentPainter::InvertIBeam(float xs, float ysTop, float ysBottom,
+- bool fAssocPrev, Rect * prdRet)
++ bool /*fAssocPrev*/, Rect * prdRet)
+ {
+ float xd = ScaleXToDest(xs);
+ float ydTop = ScaleYToDest(ysTop);
+@@ -1675,7 +1675,7 @@
+ }
+
+ bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase,
+- GrSlotOutput * pslout, int islout, bool fBefore)
++ GrSlotOutput * /*pslout*/, int islout, bool fBefore)
+ {
+ // Compare pslout to all the members of the cluster. If it is the minimum or maximum, it
+ // is at an edge.
+@@ -1778,12 +1778,12 @@
+ }
+ for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+- for (int ichw = pslout->FirstUnderlyingComponent(icomp) ;
+- ichw <= pslout->LastUnderlyingComponent(icomp) ;
+- ichw++)
++ for (int ichwTemp = pslout->FirstUnderlyingComponent(icomp) ;
++ ichwTemp <= pslout->LastUnderlyingComponent(icomp) ;
++ ichwTemp++)
+ {
+- if (m_pseg->m_prgiComponent[ichw - m_pseg->m_ichwAssocsMin] == icomp)
+- prgfAllSelected[ichw] = fAll;
++ if (m_pseg->m_prgiComponent[ichwTemp - m_pseg->m_ichwAssocsMin] == icomp)
++ prgfAllSelected[ichwTemp] = fAll;
+ }
+ }
+ }
+@@ -2304,7 +2304,11 @@
+ Assert that there are no overlaps among all the rectangles in the array, which should
+ be the case if AdjustRectsToNotOverlap is working properly.
+ ----------------------------------------------------------------------------------------------*/
++#ifdef _DEBUG
+ void SegmentPainter::AssertNoOverlaps(std::vector<Rect> & vrect)
++#else
++void SegmentPainter::AssertNoOverlaps(std::vector<Rect> & /*vrect*/)
++#endif
+ {
+ #ifdef _DEBUG
+ for (int irect1 = 0; irect1 < signed(vrect.size() - 1); irect1++)
+@@ -2452,7 +2456,11 @@
+ Assert that there are no overlaps among all the rectangles in the array, which should
+ be the case if AdjustRectsToNotOverlap is working properly.
+ ----------------------------------------------------------------------------------------------*/
++#ifdef _DEBUG
+ void SegmentPainter::AssertNoOverlaps(std::vector<LineSeg> & vls)
++#else
++void SegmentPainter::AssertNoOverlaps(std::vector<LineSeg> & /*vls*/)
++#endif
+ {
+ #ifdef _DEBUG
+ for (int ils1 = 0; ils1 < (int)vls.size() - 1; ils1++)
+@@ -2884,7 +2892,7 @@
+ {
+ if (icompNext != icompCurr)
+ {
+- float xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
++ xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
+ if (fMovingRight && xsHorizNext > xsHorizCurr)
+ break;
+ else if (!fMovingRight && xsHorizNext < xsHorizCurr)
+@@ -2996,7 +3004,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Make sure the font is set to use the character properties required by this segment.
+ ----------------------------------------------------------------------------------------------*/
+-void SegmentPainter::SetFontProps(unsigned long clrFore, unsigned long clrBack)
++void SegmentPainter::SetFontProps(unsigned long /*clrFore*/, unsigned long /*clrBack*/)
+ {
+ return;
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/FileInput.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/FileInput.cpp Sat Aug 22 19:36:33 2009
+@@ -80,7 +80,7 @@
+ #ifdef GR_FW
+ bool GrBufferIStream::Open(std::wstring stuFileName, int kMode)
+ #else
+-bool GrBufferIStream::Open(const char * pcFileName, std::ios::openmode kMode)
++bool GrBufferIStream::Open(const char * /*pcFileName*/, std::ios::openmode /*kMode*/)
+ #endif
+ {
+ Assert(false); // use OpenBuffer
+--- misc/silgraphite-2.3.1/engine/src/segment/GrCharStream.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrCharStream.cpp Sat Aug 22 19:36:33 2009
+@@ -417,8 +417,11 @@
+ return true;
+ */
+ }
+-
++#ifdef NDEBUG
++bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType /*utf*/)
++#else
+ bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf)
++#endif
+ {
+ Assert(ichs >= 0);
+ Assert(ichs <= cchs);
+--- misc/silgraphite-2.3.1/engine/src/segment/GrClassTable.h Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrClassTable.h Sat Aug 22 19:36:33 2009
+@@ -54,7 +54,11 @@
+ /*------------------------------------------------------------------------------------------
+ Copy the raw memory into the instance.
+ ------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++ void CopyFrom(data16 * pchwStart, int /*cchw*/)
++#else
+ void CopyFrom(data16 * pchwStart, int cchw)
++#endif
+ {
+ m_cgixBIG = pchwStart[0];
+ m_digixBIGInit = pchwStart[1];
+--- misc/silgraphite-2.3.1/engine/src/segment/GrEngine.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrEngine.cpp Sat Aug 22 19:36:33 2009
+@@ -159,12 +159,12 @@
+ GrEngine::~GrEngine()
+ {
+ DestroyEverything();
+- #ifdef _MSC_VER
+- if (!_CrtCheckMemory())
+- {
+- OutputDebugString(L"bad memory");
+- }
+- #endif
++// #ifdef _MSC_VER
++// if (!_CrtCheckMemory())
++// {
++// OutputDebugString(L"bad memory");
++// }
++// #endif
+ }
+
+ /*----------------------------------------------------------------------------------------------
+@@ -173,12 +173,12 @@
+ void GrEngine::DestroyEverything()
+ {
+ DestroyContents();
+- #ifdef _MSC_VER
+- if (!_CrtCheckMemory())
+- {
+- OutputDebugString(L"bad memory");
+- }
+- #endif
++// #ifdef _MSC_VER
++// if (!_CrtCheckMemory())
++// {
++// OutputDebugString(L"bad memory");
++// }
++// #endif
+
+ m_strCtrlFileReg.erase();
+ m_strCtrlFileBold.erase();
+@@ -417,7 +417,11 @@
+ @return The supported script direction(s). If more than one, the application is
+ responsible for choosing the most appropriate.
+ ----------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * /*prgchwErrMsg*/, int /*cchMaxErrMsg*/)
++#else
+ GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg)
++#endif
+ {
+ ChkGrOutPtr(pgrfsdc);
+ ChkGrArrayArg(prgchwErrMsg, cchMaxErrMsg);
+@@ -789,7 +793,7 @@
+ Record a system error indicating a bad error in rendering using a supposedly valid font.
+ OBSOLETE
+ ----------------------------------------------------------------------------------------------*/
+-void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult res)
++void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult /*res*/)
+ {
+ if (prgchwErrMsg == NULL || cchMax == 0)
+ return;
+@@ -970,7 +974,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Return whether the text is asking for bold and/or italic text.
+ ----------------------------------------------------------------------------------------------*/
+-void GrEngine::GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic)
++void GrEngine::GetStyles(Font * pfont, int /*ichwMin*/, bool * pfBold, bool * pfItalic)
+ {
+ *pfBold = pfont->bold();
+ *pfItalic = pfont->italic();
+@@ -981,7 +985,11 @@
+ Should only be called when we know we are using a base font, or when we are reading
+ the base font to see if it is valid.
+ ----------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++void GrEngine::SwitchGraphicsFont(bool /*fBase*/)
++#else
+ void GrEngine::SwitchGraphicsFont(bool fBase)
++#endif
+ {
+ Assert(!fBase || m_stuBaseFaceName.size() > 0);
+
+@@ -1135,7 +1143,7 @@
+ m_chwJShrink0 = 0xffff;
+ m_chwJStep0 = 0xffff;
+ m_chwJWeight0 = 0xffff;
+- for (int i = 0; i < m_cJLevels; i++)
++ for (i = 0; i < m_cJLevels; i++)
+ {
+ // justification glyph attribute IDs
+ bTmp = grstrm.ReadByteFromFont();
+@@ -1210,10 +1218,12 @@
+
+ // rendering behaviors--ignore for now
+ byte cBehaviors = grstrm.ReadByteFromFont();
+- unsigned int nBehaviors[kMaxRenderingBehavior];
++ int nTmp;
++ //unsigned int nBehaviors[kMaxRenderingBehavior]; -- this big buffer causes a stack overflow in Multiscribe; rework eventually
+ for (i = 0; i < cBehaviors; i++)
+ {
+- nBehaviors[i] = unsigned(grstrm.ReadIntFromFont());
++ //nBehaviors[i] = unsigned(grstrm.ReadIntFromFont());
++ nTmp = unsigned(grstrm.ReadIntFromFont());
+ }
+
+ // linebreak glyph ID
+--- misc/silgraphite-2.3.1/engine/src/segment/GrFSM.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrFSM.cpp Sat Aug 22 19:36:33 2009
+@@ -46,7 +46,7 @@
+ Fill in the FSM by reading from the font stream.
+ Assumes the stream is in the correct position.
+ ----------------------------------------------------------------------------------------------*/
+-bool GrFSM::ReadFromFont(GrIStream & grstrm, int fxdVersion)
++bool GrFSM::ReadFromFont(GrIStream & grstrm, int /*fxdVersion*/)
+ {
+ short snTmp;
+
+@@ -138,7 +138,7 @@
+ Fill in the FSM's state table by reading from the font stream.
+ Assumes the stream is in the correct position.
+ ----------------------------------------------------------------------------------------------*/
+-bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion)
++bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int /*fxdVersion*/)
+ {
+ int cCells = ((m_crow - m_crowFinal) * m_ccol);
+ m_prgrowTransitions = new short[cCells];
+--- misc/silgraphite-2.3.1/engine/src/segment/GrFeature.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrFeature.cpp Sat Aug 22 19:36:33 2009
+@@ -186,7 +186,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Read the languages from the font.
+ ----------------------------------------------------------------------------------------------*/
+-bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int fxdVersion)
++bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int /*fxdVersion*/)
+ {
+ GrIStream & grstrm = *pgrstrm;
+
+@@ -206,13 +206,22 @@
+
+ m_cbOffset0 = (lsbf)(m_prglang[0].cbOffsetBIG);
+
+- Assert((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0); // bogus entry has no settings
++ if ((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0) // bogus entry has no settings
++ {
+ cb = (lsbf)(m_prglang[m_clang].cbOffsetBIG) - m_cbOffset0;
+- Assert(cb % sizeof(FeatSet) == 0); // # of bytes fits nicely into FeatSet class
++ if (cb % sizeof(FeatSet) == 0) // # of bytes fits nicely into FeatSet class
++ {
+ int cfset = cb / sizeof(FeatSet);
+ m_prgfset = new FeatSet[cfset];
+ m_cfset = cfset;
+ grstrm.ReadBlockFromFont(m_prgfset, cb);
++ }
++ else return false;
++ }
++ else
++ {
++ return false;
++ }
+
+ return true;
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/GrPass.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPass.cpp Sat Aug 22 19:36:34 2009
+@@ -279,9 +279,10 @@
+ @param twsh - how we are handling trailing white-space
+ @param pnRet - return value
+ @param pcslotGot - return the number of slots gotten
+- @param pislotFinalBreak - return the index of the final slot, when we are removing
+- the trailing white-space and so the end of the segment
+- will be before the any actual line-break slot
++ @param pislotFinalBreak - index of the final slot (LB or actual glyph), or -1;
++ adjusted when we are removing the trailing white-space and
++ so the end of the segment will be before the any actual
++ line-break slot
+
+ @return kNextPass if we were able to generated the number requested, or processing is
+ complete; otherwise return the number of slots needed from the previous pass.
+@@ -465,7 +466,7 @@
+ void GrBidiPass::ExtendOutput(GrTableManager * ptman,
+ GrSlotStream* psstrmIn, GrSlotStream* psstrmOut,
+ int cslotNeededByNext, TrWsHandling twsh,
+- int * pnRet, int * pcslotGot, int * pislotFinalBreak)
++ int * pnRet, int * pcslotGot, int * /*pislotFinalBreak*/)
+ {
+ Assert(psstrmIn->SlotsToReprocess() == 0);
+
+@@ -776,7 +777,7 @@
+ int GrPass::ExtendFinalOutput(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
+ float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth,
+- bool fHaveLineBreak, bool fMustBacktrack, LineBrk lbMax, TrWsHandling twsh,
++ bool fHaveLineBreak, bool fMustBacktrack, LineBrk /*lbMax*/, TrWsHandling twsh,
+ int * pislotLB, float * pxsWidth)
+ {
+ EngineState * pengst = ptman->State();
+@@ -897,7 +898,11 @@
+ Remove undesirable trailing white-space.
+ ----------------------------------------------------------------------------------------------*/
+ int GrPass::RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut,
++#ifdef NDEBUG
++ TrWsHandling /*twsh*/, int * pislotFinalBreak)
++#else
+ TrWsHandling twsh, int * pislotFinalBreak)
++#endif
+ {
+ EngineState * pengst = ptman->State();
+
+@@ -944,7 +949,7 @@
+ should never be necessary if they've set up their tables right.
+ ----------------------------------------------------------------------------------------------*/
+ void GrPass::CheckInputProgress(GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
+- int islotOrigInput)
++ int /*islotOrigInput*/)
+ {
+ int islotInput = psstrmInput->ReadPosForNextGet();
+ // Assert(islotInput >= islotOrigInput); -- no longer true now that we can back up
+@@ -1752,7 +1757,7 @@
+ ----------------------------------------------------------------------------------------------*/
+ int GrPass::Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+- bool fFirst)
++ bool /*fFirst*/)
+ {
+ // Back up the number of slots required for the longest rule context,
+ // but if we land in the middle of a chunk, go forward to its boundary.
+@@ -1824,7 +1829,7 @@
+ ----------------------------------------------------------------------------------------------*/
+ int GrBidiPass::Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+- bool fFirst)
++ bool /*fFirst*/)
+ {
+ int islotIn;
+ int islotOut;
+@@ -1901,8 +1906,8 @@
+ OBSOLETE
+ ----------------------------------------------------------------------------------------------*/
+ //:Ignore
+-void GrPosPass::Unattach(GrSlotStream * psstrmIn, int islotIn,
+- GrSlotStream * psstrmOut, int islotOut, int islotLB)
++void GrPosPass::Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/,
++ GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/)
+ {
+ // Because this is a positioning pass, there is a one-to-one correspondence between
+ // the slots in the input and the slots in the output. Thus we can make simplifying
+--- misc/silgraphite-2.3.1/engine/src/segment/GrPass.h Thu Aug 21 16:24:32 2008
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPass.h Sat Aug 22 19:36:34 2009
+@@ -197,7 +197,7 @@
+ bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, int nOffset);
+ void InitializeWithNoRules();
+
+- virtual void SetTopDirLevel(int n)
++ virtual void SetTopDirLevel(int /*n*/)
+ { // only GrBidiPass does anything interesting
+ }
+
+@@ -253,13 +253,13 @@
+ m_pzpst->SetResyncSkip(n);
+ }
+
+- virtual void DoCleanUpSegMin(GrTableManager * ptman,
+- GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut)
++ virtual void DoCleanUpSegMin(GrTableManager * /*ptman*/,
++ GrSlotStream * /*psstrmIn*/, int /*islotInitReadPos*/, GrSlotStream * /*psstrmOut*/)
+ {
+ }
+
+- virtual void DoCleanUpSegLim(GrTableManager * ptman, GrSlotStream * psstrmOut,
+- TrWsHandling twsh)
++ virtual void DoCleanUpSegLim(GrTableManager * /*ptman*/, GrSlotStream * /*psstrmOut*/,
++ TrWsHandling /*twsh*/)
+ {
+ }
+
+@@ -383,8 +383,8 @@
+ void MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int islotChunkI, int islotChunkO, int cslotReprocessed);
+
+- virtual void Unattach(GrSlotStream * psstrmIn, int islotIn, // GrPosPass overrides
+- GrSlotStream * psstrmOut, int islotOut, int islotLB)
++ virtual void Unattach(GrSlotStream * /*psstrmIn*/, int /*islotIn*/, // GrPosPass overrides
++ GrSlotStream * /*psstrmOut*/, int /*islotOut*/, int /*islotLB*/)
+ {
+ }
+
+@@ -500,8 +500,8 @@
+
+ protected:
+ // Irrelevant when generating glyphs.
+- virtual void RunRule(GrTableManager *, int ruln,
+- GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
++ virtual void RunRule(GrTableManager *, int /*ruln*/,
++ GrSlotStream * /*psstrmInput*/, GrSlotStream * /*psstrmOutput*/)
+ {
+ Assert(false);
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/GrPassActionCode.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrPassActionCode.cpp Sat Aug 22 19:36:34 2009
+@@ -632,8 +632,13 @@
+ /*----------------------------------------------------------------------------------------------
+ We are finished processing a slot; go on to the next slot, or possibly go backwards.
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoNext(GrTableManager * ptman,
+- int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
++#ifdef NDEBUG
++void GrPass::DoNext(GrTableManager * /*ptman*/,
++ int /*cslot*/, GrSlotStream * /*psstrmIn*/, GrSlotStream * /*psstrmOut*/)
++#else
++void GrPass::DoNext(GrTableManager * /*ptman*/,
++ int cslot, GrSlotStream * /*psstrmIn*/, GrSlotStream * /*psstrmOut*/)
++#endif
+ {
+ gAssert(cslot == 1); // for now anyway
+ }
+@@ -690,6 +695,7 @@
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
++ //gid16 chw; chw = pslotNew->GlyphID();
+ psstrmOut->NextPut(pslotNew);
+ }
+
+@@ -729,6 +735,7 @@
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
++ //gid16 chw; chw = pslotNew->GlyphID();
+ psstrmOut->NextPut(pslotNew);
+ }
+
+@@ -825,7 +832,7 @@
+ @param psstrmIn / Out - input/output streams
+ ----------------------------------------------------------------------------------------------*/
+ void GrPass::DoPutSubs3(GrTableManager * ptman, bool fInserting,
+- int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3,
++ int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int /*cslotSel3*/, int nSelClass3,
+ int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -888,7 +895,7 @@
+ Common part of all the DoPutSubs... methods.
+ ----------------------------------------------------------------------------------------------*/
+ void GrPass::DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement,
+- GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
++ GrSlotStream * /*psstrmIn*/, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
+ bool fAtSegMin, bool fAtSegLim)
+ {
+ EngineState * pengst = ptman->State();
+@@ -915,6 +922,7 @@
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
++ //gid16 chw; chw = pslotNew->GlyphID();
+ psstrmOut->NextPut(pslotNew);
+ }
+
+@@ -924,7 +932,7 @@
+ and its after-assoc to the slot before it. This makes it basically unselectable.
+ OBSOLETE - handled by slot initialization code
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn)
++void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * /*psstrmIn*/)
+ {
+ pslotNew->ClearAssocs();
+ }
+@@ -943,6 +951,7 @@
+ psstrmOut->SetSegLimToWritePos();
+
+ GrSlotState * pslot = psstrmIn->NextGet();
++ //gid16 chw; chw = pslotNew->GlyphID();
+ pslot->MarkDeleted();
+
+ if (ptman->LoggingTransduction())
+@@ -957,7 +966,7 @@
+ @param fInserting - whether current slot was inserted
+ @param psstrmIn / Out - input/output streams
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool fInserting,
++void GrPass::DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool /*fInserting*/,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+ gAssert((unsigned)cnAssocs == vnAssocs.size());
+@@ -997,7 +1006,11 @@
+ @param vnStack - stack to read value from
+ @param psstrmIn / Out - input/output streams
+ ----------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool /*fInserting*/,
++#else
+ void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool fInserting,
++#endif
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -1192,7 +1205,7 @@
+ @param psstrmIn - input stream
+ ----------------------------------------------------------------------------------------------*/
+ void GrPass::DoPushSlotAttr(GrTableManager * ptman,
+- int nSlotRef, bool fInserting,
++ int nSlotRef, bool /*fInserting*/,
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -1236,16 +1249,16 @@
+
+ case kslatAttTo: nVal = pslot->AttachTo(); break;
+ case kslatAttLevel: nVal = pslot->AttachLevel(); break;
+- case kslatAttAtX: nVal = pslot->AttachAtX(ptman, psstrmIn); break;
+ case kslatAttAtY: nVal = pslot->AttachAtY(); break;
+ case kslatAttAtGpt: nVal = pslot->AttachAtGpoint(); break;
+ case kslatAttAtXoff: nVal = pslot->AttachAtXOffset(); break;
+ case kslatAttAtYoff: nVal = pslot->AttachAtYOffset(); break;
+- case kslatAttWithX: nVal = pslot->AttachWithX(ptman, psstrmIn); break;
+ case kslatAttWithY: nVal = pslot->AttachWithY(); break;
+ case kslatAttWithGpt: nVal = pslot->AttachWithGpoint(); break;
+ case kslatAttWithXoff: nVal = pslot->AttachWithXOffset(); break;
+ case kslatAttWithYoff: nVal = pslot->AttachWithYOffset(); break;
++ case kslatAttAtX: nVal = pslot->AttachAtX(ptman, psstrmIn); break;
++ case kslatAttWithX: nVal = pslot->AttachWithX(ptman, psstrmIn); break;
+
+ case kslatMeasureSol: nVal = pslot->MeasureSol(); break;
+ case kslatMeasureEol: nVal = pslot->MeasureEol(); break;
+@@ -1282,7 +1295,7 @@
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
++void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
+ int nGlyphAttr,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -1307,7 +1320,7 @@
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
++void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
+ int nGlyphAttr, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -1337,7 +1350,7 @@
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
++void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
+ int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+@@ -1364,7 +1377,7 @@
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
++void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool /*fInserting*/,
+ int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+@@ -1399,7 +1412,7 @@
+ }
+ else
+ {
+- pslot->CalcCompositeMetrics(ptman, psstrmIn, nAttLevel, true);
++ pslot->CalcCompositeMetrics(ptman, psstrmIn, NULL, nAttLevel, true);
+
+ float xy;
+ switch (gmet)
+@@ -1435,7 +1448,11 @@
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+ ----------------------------------------------------------------------------------------------*/
+-void GrPass::DoPushFeatValue(GrTableManager * ptman, int nSlotRef, bool fInserting,
++#ifdef NDEBUG
++void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool /*fInserting*/,
++#else
++void GrPass::DoPushFeatValue(GrTableManager * /*ptman*/, int nSlotRef, bool fInserting,
++#endif
+ int nFeat, std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+ {
+ gAssert(!fInserting);
+--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.cpp Sat Aug 22 19:36:34 2009
+@@ -261,7 +261,7 @@
+ root or attached leaf slots.
+ OBSOLETE
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotState::FixAttachmentTree(GrSlotState * pslotOld)
++void GrSlotState::FixAttachmentTree(GrSlotState * /*pslotOld*/)
+ {
+ #if 0
+ pslotOld->m_vpslotAttLeaves.CopyTo(m_vpslotAttLeaves);
+@@ -524,13 +524,13 @@
+ GrSlotState * pslot;
+ if (HasComponents())
+ {
+- for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++)
++ for (int iLigComponent = 0; iLigComponent < m_cnCompPerLig; iLigComponent++)
+ {
+- pslot = CompRefSlot(iComponent);
++ pslot = CompRefSlot(iLigComponent);
+ if (pslot)
+ {
+ Assert(PassModified() >= pslot->PassModified());
+- pslot->AllComponentRefs(vichw, vicomp, iComponent);
++ pslot->AllComponentRefs(vichw, vicomp, iLigComponent);
+ }
+ }
+ }
+@@ -1024,7 +1024,7 @@
+ NOTE: the caller is responsible to zap the cached positions of following glyphs
+ in the stream.
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotState::AttachToRoot(GrTableManager * ptman, GrSlotStream * psstrm,
++void GrSlotState::AttachToRoot(GrTableManager * /*ptman*/, GrSlotStream * psstrm,
+ GrSlotState * pslotNewRoot)
+ {
+ GrSlotState * pslotOldRoot = (m_dislotRootFixed == 0) ?
+@@ -1063,7 +1063,7 @@
+
+ float xsWidth, xsVisWidth;
+ if (m_xsPositionX == kNegInfFloat || m_ysPositionY == kNegInfFloat)
+- ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, &xsWidth, &xsVisWidth);
++ ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, true, &xsWidth, &xsVisWidth);
+
+ *pmXPos = ptman->LogToEmUnits(m_xsPositionX);
+ *pmYPos = ptman->LogToEmUnits(m_ysPositionY);
+@@ -1077,7 +1077,7 @@
+ {
+ Assert(m_dislotRootFixed == m_srAttachTo);
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
+- CalcRootMetrics(ptman, psstrm, kPosInfinity);
++ CalcRootMetrics(ptman, psstrm, NULL, kPosInfinity);
+ if (pslotRoot)
+ pslotRoot->AdjustRootMetrics(ptman, psstrm);
+ }
+@@ -1086,13 +1086,15 @@
+ Calculate the composite metrics for this slot.
+
+ @param psstrm - stream for which we are calculating it
++ @param psstrmNext - because when processing in the middle of a pass, we may need to
++ get the slot from the following (output) stream
+ @param nLevel - attachment level we are asking for; kPosInifinity means all levels
+ @param fThorough - true: do a thorough recalculation; false: don't recalculate
+ metrics for leaves (are they assumed to be accurate???)
+ --currently not used
+ ----------------------------------------------------------------------------------------------*/
+ void GrSlotState::CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
+- int nLevel, bool fThorough)
++ GrSlotStream * psstrmNext, int nLevel, bool fThorough)
+ {
+ if (m_nCompositeLevel == nLevel)
+ return;
+@@ -1101,19 +1103,38 @@
+ {
+ Assert(m_dislotRootFixed == m_srAttachTo);
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
++ // Kludge to handle the fact that we might have gotten the root from the wrong stream.
++ // Calling MidPassSlotAt finds the right one.
++ if (psstrmNext && pslotRoot)
++ {
++ int islotRoot = pslotRoot->PosPassIndex();
++ pslotRoot = psstrm->MidPassSlotAt(islotRoot, psstrmNext);
++ }
+
+ InitMetrics(ptman, pslotRoot);
+
+ for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++)
+ {
+- GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]);
++ GrSlotState * pslotLeaf;
++ if (psstrmNext)
++ {
++ // Calculating a position in the middle of processing a pass.
++ pslotLeaf = psstrm->MidPassSlotAt(PosPassIndex() + m_vdislotAttLeaves[islot],
++ psstrmNext);
++ }
++ else
++ {
++ // Calculating the final position.
++ pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]);
++ }
++
+ if (pslotLeaf->AttachLevel() <= nLevel)
+- pslotLeaf->CalcCompositeMetrics(ptman, psstrm, nLevel, fThorough);
++ pslotLeaf->CalcCompositeMetrics(ptman, psstrm, psstrmNext, nLevel, fThorough);
+ else
+ // this slot will be ignored in the composite metrics
+ pslotLeaf->ZapRootMetrics();
+ }
+- CalcRootMetrics(ptman, psstrm, nLevel);
++ CalcRootMetrics(ptman, psstrm, psstrmNext, nLevel);
+
+ m_nCompositeLevel = nLevel;
+ }
+@@ -1129,25 +1150,33 @@
+ /*----------------------------------------------------------------------------------------------
+ Calculate the metrics for this node and all its leaf nodes.
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotState::CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm, int nLevel)
++void GrSlotState::CalcRootMetrics(GrTableManager * /*ptman*/, GrSlotStream * psstrm,
++ GrSlotStream * psstrmNext, int nLevel)
+ {
+ for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++)
+ {
+- GrSlotState * pslot = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]);
+- if (pslot->AttachLevel() > nLevel)
++ GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]);
++ // Kludge to handle the fact that we might have gotten the leaf from the wrong stream.
++ // Calling MidPassSlotAt finds the right one.
++ if (psstrmNext)
++ {
++ int islot = pslotLeaf->PosPassIndex();
++ pslotLeaf = psstrm->MidPassSlotAt(islot, psstrmNext);
++ }
++ if (pslotLeaf->AttachLevel() > nLevel)
+ continue;
+
+- m_xsClusterXOffset = min(m_xsClusterXOffset, pslot->m_xsClusterXOffset);
+- if (!pslot->m_fIgnoreAdvance)
++ m_xsClusterXOffset = min(m_xsClusterXOffset, pslotLeaf->m_xsClusterXOffset);
++ if (!pslotLeaf->m_fIgnoreAdvance)
+ {
+ m_xsClusterAdv = max(
+ m_xsClusterAdv,
+- pslot->m_xsClusterAdv + m_xsRootShiftX);
++ pslotLeaf->m_xsClusterAdv + m_xsRootShiftX);
+ }
+- m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslot->m_xsClusterBbLeft);
+- m_xsClusterBbRight = max(m_xsClusterBbRight, pslot->m_xsClusterBbRight);
+- m_ysClusterBbTop = max(m_ysClusterBbTop, pslot->m_ysClusterBbTop);
+- m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslot->m_ysClusterBbBottom);
++ m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslotLeaf->m_xsClusterBbLeft);
++ m_xsClusterBbRight = max(m_xsClusterBbRight, pslotLeaf->m_xsClusterBbRight);
++ m_ysClusterBbTop = max(m_ysClusterBbTop, pslotLeaf->m_ysClusterBbTop);
++ m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslotLeaf->m_ysClusterBbBottom);
+ }
+ }
+
+@@ -1263,7 +1292,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Y-offsets of a single glyph relative to the previous advance position.
+ ----------------------------------------------------------------------------------------------*/
+-float GrSlotState::GlyphYOffset(GrSlotStream * psstrm)
++float GrSlotState::GlyphYOffset(GrSlotStream * /*psstrm*/)
+ {
+ return m_ysOffsetY;
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotState.h Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotState.h Sat Aug 22 19:36:34 2009
+@@ -308,7 +308,11 @@
+ {
+ return m_islotPosPass;
+ }
++#ifdef NDEBUG
++ void SetPosPassIndex(int islot, bool /*fInputToPosPass1*/)
++#else
+ void SetPosPassIndex(int islot, bool fInputToPosPass1)
++#endif
+ {
+ // If we're resetting it, it should be to the same value as before:
+ Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot);
+@@ -386,12 +390,12 @@
+ return (IsInitialLineBreak(chwLB) || IsFinalLineBreak(chwLB));
+ //return (m_chwGlyphID == chwLB); // TODO: remove
+ }
+- bool IsInitialLineBreak(gid16 chwLB)
++ bool IsInitialLineBreak(gid16 /*chwLB*/)
+ {
+ return (m_spsl == kspslLbInitial);
+ //return (IsLineBreak(chwLB) && m_fInitialLB == true); // TODO: remove
+ }
+- bool IsFinalLineBreak(gid16 chwLB)
++ bool IsFinalLineBreak(gid16 /*chwLB*/)
+ {
+ return (m_spsl == kspslLbFinal);
+ //return (IsLineBreak(chwLB) && m_fInitialLB == false); // TODO: remove
+@@ -475,7 +479,7 @@
+ return m_mAttachAtX;
+ }
+
+- int AttachWithX(GrTableManager * ptman, GrSlotStream * psstrm)
++ int AttachWithX(GrTableManager * /*ptman*/, GrSlotStream * /*psstrm*/)
+ {
+ if (m_mAttachAtX == kNotYetSet)
+ {
+@@ -615,7 +619,7 @@
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis);
+
+ void CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
+- int nLevel, bool fThorough = false);
++ GrSlotStream * psstrmNext, int nLevel, bool fThorough = false);
+
+ void Position(GrTableManager * ptman,
+ GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos);
+@@ -646,7 +650,7 @@
+ {
+ return ClusterBbLeft(psstrm) + xs;
+ }
+- float ClusterRsb(GrSlotStream * psstrm, float xs)
++ float ClusterRsb(GrSlotStream * /*psstrm*/, float xs)
+ {
+ return ClusterAdvWidthFrom(xs) - ClusterBbRightFrom(xs);
+ }
+@@ -668,19 +672,19 @@
+ {
+ return ClusterBbRightFrom(Base(psstrm)->ClusterRootOffset());
+ }
+- float ClusterBbTop(GrSlotStream * psstrm)
++ float ClusterBbTop(GrSlotStream * /*psstrm*/)
+ {
+ return m_ysClusterBbTop;
+ }
+- float ClusterBbBottom(GrSlotStream * psstrm)
++ float ClusterBbBottom(GrSlotStream * /*psstrm*/)
+ {
+ return m_ysClusterBbBottom;
+ }
+- float ClusterBbWidth(GrSlotStream * psstrm)
++ float ClusterBbWidth(GrSlotStream * /*psstrm*/)
+ {
+ return m_xsClusterBbRight - m_xsClusterBbLeft + 1;
+ }
+- float ClusterBbHeight(GrSlotStream * psstrm)
++ float ClusterBbHeight(GrSlotStream * /*psstrm*/)
+ {
+ return m_ysClusterBbTop - m_ysClusterBbBottom + 1;
+ }
+@@ -990,7 +994,8 @@
+ void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
+ void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
+ void InitRootMetrics(GrTableManager * ptman);
+- void CalcRootMetrics(GrTableManager * ptman, GrSlotStream *, int nLevel);
++ void CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
++ GrSlotStream * psstrmNext, int nLevel);
+ void AttachToRoot(GrTableManager * ptman, GrSlotStream *, GrSlotState * pslotNewRoot);
+ void AttachLogUnits(GrTableManager * ptman,
+ GrSlotState * pslotRoot,
+--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotStream.cpp Wed Feb 04 07:53:26 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotStream.cpp Sat Aug 22 19:36:34 2009
+@@ -189,12 +189,16 @@
+ stream position when the rule is being run.
+
+ @param dislot - how far back to peek before the write position
+- when the rule started; a negative number
++ WHEN THE RULE STARTED; a negative number
+ (NOTE: the current write position is irrelevant)
+ @param fNullOkay - true if it's okay to return NULL in the situation where we're asking
+ for something before the beginning of the stream
+ ----------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++GrSlotState * GrSlotStream::PeekBack(int dislot, bool /*fNullOkay*/)
++#else
+ GrSlotState * GrSlotStream::PeekBack(int dislot, bool fNullOkay)
++#endif
+ {
+ Assert(dislot < 0);
+ if (dislot < m_islotRuleStartWrite * -1)
+@@ -1104,6 +1108,7 @@
+ case kdircRLO:
+ case kdircRLE:
+ case kdircPdfR:
++ case kdircRlb:
+ return true;
+
+ case kdircNeutral:
+@@ -1212,7 +1217,7 @@
+ return true;
+
+ float xsWidth, xsVisWidth;
+- ptman->CalcPositionsUpTo(m_ipass, NULL, &xsWidth, &xsVisWidth);
++ ptman->CalcPositionsUpTo(m_ipass, NULL, false, &xsWidth, &xsVisWidth);
+
+ *pxsWidth = (fIgnoreTrailingWS || twsh == ktwshOnlyWs) ? xsVisWidth : xsWidth;
+ return (*pxsWidth < xsSpaceAllotted);
+@@ -1322,7 +1327,7 @@
+ @param islotMin - first slot that is officially part of the segment (after initial LB)
+ ----------------------------------------------------------------------------------------------*/
+ int GrSlotStream::MakeSegmentBreak(GrTableManager * ptman,
+- int islotPrevBreak, bool fInsertedLB, int islotStartTry,
++ int /*islotPrevBreak*/, bool /*fInsertedLB*/, int islotStartTry,
+ LineBrk lb, TrWsHandling twsh, int islotMin,
+ LineBrk * plbNextToTry)
+ {
+@@ -1576,7 +1581,11 @@
+ Return the break weight of the given slot, which should be a line-break.
+ OBSOLETE??
+ ----------------------------------------------------------------------------------------------*/
++#ifdef NDEBUG
++LineBrk GrSlotStream::BreakWeightAt(gid16 /*chwLB*/, int islot)
++#else
+ LineBrk GrSlotStream::BreakWeightAt(gid16 chwLB, int islot)
++#endif
+ {
+ GrSlotState * pslot = GetSlotAt(islot);
+ Assert(pslot->IsLineBreak(chwLB));
+@@ -1769,7 +1778,7 @@
+ @param fBackingUp - this chunk results in the stream position moving backwards,
+ so clear anything we're backing over
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int islotInputLim,
++void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int /*islotInputLim*/,
+ bool fSkipChunkStart, bool fBackingUp)
+ {
+ Assert(AssertValid());
+@@ -1828,7 +1837,7 @@
+ @param fBackingUp - this chunk results in the stream position moving backwards,
+ so clear anything we're backing over
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int islotOutputLim,
++void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int /*islotOutputLim*/,
+ bool fSkipChunkStart, int cslotReprocess, bool fBackingUp)
+ {
+ Assert(AssertValid());
+@@ -1863,7 +1872,7 @@
+ Ensure that the chunk maps for a pair of streams match properly. The recipient is
+ the input stream.
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::AssertChunkMapsValid(GrSlotStream * psstrmOut)
++void GrSlotStream::AssertChunkMapsValid(GrSlotStream * /*psstrmOut*/)
+ {
+ #ifdef _DEBUG
+ GrSlotStream * psstrmIn = this;
+@@ -1915,7 +1924,7 @@
+ Ensure that corresponding items in the streams of a positioning pass have matching
+ stream indices. The recipient is the output stream.
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * psstrmIn)
++void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * /*psstrmIn*/)
+ {
+ #ifdef _DEBUG
+ if (!GotIndexOffset())
+@@ -1939,7 +1948,7 @@
+ in the output stream. (Currently the compiler ensures this by making it an error
+ to write rules that don't do this.)
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::AssertAttachmentsInOutput(int islotMin, int islotLim)
++void GrSlotStream::AssertAttachmentsInOutput(int /*islotMin*/, int /*islotLim*/)
+ {
+ #ifdef _DEBUG
+ for (int islot = islotMin; islot < islotLim; islot++)
+@@ -2007,7 +2016,7 @@
+ Record the number of slots in the stream that are previous to the official start of the
+ segment.
+ ----------------------------------------------------------------------------------------------*/
+-void GrSlotStream::CalcIndexOffset(GrTableManager * ptman)
++void GrSlotStream::CalcIndexOffset(GrTableManager * /*ptman*/)
+ {
+ if (GotIndexOffset())
+ return; // already figured it
+@@ -2203,6 +2212,21 @@
+ }
+
+ /*----------------------------------------------------------------------------------------------
++ In the middle of running a pass, return the given slot to use in processing.
++ Read it from the reprocess buffer if appropriate, or for slots previous to the current
++ position, read from the output stream (psstrmNext).
++
++ psstrmNext may be NULL when processing is complete, therefore we only have one stream to
++ deal with.
++----------------------------------------------------------------------------------------------*/
++GrSlotState * GrSlotStream::MidPassSlotAt(int islot, GrSlotStream * psstrmNext)
++{
++ int islotInput = islot - ReadPosForNextGet() + 1; // +1 because RuleInputSlot takes 0 to mean the previously read slot
++ GrSlotState * pslot = RuleInputSlot(islotInput, psstrmNext);
++ return pslot;
++}
++
++/*----------------------------------------------------------------------------------------------
+ Return the "current" input item from the rule's perspective, ie, the last slot read.
+ So dislotOffset = 0 means not the slot at the read position but one slot earlier.
+
+@@ -2214,7 +2238,6 @@
+ @param fNullOkay - true if it's okay to return NULL in the situation where we're asking
+ for something before the beginning of the stream
+ ----------------------------------------------------------------------------------------------*/
+-
+ GrSlotState * GrSlotStream::RuleInputSlot(int dislotOffset, GrSlotStream * psstrmOutput,
+ bool fNullOkay)
+ {
+@@ -2244,8 +2267,10 @@
+
+ if (cslotOffsetBack >= cslotPostReproc + cslotValidReproc)
+ {
+- // Read from the output stream.
+- int dislotTmp = dislotOffset - 1 + cslotPostReproc + cslotValidReproc;
++ // Read from the output stream. (Remember that PeekBack works relative to
++ // the rule-start write position, not the current write position.)
++ int dislotTmp = dislotOffset - 1 + cslotPostReproc
++ + cslotValidReproc - SlotsToReprocess();
+ Assert(dislotTmp < 0);
+ return psstrmOutput->PeekBack(dislotTmp);
+ }
+@@ -2253,7 +2278,7 @@
+ {
+ if (m_islotReprocPos > -1)
+ {
+- // Current read pos is inside reprocess buffer.
++ // Current read pos could be inside reprocess buffer.
+ Assert(cslotPostReproc == 0);
+ int islotStartReadReprocBuf = m_vpslotReproc.size() - cslotValidReproc;
+ Assert(islotStartReadReprocBuf >= 0);
+@@ -2342,9 +2367,10 @@
+ else if (pslotAfter)
+ pslot->Associate(pslotAfter);
+ else
++ {
+ // Weird, but can happen with an empty segment.
+ Warn("No assocations");
+-
++ }
+ // Assert(pslot->m_vpslotAssoc.Size() > 0);
+ pslot->m_fNeutralAssocs = true;
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/GrSlotStream.h Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrSlotStream.h Sat Aug 22 19:36:34 2009
+@@ -107,7 +107,7 @@
+ ReleaseSlots(0, m_vpslot.size());
+ }
+
+- void ReleaseSlots(int islotMin, int islotLim)
++ void ReleaseSlots(int /*islotMin*/, int /*islotLim*/)
+ {
+ // A slot stream is responsible for deleting the slot states that it created,
+ // that is, the ones whose modified tag equals this stream's pass index.
+@@ -182,6 +182,7 @@
+ return Peek(islot - ReadPosForNextGet());
+ }
+
++ // Return the functional read position, taking into account the reprocess buffer.
+ int ReadPosForNextGet()
+ {
+ return ReadPos() - SlotsToReprocess();
+@@ -260,12 +261,16 @@
+
+ void MarkFullyWritten();
+
++#ifdef NDEBUG
++ void SetSegMin(int islot, bool /*fAdjusting*/ = false)
++#else
+ void SetSegMin(int islot, bool fAdjusting = false)
++#endif
+ {
+ Assert(fAdjusting || m_islotSegMin == -1 || m_islotSegMin == islot);
+ m_islotSegMin = islot;
+ }
+- void SetSegMinToWritePos(bool fMod = true)
++ void SetSegMinToWritePos(bool /*fMod*/ = true)
+ {
+ if (m_islotSegMin == -1)
+ m_islotSegMin = m_islotWritePos;
+@@ -456,6 +461,7 @@
+ }
+ }
+
++ GrSlotState * MidPassSlotAt(int islot, GrSlotStream * psstrmNext = NULL);
+ GrSlotState * RuleInputSlot(int dislot = 0, GrSlotStream * psstrmOut = NULL,
+ bool fNullOkay = false);
+ GrSlotState * RuleOutputSlot(int dislot = 0);
+--- misc/silgraphite-2.3.1/engine/src/segment/GrTableManager.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrTableManager.cpp Sat Aug 22 19:36:34 2009
+@@ -25,8 +25,8 @@
+ DEFINE_THIS_FILE
+ #ifndef _WIN32
+ #include <stdlib.h>
+-#include <math.h>
+ #endif
++#include <math.h>
+
+ //:>********************************************************************************************
+ //:> Forward declarations
+@@ -572,7 +572,7 @@
+ else
+ {
+ Assert(!m_engst.m_fInsertedLB);
+- Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB);
++ //Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB); -- no, ExtendGlyphIDOutput clearly sets islotUnderBreak regardless
+ }
+ int islotTmp = OutputStream(m_cpass - 1)->WritePos();
+ GrSlotState * pslotTmp;
+@@ -931,7 +931,7 @@
+ @param plbFound - kind of line-break created
+ ----------------------------------------------------------------------------------------------*/
+ bool GrTableManager::Backtrack(int * pislotPrevBreak,
+- LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool fMoreText,
++ LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool /*fMoreText*/,
+ int ichwCallerBtLim, bool fEndLine,
+ LineBrk * plbFound)
+ {
+@@ -1343,7 +1343,7 @@
+ Calculate the associations, and record the output slots in the segment.
+ ----------------------------------------------------------------------------------------------*/
+ void GrTableManager::RecordAssocsAndOutput(Font * pfont,
+- Segment * pseg, bool fWidthIsCharCount,
++ Segment * pseg, bool /*fWidthIsCharCount*/,
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth)
+ {
+ int cchwUnderlying = pseg->stopCharacter() - pseg->startCharacter();
+@@ -1362,7 +1362,7 @@
+ #endif // OLD_TEST_STUFF
+
+ // Make sure the final positions are set for every glyph.
+- CalcPositionsUpTo(m_cpass-1, reinterpret_cast<GrSlotState *>(NULL),
++ CalcPositionsUpTo(m_cpass-1, reinterpret_cast<GrSlotState *>(NULL), false,
+ &xsTotalWidth, &xsVisWidth);
+ pseg->SetWidths(xsVisWidth, xsTotalWidth);
+
+@@ -1377,7 +1377,7 @@
+ Calculate the underlying-to-surface associations and ligature mappings.
+ Assumes the arrays have been properly initialized.
+ ----------------------------------------------------------------------------------------------*/
+-void GrTableManager::CalculateAssociations(Segment * pseg, int csloutSurface)
++void GrTableManager::CalculateAssociations(Segment * pseg, int /*csloutSurface*/)
+ {
+ GrSlotStream * psstrmFinal = OutputStream(m_cpass-1);
+
+@@ -2350,18 +2350,20 @@
+ final pass, but it could be another if positions are
+ requested by the rules themselves
+ @param pslotLast - last slot that needs to be positioned, or NULL
++ @param fMidPass - calculating the position of some slot in the middle of the pass
+ @param pxsWidth - return the total width used so far
+ @param psxVisibleWidth - return the visible width so far
+
+ MOVE to EngineState
+ ----------------------------------------------------------------------------------------------*/
+-void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
++void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass,
+ float * pxsWidth, float * pxsVisibleWidth)
+ {
+ Assert(ipass >= m_ipassPos1 - 1);
+
+ int isstrm = ipass;
+ GrSlotStream * psstrm = OutputStream(isstrm);
++ GrSlotStream * psstrmNext = (isstrm >= m_cpass - 1) ? NULL : OutputStream(isstrm + 1);
+ Assert(psstrm->GotIndexOffset());
+ if (psstrm->WritePos() <= psstrm->IndexOffset())
+ {
+@@ -2399,7 +2401,9 @@
+ // to be later in the stream than the last actual slot passed in.
+ if (!psstrm->HasSlotAtPosPassIndex(pslotLast->AttachRootPosPassIndex()))
+ return;
+- GrSlotState * pslotLastBase = pslotLast->Base(psstrm);
++ GrSlotState * pslotLastBase = (fMidPass && pslotLast->PosPassIndex() < psstrm->WritePos())
++ ? pslotLast->Base(psstrmNext)
++ : pslotLast->Base(psstrm);
+
+ if (ipass == m_cpass - 1 && m_engst.m_islotPosNext > -1)
+ {
+@@ -2428,6 +2432,7 @@
+ }
+
+ std::vector<GrSlotState *> vpslotAttached;
++ std::vector<GrSlotStream *> vpsstrmAttached;
+
+ bool fRtl = RightToLeft();
+
+@@ -2435,13 +2440,24 @@
+ {
+ Assert(islot < psstrm->SlotsPresent());
+
+- pslot = (isstrm == ipass) ? psstrm->SlotAt(islot) : psstrm->OutputSlotAt(islot);
++ GrSlotStream * psstrmThis = psstrm;
++ if (fMidPass && islot < psstrm->WritePos())
++ {
++ pslot = psstrm->MidPassSlotAt(islot, psstrmNext);
++ psstrmThis = psstrmNext;
++ }
++ else
++ {
++ //pslot = (isstrm == ipass) ? psstrm->SlotAt(islot) : psstrm->OutputSlotAt(islot);
++ pslot = psstrm->SlotAt(islot);
++ }
+
+ if (!pslot->IsBase())
+ {
+ // This slot is attached to another; it will be positioned strictly
+ // relative to that one. This happens in the loop below.
+ vpslotAttached.push_back(pslot);
++ vpsstrmAttached.push_back(psstrmThis);
+ }
+ else
+ {
+@@ -2455,7 +2471,7 @@
+ }
+
+ // Make sure the metrics are the complete ones.
+- pslot->CalcCompositeMetrics(this, psstrm, kPosInfinity, true);
++ pslot->CalcCompositeMetrics(this, psstrm, psstrmNext, kPosInfinity, true);
+
+ float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
+ float ysInc = pslot->GlyphYOffset(psstrm);
+@@ -2514,8 +2530,9 @@
+
+ for (size_t ipslot = 0; ipslot < vpslotAttached.size(); ipslot++)
+ {
+- GrSlotState * pslot = vpslotAttached[ipslot];
+- GrSlotState * pslotBase = pslot->Base(psstrm);
++ GrSlotState * pslotAtt = vpslotAttached[ipslot];
++ GrSlotStream * psstrmAtt = vpsstrmAttached[ipslot];
++ GrSlotState * pslotBase = pslotAtt->Base(psstrmAtt);
+ if (pslotBase->XPosition() == kNegInfinity || pslotBase->YPosition() == kNegInfinity)
+ {
+ Assert(false);
+@@ -2523,10 +2540,10 @@
+ }
+ float xsCluster = pslotBase->XPosition() - pslotBase->GlyphXOffset(psstrm, fakeItalicRatio);
+ float ysCluster = pslotBase->YPosition() - pslotBase->GlyphYOffset(psstrm);
+- float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
+- float ysInc = pslot->GlyphYOffset(psstrm);
+- pslot->SetXPos(xsCluster + xsInc);
+- pslot->SetYPos(ysCluster + ysInc);
++ float xsInc = pslotAtt->GlyphXOffset(psstrm, fakeItalicRatio);
++ float ysInc = pslotAtt->GlyphYOffset(psstrm);
++ pslotAtt->SetXPos(xsCluster + xsInc);
++ pslotAtt->SetYPos(ysCluster + ysInc);
+
+ // My theory is that we don't need to adjust *pxsWidth here, because the width of
+ // any non-base slots should be factored into the advance width of their cluster
+--- misc/silgraphite-2.3.1/engine/src/segment/GrTableManager.h Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/GrTableManager.h Sat Aug 22 19:36:35 2009
+@@ -442,7 +442,7 @@
+ int LogToEmUnits(float xys);
+ bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys);
+
+- void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
++ void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast, bool fMidPass,
+ float * pxsWidth, float * pxsVisibleWidth);
+
+ void InitPosCache()
+--- misc/silgraphite-2.3.1/engine/src/segment/Platform.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/Platform.cpp Sat Aug 22 19:36:35 2009
+@@ -103,7 +103,7 @@
+ {
+ // assumes NULL terminated strings
+ const utf16 *start = s;
+- for (; *s; ++s);
++ for (; *s; ++s) {};
+
+ return s - start;
+ }
+--- misc/silgraphite-2.3.1/engine/src/segment/Segment.cpp Thu Aug 21 16:24:32 2008
++++ misc/build/silgraphite-2.3.1/engine/src/segment/Segment.cpp Sat Aug 22 19:36:35 2009
+@@ -1178,7 +1178,7 @@
+ part of the segment.
+ ----------------------------------------------------------------------------------------------*/
+ float Segment::getRangeWidth(int ichMin, int ichLim,
+- bool fStartLine, bool fEndLine, bool fSkipSpace)
++ bool /*fStartLine*/, bool /*fEndLine*/, bool fSkipSpace)
+ {
+ if (m_dxsWidth < 0)
+ {
+@@ -1549,7 +1549,11 @@
+ void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman,
+ GrSlotStream * psstrmFinal,
+ int cchwInThisSeg, int csloutSurface, gid16 chwLB,
++#ifdef NDEBUG
++ TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool /*fEmpty*/)
++#else
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool fEmpty)
++#endif
+ {
+ m_mFontEmUnits = EngineImpl()->GetFontEmUnits();
+
+@@ -1725,7 +1729,7 @@
+ Set up the data structures that represent the actual rendered glyphs for the new segment.
+ ----------------------------------------------------------------------------------------------*/
+ void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal,
+- gid16 chwLB, int nDirDepth, int islotMin, int cslot)
++ gid16 chwLB, int /*nDirDepth*/, int islotMin, int cslot)
+ {
+ //int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0;
+
+@@ -1751,7 +1755,7 @@
+
+ m_isloutGinf0 = -1;
+ int iginf = 0;
+- for (int islot = islotMin; islot < cslot; islot++)
++ for (islot = islotMin; islot < cslot; islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+
+@@ -2160,7 +2164,7 @@
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islot - processed glyph it maps to
+ ----------------------------------------------------------------------------------------------*/
+-void Segment::MarkSlotInPrevSeg(int ichwUnder, int islot)
++void Segment::MarkSlotInPrevSeg(int ichwUnder, int /*islot*/)
+ {
+ if (ichwUnder >= m_ichwAssocsMin)
+ m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = kNegInfinity;
+@@ -2174,7 +2178,7 @@
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islot - processed glyph it maps to
+ ----------------------------------------------------------------------------------------------*/
+-void Segment::MarkSlotInNextSeg(int ichwUnder, int islot)
++void Segment::MarkSlotInNextSeg(int ichwUnder, int /*islot*/)
+ {
+ if (ichwUnder < m_ichwAssocsLim)
+ m_prgisloutAfter[ichwUnder - m_ichwAssocsMin] = kPosInfinity;
+@@ -2351,7 +2355,7 @@
+ @param pfAfter - return true if they clicked on trailing side; possibly NULL
+ ----------------------------------------------------------------------------------------------*/
+ int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClick,
+- float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter)
++ float dxsGlyphWidth, float /*dysGlyphHeight*/, bool * pfAfter)
+ {
+ Assert(islout >= 0);
+ Assert(islout < m_cslout);
+@@ -2529,31 +2533,31 @@
+ else if (fBefore)
+ {
+ int isloutRet;
+- int ichw = ichwSegOffset;
++ int ichwTemp = ichwSegOffset;
+ // If no association has been made, loop forward to the next slot
+ // we are before. As a last resort, answer kPosInfinity, meaning we
+ // aren't before anything.
+ do
+ {
+- isloutRet = m_prgisloutBefore[ichw - m_ichwAssocsMin];
+- do { ++ichw; }
+- while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
+- } while (isloutRet == kPosInfinity && ichw < m_ichwAssocsLim);
++ isloutRet = m_prgisloutBefore[ichwTemp - m_ichwAssocsMin];
++ do { ++ichwTemp; }
++ while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwTemp));
++ } while (isloutRet == kPosInfinity && ichwTemp < m_ichwAssocsLim);
+ return isloutRet;
+ }
+ else
+ {
+ int isloutRet;
+- int ichw = ichwSegOffset;
++ int ichwTemp = ichwSegOffset;
+ // If no association has been made, loop backward to the previous slot
+ // we are after. As a last resort, answer kNegInfinity, meaning we
+ // aren't after anything.
+ do
+ {
+- isloutRet = m_prgisloutAfter[ichw - m_ichwAssocsMin];
+- do { --ichw; }
+- while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
+- } while (isloutRet == kNegInfinity && ichw >= 0);
++ isloutRet = m_prgisloutAfter[ichwTemp - m_ichwAssocsMin];
++ do { --ichwTemp; }
++ while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwTemp));
++ } while (isloutRet == kNegInfinity && ichwTemp >= 0);
+ return isloutRet;
+ }
+ Assert(false); // should never reach here
+@@ -2748,7 +2752,11 @@
+ that root glyph as one of its roots.
+ OBSOLETE
+ ----------------------------------------------------------------------------------------------*/
++#ifdef _DEBUG
+ void Segment::AssertValidClusters(GrSlotStream * psstrm)
++#else
++void Segment::AssertValidClusters(GrSlotStream * /*psstrm*/)
++#endif
+ {
+ #ifdef _DEBUG
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+--- misc/silgraphite-2.3.1/engine/src/segment/TransductionLog.cpp Wed Jan 28 04:01:29 2009
++++ misc/build/silgraphite-2.3.1/engine/src/segment/TransductionLog.cpp Sat Aug 22 19:36:35 2009
+@@ -175,7 +175,7 @@
+ Output a file showing a log of the transduction process and the resulting segment.
+ ----------------------------------------------------------------------------------------------*/
+ void GrTableManager::WriteXductnLog(std::ostream & strmOut,
+- GrCharStream * pchstrm, Segment * psegRet,
++ GrCharStream * pchstrm, Segment * /*psegRet*/,
+ int cbPrevSegDat, byte * pbPrevSegDat)
+ {
+ if (cbPrevSegDat == 0)
+@@ -416,8 +416,8 @@
+ the raw (UTF-16 or UTF-8) chars for display. To do this we get the raw characters
+ directly from the text source.
+ ----------------------------------------------------------------------------------------------*/
+-void GrCharStream::GetLogDataRaw(GrTableManager * ptman, int cchl, int cchrBackup,
+- int cchrMaxRaw, int * prgchl,
++void GrCharStream::GetLogDataRaw(GrTableManager * /*ptman*/, int cchl, int cchrBackup,
++ int /*cchrMaxRaw*/, int * prgchl,
+ utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6,
+ int * prgcchr)
+ {
+@@ -441,7 +441,7 @@
+ case kutf8:
+ prgchsRunText8 = new utf8[cchrRange];
+ m_pgts->fetch(ichrMin, cchrRange, prgchsRunText8);
+- for (int ichr = 0; ichr < cchrRange; ichr++)
++ for (ichr = 0; ichr < cchrRange; ichr++)
+ prgchwRunText[ichr] = (utf16)prgchsRunText8[ichr]; // zero-extend into UTF-16 buffer
+ break;
+ case kutf16:
+@@ -634,7 +634,7 @@
+ m_pzpst->LogRulesFiredAndFailed(strmOut, psstrmIn);
+ }
+
+-void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn)
++void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * /*psstrmIn*/)
+ {
+
+ strmOut << "PASS " << m_ipass << "\n\n" << "Rules matched: ";
+@@ -1193,7 +1193,7 @@
+ if (fAnyPseudos)
+ {
+ strmOut << "Actual glyphs: ";
+- for (int islout = 0; islout < m_cslout; islout++)
++ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
+@@ -1319,7 +1319,7 @@
+ Write out the header lines for the slot contents.
+ ----------------------------------------------------------------------------------------------*/
+ void GrTableManager::LogSlotHeader(std::ostream & strmOut, int islotLim,
+- int cspPerSlot, int cspLeading, int islotMin)
++ int /*cspPerSlot*/, int cspLeading, int islotMin)
+ {
+ islotLim = min(islotLim, MAX_SLOTS);
+
+@@ -1721,7 +1721,7 @@
+
+ case kslatAttAtX: // always do these in pairs
+ case kslatAttAtY:
+- if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : kNotYetSet) ||
++ if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : static_cast<short>(kNotYetSet)) ||
+ m_mAttachAtY != (pslotPrev ? pslotPrev->m_mAttachAtY : 0))
+ {
+ ptman->LogInTable(strmOut,
+@@ -1730,7 +1730,7 @@
+ }
+ break;
+ case kslatAttAtGpt:
+- if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : kNotYetSet))
++ if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : static_cast<short>(kNotYetSet)))
+ {
+ ptman->LogInTable(strmOut,
+ ((m_nAttachAtGpoint == kGpointZero) ? 0 : m_nAttachAtGpoint));
+@@ -1750,7 +1750,7 @@
+
+ case kslatAttWithX: // always do these in pairs
+ case kslatAttWithY:
+- if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : kNotYetSet) ||
++ if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : static_cast<short>(kNotYetSet)) ||
+ m_mAttachWithY != (pslotPrev ? pslotPrev->m_mAttachWithY : 0))
+ {
+ ptman->LogInTable(strmOut,
+@@ -1759,7 +1759,7 @@
+ }
+ break;
+ case kslatAttWithGpt:
+- if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : kNotYetSet))
++ if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : static_cast<short>(kNotYetSet)))
+ {
+ ptman->LogInTable(strmOut,
+ ((m_nAttachWithGpoint == kGpointZero) ? 0 : m_nAttachWithGpoint));
+@@ -1786,14 +1786,14 @@
+ break;
+
+ case kslatBreak:
+- if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet8))
++ if (m_lb != (pslotPrev ? pslotPrev->m_lb : static_cast<sdata8>(kNotYetSet8)))
+ {
+ ptman->LogBreakWeightInTable(strmOut, m_lb);
+ return;
+ }
+ break;
+ case kslatDir:
+- if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet8))
++ if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : static_cast<sdata8>(kNotYetSet8)))
+ {
+ ptman->LogDirCodeInTable(strmOut, m_dirc);
+ return;
+--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.cpp Sat Aug 22 19:36:35 2009
+@@ -210,12 +210,12 @@
+ }
+
+
+-bool GrUtfTextSrc::getRightToLeft(gr::toffset ich)
++bool GrUtfTextSrc::getRightToLeft(gr::toffset /*ich*/)
+ {
+ return mRtl; // assumes src only contains one direction
+ }
+
+-unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset ich)
++unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset /*ich*/)
+ {
+ return (mRtl) ? 1 : 0; // TBD
+ }
+@@ -254,7 +254,7 @@
+ return range;
+ }
+
+-size_t GrUtfTextSrc::getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset)
++size_t GrUtfTextSrc::getFontFeatures(gr::toffset /*ich*/, gr::FeatureSetting * /*prgfset*/)
+ {
+ return 0;
+ }
+@@ -277,14 +277,14 @@
+
+ // these should be called I hope
+ float
+-GrUtfTextSrc::getFontSize(gr::toffset ich)
++GrUtfTextSrc::getFontSize(gr::toffset /*ich*/)
+ {
+ assert(mFont);
+ return mPointSize;
+ }
+
+ bool
+-GrUtfTextSrc::getBold(gr::toffset ich)
++GrUtfTextSrc::getBold(gr::toffset /*ich*/)
+ {
+ assert(mFont);
+ // NS_ASSERTION(false, "unexpected call to getBold");
+@@ -293,7 +293,7 @@
+ }
+
+ bool
+-GrUtfTextSrc::getItalic(gr::toffset ich)
++GrUtfTextSrc::getItalic(gr::toffset /*ich*/)
+ {
+ assert(mFont);
+ //NS_ASSERTION(false, "unexpected call to getItalic");
+@@ -301,7 +301,7 @@
+ return mFont->italic();
+ }
+
+-gr::isocode GrUtfTextSrc::getLanguage(gr::toffset ich)
++gr::isocode GrUtfTextSrc::getLanguage(gr::toffset /*ich*/)
+ {
+ gr::isocode unknown;
+ std::fill_n(unknown.rgch, 4, '\0');
+--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.h Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/GrUtfTextSrc.h Sat Aug 22 19:36:35 2009
+@@ -79,7 +79,7 @@
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer);
+- virtual gr::GrResult getFaceName(int ich, unsigned int cchMax,
++ virtual gr::GrResult getFaceName(int /*ich*/, unsigned int /*cchMax*/,
+ gr::utf16 * prgchFaceName, unsigned int * pcchLen)
+ {
+ prgchFaceName[0] = 0;
+@@ -92,12 +92,12 @@
+ virtual bool getItalic(gr::toffset ich);
+ virtual bool getRightToLeft(gr::toffset ich);
+ virtual unsigned int getDirectionDepth(gr::toffset ich);
+- virtual float getVerticalOffset(gr::toffset ich) { return 0;};
++ virtual float getVerticalOffset(gr::toffset /*ich*/) { return 0;};
+ virtual gr::isocode getLanguage(gr::toffset ich);
+
+ virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
+- virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2) { return true; };
++ virtual bool sameSegment(gr::toffset /*ich1*/, gr::toffset /*ich2*/) { return true; };
+
+ protected:
+ bool checkBuffer8();
+@@ -129,11 +129,11 @@
+ virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack);
+
+ // Shouldn't be here!
+- virtual gr::GrResult Fetch(int ichMin, int ichLim, gr::utf16 * prgchBuf) { return gr::kresNotImpl; };
+- virtual gr::GrResult get_Length(int * pcch) { return gr::kresNotImpl; };
+- virtual gr::GrResult GetFontVariations(int ich,
+- wchar_t * prgchFontVar, int ichMax, int * pich,
+- int * pichMin, int * pichLim) { return gr::kresNotImpl; };
++ virtual gr::GrResult Fetch(int /*ichMin*/, int /*ichLim*/, gr::utf16 * /*prgchBuf*/) { return gr::kresNotImpl; };
++ virtual gr::GrResult get_Length(int * /*pcch*/) { return gr::kresNotImpl; };
++ virtual gr::GrResult GetFontVariations(int /*ich*/,
++ wchar_t * /*prgchFontVar*/, int /*ichMax*/, int * /*pich*/,
++ int * /*pichMin*/, int * /*pichLim*/) { return gr::kresNotImpl; };
+
+ };
+
+--- misc/silgraphite-2.3.1/engine/test/ProfileHarness/ProfileHarness.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/ProfileHarness/ProfileHarness.cpp Sat Aug 22 19:36:35 2009
+@@ -39,14 +39,14 @@
+ typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange;
+
+ #ifndef HAVE_STRTOF
+-float strtof(char * text, char ** ignore)
++float strtof(char * text, char ** /*ignore*/)
+ {
+ return static_cast<float>(atof(text));
+ }
+ #endif
+
+ #ifndef HAVE_STRTOL
+-long strtol(char * text, char ** ignore)
++long strtol(char * text, char ** /*ignore*/)
+ {
+ return atol(text);
+ }
+--- misc/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/GrJustifier.cpp Sat Aug 22 19:36:35 2009
+@@ -327,7 +327,7 @@
+ &dxStretchAchieved);
+ for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++)
+ {
+- int iiGlyph = viiGlyphsRem[iiiGlyph];
++ iiGlyph = viiGlyphsRem[iiiGlyph];
+ vdxStretchLeft[iiGlyph] = vdxStretchRem[iiiGlyph];
+ vdxWidth[iiGlyph] = vdxWidthRem[iiiGlyph];
+ }
+--- misc/silgraphite-2.3.1/engine/test/RegressionTest/RegressionTest.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/RegressionTest.cpp Sat Aug 22 19:36:35 2009
+@@ -675,7 +675,7 @@
+ OutputErrorAux(ptcase, strErr, i, true, valueFound, valueExpected);
+ }
+
+-void OutputErrorAux(TestCase * ptcase, std::string strErr, int i,
++void OutputErrorAux(TestCase * /*ptcase*/, std::string strErr, int i,
+ bool showValues, int valueFound, int valueExpected)
+ {
+ // if (g_debugMode)
+--- misc/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.cpp Sat Aug 22 19:36:36 2009
+@@ -70,7 +70,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Return true if the text uses a right-to-left writing system.
+ ----------------------------------------------------------------------------------------------*/
+-bool SimpleTextSrc::getRightToLeft(toffset ich)
++bool SimpleTextSrc::getRightToLeft(toffset /*ich*/)
+ {
+ return false;
+ }
+@@ -78,7 +78,7 @@
+ /*----------------------------------------------------------------------------------------------
+ Return the depth of embedding of the writing system.
+ ----------------------------------------------------------------------------------------------*/
+-unsigned int SimpleTextSrc::getDirectionDepth(toffset ich)
++unsigned int SimpleTextSrc::getDirectionDepth(toffset /*ich*/)
+ {
+ return 0;
+ }
+@@ -87,7 +87,7 @@
+ Return the vertical offset of the text. This simple implementation provides no
+ vertical offset.
+ ----------------------------------------------------------------------------------------------*/
+-float SimpleTextSrc::getVerticalOffset(toffset ich)
++float SimpleTextSrc::getVerticalOffset(toffset /*ich*/)
+ {
+ return 0;
+ }
+--- misc/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h Thu Jan 22 00:36:42 2009
++++ misc/build/silgraphite-2.3.1/engine/test/RegressionTest/SimpleTextSrc.h Sat Aug 22 19:36:36 2009
+@@ -59,12 +59,12 @@
+ {
+ return m_cchLength;
+ }
+- virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer)
++ virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf32 * /*prgchBuffer*/)
+ {
+ throw;
+ }
+ virtual size_t fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
+- virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer)
++ virtual size_t fetch(toffset /*ichMin*/, size_t /*cch*/, utf8 * /*prgchsBuffer*/)
+ {
+ throw;
+ };
+@@ -73,14 +73,14 @@
+ virtual unsigned int getDirectionDepth(toffset ich);
+ virtual float getVerticalOffset(toffset ich);
+
+- virtual isocode getLanguage(toffset ich)
++ virtual isocode getLanguage(toffset /*ich*/)
+ {
+ isocode ret;
+ ret.rgch[0] = 'e'; ret.rgch[1] = 'n'; ret.rgch[2] = 0; ret.rgch[3] = 0;
+ return ret;
+ }
+
+- virtual std::pair<toffset, toffset> propertyRange(toffset ich)
++ virtual std::pair<toffset, toffset> propertyRange(toffset /*ich*/)
+ {
+ std::pair<toffset, toffset> pairRet;
+ pairRet.first = 0;
+@@ -88,16 +88,16 @@
+ return pairRet;
+ }
+
+- virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset)
++ virtual size_t getFontFeatures(toffset /*ich*/, FeatureSetting * /*prgfset*/)
+ {
+ return 0; // no features in this simple implementation
+ }
+- virtual bool sameSegment(toffset ich1, toffset ich2)
++ virtual bool sameSegment(toffset /*ich1*/, toffset /*ich2*/)
+ {
+ return true;
+ }
+
+- virtual void getColors(toffset ich, int * pclrFore, int * pclrBack)
++ virtual void getColors(toffset /*ich*/, int * pclrFore, int * pclrBack)
+ {
+ *pclrFore = kclrBlack;
+ *pclrBack = kclrTransparent;
+--- misc/silgraphite-2.3.1/wrappers/win32/WinFont.cpp Thu Jan 29 10:33:19 2009
++++ misc/build/silgraphite-2.3.1/wrappers/win32/WinFont.cpp Sat Aug 22 19:36:36 2009
+@@ -767,7 +767,7 @@
+ ----------------------------------------------------------------------------------------------*/
+ void WinFont::FontHandleCache::DeleteFont(HFONT hfont)
+ {
+- if (!hfont || !m_bValid)
++ if (!hfont || !m_bValid || m_hmlffcv.size() == 0)
+ return;
+
+ // find the font in the hash map
+--- misc/silgraphite-2.3.1/wrappers/win32/WinFont.h Thu Jan 29 10:33:19 2009
++++ misc/build/silgraphite-2.3.1/wrappers/win32/WinFont.h Sat Aug 22 19:36:36 2009
+@@ -27,6 +27,10 @@
+ #include "GrClient.h"
+ #include "Font.h"
+
++#ifdef _STLPORT_VERSION
++namespace stdext = _STLP_STD;
++#endif
++
+ namespace gr
+ {
+
diff --git a/graphite/makefile.mk b/graphite/makefile.mk
new file mode 100644
index 000000000000..8b673709a971
--- /dev/null
+++ b/graphite/makefile.mk
@@ -0,0 +1,184 @@
+#*************************************************************************
+#
+# $RCSfile: graphite-makefile-mk.diff,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+# TODO: enable warnings again when external module compiles without warnings on all platforms
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=.
+
+PRJNAME=graphite
+TARGET=so_graphite
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+.IF "$(ENABLE_GRAPHITE)"=="TRUE"
+TARFILE_NAME=silgraphite-2.3.1
+PATCH_FILES=graphite-2.3.1.patch
+
+# convert line-endings to avoid problems when patching
+CONVERTFILES=\
+ engine/makefile.vc8
+
+#.IF "$(OS)"=="WNT" && "$(COM)"!="GCC"
+#CONFIGURE_DIR=win32
+#.ELSE
+#CONFIGURE_DIR=engine
+#.ENDIF
+
+CONFIGURE_DIR=engine
+
+.IF "$(COM)"=="MSC"
+.IF "$(COMEX)"=="10"
+VCNUM=7
+.ELSE
+VCNUM=8
+.ENDIF
+# make use of stlport headerfiles
+EXT_USE_STLPORT=TRUE
+BUILD_ACTION=nmake VERBOSE=1
+.IF "$(debug)"=="true"
+BUILD_FLAGS= "CFG=DEBUG"
+.ENDIF
+### convert CFLAGS as cl.exe cannot handle OOO"s generic ones directly
+### TODO: use "guw.exe" instead?
+ALLCFLAGS= $(CFLAGS) $(CFLAGSCXX) $(CFLAGSEXCEPTIONS) $(CDEFS)
+JUSTASLASH= /
+CFLAGS2MSC= $(ALLCFLAGS:s/-Z/$(JUSTASLASH)Z/)
+CFLAGS4MSC= $(CFLAGS2MSC:s/ -/ $(JUSTASLASH)/)
+BUILD_FLAGS+= "MLIB=MD" "CFLAGS4MSC=$(CFLAGS4MSC)" /F makefile.vc$(VCNUM) dll
+.ENDIF
+
+.IF "$(COM)"=="GCC"
+
+# Does linux want --disable-shared?
+.IF "$(debug)"=="true"
+GR_CONFIGURE_FLAGS= --enable-debug=yes --disable-final --enable-static --disable-shared
+.ELSE
+GR_CONFIGURE_FLAGS= --enable-final=yes --enable-static --disable-shared
+.ENDIF
+EXTRA_GR_CXX_FLAGS=-fPIC
+
+.IF "$(USE_SYSTEM_STL)"!="YES"
+EXTRA_GR_LD_FLAGS=$(LIBSTLPORT) -lm
+GR_LIB_PATH=LD_LIBRARY_PATH=$(SOLARVERSION)/$(INPATH)/lib$(UPDMINOREXT)
+.ELSE
+GR_LIB_PATH=
+.ENDIF
+
+# don't use SOLARLIB for LDFLAGS because it pulls in system graphite so build will fail
+#
+CONFIGURE_ACTION=bash -c 'CXXFLAGS="$(INCLUDE) $(CFLAGSCXX) $(CFLAGSCOBJ) $(CDEFS) $(CDEFSOBJ) $(SOLARINC) $(LFS_CFLAGS) $(EXTRA_GR_CXX_FLAGS)" $(GR_LIB_PATH) LDFLAGS="-L$(SOLARVERSION)/$(INPATH)/lib$(UPDMINOREXT) $(EXTRA_GR_LD_FLAGS)" ./configure $(GR_CONFIGURE_FLAGS)'
+.ENDIF
+
+BUILD_DIR=$(CONFIGURE_DIR)
+
+.IF "$(OS)"=="WNT" && "$(COM)"!="GCC"
+#OUT2LIB=win32$/bin.msvc$/*.lib
+.IF "$(debug)"=="true"
+OUT2LIB=engine$/debug$/*.lib
+.ELSE
+OUT2LIB=engine$/release$/*.lib
+.ENDIF
+.ELSE
+OUT2LIB=engine$/src$/.libs$/libgraphite*.a
+.ENDIF
+
+.IF "$(COM)"=="GCC"
+BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS)
+.ENDIF
+
+.IF "$(OS)"=="MACOSX"
+OUT2LIB+=src$/.libs$/libgraphite.*.dylib
+.ELSE
+.IF "$(OS)"=="WNT"
+#OUT2LIB+=engine$/src$/.libs$/libgraphite*.dll
+.IF "$(debug)"=="true"
+OUT2BIN= \
+ engine$/debug$/*.dll \
+ engine$/debug$/*.pdb
+.ELSE
+OUT2BIN= \
+ engine$/release$/*.dll
+# engine$/release$/*.pdb
+.ENDIF
+.ELSE
+#OUT2LIB+=engine$/src$/.libs$/libgraphite.so.*.*.*
+.ENDIF
+.ENDIF
+
+
+OUTDIR2INC= \
+ engine$/include$/graphite
+
+.IF "$(OS)"=="WNT"
+OUT2INC=wrappers$/win32$/WinFont.h
+.ENDIF
+.ELSE
+dddd:
+ @echo Nothing to do
+.ENDIF
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : set_ext.mk
+.INCLUDE : target.mk
+.INCLUDE : tg_ext.mk
+
diff --git a/graphite/prj/build.lst b/graphite/prj/build.lst
new file mode 100644
index 000000000000..b409ff4da102
--- /dev/null
+++ b/graphite/prj/build.lst
@@ -0,0 +1,3 @@
+gr graphite : stlport solenv NULL
+gr graphite usr1 - all gr_mkout NULL
+gr graphite nmake - all gr_graphite NULL
diff --git a/graphite/prj/d.lst b/graphite/prj/d.lst
new file mode 100644
index 000000000000..574849dfc1f1
--- /dev/null
+++ b/graphite/prj/d.lst
@@ -0,0 +1,15 @@
+mkdir: %_DEST%\inc%_EXT%\graphite
+..\%__SRC%\inc\graphite\*.h %_DEST%\inc%_EXT%\graphite\*.h
+..\%__SRC%\inc\WinFont.h %_DEST%\inc%_EXT%\graphite\WinFont.h
+
+..\%__SRC%\lib\*.so.* %_DEST%\lib%_EXT%\*.so.*
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\bin\*.pdb %_DEST%\bin%_EXT%\*.pdb
+..\%__SRC%\lib\graphite.lib %_DEST%\lib%_EXT%\graphite.lib
+
+linklib: libgraphite.so.*.*.*
+linklib: libgraphite.dylib.*.*.*
+#linklib: graphite.*
diff --git a/icu/icu-4.0.patch b/icu/icu-4.0.patch
index cb46b9c71cae..172d6244634c 100644
--- a/icu/icu-4.0.patch
+++ b/icu/icu-4.0.patch
@@ -9,6 +9,19 @@
#define _XOPEN_SOURCE_EXTENDED 1
#endif
+--- misc/icu/source/common/unicode/pwin32.h 2008-07-01 10:41:12.000000000 +0900
++++ misc/build/icu/source/common/unicode/pwin32.h 2008-11-05 22:37:21.479250000 +0900
+@@ -32,6 +32,10 @@
+ #define __STDC_CONSTANT_MACROS
+ #endif
+
++#if defined(__MINGW32__)
++#define U_HAVE_INTTYPES_H 1
++#endif
++
+ /* _MSC_VER is used to detect the Microsoft compiler. */
+ #if defined(_MSC_VER)
+ #define U_INT64_IS_LONG_LONG 0
--- misc/icu/source/config/mh-darwin Tue Jul 1 03:41:24 2008
+++ misc/build/icu/source/config/mh-darwin Tue Jan 20 18:33:16 2009
@@ -25,7 +25,7 @@
diff --git a/icu/makefile.mk b/icu/makefile.mk
index 6b3c15a158c8..71e2c911fc80 100644
--- a/icu/makefile.mk
+++ b/icu/makefile.mk
@@ -149,11 +149,18 @@ OUT2BIN= \
CONFIGURE_DIR=source
.IF "$(COM)"=="GCC"
CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+icu_LDFLAGS+=-shared-libgcc
+.ENDIF
.IF "$(USE_MINGW)"=="cygwin"
-CONFIGURE_ACTION+=sh -c 'CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" LDFLAGS="-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api -L$(COMPATH)$/lib" LIBS="-lmingwthrd" ./configure --build=i586-pc-mingw32 --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no'
-.ELSE
-CONFIGURE_ACTION+=sh -c 'CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" LDFLAGS="-L$(COMPATH)$/lib" LIBS="-lmingwthrd" ./configure --build=i586-pc-mingw32 --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no'
+icu_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
+.ENDIF
+icu_LDFLAGS+=-L$(COMPATH)$/lib
+icu_LIBS=-lmingwthrd
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+icu_LIBS+=-lstdc++_s
.ENDIF
+CONFIGURE_ACTION+=sh -c 'CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" LDFLAGS="$(icu_LDFLAGS)" LIBS="$(icu_LIBS)" ./configure --build=i586-pc-mingw32 --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no'
#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
CONFIGURE_FLAGS=
diff --git a/libxml2/libxml2-2.6.31-mingw.patch b/libxml2/libxml2-2.6.31-mingw.patch
new file mode 100644
index 000000000000..102ef3e2dbb2
--- /dev/null
+++ b/libxml2/libxml2-2.6.31-mingw.patch
@@ -0,0 +1,13 @@
+--- misc/libxml2-2.6.31/libxml.h 2007-11-23 19:47:23.000000000 +0900
++++ misc/build/libxml2-2.6.31/libxml.h 2009-07-10 14:37:34.988250000 +0900
+@@ -30,6 +30,10 @@
+ #include <libxml/xmlversion.h>
+ #else
+ #include "config.h"
++#ifdef __MINGW32__
++#undef HAVE_LIBPTHREAD
++#undef HAVE_PTHREAD_H
++#endif
+ #include <libxml/xmlversion.h>
+ #endif
+
diff --git a/libxml2/libxml2-2.6.31.patch b/libxml2/libxml2-2.6.31.patch
index 53f35c1915ee..cba8f23e9663 100644
--- a/libxml2/libxml2-2.6.31.patch
+++ b/libxml2/libxml2-2.6.31.patch
@@ -282,3 +282,131 @@
#define LIBXML_DEBUG_RUNTIME
#endif
+diff -r -cN misc/libxml2-2.6.31/changelog misc/build/libxml2-2.6.31/changelog
+*** misc/libxml2-2.6.31/changelog
+--- misc/build/libxml2-2.6.31/changelog
+***************
+*** 0 ****
+--- 1,10 ----
++ libxml2 (2.6.32.dfsg-5+lenny1) stable-security; urgency=high
++
++ * Non-maintainer upload by the Security Team.
++ * Fix multiple use-after-free flaws when parsing notation and
++ enumeration attribute types (CVE-2009-2416).
++ * Fix stack overflow when parsing root XML document element DTD
++ definition (CVE-2009-2414).
++
++ -- Nico Golde <nion@debian.org> Thu, 06 Aug 2009 13:04:00 +0000
++
+diff -r -cN misc/libxml2-2.6.31/parser.c misc/build/libxml2-2.6.31/parser.c
+*** misc/libxml2-2.6.31/parser.c
+--- misc/build/libxml2-2.6.31/parser.c
+***************
+*** 4752,4761 ****
+ if (name == NULL) {
+ xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
+ "Name expected in NOTATION declaration\n");
+! return(ret);
+ }
+ cur = xmlCreateEnumeration(name);
+! if (cur == NULL) return(ret);
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+--- 4752,4766 ----
+ if (name == NULL) {
+ xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
+ "Name expected in NOTATION declaration\n");
+! xmlFreeEnumeration(ret);
+! return(NULL);
+ }
+ cur = xmlCreateEnumeration(name);
+! if (cur == NULL) {
+! xmlFreeEnumeration(ret);
+! return(NULL);
+! }
+!
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+***************
+*** 4765,4773 ****
+ } while (RAW == '|');
+ if (RAW != ')') {
+ xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_FINISHED, NULL);
+! if ((last != NULL) && (last != ret))
+! xmlFreeEnumeration(last);
+! return(ret);
+ }
+ NEXT;
+ return(ret);
+--- 4770,4777 ----
+ } while (RAW == '|');
+ if (RAW != ')') {
+ xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_FINISHED, NULL);
+! xmlFreeEnumeration(ret);
+! return(NULL);
+ }
+ NEXT;
+ return(ret);
+***************
+*** 4808,4814 ****
+ }
+ cur = xmlCreateEnumeration(name);
+ xmlFree(name);
+! if (cur == NULL) return(ret);
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+--- 4812,4822 ----
+ }
+ cur = xmlCreateEnumeration(name);
+ xmlFree(name);
+! if (cur == NULL) {
+! xmlFreeEnumeration(ret);
+! return(NULL);
+! }
+!
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+***************
+*** 5206,5211 ****
+--- 5214,5226 ----
+ const xmlChar *elem;
+ xmlChar type = 0;
+
++ if (ctxt->depth > 128) {
++ xmlFatalErrMsgInt(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED,
++ "xmlParseElementChildrenContentDecl : depth %d too deep\n",
++ ctxt->depth);
++ return(NULL);
++ }
++
+ SKIP_BLANKS;
+ GROW;
+ if (RAW == '(') {
+***************
+*** 5214,5220 ****
+--- 5229,5237 ----
+ /* Recurse on first child */
+ NEXT;
+ SKIP_BLANKS;
++ ctxt->depth++;
+ cur = ret = xmlParseElementChildrenContentDecl(ctxt, inputid);
++ ctxt->depth--;
+ SKIP_BLANKS;
+ GROW;
+ } else {
+***************
+*** 5344,5350 ****
+--- 5361,5369 ----
+ /* Recurse on second child */
+ NEXT;
+ SKIP_BLANKS;
++ ctxt->depth++;
+ last = xmlParseElementChildrenContentDecl(ctxt, inputid);
++ ctxt->depth--;
+ SKIP_BLANKS;
+ } else {
+ elem = xmlParseName(ctxt);
diff --git a/libxml2/makefile.mk b/libxml2/makefile.mk
index 7ae2265271b8..b99c52f6aa88 100644
--- a/libxml2/makefile.mk
+++ b/libxml2/makefile.mk
@@ -59,9 +59,18 @@ PATCH_FILES=$(TARFILE_NAME).patch
.IF "$(OS)"=="WNT"
.IF "$(COM)"=="GCC"
+PATCH_FILES+=$(TARFILE_NAME)-mingw.patch
+xml2_CC=$(CC)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+xml2_CC+=-shared-libgcc
+.ENDIF
+xml2_LIBS=-lws2_32 -lmingwthrd
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+xml2_LIBS+=-lstdc++_s
+.ENDIF
CONFIGURE_DIR=
CONFIGURE_ACTION=.$/configure
-CONFIGURE_FLAGS=--enable-ipv6=no --without-python --enable-static=no --without-debug --build=i586-pc-mingw32 --host=i586-pc-mingw32 lt_cv_cc_dll_switch="-shared" CFLAGS=-D_MT LDFLAGS="-no-undefined -Wl,--enable-runtime-pseudo-reloc -L$(ILIB:s/;/ -L/)" LIBS="-lws2_32 -lmingwthrd" OBJDUMP="$(WRAPCMD) objdump"
+CONFIGURE_FLAGS=--enable-ipv6=no --without-python --enable-static=no --without-debug --build=i586-pc-mingw32 --host=i586-pc-mingw32 lt_cv_cc_dll_switch="-shared" CC="$(xml2_CC)" CFLAGS=-D_MT LDFLAGS="-no-undefined -Wl,--enable-runtime-pseudo-reloc -L$(ILIB:s/;/ -L/)" LIBS="$(xml2_LIBS)" OBJDUMP="$(WRAPCMD) objdump"
BUILD_ACTION=$(GNUMAKE)
BUILD_DIR=$(CONFIGURE_DIR)
.ELSE
diff --git a/libxslt/makefile.mk b/libxslt/makefile.mk
index 76cbcd39be39..ba335eed7e19 100644
--- a/libxslt/makefile.mk
+++ b/libxslt/makefile.mk
@@ -57,9 +57,17 @@ PATCH_FILES=$(TARFILE_NAME).patch $(TARFILE_NAME)_win_manifest.patch
.IF "$(OS)"=="WNT"
.IF "$(COM)"=="GCC"
+xslt_CC=$(CC)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+xslt_CC+=-shared-libgcc
+.ENDIF
+xslt_LIBS=-lmingwthrd
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+xslt_LIBS+=-lstdc++_s
+.ENDIF
CONFIGURE_DIR=
CONFIGURE_ACTION=.$/configure
-CONFIGURE_FLAGS=--enable-ipv6=no --without-crypto --without-python --enable-static=no --with-sax1=yes --build=i586-pc-mingw32 --host=i586-pc-mingw32 CFLAGS="$(xslt_CFLAGS) -D_MT" LDFLAGS="$(xslt_LDFLAGS) -no-undefined -L$(ILIB:s/;/ -L/)" LIBS="-lmingwthrd" LIBXML2LIB=$(LIBXML2LIB) OBJDUMP="$(WRAPCMD) objdump"
+CONFIGURE_FLAGS=--enable-ipv6=no --without-crypto --without-python --enable-static=no --with-sax1=yes --build=i586-pc-mingw32 --host=i586-pc-mingw32 CC="$(xslt_CC)" CFLAGS="$(xslt_CFLAGS) -D_MT" LDFLAGS="-no-undefined -L$(ILIB:s/;/ -L/)" LIBS="$(xslt_LIBS)" LIBXML2LIB=$(LIBXML2LIB) OBJDUMP="$(WRAPCMD) objdump"
BUILD_ACTION=chmod 777 xslt-config && $(GNUMAKE)
BUILD_FLAGS+= -j$(EXTMAXPROCESS)
BUILD_DIR=$(CONFIGURE_DIR)
diff --git a/moz/README b/moz/README
new file mode 100644
index 000000000000..6b1d0a2e169e
--- /dev/null
+++ b/moz/README
@@ -0,0 +1,4 @@
+Rebuild moz whenever changes have been made in the nss module. Those libs are
+merged into mozruntime.zip which is build in this project.
+
+Please read nss/readme.txt !!! \ No newline at end of file
diff --git a/moz/extractfiles.mk b/moz/extractfiles.mk
index b63425810435..654cbc8d05e0 100644
--- a/moz/extractfiles.mk
+++ b/moz/extractfiles.mk
@@ -36,17 +36,71 @@ RUNTIME_DIR=$(MISC)$/$(MOZTARGET)runtime
LIB_DIR=$(LB)
INCLUDE_DIR=$(INCCOM)
+
+
+#If we build the NSS module then we do not need the old nss libs from here
+.IF "$(ENABLE_NSS_MODULE)"=="YES"
+
+
+.IF "$(OS)" == "SOLARIS"
+.IF "$(CPU)" == "S" #32bit
+FREEBL_LIB=freebl_32fpu_3 freebl_32int64_3 freebl_32int_3
+.ELIF "$(CPU)" == "U" #64bit unxsolu4
+FREEBL_LIB=freebl_64int_3 freebl_64fpu_3
+.ELSE
+FREEBL_LIB=freebl3
+.ENDIF #"$(CPU)" == "S"
+
+.ELSE # "$(OS)" == "SOLARIS"
+FREEBL_LIB=freebl3
+.ENDIF # "$(OS)" == "SOLARIS"
+
+
+NSS_MODULE_RUNTIME_LIST:= \
+ $(FREEBL_LIB) \
+ nspr4 \
+ nss3 \
+ nssckbi \
+ nssdbm3 \
+ nssutil3 \
+ plc4 \
+ plds4 \
+ smime3 \
+ softokn3 \
+ sqlite3 \
+ ssl3
+
+BIN_RUNTIMELIST= \
+ xpcom \
+ xpcom_core \
+ xpcom_compat
+.ELSE
+
+.IF "$(GUI)" == "WNT"
+ FREEBL_LIB=freebl3
+.ELSE # "$(GUI)" == "WNT"
+ .IF "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+ FREEBL_LIB=freebl_32fpu_3
+ .ELSE # "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+ FREEBL_LIB=freebl3
+ .ENDIF # "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+.ENDIF # "$(GUI)" == "WNT"
+
+
BIN_RUNTIMELIST= \
nspr4 \
plc4 \
plds4 \
xpcom \
+ xpcom_core \
xpcom_compat \
nss3 \
ssl3 \
softokn3 \
- smime3
-
+ smime3 \
+ $(FREEBL_LIB)
+.ENDIF # "$(ENABLE_NSS_MODULE)"=="YES"
+
.IF "$(GUI)"=="WNT"
BIN_RUNTIMELIST+= \
js3250 \
@@ -61,12 +115,6 @@ BIN_RUNTIMELIST+= \
msgbaseutil \
ldap50 \
prldap50
-.IF "$(OS)"=="SOLARIS"
-.IF "$(CPU)"=="S"
-BIN_RUNTIMELIST+= \
- freebl_hybrid_3
-.ENDIF
-.ENDIF #"$(OS)"=="SOLARIS"
.ENDIF
COMPONENT_RUNTIMELIST= \
@@ -81,7 +129,7 @@ COMPONENT_RUNTIMELIST= \
vcard \
i18n \
pipnss
-
+
.IF "$(GUI)"=="WNT"
COMPONENT_RUNTIMELIST+= \
xppref32 \
@@ -101,7 +149,8 @@ COMREGISTRY_FILELIST= \
xpcom_io.xpt \
xpcom_xpti.xpt \
addrbook.xpt \
- mozldap.xpt
+ mozldap.xpt \
+ pref.xpt
.IF "$(GUI)"=="WNT"
COMREGISTRY_FILELIST+= xpcom_thread.xpt
@@ -119,37 +168,89 @@ DEFAULTS_RUNTIMELIST= \
greprefs$/all.js \
greprefs$/security-prefs.js
+.IF "$(ENABLE_NSS_MODULE)"=="YES"
+#These headers come from the separate NSS module if enabled
+NSS_INCLUDE_LIST= nspr nss
+
+.IF "$(GUI)"=="WNT"
+.IF "$(COM)"=="GCC"
+
+
+LIBLIST= \
+ libembed_base_s.a \
+ libmozreg_s.a \
+ libnslber32v50.a \
+ libnsldap32v50.a \
+ libxpcom_core.dll.a \
+ libxpcom.dll.a
+
+.ELSE #"$(COM)"=="GCC"
+
+LIBLIST= \
+ embed_base_s.lib \
+ mozreg_s.lib \
+ nslber32v50.lib \
+ nsldap32v50.lib \
+ xpcom_core.lib \
+ xpcom.lib
+
+.ENDIF #"$(COM)"=="GCC"
+
+.ELSE #"$(GUI)"=="WNT"
+
+LIBLIST= \
+ libembed_base_s.a \
+ libmozreg_s.a \
+ liblber50.a \
+ libxpcom_core$(DLLPOST) \
+ libxpcom$(DLLPOST) \
+ libmsgbaseutil$(DLLPOST) \
+ libldap50$(DLLPOST) \
+
+.ENDIF
+
+.ELSE # .IF"$(ENABLE_NSS_MODULE)"=="YES"
+
.IF "$(GUI)"=="WNT"
.IF "$(COM)"=="GCC"
+
LIBLIST= \
libembed_base_s.a \
libmozreg_s.a \
libnslber32v50.a \
libnsldap32v50.a \
libnspr4.a \
+ libxpcom_core.dll.a \
libxpcom.dll.a \
libnss3.a \
libsmime3.a
+
.ELSE
+
LIBLIST= \
embed_base_s.lib \
mozreg_s.lib \
nslber32v50.lib \
nsldap32v50.lib \
nspr4.lib \
+ xpcom_core.lib \
xpcom.lib \
plc4.lib \
plds4.lib \
nss3.lib \
ssl3.lib \
smime3.lib
+
.ENDIF
-.ELSE #"$(GUI)"=="WNT"
+
+.ELSE #"$(GUI)"=="WNT"
+
LIBLIST= \
libembed_base_s.a \
libmozreg_s.a \
liblber50.a \
libnspr4$(DLLPOST) \
+ libxpcom_core$(DLLPOST) \
libxpcom$(DLLPOST) \
libmsgbaseutil$(DLLPOST) \
libldap50$(DLLPOST) \
@@ -159,7 +260,9 @@ LIBLIST= \
libnss3$(DLLPOST) \
libssl3$(DLLPOST) \
libsmime3$(DLLPOST)
+
.ENDIF
+.ENDIF # .IF "$(ENABLE_NSS_MODULE)"=="YES"
INCLUDE_PATH=$(MOZ_DIST_DIR)$/include$/
PUBLIC_PATH=$(MOZ_DIST_DIR)$/public$/
@@ -178,7 +281,7 @@ extract_mozab_files: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE) \
$(MISC)$/build$/so_moz_runtime_files \
$(MISC)$/build$/so_moz_include_files \
$(MISC)$/build$/so_moz_lib_files
-
+
make_temp_dir:
@@-$(MKDIR) $(RUNTIME_DIR)
@@-$(MKDIR) $(RUNTIME_DIR)$/components
@@ -202,7 +305,21 @@ $(MISC)$/build$/so_moz_runtime_files: $(OUT)$/bin$/mozruntime.zip
$(foreach,file,$(BIN_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/$(DLLPRE)$(file)$(DLLPOST) \
$(LIB_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \
echo >& $(NULLDEV)
+.IF "$(ENABLE_NSS_MODULE)" == "YES"
+# We add the libraries from the separate nss module
+ $(foreach,file,$(NSS_MODULE_RUNTIME_LIST) $(COPY) $(SOLARLIBDIR)$/$(DLLPRE)$(file)$(DLLPOST) \
+ $(RUNTIME_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \
+ echo >& $(NULLDEV)
.ENDIF
+.ELSE # .IF "$(GUI)" == "UNX"
+.IF "$(ENABLE_NSS_MODULE)" == "YES"
+# We add the libraries from the separate nss module
+ $(foreach,file,$(NSS_MODULE_RUNTIME_LIST) $(COPY) $(SOLARBINDIR)$/$(DLLPRE)$(file)$(DLLPOST) \
+ $(RUNTIME_DIR)$/$(DLLPRE)$(file)$(DLLPOST) &&) \
+ echo >& $(NULLDEV)
+.ENDIF
+.ENDIF # .IF "$(GUI)" == "UNX"
+
# copy files in RES_FILELIST
.IF "$(OS)"=="SOLARIS"
@@ -227,8 +344,6 @@ $(MISC)$/build$/so_moz_runtime_files: $(OUT)$/bin$/mozruntime.zip
@@-$(MKDIR) $(RUNTIME_DIR)$/greprefs
$(foreach,file,$(DEFAULTS_RUNTIMELIST) $(COPY) $(MOZ_BIN_DIR)$/$(file) $(RUNTIME_DIR)$/$(file) &&) \
echo >& $(NULLDEV)
-# copy regxpcom
- @$(COPY) $(MOZ_BIN_DIR)$/regxpcom$(REG_SUBFIX) $(RUNTIME_DIR)$/regxpcom$(REG_SUBFIX)
.IF "$(GUI)"=="UNX"
.IF "$(OS)"!="MACOSX"
@@ -266,30 +381,14 @@ $(MISC)$/build$/so_moz_runtime_files: $(OUT)$/bin$/mozruntime.zip
.ENDIF
# zip runtime files to mozruntime.zip
-.IF "$(OS)"=="LINUX" || "$(OS)"=="SOLARIS"
-# regxpcom needs to find libxpcom.so next to itself:
-.IF "$(USE_SHELL)"=="bash"
- cd $(RUNTIME_DIR) && \
- LD_LIBRARY_PATH=$${{LD_LIBRARY_PATH+$${{LD_LIBRARY_PATH}}:}}. \
- .$/regxpcom$(REG_SUBFIX)
-.ELSE
- cd $(RUNTIME_DIR) && if ($$?LD_LIBRARY_PATH == 1) \
- eval 'setenv LD_LIBRARY_PATH "$${{LD_LIBRARY_PATH}}:."' && \
- if ($$?LD_LIBRARY_PATH == 0) setenv LD_LIBRARY_PATH . && \
- .$/regxpcom$(REG_SUBFIX)
-.ENDIF
-.ELSE
- cd $(RUNTIME_DIR) && .$/regxpcom$(REG_SUBFIX)
-.ENDIF
- $(COPY) $(RUNTIME_DIR)$/components$/xpti.dat $(RUNTIME_DIR)$/components$/xptitemp.dat
- $(RM) $(RUNTIME_DIR)$/regxpcom$(REG_SUBFIX)
cd $(RUNTIME_DIR) && zip -r ..$/..$/bin$/mozruntime.zip *
-
+
$(TOUCH) $@
$(INCCOM)$/nsBuildID.h: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
@-echo "You can delete $(INCCOM) to force it copy all include files again."
-
+
+
$(MISC)$/build$/so_moz_include_files: $(INCCOM)$/nsBuildID.h
.IF "$(USE_SHELL)"=="4nt"
$(COPY) /QSZ $(INCLUDE_PATH)* $(INCLUDE_DIR)
@@ -308,6 +407,13 @@ $(MISC)$/build$/so_moz_include_files: $(INCCOM)$/nsBuildID.h
chmod -R 775 $(INCCOM)
.ENDIF
$(TOUCH) $@
+.IF "$(ENABLE_NSS_MODULE)"=="YES"
+ +$(foreach,dir,$(NSS_INCLUDE_LIST) $(RENAME:s/+//) $(INCLUDE_DIR)$/$(dir) \
+ $(INCLUDE_DIR)$/$(dir)_remove_me &&) \
+ echo >& $(NULLDEV)
+ $(foreach,dir,$(NSS_INCLUDE_LIST) rm -r -f $(INCLUDE_DIR)$/$(dir)_remove_me &&) \
+ echo >& $(NULLDEV)
+.ENDIF
# On UNX the rules for so_moz_runtime_files copy files into the same directory
# used here (LIB_DIR), and on MACOSX all those files together need to be
@@ -325,13 +431,13 @@ $(MISC)$/build$/so_moz_lib_files: $(foreach,file,$(LIBLIST) $(LIB_DIR)$/$(file)
chmod -R 775 $(LB)
.ENDIF
$(TOUCH) $@
-
+
$(BIN_RUNTIMELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
@$(COPY) $(MOZ_BIN_DIR)$/$(DLLPRE)$@$(DLLPOST) $(RUNTIME_DIR)$/$(DLLPRE)$@$(DLLPOST)
$(COMPONENT_RUNTIMELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
@$(COPY) $(MOZ_BIN_DIR)$/components$/$(DLLPRE)$@$(DLLPOST) $(RUNTIME_DIR)$/components$/$(DLLPRE)$@$(DLLPOST)
-
+
$(COMREGISTRY_FILELIST): $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
@$(COPY) $(MOZ_BIN_DIR)$/components$/$@ $(RUNTIME_DIR)$/components$/$@
@@ -345,7 +451,6 @@ RES_FILELIST: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
@echo No Res Files to copy.
.ENDIF
-
$(LIB_DIR)$/%: $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
noop
diff --git a/moz/makefile.mk b/moz/makefile.mk
index 0a81119bed29..75be11886f66 100644
--- a/moz/makefile.mk
+++ b/moz/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -41,7 +41,6 @@ TARGET=ooo_mozab
# --- Files --------------------------------------------------------
# ----- pkg-config start -------
.INCLUDE .IGNORE : pkgroot.mk
-
.IF "$(PKGCONFIG_ROOT)"!=""
PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config
PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig
@@ -53,41 +52,59 @@ LD_LIBRARY_PATH!:=$(LD_LIBRARY_PATH)$(PATH_SEPERATOR)$(PKGCONFIG_ROOT)$/lib
.EXPORT : PKG_CONFIG_PATH PKG_CONFIG LD_LIBRARY_PATH
.ENDIF # "$(PKGCONFIG_ROOT)"!=""
-.IF "$(BUILD_SPECIAL)"!=""
# reduce prerequisites by disabling mozilla binary
DISABLE_MOZ_EXECUTABLE=TRUE
.EXPORT : DISABLE_MOZ_EXECUTABLE
-.ENDIF # "$(BUILD_SPECIAL)"!=""
.IF "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
-# hmm... rather gcc specific switches...
+## hmm... rather gcc specific switches...
CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib
-LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -LX11
+LDFLAGS:= -Wl,--unresolved-symbols=ignore-in-shared-libs -L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/X11R6/lib
SYSBASE_X11:=--x-includes=$(SYSBASE)/usr/include/X11 --x-libraries=$(SYSBASE)/usr/X11R6/lib
-.EXPORT : CFLAGS LDFLAGS
+MOZ_ENABLE_COREXFONTS=1
+MOZILLA_CONFIGURE_FLAGS +=--disable-xft
+.EXPORT : CFLAGS LDFLAGS MOZ_ENABLE_COREXFONTS
.ENDIF # "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
+.IF "$(SYSBASE)"!="" && "$(OS)" == "MACOSX"
+PKGCONFIG_ROOT!:=$(ENV_ROOT)$/macports-1.7.0
+PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config
+PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig
+.EXPORT : PKG_CONFIG_PATH PKG_CONFIG
+# hmm... rather gcc specific switches...
+CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib -B$(SYSBASE)/usr/lib/system -L$(ENV_ROOT)/macports-1.7.0/lib -lmathCommon
+LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/lib/system
+XLDOPTS:= -B$(SYSBASE)/usr/lib -B$(SYSBASE)/usr/lib/system -lmathCommon
+.EXPORT : CFLAGS LDFLAGS XLDOPTS
+.ENDIF # "$(SYSBASE)"!="" && "$(OS)" == "MACOSX"
+
# ----- pkg-config end -------
-MOZILLA_VERSION*=1.7.5
-.IF "$(MOZILLA_VERSION)"=="1.7b"
-TARFILE_NAME=mozilla-source-1.7b-source
-.ELSE
-TARFILE_NAME=mozilla-source-$(MOZILLA_VERSION)
-.ENDIF
-TARFILE_ROOTDIR=mozilla
+MOZILLA_VERSION=1.1.14
+TARFILE_NAME=seamonkey-$(MOZILLA_VERSION).source
-PATCH_FILES=mozilla-source-$(MOZILLA_VERSION).patch
+TARFILE_ROOTDIR=mozilla
+PATCH_FILES=seamonkey-source-$(MOZILLA_VERSION).patch
-# These files are needed for the W32 build when BUILD_MOZAB is set
+# This file is needed for the W32 build when BUILD_MOZAB is set
+# (currently only vc8/vs2005 is supported when BUILD_MOZAB is set)
+.IF "$(COM)"=="GCC"
LIBIDL_VC71_ZIPFILE_NAME*=vc71-libIDL-0.6.8-bin.zip
LIBGLIB_VC71_ZIPFILE_NAME*=vc71-glib-1.2.10-bin.zip
-WINTOOLS_ZIPFILE_NAME*=wintools.zip
+MOZTOOLS_ZIPFILE_NAME*=wintools.zip
+.ELSE
+MOZTOOLS_ZIPFILE_NAME*=vc8-moztools.zip
+.ENDIF
ADDITIONAL_FILES=mailnews$/addrbook$/src$/nsAbMD5sum.cpp
CONFIGURE_DIR=
-MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
+.IF "$(GUIBASE)"!="aqua"
+MOZILLA_CONFIGURE_FLAGS += $(SYSBASE_X11)
+.ENDIF
+
+MOZILLA_CONFIGURE_FLAGS += --disable-tests \
+ --enable-application=suite \
--enable-ldap \
--enable-crypto \
--enable-optimize \
@@ -99,7 +116,6 @@ MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
--disable-debug \
--disable-xprint \
--disable-postscript \
- --disable-freetype2 \
--without-system-zlib \
--disable-installer \
--disable-accessibility \
@@ -108,7 +124,18 @@ MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
--disable-oji \
--disable-profilesharing \
--disable-boehm \
- --disable-jsloader
+ --disable-jsloader \
+ --disable-canvas \
+ --disable-freetype2 \
+ --disable-gnomeui \
+ --disable-image-encoders \
+ --disable-plugins \
+ --disable-printing \
+ --enable-extensions="pref"
+
+#.IF "$(GUI)"!="WNT"
+#MOZILLA_CONFIGURE_FLAGS += --enable-system-cairo
+#.ENDIF
#disable profilelocking to share profile with mozilla
#disable activex and activex-scripting to remove the dependence of Microsoft_SDK\src\mfc\atlbase.h
@@ -116,12 +143,20 @@ MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
#disable others to save build times
.IF "$(GUI)"=="UNX"
+.IF "$(GUIBASE)"=="aqua"
+MACDEVSDK*=/Developer/SDKs/MacOSX10.4u.sdk
+MOZILLA_CONFIGURE_FLAGS+= \
+ --with-macos-sdk=$(MACDEVSDK) \
+ --disable-glibtest \
+ --enable-macos-target=10.4 \
+ --disable-libxul
+DEFAULT_MOZILLA_TOOLKIT=mac
+.ELSE
#We do not need mozilla ui, but libIDL version are decided by default toolkit.
#default-toolkit=xlib need libIDL < 0.68
#default-toolkit=gtk2 need libIDL > 0.8 (know as libIDL2)
-.IF "x$(DEFAULT_MOZILLA_TOOLKIT)"=="x"
-DEFAULT_MOZILLA_TOOLKIT=gtk2
-.ENDIF
+DEFAULT_MOZILLA_TOOLKIT*=gtk2
+.ENDIF # "$(GUIBASE)"=="aqua"
MOZILLA_CONFIGURE_FLAGS+= --enable-default-toolkit=$(DEFAULT_MOZILLA_TOOLKIT)
.ENDIF
@@ -142,13 +177,17 @@ CXXFLAGS:=-features=tmplife
.IF "$(CPU)"=="U"
CXXFLAGS+=-m64
.ENDIF
-.EXPORT : CXXFLAGS
+.EXPORT : CXXFLAGS
.ENDIF # "$(COMNAME)"=="sunpro5"
.ENDIF
.IF "$(OS)"=="SOLARIS" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
.EXPORT: PKG_CONFIG_PATH
+MAKE=/usr/sfw/bin/gmake
+.EXPORT: MAKE
+CFLAGS=-I/usr/sfw/include
+.EXPORT: CFLAGS
.ENDIF
.IF "$(COM)"=="C52" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
CFLAGS=-m64
@@ -156,7 +195,7 @@ ASFLAGS=-m64
.EXPORT: CFLAGS ASFLAGS
.ENDIF
-MOZDIR=$(MISC)$/build$/mozilla
+MOZDIR=$(MISC)$/build$/seamonkey
MOZTARGET=$(OS)$(COM)$(CPU)
.IF "$(GUI)"=="WNT"
@@ -190,33 +229,35 @@ CXX:=cl.exe
.ENDIF
# Variables to install/use our own wintools
+.IF "$(COM)"=="GCC"
MOZTOOLSUNPACK:=$(MISC)$/build$/moztoolsunpack
MOZTOOLSINST:=$(MISC)$/build$/moztoolsinst
+.ELSE
+MOZTOOLS_EXTRACT:=$(MISC)$/build$/moztools
+.ENDIF
.IF "$(USE_SHELL)"!="4nt"
-MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztoolsinst
.IF "$(COM)"=="GCC"
+MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztoolsinst
PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin
-.ELSE
-PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
-.ENDIF
-.IF "$(USE_SHELL)"=="tcsh"
-SET_MOZ_TOOLS_INSTALL_BAT:=setenv MOZ_TOOLS "$(MOZ_TOOLS_DOS)"
-.ELIF "$(USE_SHELL)"=="bash"
SET_MOZ_TOOLS_INSTALL_BAT:=export "MOZ_TOOLS=$(MOZ_TOOLS_DOS)"
.ELSE
-SET_MOZ_TOOLS_INSTALL_BAT:=MOZ_TOOLS="$(MOZ_TOOLS_DOS)"; export MOZ_TOOLS
+MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztools\vc8-moztools
+PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
.ENDIF
.ELSE # "$(USE_SHELL)"!="4nt"
# MOZ_TOOLS must contain an absolute path
-MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztoolsinst
-PATH!:=$(MOZ_TOOLS_DOS)\vc71\bin;$(MOZ_TOOLS_DOS)\bin;$(PATH)
-SET_MOZ_TOOLS_INSTALL_BAT:=set MOZ_TOOLS=$(MOZ_TOOLS_DOS)
+MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztools\vc8-moztools
+PATH!:=$(MOZ_TOOLS_DOS)\bin;$(PATH)
.ENDIF # "$(USE_SHELL)"!="4nt"
+
MOZ_TOOLS:=$(subst,\,/ $(MOZ_TOOLS_DOS))
+.IF "$(COM)"=="GCC"
GLIB_PREFIX:=$(MOZ_TOOLS)/vc71
LIBIDL_PREFIX:=$(MOZ_TOOLS)/vc71
+.EXPORT : GLIB_PREFIX LIBIDL_PREFIX
+.ENDIF
-.EXPORT : PATH MOZ_TOOLS GLIB_PREFIX LIBIDL_PREFIX
+.EXPORT : PATH MOZ_TOOLS
.ENDIF # "$(GUI)"=="WNT"
# --- Targets ------------------------------------------------------
@@ -231,7 +272,7 @@ all:
.INCLUDE : tg_ext.mk
.IF "$(GUI)"=="WNT"
-NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/wintools.complete
+NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/moztools.complete
.ENDIF # "$(GUI)"=="WNT"
ALLTAR: $(NEEDWINTOOLSFLAGFILE) \
@@ -249,29 +290,43 @@ $(MISC)$/remove_build.flag : $(PATCH_FILES)
# Unpack/setup Windows build tools
.IF "$(GUI)"=="WNT"
-$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/wintools.complete
+$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/moztools.complete
-$(MISC)$/build$/wintools.unpack : $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME)
+.IF "$(COM)"=="GCC"
+$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME)
-$(RENAME) $(MOZTOOLSUNPACK) $(MOZTOOLSUNPACK)_removeme
-$(RENAME) $(MOZTOOLSINST) $(MOZTOOLSINST)_removeme
-rm -rf $(MOZTOOLSUNPACK)_removeme $(MOZTOOLSINST)_removeme
@-$(MKDIRHIER) $(MOZTOOLSUNPACK)
- unzip $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME) -d $(MOZTOOLSUNPACK)
- $(TOUCH) $(MISC)$/build$/wintools.unpack
+ unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLSUNPACK)
+ $(TOUCH) $(MISC)$/build$/moztools.unpack
-$(MISC)$/build$/wintools.install : $(MISC)$/build$/wintools.unpack
+$(MISC)$/build$/moztools.install : $(MISC)$/build$/moztools.unpack
cd $(MOZTOOLSUNPACK)$/buildtools$/windows && $(SET_MOZ_TOOLS_INSTALL_BAT) && cmd /c install.bat
- $(TOUCH) $(MISC)$/build$/wintools.install
+ $(TOUCH) $(MISC)$/build$/moztools.install
-$(MISC)$/build$/wintools.complete : \
- $(MISC)$/build$/wintools.install \
+$(MISC)$/build$/moztools.complete : \
+ $(MISC)$/build$/moztools.install \
$(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) \
$(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME)
unzip $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
unzip $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
# chmod is also needed for W32-4nt build (when cygwin unzip is used)
-chmod -R +x $(MOZTOOLSINST)$/vc71$/bin
- $(TOUCH) $(MISC)$/build$/wintools.complete
+ $(TOUCH) $(MISC)$/build$/moztools.complete
+.ELSE
+$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME)
+ -$(RENAME) $(MOZTOOLS_EXTRACT) $(MOZTOOLS_EXTRACT)_removeme
+ -rm -rf $(MOZTOOLS_EXTRACT)_removeme
+ @-$(MKDIRHIER) $(MOZTOOLS_EXTRACT)
+ unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLS_EXTRACT)
+# chmod is also needed for W32-4nt build (when cygwin unzip is used)
+ -chmod -R +x $(MOZTOOLS_EXTRACT)$/vc8-moztools$/bin
+ $(TOUCH) $(MISC)$/build$/moztools.unpack
+
+$(MISC)$/build$/moztools.complete : $(MISC)$/build$/moztools.unpack
+ $(TOUCH) $(MISC)$/build$/moztools.complete
+.ENDIF
.ENDIF # "$(GUI)"=="WNT"
zip: \
diff --git a/moz/mozilla-source-1.0.patch b/moz/mozilla-source-1.0.patch
deleted file mode 100644
index 46787d6bac99..000000000000
--- a/moz/mozilla-source-1.0.patch
+++ /dev/null
@@ -1,4499 +0,0 @@
-Index: directory/xpcom/base/public/nsILDAPConnection.idl
-===================================================================
-RCS file: /mozilla/mozilla/directory/xpcom/base/public/nsILDAPConnection.idl,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/directory/xpcom/base/public/nsILDAPConnection.idl 22 Oct 2003 02:37:04 -0000 1.1.1.1
-+++ miss/build/mozilla/directory/xpcom/base/public/nsILDAPConnection.idl 22 Oct 2003 09:45:04 -0000 1.2
-@@ -69,7 +69,7 @@
- * @exception NS_ERROR_FAILURE
- * @exception NS_ERROR_UNEXPECTED internal error
- */
-- void init(in string aHost, in short aPort, in boolean aSSL,
-+ void init(in string aHost, in long aPort, in boolean aSSL,
- in wstring aBindName,
- in nsILDAPMessageListener aMessageListener);
-
-Index: directory/xpcom/base/src/nsLDAPConnection.cpp
-===================================================================
-RCS file: /mozilla/mozilla/directory/xpcom/base/src/nsLDAPConnection.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/directory/xpcom/base/src/nsLDAPConnection.cpp 22 Oct 2003 02:37:04 -0000 1.1.1.1
-+++ miss/build/mozilla/directory/xpcom/base/src/nsLDAPConnection.cpp 22 Oct 2003 09:45:04 -0000 1.2
-@@ -48,7 +48,6 @@
- #include "nsIConsoleService.h"
- #include "nsIDNSService.h"
- #include "nsIRequestObserver.h"
--#include "nsIProxyObjectManager.h"
- #include "netCore.h"
-
- const char kConsoleServiceContractId[] = "@mozilla.org/consoleservice;1";
-@@ -169,11 +168,10 @@
-
-
- NS_IMETHODIMP
--nsLDAPConnection::Init(const char *aHost, PRInt16 aPort, PRBool aSSL,
-+nsLDAPConnection::Init(const char *aHost, PRInt32 aPort, PRBool aSSL,
- const PRUnichar *aBindName,
- nsILDAPMessageListener *aMessageListener)
- {
-- nsCOMPtr<nsIDNSListener> selfProxy;
- nsresult rv;
-
- if ( !aHost || !aMessageListener) {
-@@ -222,22 +220,6 @@
- return NS_ERROR_FAILURE;
- }
-
-- // Get a proxy object so the callback happens on the current thread.
-- // This is now a Synchronous proxy, due to the fact that the DNS
-- // service hands out data which it later deallocates, and the async
-- // proxy makes this unreliable. See bug 102227 for more details.
-- //
-- rv = NS_GetProxyForObject(NS_CURRENT_EVENTQ,
-- NS_GET_IID(nsIDNSListener),
-- NS_STATIC_CAST(nsIDNSListener*, this),
-- PROXY_SYNC | PROXY_ALWAYS,
-- getter_AddRefs(selfProxy));
--
-- if (NS_FAILED(rv)) {
-- NS_ERROR("nsLDAPConnection::Init(): couldn't "
-- "create proxy to this object for callback");
-- return NS_ERROR_FAILURE;
-- }
-
- // Do the pre-resolve of the hostname, using the DNS service. This
- // will also initialize the LDAP connection properly, once we have
-@@ -256,7 +238,8 @@
- return NS_ERROR_FAILURE;
- }
- rv = pDNSService->Lookup(aHost,
-- selfProxy,
-+ //selfProxy,
-+ this, // SDBC change
- nsnull,
- getter_AddRefs(mDNSRequest));
-
-Index: directory/xpcom/base/src/nsLDAPConnection.h
-===================================================================
-RCS file: /mozilla/mozilla/directory/xpcom/base/src/nsLDAPConnection.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/directory/xpcom/base/src/nsLDAPConnection.h 22 Oct 2003 02:37:04 -0000 1.1.1.1
-+++ miss/build/mozilla/directory/xpcom/base/src/nsLDAPConnection.h 22 Oct 2003 09:45:04 -0000 1.2
-@@ -119,7 +119,7 @@
- nsSupportsHashtable *mPendingOperations; // keep these around for callbacks
- nsLDAPConnectionLoop *mRunnable; // nsIRunnable object
-
-- PRInt16 mPort; // The LDAP port we're binding to
-+ PRInt32 mPort; // The LDAP port we're binding to
- PRBool mSSL; // the options
-
- nsCString mResolvedIP; // Preresolved list of host IPs
-Index: mailnews/addrbook/Makefile.in
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/Makefile.in,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/Makefile.in 22 Oct 2003 02:43:08 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/Makefile.in 9 Dec 2003 03:27:41 -0000 1.2
-@@ -31,7 +31,7 @@
- EXTRA_COMPONENTS += src/nsLDAPPrefsService.js
- endif
-
--DIRS = public src build
-+DIRS = public src build
-
- include $(topsrcdir)/config/rules.mk
-
-Index: mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp 22 Oct 2003 09:45:04 -0000 1.2
-@@ -39,6 +39,7 @@
- #include "nsAbBoolExprToLDAPFilter.h"
- #include "nsAbLDAPProperties.h"
- #include "nsXPIDLString.h"
-+#include "nsAbUtils.h"
-
- const int nsAbBoolExprToLDAPFilter::TRANSLATE_CARD_PROPERTY = 1 << 0 ;
- const int nsAbBoolExprToLDAPFilter::ALLOW_NON_CONVERTABLE_CARD_PROPERTY = 1 << 1 ;
-@@ -80,6 +81,35 @@
- if (count == 0)
- return NS_OK;
-
-+ /*
-+ * 3rd party query integration with Mozilla is achieved
-+ * by calling nsAbLDAPDirectoryQuery::DoQuery(). Thus
-+ * we can arrive here with a query asking for all the
-+ * ldap attributes using the card:nsIAbCard interface.
-+ *
-+ * So we need to check that we are not creating a condition
-+ * filter against this otherwise we can end an
-+ * invalid filter equal to "(|)".
-+ */
-+
-+ if (count == 1 )
-+ {
-+ nsCOMPtr<nsISupports> item;
-+ rv = childExpressions->GetElementAt (0, getter_AddRefs (item));
-+ NS_ENSURE_SUCCESS(rv, rv);
-+
-+ nsCOMPtr<nsIAbBooleanConditionString> childCondition(do_QueryInterface(item, &rv));
-+ if (NS_SUCCEEDED(rv))
-+ {
-+ nsXPIDLCString name;
-+ rv = childCondition->GetName (getter_Copies (name));
-+ NS_ENSURE_SUCCESS(rv, rv);
-+
-+ if(name.Equals("card:nsIAbCard"))
-+ return NS_OK;
-+ }
-+ }
-+
- filter += NS_LITERAL_CSTRING("(");
- switch (operation)
- {
-@@ -157,13 +187,16 @@
- rv = condition->GetName (getter_Copies (name));
- NS_ENSURE_SUCCESS(rv, rv);
-
-- const char* ldapProperty = name.get ();
-+ CharPtrArrayGuard attrs;
- if (flags & TRANSLATE_CARD_PROPERTY)
- {
-- const MozillaLdapPropertyRelation* p =
-- MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ());
-- if (p)
-- ldapProperty = p->ldapProperty;
-+ if(const MozillaLdapPropertyRelation* property =
-+ MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ()))
-+ {
-+ // allow even single ldap attribute mapppings to go through this to simplify the filter creation later.
-+ rv = MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (property->ldapProperty, attrs.GetSizeAddr(), attrs.GetArrayAddr() );
-+ NS_ENSURE_SUCCESS(rv, rv);
-+ }
- else if (!(flags & ALLOW_NON_CONVERTABLE_CARD_PROPERTY))
- return NS_OK;
- }
-@@ -173,6 +206,37 @@
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ConvertUCS2toUTF8 vUTF8 (value);
-
-+ // check if using multiple ldap attributes
-+ if(attrs.GetSize() == 1 )
-+ GenerateSingleFilter(conditionType,filter,vUTF8,attrs.GetArray()[0]);
-+ else
-+ {
-+ // add the opening brace if using multiple ldap attributes
-+ switch (conditionType)
-+ {
-+ // 'NOT' conditionals use the 'AND' operator
-+ case nsIAbBooleanConditionTypes::DoesNotExist:
-+ case nsIAbBooleanConditionTypes::DoesNotContain:
-+ case nsIAbBooleanConditionTypes::IsNot:
-+ filter += NS_LITERAL_CSTRING("(&");
-+ break;
-+ default:
-+ filter += NS_LITERAL_CSTRING("(|");
-+ break;
-+ }
-+ GenerateMultipleFilter(conditionType,filter,vUTF8,&attrs);
-+ // add the closing brace if using multiple ldap attributes
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+
-+ return rv;
-+}
-+void nsAbBoolExprToLDAPFilter:: GenerateSingleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ const char *ldapProperty)
-+{
- switch (conditionType)
- {
- case nsIAbBooleanConditionTypes::DoesNotExist:
-@@ -253,7 +317,47 @@
- default:
- break;
- }
--
-- return rv;
- }
-+void nsAbBoolExprToLDAPFilter:: GenerateMultipleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ CharPtrArrayGuard *pAttrs)
-+{
-+ PRUint16 i = 0;
-+ PRUint16 inner = 0;
-
-+ /*
-+ * This function is based on the fact that we are trying to generate support
-+ * for multiple occurring ldap attributes. Consider the following query:
-+ * (PagerNumber,=,123456) where PagerNumber = pager|pagerphone translates to:
-+ * (|(&(pager=*)(pager=123456))(&(!(pager=*))(pagerphone=123456)))
-+ * This can be shortened to:
-+ * (|(pager=123456)(&(!(pager=*))(pagerphone=123456)))
-+ *
-+ * i.e. use the first occurring attribute if it exists otherwise if first
-+ * does not exist use the second etc. The assumption is that the first
-+ * always takes precedence.
-+ * This translates to:
-+ * GenerateSingleFilter(Is);
-+ * GenerateSingleFilter(DoesNotExists);
-+ * GenerateSingleFilter(Is);
-+ */
-+
-+ for (i = 0; i < pAttrs->GetSize(); i++)
-+ {
-+ if(i == 0)
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ else
-+ {
-+ filter += NS_LITERAL_CSTRING("(&");
-+ nsAbBooleanConditionType doesNotExistsType = nsIAbBooleanConditionTypes::DoesNotExist;
-+ for(inner = 0; inner < i; ++inner)
-+ {
-+ GenerateSingleFilter(doesNotExistsType,filter,vUTF8,pAttrs->GetArray()[inner]);
-+ }
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+ }
-+}
-Index: mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 22 Oct 2003 09:45:04 -0000 1.2
-@@ -42,6 +42,7 @@
- #include "nsIAbBooleanExpression.h"
- #include "nsCOMPtr.h"
- #include "nsString.h"
-+#include "nsAbUtils.h"
-
- class nsAbBoolExprToLDAPFilter
- {
-@@ -67,6 +68,16 @@
- nsIAbBooleanConditionString* condition,
- nsCString& filter,
- int flags);
-+ static void GenerateMultipleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ CharPtrArrayGuard *pAttrs);
-+ static void GenerateSingleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ const char *ldapProperty);
- };
-
- #endif
-Index: mailnews/addrbook/src/nsAbLDAPDirectory.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -w -b -i -r1.1.1.1 -r1.3
---- miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 8 Jan 2004 04:26:20 -0000 1.3
-@@ -112,15 +112,82 @@
-
- // use mURINoQuery to get a prefName
- nsCAutoString prefName;
-- prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
-+ prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) ;
-
- // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
- nsXPIDLCString URI;
-- rv = prefs->CopyCharPref(prefName.get(), getter_Copies(URI));
-+ nsCAutoString uriPrefName;
-+ uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
-+ rv = prefs->CopyCharPref(uriPrefName.get(), getter_Copies(URI));
-+ if (NS_FAILED(rv))
-+ {
-+ /*
-+ * A recent change in Mozilla now means that the LDAP Address Book
-+ * RDF Resource URI is based on the unique preference name value i.e.
-+ * [moz-abldapdirectory://prefName]
-+ * Prior to this valid change it was based on the actual uri i.e.
-+ * [moz-abldapdirectory://host:port/basedn]
-+ * Basing the resource on the prefName allows these attributes to
-+ * change.
-+ *
-+ * But the uri value was also the means by which third-party
-+ * products could integrate with Mozilla's LDAP Address Books without
-+ * necessarily having an entry in the preferences file or more importantly
-+ * needing to be able to change the preferences entries. Thus to set the
-+ * URI Spec now, it is only necessary to read the uri pref entry, while in the case
-+ * where it is not a preference, we need to replace the "moz-abldapdirectory".
-+ */
-+ nsCAutoString tempLDAPURL(mURINoQuery);
-+ tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
-+ rv = mURL->SetSpec(tempLDAPURL);
- NS_ENSURE_SUCCESS(rv,rv);
-
-+ nsCAutoString aHost;
-+ mURL->GetHost(aHost);
-+ aHost.ReplaceChar('.','_');
-+ prefName = nsDependentCString("ldap_2.servers.") + aHost;
-+ PRBool useSSL=0;
-+ rv = prefs->GetBoolPref(
-+ PromiseFlatCString(prefName
-+ + NS_LITERAL_CSTRING(".UseSSL")).get(),
-+ &useSSL
-+ );
-+
-+ // If use SSL,ldap url will look like this ldaps://host:port/.....
-+ if (!NS_FAILED(rv) && useSSL)
-+ {
-+ tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
-+ rv = mURL->SetSpec(tempLDAPURL);
-+ }
-+ //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
-+ rv = 0;
-+
-+ }
-+ else
-+ {
- rv = mURL->SetSpec(URI);
-+ }
- NS_ENSURE_SUCCESS(rv, rv);
-+
-+ // get the login information, if there is any
-+ //
-+ rv = prefs->GetCharPref(
-+ PromiseFlatCString(prefName
-+ + NS_LITERAL_CSTRING(".auth.dn")).get(),
-+ getter_Copies(mLogin));
-+ if (NS_FAILED(rv)) {
-+ mLogin.Truncate(); // zero out mLogin
-+ }
-+
-+ // get the password information, if there is any
-+ //
-+ rv = prefs->GetCharPref(
-+ PromiseFlatCString(prefName
-+ + NS_LITERAL_CSTRING(".auth.pwd")).get(),
-+ getter_Copies(mPassword));
-+ if (NS_FAILED(rv)) {
-+ mPassword.Truncate(); // zero out mLogin
-+ }
-
- mConnection = do_CreateInstance(NS_LDAPCONNECTION_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-Index: mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -w -b -i -r1.1.1.1 -r1.3
---- miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 8 Jan 2004 04:26:20 -0000 1.3
-@@ -68,7 +68,7 @@
- PRInt32 resultLimit = -1,
- PRInt32 timeOut = 0);
- virtual ~nsAbQueryLDAPMessageListener ();
--
-+ void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
- protected:
- nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
- nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
-@@ -99,6 +99,8 @@
- PRBool mInitialized;
- PRBool mCanceled;
-
-+ nsAutoString m_sPassword;
-+
- nsCOMPtr<nsILDAPOperation> mSearchOperation;
-
- PRLock* mLock;
-@@ -253,6 +255,7 @@
- do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
-+#if 0
- nsCOMPtr<nsILDAPMessageListener> proxyListener;
- rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ,
- NS_GET_IID(nsILDAPMessageListener),
-@@ -261,10 +264,14 @@
- getter_AddRefs(proxyListener));
-
- rv = ldapOperation->Init(mConnection, proxyListener);
-+#endif
-+#if 1
-+ rv = ldapOperation->Init(mConnection, this);
-+#endif
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Bind
-- rv = ldapOperation->SimpleBind(nsnull);
-+ rv = ldapOperation->SimpleBind(m_sPassword.get());
- NS_ENSURE_SUCCESS(rv, rv);
-
- return rv;
-@@ -280,6 +287,7 @@
- mSearchOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
-+#if 0
- nsCOMPtr<nsIProxyObjectManager> proxyMgr =
- do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-@@ -290,6 +298,10 @@
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = mSearchOperation->Init (mConnection, proxyListener);
-+#endif
-+#if 1
-+ rv = mSearchOperation->Init (mConnection, this);
-+#endif
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsXPIDLCString dn;
-@@ -519,6 +531,23 @@
- rv = nsAbBoolExprToLDAPFilter::Convert (expression, filter);
- NS_ENSURE_SUCCESS(rv, rv);
-
-+ /*
-+ * Mozilla itself cannot arrive here with a blank filter
-+ * as the nsAbLDAPDirectory::StartSearch() disallows it.
-+ * But 3rd party LDAP query integration with Mozilla begins
-+ * in this method.
-+ *
-+ * Default the filter string if blank, otherwise it gets
-+ * set to (objectclass=*) which returns everything. Set
-+ * the default to (objectclass=inetorgperson) as this
-+ * is the most appropriate default objectclass which is
-+ * central to the makeup of the mozilla ldap address book
-+ * entries.
-+ */
-+ if(filter.IsEmpty())
-+ {
-+ filter += NS_LITERAL_CSTRING("(objectclass=inetorgperson)");
-+ }
-
- // Set up the search ldap url
- nsCOMPtr<nsILDAPURL> directoryUrl;
-@@ -592,6 +621,11 @@
- timeOut);
- if (_messageListener == NULL)
- return NS_ERROR_OUT_OF_MEMORY;
-+
-+ nsAutoString wPassword;
-+ wPassword.AssignWithConversion(mPassword.get());
-+ _messageListener->SetPassword(wPassword);
-+
- messageListener = _messageListener;
- nsVoidKey key (NS_REINTERPRET_CAST(void *,contextID));
-
-@@ -604,9 +638,12 @@
-
- *_retval = contextID;
-
-+ nsAutoString wLogin;
-+ wLogin.AssignWithConversion(mLogin.get());
-+
- // Now lets initialize the LDAP connection properly. We'll kick
- // off the bind operation in the callback function, |OnLDAPInit()|.
-- rv = ldapConnection->Init(host.get(), port, options, nsnull,
-+ rv = ldapConnection->Init(host.get(), port, options, wLogin.get(),
- messageListener);
- NS_ENSURE_SUCCESS(rv, rv);
-
-Index: mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 8 Jan 2004 04:26:20 -0000 1.2
-@@ -72,6 +72,8 @@
- friend class nsAbQueryLDAPMessageListener;
- nsresult RemoveListener (PRInt32 contextID);
- nsresult Initiate ();
-+ nsXPIDLCString mLogin; // authenticate to the LDAP server as...
-+ nsXPIDLCString mPassword; // password to the LDAP server as...
-
- private:
- nsCString mLdapUrl;
-Index: mailnews/addrbook/src/nsAbLDAPProperties.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp 22 Oct 2003 09:45:04 -0000 1.2
-@@ -39,6 +39,7 @@
- #include "nsAbLDAPProperties.h"
-
- #include "nsAbUtils.h"
-+#include "nsCRT.h"
-
- #include "nsCOMPtr.h"
- #include "nsString.h"
-@@ -59,6 +60,21 @@
- If there are multiple entries for a mozilla
- property the first takes precedence.
-
-+ But where we need to do a query against
-+ a multiple occurring ldap attribute we
-+ need to OR all the possible ldap entries e.g.
-+
-+ (CellularNumber=123456) translates to
-+ (|(mobile=123456)(&(!(mobile=*))(cellphone=123456))(&(!(mobile=*))(!(cellphone=*))(carphone=123456)))
-+
-+ i.e. use the first occurring attribute otherwise if
-+ first does not exist use the second etc.
-+
-+ [Multiple occurring ldap attributes do not
-+ include aliases. We have also ignored the case
-+ for including 'displayname' as the first occurring
-+ attribute 'cn' is a required attribute.]
-+
- This ensures that
-
- 1) Generality is maintained when mapping from
-@@ -101,55 +117,32 @@
- {MozillaProperty_String, "FaxNumber", "fax"},
- // organizationalPerson
- {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber"},
-- // inetOrgPerson
-- {MozillaProperty_String, "PagerNumber", "pager"},
-- // ?
-- {MozillaProperty_String, "PagerNumber", "pagerphone"},
-- // inetOrgPerson
-- {MozillaProperty_String, "CellularNumber", "mobile"},
-- // ?
-- {MozillaProperty_String, "CellularNumber", "cellphone"},
-- // ?
-- {MozillaProperty_String, "CellularNumber", "carphone"},
-+ // inetOrgPerson ?
-+ {MozillaProperty_String, "PagerNumber", "pager,pagerphone"},
-+ // inetOrgPerson ? ?
-+ {MozillaProperty_String, "CellularNumber", "mobile,cellphone,carphone"},
-
- // No Home* properties defined yet
-
-- // organizationalPerson
-- {MozillaProperty_String, "WorkAddress", "postofficebox"},
-- // ?
-- {MozillaProperty_String, "WorkAddress", "streetaddress"},
-+ // organizationalPerson ?
-+ {MozillaProperty_String, "WorkAddress", "postofficebox,streetaddress"},
- // ?
- {MozillaProperty_String, "WorkCity", "l"},
- // ?
- {MozillaProperty_String, "WorkCity", "locality"},
-- // ?
-- {MozillaProperty_String, "WorkState", "st"},
-- // ?
-- {MozillaProperty_String, "WorkState", "region"},
-- // organizationalPerson
-- {MozillaProperty_String, "WorkZipCode", "postalcode"},
-- // ?
-- {MozillaProperty_String, "WorkZipCode", "zip"},
-+ // ? ?
-+ {MozillaProperty_String, "WorkState", "st,region"},
-+ // organizationalPerson ?
-+ {MozillaProperty_String, "WorkZipCode", "postalcode,zip"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
-
- // organizationalPerson
- {MozillaProperty_String, "JobTitle", "title"},
-- // ?
-- {MozillaProperty_String, "Department", "ou"},
-- // ?
-- {MozillaProperty_String, "Department", "orgunit"},
-- // ?
-- {MozillaProperty_String, "Department", "department"},
-- // ?
-- {MozillaProperty_String, "Department", "departmentnumber"},
-- // inetOrgPerson
-- {MozillaProperty_String, "Company", "o"},
-- // ?
-- {MozillaProperty_String, "Company", "company"},
-- // ?
-- {MozillaProperty_String, "WorkCountry", "countryname"},
--
-+ // ? ? ? ?
-+ {MozillaProperty_String, "Department", "ou,orgunit,department,departmentnumber"},
-+ // inetOrgPerson ?
-+ {MozillaProperty_String, "Company", "o,company"},
- // ?
- {MozillaProperty_String, "WebPage1", "workurl"},
- // ?
-@@ -167,10 +160,8 @@
- // ?
- {MozillaProperty_String, "Custom4", "custom4"},
-
-- // ?
-- {MozillaProperty_String, "Notes", "notes"},
-- // person
-- {MozillaProperty_String, "Notes", "description"},
-+ // ? person
-+ {MozillaProperty_String, "Notes", "notes,description"},
-
- // mozilla specfic
- {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail"},
-@@ -208,10 +199,22 @@
- if (IsInitialized) { return ; }
-
- for (int i = tableSize - 1 ; i >= 0 ; -- i) {
-- nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
-- nsCStringKey keyLdap (table [i].ldapProperty, -1, nsCStringKey::NEVER_OWN);
-
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsCRT::strdup(table[i].ldapProperty);
-+ char *tmpLDAPProperty;
-+
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (attrToken != nsnull)
-+ {
-+ while ( ' ' == *attrToken)
-+ attrToken++;
-+ nsCStringKey keyLdap (attrToken, -1, nsCStringKey::NEVER_OWN);
- mLdapToMozilla.Put(&keyLdap, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
-+ }
-+
-+ nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
- mMozillaToLdap.Put(&keyMozilla, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
- }
- IsInitialized = PR_TRUE;
-@@ -233,10 +236,13 @@
- const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (const char* ldapProperty)
- {
- Initialize();
-+ char *attrToken;
-+ char *tmpLDAPProperty;
-+ attrToken = nsCRT::strtok(NS_CONST_CAST(char *,ldapProperty), ",", &tmpLDAPProperty);
- // ensure that we always do a case insensitive comparison
- // against the incoming ldap attributes.
-- nsCAutoString lowercasedProp (ldapProperty) ;
-- ToLowerCase(nsDependentCString(ldapProperty),lowercasedProp);
-+ nsCAutoString lowercasedProp (attrToken) ;
-+ ToLowerCase(nsDependentCString(attrToken),lowercasedProp);
- nsCStringKey key (lowercasedProp) ;
-
- return NS_REINTERPRET_CAST(const MozillaLdapPropertyRelation *, mLdapToMozilla.Get(&key)) ;
-@@ -286,5 +292,66 @@
- }
- }
-
-+ return rv;
-+}
-+
-+// Parse the input string which may contain a single ldap attribute or multiple attributes in the form
-+// "string" or "string1,string2,string3" respectively and assign to the array.
-+nsresult MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes)
-+{
-+ NS_ENSURE_ARG_POINTER(aAttrCount);
-+ NS_ENSURE_ARG_POINTER(aAttributes);
-+
-+ nsresult rv = NS_OK;
-+
-+ *aAttributes = 0;
-+ // we must have at least one attribute
-+ *aAttrCount = 1;
-+
-+ // if no multiple ldap attributes then allocate our single entry and exit
-+ if (!strchr(aLDAPProperty,','))
-+ {
-+ if (!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ if (!((*aAttributes)[0] = nsCRT::strdup(aLDAPProperty)))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ return rv;
-+ }
-+
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsnull;
-+ char *tmpLDAPProperty;
-+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ // set our tokenizer to the start
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+
-+ // Count up the attribute names
-+ while ((attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty)) != nsnull)
-+ *aAttrCount += 1;
-+
-+ nsCRT::free (LDAPProperty);
-+ if(!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(*aAttrCount * sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ PRInt32 j = 0;
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (nsnull != attrToken) {
-+ if(((*aAttributes)[j++] = nsCRT::strdup(attrToken)) == nsnull)
-+ {
-+ nsCRT::free(LDAPProperty);
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ }
-+
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
-+ }
-+
-+ nsCRT::free(LDAPProperty);
- return rv;
- }
-Index: mailnews/addrbook/src/nsAbLDAPProperties.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h 22 Oct 2003 09:45:04 -0000 1.2
-@@ -85,6 +85,7 @@
- static nsresult createCardPropertyFromLDAPMessage (nsILDAPMessage* message,
- nsIAbCard* card,
- PRBool* hasSetCardProperty);
-+ static nsresult getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes);
- };
-
- #endif
-Index: mailnews/addrbook/src/nsAbOutlookCard.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 9 Dec 2003 03:26:47 -0000 1.2
-@@ -97,6 +97,8 @@
- {
- index_DisplayName = 0,
- index_EmailAddress,
-+ index_SecondEmailAddress,
-+ //index_ScreenName,
- index_FirstName,
- index_LastName,
- index_NickName,
-@@ -124,32 +126,35 @@
-
- static const ULONG OutlookCardMAPIProps [] =
- {
-- PR_DISPLAY_NAME_W,
-- PR_EMAIL_ADDRESS_W,
-- PR_GIVEN_NAME_W,
-- PR_SURNAME_W,
-- PR_NICKNAME_W,
-- PR_BUSINESS_TELEPHONE_NUMBER_W,
-- PR_HOME_TELEPHONE_NUMBER_W,
-- PR_BUSINESS_FAX_NUMBER_W,
-- PR_PAGER_TELEPHONE_NUMBER_W,
-- PR_MOBILE_TELEPHONE_NUMBER_W,
-- PR_HOME_ADDRESS_CITY_W,
-- PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
-- PR_HOME_ADDRESS_POSTAL_CODE_W,
-- PR_HOME_ADDRESS_COUNTRY_W,
-- PR_BUSINESS_ADDRESS_CITY_W,
-- PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
-- PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
-- PR_BUSINESS_ADDRESS_COUNTRY_W,
-- PR_TITLE_W,
-- PR_DEPARTMENT_NAME_W,
-- PR_COMPANY_NAME_W,
-- PR_BUSINESS_HOME_PAGE_W,
-- PR_PERSONAL_HOME_PAGE_W,
-- PR_COMMENT_W
-+ PR_DISPLAY_NAME_A,//0x8035001E,//PR_DISPLAY_NAME_A,
-+ PR_EMAIL_ADDRESS_A,//0x8034001E,//PR_EMAIL_ADDRESS_A,
-+ PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
-+ //PR_SCREEN_NAME_A,//AimScreenName
-+ PR_GIVEN_NAME_A,
-+ PR_SURNAME_A,
-+ PR_NICKNAME_A,
-+ PR_BUSINESS_TELEPHONE_NUMBER_A,
-+ PR_HOME_TELEPHONE_NUMBER_A,
-+ PR_BUSINESS_FAX_NUMBER_A,
-+ PR_PAGER_TELEPHONE_NUMBER_A,
-+ PR_MOBILE_TELEPHONE_NUMBER_A,
-+ PR_HOME_ADDRESS_CITY_A,
-+ PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
-+ PR_HOME_ADDRESS_POSTAL_CODE_A,
-+ PR_HOME_ADDRESS_COUNTRY_A,
-+ PR_BUSINESS_ADDRESS_CITY_A,
-+ PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
-+ PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
-+ PR_BUSINESS_ADDRESS_COUNTRY_A,
-+ PR_TITLE_A,
-+ PR_DEPARTMENT_NAME_A,
-+ PR_COMPANY_NAME_A,
-+ PR_BUSINESS_HOME_PAGE_A,
-+ PR_PERSONAL_HOME_PAGE_A,
-+ PR_COMMENT_A
- } ;
-
-+
- nsresult nsAbOutlookCard::Init(const char *aUri)
- {
- nsresult retCode = nsRDFResource::Init(aUri) ;
-@@ -176,6 +181,8 @@
- SetDisplayName(unichars [index_DisplayName]->get()) ;
- SetNickName(unichars [index_NickName]->get()) ;
- SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
-+ SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
-+ //SetAimScreenName(unichars [index_ScreenName]->get()) ;
- SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
- SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
- SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
-@@ -210,12 +217,12 @@
- nsAutoString unichar ;
- nsAutoString unicharBis ;
-
-- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
-+ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
- splitString(unichar, unicharBis) ;
- SetHomeAddress(unichar.get()) ;
- SetHomeAddress2(unicharBis.get()) ;
- }
-- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
-+ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
- splitString(unichar, unicharBis) ;
- SetWorkAddress(unichar.get()) ;
- SetWorkAddress2(unicharBis.get()) ;
-@@ -297,6 +304,8 @@
- SetDisplayName(properties [index_DisplayName]) ;
- GetNickName(getter_Copies(properties [index_NickName])) ;
- GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
-+ GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
-+ //GetAimScreenName(getter_Copies(properties [index_ScreenName])) ;
- GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
- GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
- GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
-@@ -316,11 +325,20 @@
- GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
- GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
- GetNotes(getter_Copies(properties [index_Comments])) ;
-- if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
-- index_LastProp, properties)) {
-- PRINTF(("Cannot set general properties.\n")) ;
-+
-+ int i=0;
-+ for (i=0;i<index_LastProp;i++)
-+ {
-+ if (!mapiAddBook->SetPropertyUString(*mMapiData,
-+ OutlookCardMAPIProps[i],
-+ properties[i]))
-+ {
-+ PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
- }
-+ }
-+
- delete [] properties ;
-+
- nsXPIDLString unichar ;
- nsXPIDLString unichar2 ;
- WORD year = 0 ;
-Index: mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 22 Oct 2003 02:43:10 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 9 Dec 2003 03:26:47 -0000 1.2
-@@ -125,8 +125,8 @@
- nsCAutoString uri ;
- nsCOMPtr<nsIRDFResource> resource ;
-
-- for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
-- folders.mEntries [i].ToString(entryId) ;
-+ for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
-+ folders[i].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
- uri.Append(entryId) ;
-
-Index: mailnews/addrbook/src/nsAbOutlookDirectory.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -w -b -i -r1.1.1.1 -r1.3
---- miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 9 Dec 2003 03:26:47 -0000 1.3
-@@ -125,7 +125,7 @@
- PRINTF(("Cannot get type.\n")) ;
- return NS_ERROR_FAILURE ;
- }
-- if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
-+ if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
- PRINTF(("Cannot get name.\n")) ;
- return NS_ERROR_FAILURE ;
- }
-@@ -161,45 +161,85 @@
- return retCode ;
- }
-
-+nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
-+ PRBool aSearchForOld, PRBool& aIsNewCard)
-+{
-+ nsresult retCode = NS_OK ;
-+ if (aSearchForOld) {
-+ nsCStringKey key(uriName) ;
-+ nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
-+
-+ if (existingCard) {
-+ nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
-+
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ NS_IF_ADDREF(*aNewCard = card) ;
-+ aIsNewCard = PR_FALSE ;
-+ return retCode ;
-+ }
-+ }
-+ aIsNewCard = PR_TRUE ;
-+ nsCOMPtr<nsIRDFResource> resource ;
-+
-+ nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ resource = do_QueryInterface(childCard, &retCode) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ retCode = resource->Init(uriName.get()) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ NS_IF_ADDREF(*aNewCard = childCard);
-+ return retCode ;
-+}
-+
- NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
- {
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsCOMPtr<nsISupportsArray> cardList ;
-+ nsCStringArray uriList ;
-+ nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
- nsresult retCode ;
-
-- mCardList.Reset() ;
- if (mIsQueryURI) {
- retCode = StartSearch() ;
-- NS_NewISupportsArray(getter_AddRefs(cardList)) ;
- }
- else {
-- retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
-+ retCode = GetChildCards(uriList, nsnull) ;
- }
-+ NS_NewISupportsArray(getter_AddRefs(cardList)) ;
- if (NS_SUCCEEDED(retCode)) {
- // Fill the results array and update the card list
- // Also update the address list and notify any changes.
- PRUint32 nbCards = 0 ;
-- nsCOMPtr<nsISupports> element ;
-+ nsCAutoString uriName;
-+ nsCOMPtr <nsIAbCard> childCard;
-+ PRBool searchForOldCards = (mCardList.Count() != 0) ;
-+
-+ nbCards = uriList.Count();
-+ NS_NewISupportsArray(getter_AddRefs(m_AddressList));
-
-- cardList->Enumerate(aCards) ;
-- cardList->Count(&nbCards) ;
- for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
-- cardList->GetElementAt(i, getter_AddRefs(element)) ;
-- nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
-- nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
-+ PRBool isNewCard = PR_FALSE ;
-+
-+ uriList.CStringAt(i,uriName);
-+ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ cardList->AppendElement(childCard);
-
-- if (!oldElement) {
-+ if (isNewCard) {
- // We are dealing with a new element (probably directly
- // added from Outlook), we may need to sync m_AddressList
-- mCardList.Put(&newKey, element) ;
-- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-+ nsCStringKey newKey(uriName) ;
-+
-+ mCardList.Put(&newKey, childCard) ;
-+ nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- PRBool isMailList = PR_FALSE ;
-
- retCode = card->GetIsMailList(&isMailList) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
- if (isMailList) {
- // We can have mailing lists only in folder,
- // we must add the directory to m_AddressList
-@@ -222,18 +262,33 @@
- NotifyItemAddition(card) ;
- }
- }
-- else {
-- NS_ASSERTION(oldElement == element, "Different card stored") ;
- }
- }
-+ return cardList->Enumerate(aCards) ;
- }
-+
-+static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
-+ nsresult retCode = NS_OK ;
-+ nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
-+
-+ // Receiving a non-RDF card is accepted
-+ if (NS_FAILED(retCode)) { return NS_OK ; }
-+ nsXPIDLCString uri ;
-+
-+ retCode = resource->GetValue(getter_Copies(uri)) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ aUri = uri.get() ;
- return retCode ;
- }
-
- NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
- {
- if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
-- nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
-+ *aHasCard = PR_FALSE ;
-+ nsCString uri ;
-+
-+ ExtractUriFromCard(aCard, uri) ;
-+ nsCStringKey key(uri) ;
-
- *aHasCard = mCardList.Exists(&key) ;
- return NS_OK ;
-@@ -315,7 +370,10 @@
- PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
- }
- else {
-- nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
-+ nsCString uri ;
-+
-+ ExtractUriFromCard(card, uri) ;
-+ nsCStringKey key(uri) ;
-
- mCardList.Remove(&key) ;
- if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
-@@ -378,7 +436,10 @@
- }
- retCode = CreateCard(aData, addedCard) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
-+ nsCString uri ;
-+
-+ ExtractUriFromCard(*addedCard, uri) ;
-+ nsCStringKey newKey(uri) ;
-
- mCardList.Put(&newKey, *addedCard) ;
- if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
-@@ -449,7 +510,7 @@
- if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
- retCode = GetDirName(getter_Copies(name)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
-+ if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
- return NS_ERROR_FAILURE ;
- }
- retCode = CommitAddressList() ;
-@@ -510,6 +571,8 @@
- {"DisplayName", PR_DISPLAY_NAME_A},
- {"NickName", PR_NICKNAME_A},
- {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
-+ //{"_AimScreenName",PR_SCREEN_NAME_A},
-+ {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
- {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
- {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
- {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
-@@ -950,6 +1013,7 @@
- delete threadArgs ;
- return NS_ERROR_OUT_OF_MEMORY ;
- }
-+
- nsIntegerKey newKey(*aReturnValue) ;
-
- mQueryThreads.Put(&newKey, newThread) ;
-@@ -1018,7 +1082,10 @@
-
- nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
- {
-- nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
-+ nsCString uri ;
-+
-+ ExtractUriFromCard(aCard, uri) ;
-+ nsCStringKey newKey(uri) ;
- nsresult retCode = NS_OK ;
-
- mCardList.Put(&newKey, aCard) ;
-@@ -1042,14 +1109,14 @@
- retCode = BuildRestriction(aArguments, arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsISupportsArray> resultsArray ;
-+ nsCStringArray uriArray ;
- PRUint32 nbResults = 0 ;
-
-- retCode = GetChildCards(getter_AddRefs(resultsArray),
-+ retCode = GetChildCards(uriArray,
- arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
- DestroyRestriction(arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- retCode = resultsArray->Count(&nbResults) ;
-- NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ nbResults = uriArray.Count() ;
- nsCOMPtr<nsIAbDirectoryQueryResult> result ;
- nsAbDirectoryQueryResult *newResult = nsnull ;
-
-@@ -1057,15 +1124,18 @@
- nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
- }
- PRUint32 i = 0 ;
-- nsCOMPtr<nsISupports> element ;
- nsCOMPtr<nsISupportsArray> propertyValues ;
-
-+ nsCAutoString uriName;
-+ nsCOMPtr <nsIAbCard> card;
-+
- for (i = 0 ; i < nbResults ; ++ i) {
-- retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
-- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-+ PRBool isNewCard = PR_FALSE ;
-
-+ uriArray.CStringAt(i,uriName);
-+ retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
- FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
- newResult = new nsAbDirectoryQueryResult(0, aArguments,
- nsIAbDirectoryQueryResult::queryResultMatch,
-@@ -1090,6 +1160,38 @@
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsresult retCode = NS_OK ;
-+
-+ nsCOMPtr<nsISupportsArray> cards;
-+ retCode = NS_NewISupportsArray(getter_AddRefs(cards));
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
-+ nsCStringArray uriList;
-+ retCode = GetChildCards(uriList,aRestriction);
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
-+ nsCAutoString uriName;
-+ nsCOMPtr <nsIAbCard> childCard;
-+ PRUint32 nbURIs = 0 ;
-+ nbURIs = uriList.Count();
-+ PRUint32 i = 0 ;
-+
-+ for (i = 0 ; i < nbURIs ; ++ i) {
-+ PRBool isNewCard = PR_FALSE ;
-+
-+ uriList.CStringAt(i,uriName);
-+ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ cards->AppendElement(childCard);
-+ }
-+
-+ NS_IF_ADDREF(*aCards = cards);
-+ return retCode ;
-+}
-+
-+nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
-+ void *aRestriction)
-+{
-+ nsresult retCode = NS_OK ;
- nsCOMPtr<nsISupportsArray> cards ;
- nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
- nsMapiEntryArray cardEntries ;
-@@ -1104,18 +1206,14 @@
- }
- nsCAutoString entryId ;
- nsCAutoString uriName ;
-- nsCOMPtr<nsIRDFResource> resource ;
-+ aURI.Clear();
-
-- for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
-- cardEntries.mEntries [card].ToString(entryId) ;
-+ for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
-+ cardEntries [card].ToString(entryId) ;
- buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
-- retCode = gRDFService->GetResource(uriName.get(), getter_AddRefs(resource)) ;
-- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- cards->AppendElement(resource) ;
-+ aURI.AppendCString(uriName);
- }
-- *aCards = cards ;
-- NS_ADDREF(*aCards) ;
- return retCode ;
- }
-
-@@ -1139,8 +1237,8 @@
- nsCAutoString uriName ;
- nsCOMPtr <nsIRDFResource> resource ;
-
-- for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
-- nodeEntries.mEntries [node].ToString(entryId) ;
-+ for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
-+ nodeEntries [node].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
- retCode = gRDFService->GetResource(uriName.get(), getter_AddRefs(resource)) ;
-@@ -1261,7 +1359,7 @@
- // In the case of a mailing list, we cannot directly create a new card,
- // we have to create a temporary one in a real folder (to be able to use
- // templates) and then copy it to the mailing list.
-- if (m_IsMailList) {
-+ if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
- nsMapiEntry parentEntry ;
- nsMapiEntry temporaryEntry ;
-
-@@ -1291,10 +1389,11 @@
- uri.Append(entryString) ;
- nsCOMPtr<nsIRDFResource> resource ;
-
-- retCode = gRDFService->GetResource(uri.get(), getter_AddRefs(resource)) ;
-+ nsCOMPtr<nsIAbCard> newCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-- nsCOMPtr<nsIAbCard> newCard(do_QueryInterface(resource, &retCode)) ;
--
-+ resource = do_QueryInterface(newCard, &retCode) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ retCode = resource->Init(uri.get()) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- if (!didCopy) {
- retCode = newCard->Copy(aData) ;
-Index: mailnews/addrbook/src/nsAbOutlookDirectory.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 22 Oct 2003 09:45:04 -0000 1.2
-@@ -46,6 +46,7 @@
- #include "nsHashtable.h"
-
- #include "nsISupportsArray.h"
-+#include "nsVoidArray.h"
-
- struct nsMapiEntry ;
-
-@@ -91,6 +92,8 @@
- protected:
- // Retrieve hierarchy as cards, with an optional restriction
- nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
-+ // Retrieve hierarchy as URIs, with an optional restriction
-+ nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
- // Retrieve hierarchy as directories
- nsresult GetChildNodes(nsISupportsArray **aNodes) ;
- // Create a new card
-@@ -102,6 +105,9 @@
- nsresult CommitAddressList(void) ;
- // Read MAPI repository
- nsresult UpdateAddressList(void) ;
-+ // Search for an existing card or build a new one
-+ nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
-+ PRBool aSearchForOld, PRBool& aIsNewCard) ;
-
- nsMapiEntry *mMapiData ;
- // Container for the query threads
-Index: mailnews/addrbook/src/nsAbWinHelper.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -w -b -i -r1.1.1.1 -r1.3
---- miss/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 9 Dec 2003 03:26:47 -0000 1.3
-@@ -41,6 +41,9 @@
- #define USES_IID_IABContainer
- #define USES_IID_IMAPITable
- #define USES_IID_IDistList
-+#define USES_IID_IMsgStore
-+#define USES_IID_IMessage
-+#define USES_IID_IMAPIFolder
-
- #include "nsAbWinHelper.h"
- #include "nsAbUtils.h"
-@@ -59,19 +62,6 @@
-
- #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
-
--// Small utility to ensure release of all MAPI interfaces
--template <class tInterface> struct nsMapiInterfaceWrapper
--{
-- tInterface mInterface ;
--
-- nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-- ~nsMapiInterfaceWrapper(void) {
-- if (mInterface != NULL) { mInterface->Release() ; }
-- }
-- operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-- tInterface operator -> (void) const { return mInterface ; }
-- operator tInterface *(void) { return &mInterface ; }
--} ;
-
- static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
- {
-@@ -249,24 +239,28 @@
- MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
-
- nsMapiEntryArray::nsMapiEntryArray(void)
--: mEntries(NULL), mNbEntries(0)
- {
- MOZ_COUNT_CTOR(nsMapiEntryArray) ;
- }
-
- nsMapiEntryArray::~nsMapiEntryArray(void)
- {
-- if (mEntries) { delete [] mEntries ; }
-+ CleanUp();
- MOZ_COUNT_DTOR(nsMapiEntryArray) ;
- }
--
-+void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
-+{
-+ m_array.AppendElement(aEntries);
-+}
- void nsMapiEntryArray::CleanUp(void)
- {
-- if (mEntries != NULL) {
-- delete [] mEntries ;
-- mEntries = NULL ;
-- mNbEntries = 0 ;
-+ nsMapiEntry *pEntries;
-+ for (int i = 0; i < m_array.Count(); i++)
-+ {
-+ pEntries = (nsMapiEntry *)m_array.ElementAt( i);
-+ delete pEntries;
- }
-+ m_array.Clear();
- }
-
- MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
-@@ -280,100 +274,55 @@
- // same protection (MAPI is supposed to be thread-safe).
- PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
-
-+int nsAbWinHelper::m_clients = 0;
-+
-+PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
-+int nsAbWinHelper::m_uniBuffLen = 0;
-+char * nsAbWinHelper::m_pCStrBuff = NULL;
-+int nsAbWinHelper::m_cstrBuffLen = 0;
-+
- nsAbWinHelper::nsAbWinHelper(void)
--: mAddressBook(NULL), mLastError(S_OK)
-+:mLastError(S_OK)
- {
- MOZ_COUNT_CTOR(nsAbWinHelper) ;
-+ m_clients++;
- }
-
- nsAbWinHelper::~nsAbWinHelper(void)
- {
- MOZ_COUNT_DTOR(nsAbWinHelper) ;
--}
--
--BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
-+ m_clients--;
-+ if (!m_clients)
- {
-- aFolders.CleanUp() ;
-- nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-- nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-- ULONG objType = 0 ;
-- ULONG rowCount = 0 ;
-- SRestriction restriction ;
-- SPropTagArray folderColumns ;
--
-- mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
-- rootFolder) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot open root %08x.\n", mLastError)) ;
-- return FALSE ;
-+ delete [] m_pUniBuff;
-+ m_pUniBuff = NULL;
-+ m_uniBuffLen = 0;
-+ delete [] m_pCStrBuff;
-+ m_pCStrBuff = NULL;
-+ m_cstrBuffLen = 0;
- }
-- mLastError = rootFolder->GetHierarchyTable(0, folders) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- // We only take into account modifiable containers,
-- // otherwise, we end up with all the directory services...
-- restriction.rt = RES_BITMASK ;
-- restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-- restriction.res.resBitMask.relBMR = BMR_NEZ ;
-- restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-- mLastError = folders->Restrict(&restriction, 0) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-- }
-- folderColumns.cValues = 1 ;
-- folderColumns.aulPropTag [0] = PR_ENTRYID ;
-- mLastError = folders->SetColumns(&folderColumns, 0) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-- return FALSE ;
- }
-- mLastError = folders->GetRowCount(0, &rowCount) ;
-- if (HR_SUCCEEDED(mLastError)) {
-- aFolders.mEntries = new nsMapiEntry [rowCount] ;
-- aFolders.mNbEntries = 0 ;
-- do {
-- LPSRowSet rowSet = NULL ;
-
-- rowCount = 0 ;
-- mLastError = folders->QueryRows(1, 0, &rowSet) ;
-- if (HR_SUCCEEDED(mLastError)) {
-- rowCount = rowSet->cRows ;
-- if (rowCount > 0) {
-- nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
-- SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
--
-- current.Assign(currentValue.Value.bin.cb,
-- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-- }
-- MyFreeProws(rowSet) ;
-- }
-- else {
-- PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-- }
-- } while (rowCount > 0) ;
-- }
-- return HR_SUCCEEDED(mLastError) ;
--}
-
- BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards)
- {
- aCards.CleanUp() ;
-- return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
-+ return GetContents(aParent, aRestriction, &aCards, 0) ;
- }
-
- BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
- {
- aNodes.CleanUp() ;
-- return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
-+ return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
- }
-
- BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
- {
-- aNbCards = 0 ;
-- return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
-+ nsMapiEntryArray aCards;
-+ BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
-+ aNbCards=aCards.GetSize();
-+ return ret;
- }
-
- BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
-@@ -390,7 +339,7 @@
- aName = values->Value.lpszA ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
-- aName.AssignWithConversion(values->Value.lpszW) ;
-+ UnicodeToCStr(values->Value.lpszW,aName) ;
- }
- }
- FreeBuffer(values) ;
-@@ -410,7 +359,7 @@
- aName = values->Value.lpszW ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
-- aName.AssignWithConversion(values->Value.lpszA) ;
-+ CStrToUnicode(values->Value.lpszA,aName) ;
- }
- }
- FreeBuffer(values) ;
-@@ -431,16 +380,24 @@
- ULONG i = 0 ;
-
- for (i = 0 ; i < valueCount ; ++ i) {
-- if (values [i].ulPropTag == aPropertyTags [i]) {
-+
-+ if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND)
-+ {
- if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
- nsAutoString temp ;
-
-- temp.AssignWithConversion (values [i].Value.lpszA) ;
-+ CStrToUnicode(values [i].Value.lpszA,temp) ;
- aNames.AppendString(temp) ;
- }
- else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
- aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
- }
-+ else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
-+ nsAutoString temp ;
-+
-+ CStrToUnicode (values [i].Value.lpszA,temp) ;
-+ aNames.AppendString(temp) ;
-+ }
- else {
- aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
- }
-@@ -466,7 +423,6 @@
- if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
- if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
- SYSTEMTIME readableTime ;
--
- if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
- aYear = readableTime.wYear ;
- aMonth = readableTime.wMonth ;
-@@ -518,7 +474,7 @@
- nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
- ULONG objType = 0 ;
-
-- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IMAPIContainer, 0, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-@@ -537,7 +493,7 @@
- SBinary entry ;
- SBinaryArray entryArray ;
-
-- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-@@ -567,14 +523,15 @@
- value.Value.lpszW = NS_CONST_CAST(WORD *, aValue) ;
- }
- else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
-- alternativeValue.AssignWithConversion(aValue) ;
-+ UnicodeToCStr(aValue,alternativeValue) ;
- value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
- }
- else {
- PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
- return TRUE ;
- }
-- return SetMAPIProperties(aObject, 1, &value) ;
-+ LPSPropValue values=&value;
-+ return SetMAPIProperties(aObject, 1, values) ;
- }
-
- BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-@@ -592,7 +549,7 @@
- values [currentValue ++].Value.lpszW = NS_CONST_CAST(WORD *, aValues [i].get()) ;
- }
- else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
-- alternativeValue.AssignWithConversion(aValues [i].get()) ;
-+ UnicodeToCStr(aValues [i].get(),alternativeValue) ;
- values [currentValue ++].Value.lpszA = nsCRT::strdup(alternativeValue.get()) ;
- }
- }
-@@ -624,7 +581,8 @@
- readableTime.wSecond = 0 ;
- readableTime.wMilliseconds = 0 ;
- if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
-- return SetMAPIProperties(aObject, 1, &value) ;
-+ LPSPropValue values=&value;
-+ return SetMAPIProperties(aObject, 1, values) ;
- }
- return TRUE ;
- }
-@@ -636,7 +594,7 @@
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-@@ -699,7 +657,7 @@
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-@@ -764,7 +722,7 @@
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-@@ -801,194 +759,77 @@
- return TRUE ;
- }
-
--BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
--{
-- LPENTRYID entryId = NULL ;
-- ULONG byteCount = 0 ;
-
-- mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- aContainer.Assign(byteCount, entryId) ;
-- FreeBuffer(entryId) ;
-- return TRUE ;
--}
-
--enum
--{
-- ContentsColumnEntryId = 0,
-- ContentsColumnObjectType,
-- ContentsColumnsSize
--} ;
-
--static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
--{
-- ContentsColumnsSize,
-- {
-- PR_ENTRYID,
-- PR_OBJECT_TYPE
-- }
--} ;
--
--BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-- nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
-+void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
- {
-- if (aList != NULL) { *aList = NULL ; }
-- aNbElements = 0 ;
-- nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-- nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-- ULONG objType = 0 ;
-- ULONG rowCount = 0 ;
-+ if (aRowset == NULL) { return ; }
-+ ULONG i = 0 ;
-
-- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-- &IID_IMAPIContainer, 0, &objType,
-- parent) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- // Here, flags for WAB and MAPI could be different, so this works
-- // only as long as we don't want to use any flag in GetContentsTable
-- mLastError = parent->GetContentsTable(0, contents) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- if (aRestriction != NULL) {
-- mLastError = contents->Restrict(aRestriction, 0) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- }
-- mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- mLastError = contents->GetRowCount(0, &rowCount) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-- return FALSE ;
-+ for (i = 0 ; i < aRowset->cRows ; ++ i) {
-+ FreeBuffer(aRowset->aRow [i].lpProps) ;
- }
-- if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
-- aNbElements = 0 ;
-- do {
-- LPSRowSet rowSet = NULL ;
--
-- rowCount = 0 ;
-- mLastError = contents->QueryRows(1, 0, &rowSet) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-- return FALSE ;
-+ FreeBuffer(aRowset) ;
- }
-- rowCount = rowSet->cRows ;
-- if (rowCount > 0 &&
-- (aMapiType == 0 ||
-- rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
-- if (aList != NULL) {
-- nsMapiEntry& current = (*aList) [aNbElements] ;
-- SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
--
-- current.Assign(currentValue.Value.bin.cb,
-- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
-+{
-+ result.Truncate( 0);
-+ int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
-+ if (wLen >= m_uniBuffLen)
-+ {
-+ delete [] m_pUniBuff;
-+ m_pUniBuff = new PRUnichar[wLen + 64];
-+ m_uniBuffLen = wLen + 64;
- }
-- ++ aNbElements ;
-+ if (wLen)
-+ {
-+ MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
-+ result = m_pUniBuff;
- }
-- MyFreeProws(rowSet) ;
-- } while (rowCount > 0) ;
-- return TRUE ;
- }
--
--BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-- ULONG aNbProperties, LPSPropValue& aValue,
-- ULONG& aValueCount)
-+void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
- {
-- nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-- ULONG objType = 0 ;
-- LPSPropTagArray properties = NULL ;
-- ULONG i = 0 ;
--
-- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-- &IID_IMAPIProp, 0, &objType,
-- object) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-- return FALSE ;
-+ result.Truncate( 0);
-+ int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
-+ if (cLen >= m_cstrBuffLen) {
-+ if (m_pCStrBuff)
-+ delete [] m_pCStrBuff;
-+ m_pCStrBuff = new char[cLen + 64];
-+ m_cstrBuffLen = cLen + 64;
- }
-- AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-- NS_REINTERPRET_CAST(void **, &properties)) ;
-- properties->cValues = aNbProperties ;
-- for (i = 0 ; i < aNbProperties ; ++ i) {
-- properties->aulPropTag [i] = aPropertyTags [i] ;
-+ if (cLen) {
-+ WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
-+ result = m_pCStrBuff;
- }
-- mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
-- FreeBuffer(properties) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get props %08x.\n", mLastError)) ;
-- }
-- return HR_SUCCEEDED(mLastError) ;
- }
-
--BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-- const LPSPropValue& aValues)
--{
-- nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-- ULONG objType = 0 ;
-- LPSPropProblemArray problems = NULL ;
-+static nsAbWinHelper *getOutlookAddressBook(void) {
-+ static nsMapiAddressBook *addressBook = NULL ;
-
-- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-- &IID_IMAPIProp, MAPI_MODIFY, &objType,
-- object) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- if (problems != NULL) {
-- for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-- PRINTF(("Problem %d: index %d code %08x.\n", i,
-- problems->aProblem [i].ulIndex,
-- problems->aProblem [i].scode)) ;
-- }
-- }
-- mLastError = object->SaveChanges(0) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-- }
-- return HR_SUCCEEDED(mLastError) ;
-+ if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
-+ return addressBook ;
- }
-
--void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
--{
-- if (aRowset == NULL) { return ; }
-- ULONG i = 0 ;
-+static nsAbWinHelper *getOutlookExpAddressBook(void) {
-+ static nsWabAddressBook *addressBook = NULL ;
-
-- for (i = 0 ; i < aRowset->cRows ; ++ i) {
-- FreeBuffer(aRowset->aRow [i].lpProps) ;
-- }
-- FreeBuffer(aRowset) ;
-+ if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
-+ return addressBook ;
- }
-
- nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
- : mHelper(NULL)
- {
- switch(aType) {
-- case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
-- case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
-+ case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
-+ case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
- default: break ;
- }
- }
-
- nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
- {
-- delete mHelper ;
- }
-
- const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
-Index: mailnews/addrbook/src/nsAbWinHelper.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsAbWinHelper.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 9 Dec 2003 03:26:47 -0000 1.2
-@@ -45,6 +45,24 @@
- #include "nsVoidArray.h"
- #include "nsXPIDLString.h"
-
-+#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
-+#define PR_SCREEN_NAME_A 0x805B001E
-+
-+
-+// Small utility to ensure release of all MAPI interfaces
-+template <class tInterface> struct nsMapiInterfaceWrapper
-+{
-+ tInterface mInterface ;
-+
-+ nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-+ ~nsMapiInterfaceWrapper(void) {
-+ if (mInterface ) { mInterface->Release() ; }
-+ }
-+ operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-+ tInterface operator -> (void) const { return mInterface ; }
-+ operator tInterface *(void) { return &mInterface ; }
-+} ;
-+
- struct nsMapiEntry
- {
- ULONG mByteCount ;
-@@ -62,14 +80,28 @@
-
- struct nsMapiEntryArray
- {
-- nsMapiEntry *mEntries ;
-- ULONG mNbEntries ;
-
- nsMapiEntryArray(void) ;
- ~nsMapiEntryArray(void) ;
-
-- const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
-+ void AddItem(nsMapiEntry * aEntries);
-+ void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
-+ {
-+ nsMapiEntry * aEntries=new nsMapiEntry();
-+ aEntries->Assign(mByteCount,mEntryId);
-+ AddItem(aEntries);
-+ }
-+
-+ ULONG GetSize( void) { return( m_array.Count());}
-+ nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
-+ nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
- void CleanUp(void) ;
-+ void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
-+ void Remove(int index){ m_array.RemoveElementAt(index); }
-+ ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
-+private:
-+ nsVoidArray m_array;
-+
- } ;
-
- class nsAbWinHelper
-@@ -79,7 +111,7 @@
- virtual ~nsAbWinHelper(void) ;
-
- // Get the top address books
-- BOOL GetFolders(nsMapiEntryArray& aFolders) ;
-+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
- // Get a list of entries for cards/mailing lists in a folder/mailing list
- BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards) ;
-@@ -97,18 +129,14 @@
- BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
- ULONG aNbProperties, nsStringArray& aValues) ;
- // Get the value of a MAPI property of type SYSTIME
-- BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD& aYear, WORD& aMonth, WORD& aDay) ;
-- // Get the value of a MAPI property of type LONG
-- BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
- // Get the value of a MAPI property of type BIN
- BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
- // Tests if a container contains an entry
- BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-- // Delete an entry in the address book
-- BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
- // Set the value of a MAPI property of type string in unicode
-- BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
- const PRUnichar *aValue) ;
- // Same as previous, but with a bunch of properties in one call
- BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-@@ -117,32 +145,44 @@
- BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD aYear, WORD aMonth, WORD aDay) ;
- // Create entry in the address book
-- BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ // Delete an entry in the address book
-+ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
- // Create a distribution list in the address book
-- BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
- // Copy an existing entry in the address book
-- BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-+ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
- // Get a default address book container
-- BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
-+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
- // Is the helper correctly initialised?
-- BOOL IsOK(void) const { return mAddressBook != NULL ; }
-+ virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
-+
-+ // Get the value of a MAPI property of type LONG
-+ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
-
- protected:
- HRESULT mLastError ;
-- LPADRBOOK mAddressBook ;
- static ULONG mEntryCounter ;
- static PRLock *mMutex ;
-
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ ) = 0;
-+
- // Retrieve the contents of a container, with an optional restriction
-- BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-- nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
-+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType) =0;
- // Retrieve the values of a set of properties on a MAPI object
-- BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
- ULONG aNbProperties,
-- LPSPropValue& aValues, ULONG& aValueCount) ;
-+ LPSPropValue& aValues, ULONG& aValueCount) =0;
- // Set the values of a set of properties on a MAPI object
-- BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-- const LPSPropValue& aValues) ;
-+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues) =0;
- // Clean-up a rowset returned by QueryRows
- void MyFreeProws(LPSRowSet aSet) ;
- // Allocation of a buffer for transmission to interfaces
-@@ -150,7 +190,16 @@
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
-
-+ static void CStrToUnicode( const char *pStr, nsString& result);
-+ static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
-+
- private:
-+ static int m_clients;
-+ static PRUnichar * m_pUniBuff;
-+ static int m_uniBuffLen;
-+ static char * m_pCStrBuff;
-+ static int m_cstrBuffLen;
-+
- } ;
-
- enum nsAbWinType
-@@ -168,6 +217,7 @@
-
- nsAbWinHelper *operator ->(void) { return mHelper ; }
-
-+ static void FreeWinAbLibrarys();
- private:
- nsAbWinHelper *mHelper ;
- } ;
-Index: mailnews/addrbook/src/nsMapiAddressBook.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 9 Dec 2003 03:26:47 -0000 1.2
-@@ -41,6 +41,22 @@
-
- #include "prlog.h"
-
-+static char * stristr(const char *big, const char *little)
-+{
-+ PRUint32 len;
-+
-+ if (!big || !little || !*big || !*little)
-+ return 0;
-+ len = strlen(little);
-+
-+ for( ; *big; big++ )
-+ if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
-+ return (char *)big;
-+
-+ return (char *)0;
-+
-+}
-+
- #ifdef PR_LOGGING
- static PRLogModuleInfo* gMapiAddressBookLog
- = PR_NewLogModule("nsMapiAddressBookLog");
-@@ -48,6 +64,60 @@
-
- #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
-
-+#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
-+#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
-+#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
-+#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
-+#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
-+#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
-+#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
-+
-+static const TagMap TagMaps[]={
-+ {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
-+ {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
-+ {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
-+ {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
-+
-+enum {
-+ ieidPR_ENTRYID = 0,
-+ ieidPR_OBJECT_TYPE,
-+ ieidPR_DISPLAY_NAME,
-+ ieidPR_MESSAGE_CLASS,
-+ ieidPR_STORE_ENTRYID,
-+ ieidPR_MESSAGE_RECIPIENTS,
-+ ieidMax
-+};
-+
-+static const SizedSPropTagArray(ieidMax, ptaEid)=
-+{
-+ ieidMax,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE,
-+ PR_DISPLAY_NAME,
-+ PR_MESSAGE_CLASS,
-+ PR_STORE_ENTRYID,
-+ PR_MESSAGE_RECIPIENTS
-+ }
-+};
-+
-+enum
-+{
-+ ContentsColumnEntryId = 0,
-+ ContentsColumnObjectType,
-+ ContentsColumnMessageClass,
-+ ContentsColumnsSize
-+} ;
-+
-+static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-+{
-+ ContentsColumnsSize,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE,
-+ PR_MESSAGE_CLASS
-+ }
-+} ;
-
- HMODULE nsMapiAddressBook::mLibrary = NULL ;
- PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
-@@ -60,7 +130,6 @@
- BOOL nsMapiAddressBook::mInitialized = FALSE ;
- BOOL nsMapiAddressBook::mLogonDone = FALSE ;
- LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
--LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
-
- BOOL nsMapiAddressBook::LoadMapiLibrary(void)
- {
-@@ -106,22 +175,19 @@
- MAPI_NEW_SESSION,
- &mRootSession) ;
- if (HR_FAILED(retCode)) {
-- PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
-+ PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
-+ return FALSE ;
- }
- mLogonDone = TRUE ;
-- retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
-- if (HR_FAILED(retCode)) {
-- PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
-- }
-+
- return HR_SUCCEEDED(retCode) ;
- }
-
- void nsMapiAddressBook::FreeMapiLibrary(void)
- {
- if (mLibrary) {
-- if (-- mLibUsage == 0) {
-+ if (--mLibUsage < 0) {
- {
-- if (mRootBook) { mRootBook->Release() ; }
- if (mRootSession) {
- if (mLogonDone) {
- mRootSession->Logoff(NULL, 0, 0) ;
-@@ -135,6 +201,7 @@
- }
- }
- FreeLibrary(mLibrary) ;
-+ mRootSession = NULL;
- mLibrary = NULL ;
- }
- }
-@@ -146,7 +213,6 @@
- : nsAbWinHelper()
- {
- BOOL result = Initialize() ;
--
- NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
- MOZ_COUNT_CTOR(nsMapiAddressBook) ;
- }
-@@ -154,35 +220,1691 @@
- nsMapiAddressBook::~nsMapiAddressBook(void)
- {
- nsAutoLock guard(mMutex) ;
--
-+ CleanUpMDB();
- FreeMapiLibrary() ;
- MOZ_COUNT_DTOR(nsMapiAddressBook) ;
- }
-
--BOOL nsMapiAddressBook::Initialize(void)
-+LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
- {
-- if (mAddressBook) { return TRUE ; }
-- nsAutoLock guard(mMutex) ;
-+ if (!pProp)
-+ return( NULL);
-
-- if (!LoadMapiLibrary()) {
-- PRINTF(("Cannot load library.\n")) ;
-+ int sz = CbNewSPropTagArray( 1);
-+ SPropTagArray *pTag = (SPropTagArray *) new char[sz];
-+ pTag->cValues = 1;
-+ pTag->aulPropTag[0] = tag;
-+ LPSPropValue lpProp = NULL;
-+ ULONG cValues = 0;
-+ HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
-+ delete pTag;
-+ if (HR_FAILED( hr) || (cValues != 1)) {
-+ if (lpProp)
-+ mMAPIFreeBuffer( lpProp);
-+ return( NULL);
-+ }
-+ else {
-+ if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
-+ if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
-+ mMAPIFreeBuffer( lpProp);
-+ lpProp = NULL;
-+ }
-+ }
-+ }
-+
-+ return( lpProp);
-+}
-+BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
-+{
-+ if (!pVal)
-+ return( FALSE);
-+
-+ BOOL bResult = TRUE;
-+ switch (PROP_TYPE(pVal->ulPropTag))
-+ {
-+ case PT_BINARY:
-+ cbEntryId = pVal->Value.bin.cb;
-+ mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
-+ memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
-+ break;
-+
-+ default:
-+ PRINTF(( "EntryId not in BINARY prop value\n"));
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (pVal && delVal)
-+ mMAPIFreeBuffer( pVal);
-+
-+ return( bResult);
-+}
-+
-+BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-+{
-+ LPMDB lpMsgStore;
-+ ULONG objType=0;
-+ HRESULT hr;
-+
-+ if (oType == MAPI_MESSAGE)
-+ return FALSE;
-+ if (oType == MAPI_STORE)
-+ {
-+ hr=mRootSession->OpenEntry(
-+ cb,
-+ pEntry,
-+ &IID_IMsgStore,
-+ 0,
-+ &objType,
-+ (IUnknown**)&lpMsgStore);
-+ if (FAILED(hr))
- return FALSE ;
-+ //Add MDB to a list to make it can be released when class destroyed.
-+ //We must leave it openned or else we can't open address store in it.
-+ AddToMDBArray(lpMsgStore);
-+
-+ LPSPropValue pVal;
-+ pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
-+
-+
-+ if (pVal) {
-+ ULONG cbEntry;
-+ LPENTRYID pEntry;
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
-+
-+ if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
-+ // Open up the folder!
-+ BOOL bResult = TRUE;
-+ bResult = lpMsgStore->OpenEntry(
-+ cbEntry,
-+ pEntry,
-+ NULL,
-+ 0,
-+ &objType,
-+ lpSubTree);
-+ mMAPIFreeBuffer( pEntry);
-+ if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
-+ // Iterate the subtree with the results going into the folder list
-+ bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
-+ }
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
- }
-- mAddressBook = mRootBook ;
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
-+ }
-+ }
-+ else
-+ {
-+ PRINTF(("Type:%d\n",oType));
-+ }
-+
- return TRUE ;
- }
-
--void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
-+BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
- {
-- mMAPIAllocateBuffer(aByteCount, aBuffer) ;
-+ // flags can be CONVENIENT_DEPTH or 0
-+ // CONVENIENT_DEPTH will return all depths I believe instead
-+ // of just children
-+ HRESULT hr;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
-+ hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
- }
-
--void nsMapiAddressBook::FreeBuffer(LPVOID aBuffer)
-+ ULONG rowCount;
-+ hr = lpTable->GetRowCount( 0, &rowCount);
-+ if (!rowCount) {
-+ return( TRUE);
-+ }
-+
-+ hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
-+ }
-+
-+ hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
-+ }
-+
-+ int cNumRows = 0;
-+ LPSRowSet lpRow;
-+ BOOL keepGoing = TRUE;
-+ BOOL bResult = TRUE;
-+ do {
-+
-+ lpRow = NULL;
-+ hr = lpTable->QueryRows( 1, 0, &lpRow);
-+
-+ if (HR_FAILED(hr))
- {
-- mMAPIFreeBuffer(aBuffer) ;
-+ PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (lpRow){
-+ cNumRows = lpRow->cRows;
-+
-+ if (cNumRows) {
-+ LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-+ ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-+
-+ keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
-+
-+ }
-+ MyFreeProws(lpRow);
-+ }
-+
-+ } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
-+
-+
-+ if (bResult && !keepGoing)
-+ bResult = FALSE;
-+
-+ return( bResult);
-+}
-+BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-+{
-+ ULONG objType=0;
-+ if (oType == MAPI_FOLDER)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
-+ if (!mRootSession->OpenEntry(
-+ cb,
-+ pEntry,
-+ 0,
-+ NULL,
-+ &objType,
-+ pFolder))
-+ {
-+ LPSPropValue pVal;
-+
-+
-+ pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
-+ if (pVal)
-+ {
-+ if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
-+ {
-+ SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
-+
-+ aFolders.AddItem(currentValue->Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
-+
-+ }
-+ }
-+ }
-+ }
-+ else
-+ {
-+ PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
-+ }
-+
-+ return( TRUE);
-+}
-+
-+
-+BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-+{
-+ aFolders.CleanUp() ;
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
-+
-+ mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
-+ return mLastError;
-+ }
-+
-+ mLastError = lpTable->GetRowCount( 0, &rowCount);
-+
-+ mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-+ if (FAILED(mLastError))
-+ return( mLastError);
-+ mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-+ if (FAILED(mLastError))
-+ return mLastError;
-+
-+ int cNumRows = 0;
-+ LPSRowSet lpRow;
-+ BOOL keepGoing = TRUE;
-+ BOOL bResult = TRUE;
-+ do {
-+
-+ lpRow = NULL;
-+ mLastError = lpTable->QueryRows( 1, 0, &lpRow);
-+
-+ if (HR_FAILED(mLastError)){
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (lpRow){
-+ cNumRows = lpRow->cRows;
-+
-+ if (cNumRows) {
-+ LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-+ ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-+
-+
-+ keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
-+ }
-+ MyFreeProws( lpRow);
-+ }
-+
-+ } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
-+
-+
-+ return HR_SUCCEEDED(mLastError) ;
-+}
-+BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
-+{
-+ ULONG conditionType = 0 ;
-+ ULONG ulResIndex;
-+ if (!aRestriction)
-+ return FALSE;
-+ for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
-+ {
-+ conditionType = aRestriction[ulResIndex].rt;
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ aRestriction[ulResIndex].res.resExist.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
-+ break ;
-+ case RES_BITMASK :
-+ aRestriction[ulResIndex].res.resBitMask.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
-+ break ;
-+ case RES_CONTENT :
-+ aRestriction[ulResIndex].res.resContent.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
-+ aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
-+ break ;
-+ case RES_PROPERTY :
-+ aRestriction[ulResIndex].res.resProperty.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
-+ aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
-+ break ;
-+ case RES_SIZE :
-+ aRestriction[ulResIndex].res.resSize.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
-+ break ;
-+ case RES_COMPAREPROPS :
-+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
-+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
-+ break ;
-+ case RES_NOT :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
-+ break;
-+ case RES_AND :
-+ CorrectRestriction(aMapiProp,
-+ aRestriction[ulResIndex].res.resAnd.cRes,
-+ aRestriction[ulResIndex].res.resAnd.lpRes);
-+ break;
-+ case RES_OR :
-+ CorrectRestriction(aMapiProp,
-+ aRestriction[ulResIndex].res.resOr.cRes,
-+ aRestriction[ulResIndex].res.resOr.lpRes);
-+ break;
-+
-+ case RES_COMMENT :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
-+ aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
-+ break;
-+ case RES_SUBRESTRICTION :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
-+ break;
-+ default:
-+ return FALSE;
-+ }
-+ }
-+ return TRUE;
-+}
-+BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
-+{
-+ if (!aRestriction)
-+ return FALSE;
-+
-+ ULONG conditionType = 0 ;
-+
-+ nsMapiEntryArray listOut;
-+ ULONG listindex=0;
-+
-+ nsMapiEntryArray listDel;
-+ ULONG delindex=0;
-+
-+ ULONG listsize;
-+ ULONG resCount = 0;
-+ ULONG resIndex = 0;
-+
-+ listsize = aList->GetSize();
-+ conditionType = aRestriction->rt;
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ case RES_BITMASK :
-+ case RES_CONTENT :
-+ case RES_PROPERTY :
-+ case RES_SIZE :
-+ case RES_COMPAREPROPS :
-+ case RES_COMMENT :
-+ case RES_SUBRESTRICTION :
-+ {
-+ while(listindex < aList->GetSize())
-+ {
-+ if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
-+ aList->Remove(listindex);
-+ else
-+ listindex++;
-+ }
-+ }
-+ break;
-+ case RES_NOT :
-+ aRestriction->res.resNot.ulReserved = 1;
-+ case RES_AND :
-+ case RES_OR :
-+ {
-+ if (conditionType == RES_OR)
-+ {
-+ for(listindex=0;listindex<aList->GetSize();listindex++)
-+ {
-+ listDel.AddItem(aList->ElementAt(listindex));
-+ }
-+ }
-+
-+ resCount = aRestriction->res.resAnd.cRes;
-+ //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
-+ //use the same struct
-+ for (resIndex = 0;resIndex < resCount;resIndex++)
-+ {
-+ //can't call listOut.CleanUp() here
-+ //because it will destroy all Element too
-+ while(listOut.GetSize())
-+ {
-+ listOut.Remove(0);
-+ }
-+
-+ for(listindex=0;listindex<aList->GetSize();listindex++)
-+ {
-+ listOut.AddItem(aList->ElementAt(listindex));
-+ }
-+
-+ Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
-+ if (conditionType == RES_NOT)
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ aList->Remove(listOut.ElementAt(listindex));
-+ }
-+ }
-+ else if (conditionType == RES_AND )
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ if (!aList->IndexOf(listOut.ElementAt(listindex)))
-+ {
-+ aList->Remove(listOut.ElementAt(listindex));
-+ }
-+ }
-+ }
-+ else if (conditionType == RES_OR )
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ listDel.Remove(listOut.ElementAt(listindex));
-+ }
-+ if (listDel.GetSize() == 0)
-+ {
-+ break;
-+ }
-+ }
-+ }
-+ if (conditionType == RES_OR)
-+ {
-+ for(listindex=0;listindex<listDel.GetSize();listindex++)
-+ {
-+ aList->Remove(listDel.ElementAt(listindex));
-+ }
-+ }
-+ }
-+
-+ }
-+ while(listDel.GetSize())
-+ {
-+ listDel.Remove(0);
-+ }
-+ while(listOut.GetSize())
-+ {
-+ listOut.Remove(0);
-+ }
-+
-+
-+ return TRUE;
-+}
-+
-+BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
-+{
-+ LPMAPIPROP object ;
-+ ULONG objType = 0 ;
-+ LPSPropValue realValue = NULL ;
-+ LPSPropValue resValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ (IUnknown **)&object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ ULONG conditionType = 0 ;
-+ conditionType = aRestriction->rt;
-+
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = NULL;
-+ break ;
-+ case RES_CONTENT :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = aRestriction->res.resContent.lpProp;
-+ break ;
-+ case RES_PROPERTY :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = aRestriction->res.resProperty.lpProp;
-+ break ;
-+ case RES_BITMASK :
-+ return FALSE; //not support
-+ break ;
-+ case RES_SIZE :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_COMPAREPROPS :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_NOT :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_AND :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_OR :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_COMMENT :
-+ return TRUE;//comment
-+ break;
-+ case RES_SUBRESTRICTION :
-+ return FALSE;//not been used now
-+ break ;
-+}
-+ return AtomyFilter(aRestriction,realValue,resValue);
-+
-+}
-+
-+BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
-+{
-+ ULONG conditionType = 0 ;
-+ conditionType = aRestriction->rt;
-+
-+ BOOL bTagEq=(aRealValue &&
-+ PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
-+ aFilterValue;
-+ // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
-+ break ;
-+ case RES_CONTENT :
-+ if (bTagEq)
-+ {
-+ switch(aRestriction->res.resContent.ulFuzzyLevel)
-+ {
-+ case FL_FULLSTRING :
-+ return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
-+ break;
-+ case FL_PREFIX :
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
-+ break;
-+ case FL_SUBSTRING :
-+ default:
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-+ break;
-+ }
-+ }
-+ return FALSE;
-+ break ;
-+ case RES_PROPERTY :
-+ if (bTagEq)
-+ {
-+ switch(aRestriction->res.resProperty.relop)
-+ {
-+ case RELOP_GE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
-+ break;
-+ case RELOP_GT :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
-+ break;
-+ case RELOP_LE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
-+ break;
-+ case RELOP_LT :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
-+ break;
-+ case RELOP_EQ :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
-+ break;
-+ case RELOP_NE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
-+ break;
-+ case RELOP_RE :
-+ default:
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-+ break;
-+
-+ }
-+ }
-+ return FALSE;
-+ break ;
-+ case RES_BITMASK :
-+ return FALSE; //not support
-+ break ;
-+ case RES_SIZE :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_COMPAREPROPS :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_NOT :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_AND :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_OR :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_COMMENT :
-+ return TRUE;//comment
-+ break;
-+ case RES_SUBRESTRICTION :
-+ return FALSE;//not been used now
-+ break ;
-+ }
-+ return TRUE;
-+}
-+
-+BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType)
-+{
-+ if (aList)
-+ aList->CleanUp();
-+
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
-+ nsCString cs;
-+ aParent.ToString(cs);
-+
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ 0, 0, &objType, pFolder);
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ HRESULT hr;
-+ LPSPropValue aValue = NULL ;
-+ ULONG aValueCount = 0 ;
-+
-+ LPSPropTagArray properties = NULL ;
-+ mMAPIAllocateBuffer(CbNewSPropTagArray(1),
-+ (void **)&properties);
-+ properties->cValues = 1;
-+ properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
-+ hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
-+
-+ SBinaryArray *sa=&aValue->Value.MVbin;
-+
-+ LPENTRYID lpEID;
-+ ULONG cbEID;
-+
-+ ULONG idx;
-+ nsMapiEntry testEntry;
-+ nsCString sClass;
-+ for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
-+ {
-+ lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
-+ cbEID = sa->lpbin[idx].cb;
-+ testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
-+
-+ if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
-+ {
-+ aList->AddItem(cbEID,lpEID);
-+ }
-+ }
-+ Filter(aRestriction,aList);
-+ }
-+ else
-+ {
-+ if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
-+ return FALSE;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIContainer, 0, &objType,
-+ parent) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mLastError = parent->GetContentsTable(0, contents) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+ if (aRestriction) {
-+ mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+ mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = contents->GetRowCount(0, &rowCount) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = contents->QueryRows(1, 0, &rowSet) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0 && aList)
-+ {
-+ if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
-+ {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+ }
-+ else if (aMapiType == MAPI_DISTLIST)
-+ {
-+ if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
-+ {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+
-+ }
- }
-
-+ }
-+ MyFreeProws(rowSet) ;
-+ } while (rowCount > 0) ;
-+ }
-
-
-+ return TRUE ;
-+}
-
-+BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties, LPSPropValue& aValue,
-+ ULONG& aValueCount)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ LPSPropTagArray properties = NULL ;
-+ ULONG i = 0 ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-+ NS_REINTERPRET_CAST(void **, &properties));
-+ properties->cValues = aNbProperties ;
-+ for (i = 0 ; i < aNbProperties ; ++ i)
-+ {
-+ properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
-+ }
-+ mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
-+ FreeBuffer(properties) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Error get props %08x.\n", mLastError)) ;
-+ }
-+ return HR_SUCCEEDED(mLastError);
-+}
-+
-+BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues)
-+{
-+ nsMapiInterfaceWrapper<LPMESSAGE> object;
-+ ULONG objType = 0 ;
-+ LPSPropProblemArray problems = NULL ;
-+ ULONG i = 0 ;
-+
-+ LPMDB lpMsgStore=GetMsgStore(aObject);
-+
-+ if (!lpMsgStore)
-+ {
-+ return FALSE;
-+ }
-+ mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMessage, MAPI_MODIFY , &objType,
-+ object) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ for (i = 0 ; i < aNbProperties ; ++ i)
-+ {
-+ aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
-+ }
-+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (problems) {
-+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-+ PRINTF(("Problem %d: index %d code %08x.\n", i,
-+ problems->aProblem [i].ulIndex,
-+ problems->aProblem [i].scode)) ;
-+ }
-+ }
-+ mLastError = object->SaveChanges(0) ;
-+ if (MAPI_E_OBJECT_CHANGED == mLastError)
-+ {
-+ mLastError = object->SaveChanges(FORCE_SAVE ) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+}
-+
-+BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-+{
-+ return FALSE ;
-+}
-+
-+BOOL nsMapiAddressBook::IsOK(void)
-+{
-+ return mRootSession && mLibUsage;
-+}
-+
-+BOOL nsMapiAddressBook::Initialize(void)
-+{
-+
-+ nsAutoLock guard(mMutex) ;
-+
-+ if (!LoadMapiLibrary()) {
-+ PRINTF(("Cannot load library.\n")) ;
-+ return FALSE ;
-+ }
-+ return TRUE;
-+}
-+
-+void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
-+{
-+ mMAPIAllocateBuffer(aByteCount, aBuffer) ;
-+}
-+
-+void nsMapiAddressBook::FreeBuffer(LPVOID aBuffer)
-+{
-+ mMAPIFreeBuffer(aBuffer) ;
-+}
-+
-+ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
-+{
-+ static GUID emailGUID =
-+ {
-+ 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
-+ };
-+
-+
-+ MAPINAMEID mapiNameID;
-+ mapiNameID.lpguid = &emailGUID;
-+ mapiNameID.ulKind = MNID_ID;
-+ mapiNameID.Kind.lID = nameID;
-+
-+ LPMAPINAMEID lpMapiNames = &mapiNameID;
-+ LPSPropTagArray lpMailTagArray = NULL;
-+
-+ HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
-+ if (result == S_OK)
-+ {
-+ ULONG lTag = lpMailTagArray->aulPropTag[0];
-+ mMAPIFreeBuffer(lpMailTagArray);
-+ return lTag;
-+ }
-+ return 0L;
-+}
-+ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
-+{
-+ LPSPropValue addr;
-+ ULONG upRealTag=aPropertyTag;
-+ ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
-+
-+ for(int i=0; i<lSize; i++)
-+ {
-+ if (TagMaps[i].AddressTag == aPropertyTag)
-+ {
-+
-+ ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
-+ if (aTest)
-+ {
-+ if (PR_DISPLAY_NAME_A == aPropertyTag)
-+ {
-+ //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
-+ LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
-+ if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+ else
-+ {
-+ FreeBuffer(msgClass);
-+ upRealTag = aPropertyTag;
-+ }
-+ }
-+ else //PR_DISPLAY_NAME_A == aPropertyTag
-+ {
-+ addr=GetMapiProperty(lpProp,aPropertyTag);
-+ if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
-+ addr->Value.l == MAPI_E_NOT_FOUND)
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+ }
-+ }
-+ else //aTest
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+
-+ break; //we find it,exit
-+ }
-+ }
-+
-+ return upRealTag;
-+}
-+
-+BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
-+ ULONG aPropertyTag,
-+ ULONG& aValue)
-+{
-+ aValue = 0 ;
-+ LPSPropValue values = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (PR_OBJECT_TYPE == aPropertyTag)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
-+ ULONG objType=0;
-+ mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
-+ NULL,0,&objType, pFolder);
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ FreeBuffer(msgClass);
-+ aValue = MAPI_DISTLIST;
-+ return TRUE;
-+ }
-+ }
-+
-+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
-+ return FALSE ;
-+
-+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
-+ aValue = values->Value.ul ;
-+ }
-+ FreeBuffer(values) ;
-+ return TRUE ;
-+}
-+
-+BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ WORD& aYear, WORD& aMonth, WORD& aDay)
-+{
-+ aYear = 0;
-+ aMonth = 0;
-+ aDay = 0;
-+ LPSPropValue values = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
-+ return FALSE ;
-+
-+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
-+ SYSTEMTIME readableTime ;
-+ FILETIME localTime ;
-+ FileTimeToLocalFileTime(&values->Value.ft,&localTime);
-+ if (FileTimeToSystemTime(&localTime, &readableTime)) {
-+ aYear = readableTime.wYear ;
-+ aMonth = readableTime.wMonth ;
-+ aDay = readableTime.wDay ;
-+ }
-+ }
-+ FreeBuffer(values) ;
-+ return TRUE ;
-+}
-+
-+HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ )
-+{
-+
-+ int err;
-+ HRESULT rv;
-+ __try
-+ {
-+ rv=mRootSession->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags ,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }__except(err)
-+ {
-+ return (-1);
-+ }
-+
-+ if (HR_FAILED(rv) && !m_MDBArray.Count())
-+ {
-+ //There are no openned Message store,so we have to open them all
-+ nsMapiEntryArray aFolders;
-+ if (GetFolders(aFolders))
-+ {
-+ __try
-+ {
-+ rv=mRootSession->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags ,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }__except(err)
-+ {
-+ return (-1);
-+ }
-+ }
-+ }
-+ return rv;
-+
-+}
-+
-+BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ return FALSE;
-+
-+ LPMDB lpMsgStore=GetMsgStore(parentEntry);
-+
-+ if (!lpMsgStore)
-+ return FALSE;
-+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-+ &IID_IMAPIProp, MAPI_MODIFY, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE ;
-+
-+
-+ /*
-+ When add mail address to distlist,Mapi need update 2 tag.
-+ */
-+ //update OUTLOOK_EMAIL_LIST1
-+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-+ SBinaryArray oldChilds;
-+ LPSBinary bins=NULL;
-+ SBinaryArray newChilds;
-+ LPSPropValue oldChildValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues + 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (ULONG i=0;i<oldChilds.cValues;i++)
-+ {
-+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-+
-+ nsMapiEntry orgEntryID;
-+ if (!GetPropertyBin(aNewEntry,
-+ GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
-+ orgEntryID))
-+ {
-+ return FALSE;
-+ }
-+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
-+
-+ SPropValue childs;
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+
-+ LPSPropProblemArray problems = NULL ;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ //update OUTLOOK_EMAIL_LIST2
-+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues + 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (ULONG i=0;i<oldChilds.cValues;i++)
-+ {
-+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-+
-+ /*
-+ Need more work here.
-+ There are two kind of mail address in outlook DistList.
-+ One is sample,not include in parent folder.
-+ The other is a link to a unattached address in parents folders.
-+ Currently we can only add first kind of address to a outlook distlist.
-+ */
-+
-+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
-+
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mMAPIFreeBuffer(bins);
-+
-+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ return TRUE ;
-+}
-+BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ return FALSE;
-+
-+ LPMDB lpMsgStore=GetMsgStore(parentEntry);
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-+ &IID_IMAPIProp, MAPI_MODIFY, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE ;
-+ /*
-+ When delete mail address from distlist,Mapi need update 2 tag.
-+ */
-+ //update OUTLOOK_EMAIL_LIST1
-+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-+
-+ SBinaryArray oldChilds;
-+ LPSBinary bins=NULL;
-+ SBinaryArray newChilds;
-+ LPSPropValue oldChildValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ newChilds.lpbin=NULL;
-+
-+ ULONG lDeleteEntry=0;
-+ ULONG newIndex=0;
-+ ULONG oldIndex=0;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues - 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-+ {
-+ if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
-+ !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
-+ (void*)(aNewEntry.mEntryId->ab),
-+ oldChilds.lpbin[oldIndex].cb-4))
-+ {
-+ lDeleteEntry=oldIndex;
-+ }
-+ else
-+ {
-+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-+ newIndex++;
-+ }
-+ }
-+ }
-+ else
-+ return FALSE;
-+
-+
-+ SPropValue childs;
-+ LPSPropProblemArray problems = NULL ;
-+
-+ if (newChilds.cValues == 0)
-+ {
-+ SPropTagArray delTags;
-+ delTags.cValues = 1;
-+ delTags.aulPropTag[0] = listTag;
-+
-+ mLastError = container->DeleteProps(&delTags, &problems) ;
-+ }
-+ else
-+ {
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ }
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ //update OUTLOOK_EMAIL_LIST2
-+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ newIndex=0;
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues - 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-+ {
-+ if (oldIndex != lDeleteEntry)
-+ {
-+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-+ newIndex++;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-+
-+
-+
-+ if (newChilds.cValues == 0)
-+ {
-+ SPropTagArray delTags;
-+ delTags.cValues = 1;
-+ delTags.aulPropTag[0] = listTag;
-+
-+ mLastError = container->DeleteProps(&delTags, &problems) ;
-+ }
-+ else
-+ {
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ }
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mMAPIFreeBuffer(bins);
-+
-+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ return TRUE ;
-+}
-+
-+BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ (IUnknown **)&object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
-+
-+ if (parentID->Value.l == MAPI_E_NOT_FOUND)
-+ return FALSE;
-+ aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
-+ return TRUE;
-+}
-+BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ {
-+ return FALSE;
-+ }
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+ if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
-+ return FALSE;
-+
-+ return AddEntryToList(aDistlist,aNewEntry);
-+}
-+
-+BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
-+
-+ LPMDB lpMsgStore=GetMsgStore(aParent);
-+
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIFolder, MAPI_MODIFY, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE;
-+
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+
-+ mLastError = container->CreateMessage(&IID_IMessage,
-+ 0,
-+ newEntry) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue messageclass ;
-+ LPSPropProblemArray problems = NULL ;
-+ nsCString tempName ;
-+
-+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-+ tempName.Assign("IPM.Contact") ;
-+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ SPropTagArray property ;
-+ LPSPropValue value = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ property.cValues = 1 ;
-+ property.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-+ if (HR_FAILED(mLastError) || valueCount != 1) {
-+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-+ FreeBuffer(value) ;
-+ return TRUE ;
-+}
-+
-+BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+
-+ LPMDB lpMsgStore=GetMsgStore(aParent);
-+ if (!lpMsgStore)
-+ return FALSE;
-+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIFolder, MAPI_MODIFY, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+ mLastError = container->CreateMessage(&IID_IMAPIProp,
-+ 0,
-+ newEntry) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue messageclass ;
-+ LPSPropProblemArray problems = NULL ;
-+ nsCString tempName ;
-+
-+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-+ tempName.Assign("IPM.DistList") ;
-+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ ULONG valueCount = 0 ;
-+ SPropTagArray property ;
-+ LPSPropValue value = NULL ;
-+
-+ property.cValues = 1 ;
-+ property.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-+ if (HR_FAILED(mLastError) || valueCount != 1) {
-+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-+
-+ FreeBuffer(value) ;
-+ return TRUE ;
-+}
-+
-+
-+BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
-+ nsMapiEntry& aTarget)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
-+ ULONG objType = 0 ;
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ //Add Entry To DistList
-+ if (!AddEntryToList(aContainer,aSource))
-+ return FALSE;
-+ aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
-+ return TRUE;
-+ }
-+
-+ SBinary entry ;
-+ SBinaryArray entryArray ;
-+
-+ entry.cb = aSource.mByteCount ;
-+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
-+ entryArray.cValues = 1 ;
-+ entryArray.lpbin = &entry ;
-+
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIFolder, MAPI_MODIFY, &objType,
-+ container) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
-+ &IID_IMAPIFolder, MAPI_MODIFY, &objType,
-+ targetFolder) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
-+
-+ mLastError = container->CopyMessages(&entryArray,
-+ &IID_IMessage,
-+ (void*)&targetFolder,
-+ 0,
-+ NULL,
-+ NULL) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ return TRUE ;
-+}
-+
-+BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+ SBinary entry ;
-+ SBinaryArray entryArray ;
-+
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
-+
-+ LPMDB lpMsgStore=GetMsgStore(aContainer);
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIFolder, MAPI_MODIFY, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ entry.cb = aEntry.mByteCount ;
-+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
-+ entryArray.cValues = 1 ;
-+ entryArray.lpbin = &entry ;
-+ mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ return TRUE ;
-+}
-+
-+//Use to open message store in write mode
-+LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ ULONG objType=0;
-+
-+ mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
-+ object) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+ SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
-+
-+ LPMDB lpMsgStore=NULL;
-+ mLastError=mRootSession->OpenMsgStore(0,
-+ svMsgSore->Value.bin.cb,
-+ (ENTRYID*)svMsgSore->Value.bin.lpb,
-+ &IID_IMsgStore,
-+ MDB_NO_MAIL | MDB_WRITE ,
-+ &lpMsgStore);
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+
-+ return lpMsgStore;
-+}
-Index: mailnews/addrbook/src/nsMapiAddressBook.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 9 Dec 2003 03:26:47 -0000 1.2
-@@ -40,12 +40,42 @@
-
- #include "nsAbWinHelper.h"
-
-+struct TagMap
-+{
-+ ULONG AddressTag;
-+ ULONG NameID;
-+ ULONG TypeMask;
-+};
- class nsMapiAddressBook : public nsAbWinHelper
- {
- public :
- nsMapiAddressBook(void) ;
- virtual ~nsMapiAddressBook(void) ;
-
-+ // Get the top address books
-+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-+
-+ // Get a default address book container
-+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-+ // Is the helper correctly initialised?
-+ virtual BOOL IsOK(void);
-+ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
-+ ULONG aPropertyTag,
-+ ULONG& aValue);
-+ // Get the value of a MAPI property of type SYSTIME
-+ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ WORD& aYear, WORD& aMonth, WORD& aDay);
-+ // Create entry in the address book
-+ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ // Delete an entry in the address book
-+ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-+ // Create a distribution list in the address book
-+ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ // Copy an existing entry in the address book
-+ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-+
-+ static void FreeMapiLibrary(void) ;
-+
- protected :
- // Class members to handle the library/entry points
- static HMODULE mLibrary ;
-@@ -67,19 +97,77 @@
- static BOOL mInitialized ;
- static BOOL mLogonDone ;
- static LPMAPISESSION mRootSession ;
-- static LPADRBOOK mRootBook ;
-+
-
- // Load the MAPI environment
- BOOL Initialize(void) ;
-+
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ );
-+
-+
-+ // Retrieve the contents of a container, with an optional restriction
-+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType) ;
-+ // Retrieve the values of a set of properties on a MAPI object
-+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties,
-+ LPSPropValue& aValues, ULONG& aValueCount) ;
-+ // Set the values of a set of properties on a MAPI object
-+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues);
-+
-+
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Library management
- static BOOL LoadMapiLibrary(void) ;
-- static void FreeMapiLibrary(void) ;
-+
-+ BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-+ LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
-+ BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
-+ BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-+ BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
-+ ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
-+ ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
-+ LPMDB GetMsgStore(const nsMapiEntry& aEntry);
-+ BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
-+ BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
-+ BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
-+ BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
-+ BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
-+
-+ //filter
-+ BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
-+ BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
-+ BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
-+
-+ void AddToMDBArray(LPMDB aMDB)
-+ {
-+ m_MDBArray.AppendElement(aMDB);
-+ }
-+ void CleanUpMDB()
-+ {
-+ LPMDB mdb;
-+ for (int i = 0; i < m_MDBArray.Count(); i++)
-+ {
-+ mdb = (LPMDB)m_MDBArray.ElementAt(i);
-+ mdb->Release();
-+ }
-+ m_MDBArray.Clear();
-+ }
-
- private :
-+ //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
-+ //so we have to kill message stores openned
-+ nsVoidArray m_MDBArray;
- } ;
-
- #endif // nsMapiAddressBook_h___
-Index: mailnews/addrbook/src/nsWabAddressBook.cpp
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 9 Dec 2003 03:26:47 -0000 1.2
-@@ -47,6 +47,22 @@
-
- #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
-
-+enum
-+{
-+ ContentsColumnEntryId = 0,
-+ ContentsColumnObjectType,
-+ ContentsColumnsSize
-+} ;
-+
-+static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-+{
-+ ContentsColumnsSize,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE
-+ }
-+} ;
-+
- HMODULE nsWabAddressBook::mLibrary = NULL ;
- PRInt32 nsWabAddressBook::mLibUsage = 0 ;
- LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
-@@ -95,7 +111,7 @@
- MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
-
- nsWabAddressBook::nsWabAddressBook(void)
--: nsAbWinHelper()
-+: nsAbWinHelper(),mAddressBook(NULL)
- {
- BOOL result = Initialize() ;
-
-@@ -110,9 +126,254 @@
- MOZ_COUNT_DTOR(nsWabAddressBook) ;
- }
-
-+BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-+{
-+ aFolders.CleanUp() ;
-+ nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+ SRestriction restriction ;
-+ SPropTagArray folderColumns ;
-+
-+ mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
-+ rootFolder);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot open root %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ mLastError = rootFolder->GetHierarchyTable(0, folders);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ // We only take into account modifiable containers,
-+ // otherwise, we end up with all the directory services...
-+ restriction.rt = RES_BITMASK ;
-+ restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-+ restriction.res.resBitMask.relBMR = BMR_NEZ ;
-+ restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-+ mLastError = folders->Restrict(&restriction, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-+ }
-+ folderColumns.cValues = 1 ;
-+ folderColumns.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = folders->SetColumns(&folderColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = folders->GetRowCount(0, &rowCount) ;
-+ if (HR_SUCCEEDED(mLastError)) {
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = folders->QueryRows(1, 0, &rowSet) ;
-+ if (HR_SUCCEEDED(mLastError)) {
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0) {
-+ SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
-+
-+ aFolders.AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+ }
-+ MyFreeProws(rowSet) ;
-+ }
-+ else {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ }
-+ } while (rowCount > 0) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+}
-+BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType)
-+{
-+ if (aList) { aList->CleanUp(); }
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIContainer, 0, &objType,
-+ parent) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ // Here, flags for WAB and MAPI could be different, so this works
-+ // only as long as we don't want to use any flag in GetContentsTable
-+ mLastError = parent->GetContentsTable(0, contents) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (aRestriction) {
-+ mLastError = contents->Restrict(aRestriction, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+ int entryId = ContentsColumnEntryId ;
-+ int objectType = ContentsColumnObjectType ;
-+
-+ if (aRestriction)
-+ {
-+ LPSPropTagArray allColumns = NULL ;
-+
-+ mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
-+ if (allColumns->aulPropTag [j] == PR_ENTRYID) {
-+ entryId = j ;
-+ }
-+ else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
-+ objectType = j ;
-+ }
-+ }
-+ mLastError = contents->SetColumns(allColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ FreeBuffer(allColumns) ;
-+ }
-+ else
-+ {
-+
-+ mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+
-+ mLastError = contents->GetRowCount(0, &rowCount) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = contents->QueryRows(1, 0, &rowSet) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0 &&
-+ (aMapiType == 0 ||
-+ rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
-+ if (aList) {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
-+
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+
-+ }
-+ }
-+ MyFreeProws(rowSet) ;
-+ } while (rowCount > 0) ;
-+ return TRUE ;
-+}
-+
-+BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties, LPSPropValue& aValue,
-+ ULONG& aValueCount)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ IMsgStore * mdb=NULL;
-+ ULONG objType = 0 ;
-+ LPSPropTagArray properties = NULL ;
-+ ULONG i = 0 ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot open entry %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-+ NS_REINTERPRET_CAST(void **, &properties));
-+ properties->cValues = aNbProperties;
-+ for (i = 0 ; i < aNbProperties ; ++ i) {
-+ properties->aulPropTag [i] = aPropertyTags [i];
-+ }
-+ mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
-+ FreeBuffer(properties);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get props %08x.\n", mLastError));
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+}
-+
-+BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues)
-+{
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ LPSPropProblemArray problems = NULL ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, MAPI_MODIFY, &objType,
-+ object) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (problems) {
-+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-+ PRINTF(("Problem %d: index %d code %08x.\n", i,
-+ problems->aProblem [i].ulIndex,
-+ problems->aProblem [i].scode));
-+ }
-+ }
-+ mLastError = object->SaveChanges(0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+}
-+
-+BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-+{
-+ LPENTRYID entryId = NULL;
-+ ULONG byteCount = 0;
-+
-+ mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get PAB %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ aContainer.Assign(byteCount, entryId);
-+ FreeBuffer(entryId) ;
-+ return TRUE ;
-+}
-+
-+BOOL nsWabAddressBook::IsOK(void)
-+{
-+ return mAddressBook != NULL ;
-+}
-+
- BOOL nsWabAddressBook::Initialize(void)
- {
-- if (mAddressBook) { return TRUE ; }
- nsAutoLock guard(mMutex) ;
-
- if (!LoadWabLibrary()) {
-Index: mailnews/addrbook/src/nsWabAddressBook.h
-===================================================================
-RCS file: /mozilla/mozilla/mailnews/addrbook/src/nsWabAddressBook.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 22 Oct 2003 02:43:11 -0000 1.1.1.1
-+++ miss/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 9 Dec 2003 03:26:47 -0000 1.2
-@@ -47,6 +47,15 @@
- nsWabAddressBook(void) ;
- virtual ~nsWabAddressBook(void) ;
-
-+ // Get the top address books
-+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-+
-+ // Get a default address book container
-+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-+ // Is the helper correctly initialised?
-+ virtual BOOL IsOK(void);
-+ static void FreeWabLibrary(void) ;
-+
- protected :
- // Session and address book that will be shared by all instances
- // (see nsMapiAddressBook.h for details)
-@@ -57,15 +66,46 @@
- static HMODULE mLibrary ;
- static LPWABOPEN mWABOpen ;
-
-+ LPADRBOOK mAddressBook ;
-+
- // Load the WAB environment
- BOOL Initialize(void) ;
-+
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ )
-+ {
-+ return mAddressBook->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }
-+
-+
-+ // Retrieve the contents of a container, with an optional restriction
-+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType) ;
-+ // Retrieve the values of a set of properties on a MAPI object
-+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties,
-+ LPSPropValue& aValues, ULONG& aValueCount) ;
-+ // Set the values of a set of properties on a MAPI object
-+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues) ;
-+
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Manage the library
- static BOOL LoadWabLibrary(void) ;
-- static void FreeWabLibrary(void) ;
-
- private :
- } ;
-Index: profile/src/nsProfile.cpp
-===================================================================
-RCS file: /mozilla/mozilla/profile/src/nsProfile.cpp,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -w -b -i -r1.1.1.1 -r1.2
---- miss/build/mozilla/profile/src/nsProfile.cpp 22 Oct 2003 02:40:14 -0000 1.1.1.1
-+++ miss/build/mozilla/profile/src/nsProfile.cpp 22 Oct 2003 09:45:04 -0000 1.2
-@@ -555,6 +555,7 @@
- rv = curProfileDir->Exists(&exists);
- if (NS_FAILED(rv) || !exists)
- profileURLStr = PROFILE_MANAGER_URL;
-+#if 0
- if (exists)
- {
- // If the profile is locked, we need the UI
-@@ -564,6 +565,7 @@
- if (NS_FAILED(rv))
- profileURLStr = PROFILE_MANAGER_URL;
- }
-+#endif
- }
- else
- profileURLStr = PROFILE_SELECTION_URL;
-@@ -1200,6 +1202,7 @@
- else
- isSwitch = PR_FALSE;
-
-+#if 0
- nsProfileLock localLock;
- nsCOMPtr<nsILocalFile> localProfileDir(do_QueryInterface(profileDir, &rv));
- if (NS_FAILED(rv)) return rv;
-@@ -1209,6 +1212,7 @@
- NS_ERROR("Could not get profile directory lock.");
- return rv;
- }
-+#endif
-
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
-@@ -1244,7 +1248,9 @@
- gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
- gProfileDataAccess->mProfileDataChanged = PR_TRUE;
- gProfileDataAccess->UpdateRegistry(nsnull);
-+#if 0
- mCurrentProfileLock = localLock;
-+#endif
-
- if (NS_FAILED(rv)) return rv;
- mCurrentProfileAvailable = PR_TRUE;
-@@ -1331,7 +1337,9 @@
- UpdateCurrentProfileModTime(PR_TRUE);
- mCurrentProfileAvailable = PR_FALSE;
- mCurrentProfileName.Truncate(0);
-+#if 0
- mCurrentProfileLock.Unlock();
-+#endif
-
- return NS_OK;
- }
-
---- miss/build/mozilla/.mozconfig Tue Jul 22 21:52:27 2003
-+++ misc/build/mozilla/.mozconfig Mon Jul 28 15:07:20 2003
-@@ -0,0 +1,8 @@
-+ac_add_options --disable-tests
-+ac_add_options --disable-xprint
-+ac_add_options --without-system-zlib
-+ac_add_options --enable-ldap
-+ac_add_options --disable-debug
-+ac_add_options --enable-optimize
-+ac_add_options --enable-crypto
-+ac_add_options --enable-strip
-
---- misc/build/mozilla/client.mk Fri Aug 1 10:14:27 2003
-+++ misc/build/mozilla/client.mk Fri Aug 1 10:11:31 2003
-@@ -386,9 +386,9 @@
- fi
-
- ifdef _IS_FIRST_CHECKOUT
--all:: checkout build
-+all:: build
- else
--all:: checkout alldep
-+all:: alldep
- endif
-
- # Windows equivalents
diff --git a/moz/mozilla-source-1.7.5.patch b/moz/mozilla-source-1.7.5.patch
deleted file mode 100644
index 31f36d37072d..000000000000
--- a/moz/mozilla-source-1.7.5.patch
+++ /dev/null
@@ -1,9658 +0,0 @@
-*** misc/mozilla/build/autoconf/mozconfig-find Fri Jul 16 20:13:24 2004
---- misc/build/mozilla/build/autoconf/mozconfig-find Tue Jan 15 13:34:32 2008
-***************
-*** 51,60 ****
- $topsrcdir/.mozconfig \
- $topsrcdir/mozconfig \
- $topsrcdir/mozconfig.sh \
-! $topsrcdir/myconfig.sh \
-! $HOME/.mozconfig \
-! $HOME/.mozconfig.sh \
-! $HOME/.mozmyconfig.sh
- do
- if test -f $_config; then
- echo $_config;
---- 51,57 ----
- $topsrcdir/.mozconfig \
- $topsrcdir/mozconfig \
- $topsrcdir/mozconfig.sh \
-! $topsrcdir/myconfig.sh
- do
- if test -f $_config; then
- echo $_config;
-*** misc/mozilla/build/cygwin-wrapper Thu Oct 30 22:05:56 2003
---- misc/build/mozilla/build/cygwin-wrapper Tue Jan 15 13:34:32 2008
-***************
-*** 1,4 ****
-! #!/bin/sh
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
---- 1,4 ----
-! #!/bin/bash
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
-***************
-*** 48,59 ****
- i=-I${mountpoint}/${driveletter}/${pathname}
- fi
- else
-! eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-! if ! test "${leader}" = "${i}"; then
-! eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
-! eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
-! driveletter=${no_mountpoint%%/*}
-! i=${leader}${driveletter}:/${pathname}
- fi
- fi
- fi
---- 48,83 ----
- i=-I${mountpoint}/${driveletter}/${pathname}
- fi
- else
-! # The original version missed mounted paths, the new version below
-! # doesn't transform /para as this is most likely a parameter.
-! eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-! if ! test "$notinpath" = "$i"; then
-! # found $mountpoint
-! eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
-! eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
-! driveletter=${withdrive%%/*}
-! i=${notinpath}${driveletter}:/${restpath}
-! else
-! # check for potential path. Precheck using shell methods
-! doconvert=""
-! # Shortcut -X<path> when path does not begin with '/'
-! noswitch=${i#-[a-zA-Z]}
-! if test "$noswitch" != "$i"; then
-! test "${noswitch#/}" != "$noswitch" && doconvert="1"
-! fi
-! # Precheck for possible path. Consider only absolute paths that contain at least
-! # a second / to prevent converting of /abc parameters.
-! test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
-! if test -n "$doconvert"; then
-! # Can be a path. If forking grep would be faster or we could require bash 3
-! # this regexp would be all that's needed to find pathnames that need converting
-! pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
-! eval 'notinpath=${i%'${pathname}'}'
-! if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
-! pathname=`cygpath -am "$pathname"`
-! i=${notinpath}${pathname}
-! fi
-! fi
- fi
- fi
- fi
-*** misc/mozilla/calendar/Makefile.in Sat Apr 10 16:27:46 2004
---- misc/build/mozilla/calendar/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 106,112 ****
- mkdir -p ./xpi/bin/chrome
- mkdir -p ./xpi/resources
- cp $(DEPTH)/dist/bin/chrome/calendar.jar ./xpi/bin/chrome
-! cp libxpical/$(LIB_PREFIX)xpical$(DLL_SUFFIX) ./xpi/bin/components
- cp libxpical/_xpidlgen/calendar.xpt ./xpi/bin/components
- cp $(srcdir)/resources/content/calendarService.js ./xpi/bin/components
- cp -r $(srcdir)/resources/locale ./xpi/resources
---- 106,112 ----
- mkdir -p ./xpi/bin/chrome
- mkdir -p ./xpi/resources
- cp $(DEPTH)/dist/bin/chrome/calendar.jar ./xpi/bin/chrome
-! cp libxpical/$(DLL_PREFIX)xpical$(DLL_SUFFIX) ./xpi/bin/components
- cp libxpical/_xpidlgen/calendar.xpt ./xpi/bin/components
- cp $(srcdir)/resources/content/calendarService.js ./xpi/bin/components
- cp -r $(srcdir)/resources/locale ./xpi/resources
-*** misc/mozilla/calendar/sunbird/Makefile.in Wed Apr 7 21:18:59 2004
---- misc/build/mozilla/calendar/sunbird/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 71,87 ****
- sunbird::sunbirddirs sunbirdunix
- endif
- cp $(topsrcdir)/dist/bin/MozillaSunbird* ./MozillaSunbird
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)plc4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)ssl3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)xpcom$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)nss3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)smime3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)xpistub$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)nspr4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)nssckbi$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)plds4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)softokn3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)xpcom_compat$(DLL_SUFFIX) ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/mangle ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/shlibsign ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/xpicleanup ./MozillaSunbird/
---- 71,87 ----
- sunbird::sunbirddirs sunbirdunix
- endif
- cp $(topsrcdir)/dist/bin/MozillaSunbird* ./MozillaSunbird
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)plc4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)ssl3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)xpcom$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)nss3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)smime3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)xpistub$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)nssckbi$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)plds4$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX) ./MozillaSunbird/
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)xpcom_compat$(DLL_SUFFIX) ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/mangle ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/shlibsign ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/xpicleanup ./MozillaSunbird/
-***************
-*** 185,191 ****
- cp $(topsrcdir)/dist/bin/components/intl.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/lwbrk.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/chardet.xpt ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/components/$(LIB_PREFIX)jar50$(DLL_SUFFIX) ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/jar.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/oji.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/jsdservice.xpt ./MozillaSunbird/components
---- 185,191 ----
- cp $(topsrcdir)/dist/bin/components/intl.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/lwbrk.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/chardet.xpt ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/components/$(DLL_PREFIX)jar50$(DLL_SUFFIX) ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/jar.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/oji.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/jsdservice.xpt ./MozillaSunbird/components
-***************
-*** 283,293 ****
- cp $(topsrcdir)/dist/bin/components/downloads.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/calendar.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/chrome/calendar.jar ./MozillaSunbird/chrome
-! cp $(topsrcdir)/dist/bin/components/$(LIB_PREFIX)xp*$(DLL_SUFFIX) ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/$(LIB_PREFIX)*js*$(DLL_SUFFIX) ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/components/xpcom_thread*.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/proxyObj*.xpt ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/components/$(LIB_PREFIX)jsd*$(DLL_SUFFIX) ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/docshell*.xpt ./MozillaSunbird/components
-
- sunbirdunix::
---- 283,293 ----
- cp $(topsrcdir)/dist/bin/components/downloads.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/calendar.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/chrome/calendar.jar ./MozillaSunbird/chrome
-! cp $(topsrcdir)/dist/bin/components/$(DLL_PREFIX)xp*$(DLL_SUFFIX) ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/$(DLL_PREFIX)*js*$(DLL_SUFFIX) ./MozillaSunbird/
- cp $(topsrcdir)/dist/bin/components/xpcom_thread*.xpt ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/proxyObj*.xpt ./MozillaSunbird/components
-! cp $(topsrcdir)/dist/bin/components/$(DLL_PREFIX)jsd*$(DLL_SUFFIX) ./MozillaSunbird/components
- cp $(topsrcdir)/dist/bin/components/docshell*.xpt ./MozillaSunbird/components
-
- sunbirdunix::
-*** misc/mozilla/config/Makefile.in Mon Nov 1 19:30:40 2004
---- misc/build/mozilla/config/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 135,141 ****
-
- ifdef MOZ_ENABLE_GTK2
- GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
-! GLIB_LIBS = $(MOZ_GTK2_LIBS)
- endif
-
- build_number: FORCE
---- 135,141 ----
-
- ifdef MOZ_ENABLE_GTK2
- GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
-! GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
- endif
-
- build_number: FORCE
-*** misc/mozilla/config/config.mk Tue Oct 12 06:13:31 2004
---- misc/build/mozilla/config/config.mk Tue Jan 15 13:34:32 2008
-***************
-*** 771,776 ****
---- 771,793 ----
- endif
-
- #
-+ # Shared library RUNPATH linker option(s)
-+ #
-+ ifeq ($(OS_ARCH),Linux)
-+ EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ ifdef IS_COMPONENT
-+ EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
-+ endif # IS_COMPONENT
-+ endif # Linux
-+
-+ ifeq ($(OS_ARCH),SunOS)
-+ EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
-+ ifdef IS_COMPONENT
-+ EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
-+ endif # IS_COMPONENT
-+ endif # SunOS
-+
-+ #
- # Include any personal overrides the user might think are needed.
- #
- -include $(MY_CONFIG)
-*** misc/mozilla/config/rules.mk Thu Jun 24 20:58:48 2004
---- misc/build/mozilla/config/rules.mk Tue Jan 15 13:34:32 2008
-***************
-*** 516,523 ****
- ifeq ($(OS_ARCH),WINNT)
- ifdef GNU_CC
- ifndef IS_COMPONENT
-! DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
- endif
- endif
- endif
-
---- 516,524 ----
- ifeq ($(OS_ARCH),WINNT)
- ifdef GNU_CC
- ifndef IS_COMPONENT
-! DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
- endif
-+ DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
- endif
- endif
-
-***************
-*** 1320,1325 ****
---- 1321,1327 ----
-
- $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
- $(REPORT_BUILD)
-+ echo "PATH=" $(PATH)
- $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
- @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
- then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
-*** misc/mozilla/configure Tue Oct 12 06:13:29 2004
---- misc/build/mozilla/configure Tue Jan 15 13:34:32 2008
-***************
-*** 3207,3212 ****
---- 3207,3214 ----
- ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
- cross_compiling=$ac_cv_prog_cc_cross
- fi
-+ else
-+ ac_cv_prog_CXXCPP="$CXXCPP"
- fi
- CXXCPP="$ac_cv_prog_CXXCPP"
- echo "$ac_t""$CXXCPP" 1>&6
-***************
-*** 4972,4977 ****
---- 4972,4978 ----
- if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
- _pwd=`pwd`
- CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
-+ CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
- fi
- if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
- _AS_PERL=1
-***************
-*** 5215,5221 ****
- CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
- DLL_SUFFIX=".dylib"
- DSO_LDOPTS=''
-! STRIP="$STRIP -x -S"
- case "${target_cpu}" in
- powerpc*)
- _PLATFORM_DEFAULT_TOOLKIT='mac'
---- 5215,5221 ----
- CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
- DLL_SUFFIX=".dylib"
- DSO_LDOPTS=''
-! STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
- case "${target_cpu}" in
- powerpc*)
- _PLATFORM_DEFAULT_TOOLKIT='mac'
-***************
-*** 5228,5234 ****
- ;;
-
- *-freebsd*)
-! if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
- DLL_SUFFIX=".so.1.0"
- DSO_LDOPTS="-shared"
- fi
---- 5229,5235 ----
- ;;
-
- *-freebsd*)
-! if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
- DLL_SUFFIX=".so.1.0"
- DSO_LDOPTS="-shared"
- fi
-***************
-*** 5476,5482 ****
- case "$host" in
- *-mingw*|*-cygwin*|*-msvc*|*-mks*)
-
-! MOZ_BUILD_ROOT=`cygpath -w $MOZ_BUILD_ROOT | sed -e 's|\\\\|/|g'`
-
- if test -z "$MOZ_TOOLS"; then
- { echo "configure: error: MOZ_TOOLS is not set" 1>&2; exit 1; }
---- 5477,5483 ----
- case "$host" in
- *-mingw*|*-cygwin*|*-msvc*|*-mks*)
-
-! MOZ_BUILD_ROOT=`cygpath -u $MOZ_BUILD_ROOT`
-
- if test -z "$MOZ_TOOLS"; then
- { echo "configure: error: MOZ_TOOLS is not set" 1>&2; exit 1; }
-***************
-*** 5489,5495 ****
- if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
- { echo "configure: error: \$MOZ_TOOLS\\bin must be in your path." 1>&2; exit 1; }
- fi
-! MOZ_TOOLS_DIR=`cygpath -w $MOZ_TOOLS_DIR | sed -e 's|\\\\|/|g'`
-
- if test -n "$GLIB_PREFIX"; then
- _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
---- 5490,5496 ----
- if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
- { echo "configure: error: \$MOZ_TOOLS\\bin must be in your path." 1>&2; exit 1; }
- fi
-! MOZ_TOOLS_DIR=`cygpath -u $MOZ_TOOLS_DIR`
-
- if test -n "$GLIB_PREFIX"; then
- _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
-***************
-*** 5497,5503 ****
- if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
- { echo "configure: error: GLIB_PREFIX must be in your \$PATH." 1>&2; exit 1; }
- fi
-! _GLIB_PREFIX_DIR=`cygpath -w $_GLIB_PREFIX_DIR | sed -e 's|\\\\|/|g'`
- else
- { echo "configure: error: GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory." 1>&2; exit 1; }
- fi
---- 5498,5504 ----
- if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
- { echo "configure: error: GLIB_PREFIX must be in your \$PATH." 1>&2; exit 1; }
- fi
-! _GLIB_PREFIX_DIR=`cygpath -u $_GLIB_PREFIX_DIR`
- else
- { echo "configure: error: GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory." 1>&2; exit 1; }
- fi
-***************
-*** 5516,5522 ****
- if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
- { echo "configure: error: LIBIDL_PREFIX must be in your \$PATH." 1>&2; exit 1; }
- fi
-! _LIBIDL_PREFIX_DIR=`cygpath -w $_LIBIDL_PREFIX_DIR | sed -e 's|\\\\|/|g'`
- else
- { echo "configure: error: LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory." 1>&2; exit 1; }
- fi
---- 5517,5523 ----
- if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
- { echo "configure: error: LIBIDL_PREFIX must be in your \$PATH." 1>&2; exit 1; }
- fi
-! _LIBIDL_PREFIX_DIR=`cygpath -u $_LIBIDL_PREFIX_DIR`
- else
- { echo "configure: error: LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory." 1>&2; exit 1; }
- fi
-***************
-*** 5895,5901 ****
- MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -Wl,-z -Wl,muldefs -o $@'
- MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
- MKSHLIB_UNFORCE_ALL=''
-! DSO_LDOPTS='-G -Qoption ld -z,muldefs -h $@'
- AR_LIST="$AR t"
- AR_EXTRACT="$AR x"
- AR_DELETE="$AR d"
---- 5896,5902 ----
- MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -Wl,-z -Wl,muldefs -o $@'
- MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
- MKSHLIB_UNFORCE_ALL=''
-! DSO_LDOPTS='-G -norunpath -Qoption ld -z,muldefs -h $@'
- AR_LIST="$AR t"
- AR_EXTRACT="$AR x"
- AR_DELETE="$AR d"
-***************
-*** 7504,7509 ****
---- 7505,7512 ----
- case $target in
- *-hpux11.*)
- ;;
-+ *-freebsd*)
-+ ;;
- *)
- echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
- echo "configure:7510: checking for gethostbyname_r in -lc_r" >&5
-***************
-*** 16606,16613 ****
---- 16609,16620 ----
-
- case "$host_os" in
- mingw*|cygwin*|msvc*|mks*)
-+ # Don't add the wrapper for the HOST_* versions as they contain an
-+ # unexpanded $CC and therfore wil get the wrapper below.
-+ if test -n "$GNU_CC"; then
- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-+ fi
- CC="\$(CYGWIN_WRAPPER) $CC"
- CXX="\$(CYGWIN_WRAPPER) $CXX"
- CPP="\$(CYGWIN_WRAPPER) $CPP"
-*** misc/mozilla/configure.in Tue Oct 12 06:13:29 2004
---- misc/build/mozilla/configure.in Tue Jan 15 13:34:32 2008
-***************
-*** 993,999 ****
- CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
- DLL_SUFFIX=".dylib"
- DSO_LDOPTS=''
-! STRIP="$STRIP -x -S"
- case "${target_cpu}" in
- powerpc*)
- _PLATFORM_DEFAULT_TOOLKIT='mac'
---- 993,999 ----
- CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
- DLL_SUFFIX=".dylib"
- DSO_LDOPTS=''
-! STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
- case "${target_cpu}" in
- powerpc*)
- _PLATFORM_DEFAULT_TOOLKIT='mac'
-***************
-*** 1006,1012 ****
- ;;
-
- *-freebsd*)
-! if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
- DLL_SUFFIX=".so.1.0"
- DSO_LDOPTS="-shared"
- fi
---- 1006,1012 ----
- ;;
-
- *-freebsd*)
-! if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
- DLL_SUFFIX=".so.1.0"
- DSO_LDOPTS="-shared"
- fi
-***************
-*** 1536,1542 ****
- MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -Wl,-z -Wl,muldefs -o $@'
- MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
- MKSHLIB_UNFORCE_ALL=''
-! DSO_LDOPTS='-G -Qoption ld -z,muldefs -h $@'
- AR_LIST="$AR t"
- AR_EXTRACT="$AR x"
- AR_DELETE="$AR d"
---- 1536,1542 ----
- MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -Wl,-z -Wl,muldefs -o $@'
- MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
- MKSHLIB_UNFORCE_ALL=''
-! DSO_LDOPTS='-G -norunpath -Qoption ld -z,muldefs -h $@'
- AR_LIST="$AR t"
- AR_EXTRACT="$AR x"
- AR_DELETE="$AR d"
-***************
-*** 1981,1986 ****
---- 1981,1988 ----
- case $target in
- *-hpux11.*)
- ;;
-+ *-freebsd*)
-+ ;;
- *)
- AC_CHECK_LIB(c_r, gethostbyname_r)
- ;;
-***************
-*** 5692,5699 ****
---- 5694,5705 ----
- dnl ========================================================
- case "$host_os" in
- mingw*|cygwin*|msvc*|mks*)
-+ # Don't add the wrapper for the HOST_* versions as they contain an
-+ # unexpanded $CC and therfore wil get the wrapper below.
-+ if test -n "$GNU_CC"; then
- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-+ fi
- CC="\$(CYGWIN_WRAPPER) $CC"
- CXX="\$(CYGWIN_WRAPPER) $CXX"
- CPP="\$(CYGWIN_WRAPPER) $CPP"
-*** misc/mozilla/directory/c-sdk/build.mk Tue Sep 14 23:14:38 2004
---- misc/build/mozilla/directory/c-sdk/build.mk Tue Jan 15 13:34:32 2008
-***************
-*** 367,373 ****
- ifdef NS_USE_GCC
- LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
- LINK_LIB = $(AR) cr $@ $(OBJS)
-! LINK_DLL = $(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
- else
- DEBUG_LINK_OPT=/DEBUG
- ifeq ($(BUILD_OPT), 1)
---- 367,373 ----
- ifdef NS_USE_GCC
- LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
- LINK_LIB = $(AR) cr $@ $(OBJS)
-! LINK_DLL = $(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(LIB_PREFIX)$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
- else
- DEBUG_LINK_OPT=/DEBUG
- ifeq ($(BUILD_OPT), 1)
-*** misc/mozilla/directory/c-sdk/config/FreeBSD.mk Tue Mar 26 22:51:46 2002
---- misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk Tue Jan 15 13:34:32 2008
-***************
-*** 66,72 ****
-
- ARCH = freebsd
-
-! MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
-
- ifeq ($(MOZ_OBJFORMAT),elf)
- DLL_SUFFIX = so
---- 66,72 ----
-
- ARCH = freebsd
-
-! MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
-
- ifeq ($(MOZ_OBJFORMAT),elf)
- DLL_SUFFIX = so
-*** misc/mozilla/directory/c-sdk/config/Makefile Wed Feb 11 05:01:16 2004
---- misc/build/mozilla/directory/c-sdk/config/Makefile Tue Jan 15 13:34:32 2008
-***************
-*** 48,58 ****
-
- include $(topsrcdir)/config/config.mk
-
-! CSRCS = nsinstall.c now.c
-
- PLSRCS = nfspwd.pl
-
-! ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
- PROG_SUFFIX = .exe
- else
- PROG_SUFFIX =
---- 48,62 ----
-
- include $(topsrcdir)/config/config.mk
-
-! ifndef MOZILLA_CLIENT
-! CSRCS = nsinstall.c
-! endif
-!
-! CSRCS += now.c
-
- PLSRCS = nfspwd.pl
-
-! ifneq (,$(CROSS_COMPILE)$(filter WINNT OS2,$(OS_ARCH)))
- PROG_SUFFIX = .exe
- else
- PROG_SUFFIX =
-***************
-*** 92,100 ****
- XLDOPTS += $(LDFLAGS)
- endif
-
-! ifdef XP_OS2_EMX
- XCFLAGS = $(OS_EXE_CFLAGS)
-! XLDOPTS = -Zlinker /PM:VIO
- endif
-
- ifeq ($(MOZ_OS2_TOOLS),VACPP)
---- 96,104 ----
- XLDOPTS += $(LDFLAGS)
- endif
-
-! ifeq ($(MOZ_OS2_TOOLS),EMX)
- XCFLAGS = $(OS_EXE_CFLAGS)
-! XLDOPTS = -Zomf -Zlinker /PM:VIO
- endif
-
- ifeq ($(MOZ_OS2_TOOLS),VACPP)
-***************
-*** 114,120 ****
---- 118,126 ----
-
- OUTOPTION = -o # end of the line
- ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
-+ ifndef NS_USE_GCC
- OUTOPTION = /Fe
-+ endif
- endif
-
- # Redefine MAKE_OBJDIR for just this directory
-*** misc/mozilla/directory/c-sdk/config/autoconf.mk.in Fri Mar 7 21:57:13 2003
---- misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in Tue Jan 15 13:34:32 2008
-***************
-*** 25,30 ****
---- 25,31 ----
- LIB_SUFFIX = @LIB_SUFFIX@
- LIB_PREFIX = @LIB_PREFIX@
- DLL_SUFFIX = @DLL_SUFFIX@
-+ DLL_PREFIX = @DLL_PREFIX@
- ASM_SUFFIX = @ASM_SUFFIX@
- PROG_SUFFIX = @PROG_SUFFIX@
- MOD_NAME = @NSPR_MODNAME@
-*** misc/mozilla/directory/c-sdk/config/cygwin-wrapper Thu Apr 3 01:22:39 2003
---- misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper Tue Jan 15 13:34:32 2008
-***************
-*** 1,4 ****
-! #!/bin/sh
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
---- 1,4 ----
-! #!/bin/bash
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
-***************
-*** 18,23 ****
- shift
- args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
- else
-! args=`echo $* | sed -e "s|${mountpoint}/\([a-zA-Z]\)/|\1:/|g;"`
- fi
- exec $prog $args
---- 18,57 ----
- shift
- args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
- else
-! for i in "${@}"
-! do
-! # The original version missed mounted paths, the new version below
-! # doesn't transform /para as this is most likely a parameter.
-! eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-! if ! test "$notinpath" = "$i"; then
-! # found $mountpoint
-! eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
-! eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
-! driveletter=${withdrive%%/*}
-! i=${notinpath}${driveletter}:/${restpath}
-! else
-! # check for potential path. Precheck using shell methods
-! doconvert=""
-! # Shortcut -X<path> when path does not begin with '/'
-! noswitch=${i#-[a-zA-Z]}
-! if test "$noswitch" != "$i"; then
-! test "${noswitch#/}" != "$noswitch" && doconvert="1"
-! fi
-! # Precheck for possible path. Consider only absolute paths that contain at least
-! # a second / to prevent converting of /abc parameters.
-! test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
-! if test -n "$doconvert"; then
-! # Can be a path. If forking grep would be faster or we could require bash 3
-! # this regexp would be all that's needed to find pathnames that need converting
-! pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
-! eval 'notinpath=${i%'${pathname}'}'
-! if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
-! pathname=`cygpath -am "$pathname"`
-! i=${notinpath}${pathname}
-! fi
-! fi
-! fi
-! args="${args} ${i}"
-! done
- fi
- exec $prog $args
-*** misc/mozilla/directory/c-sdk/configure Tue Sep 14 23:14:38 2004
---- misc/build/mozilla/directory/c-sdk/configure Tue Jan 15 13:34:32 2008
-***************
-*** 2830,2835 ****
---- 2830,2836 ----
- LIB_SUFFIX=a
- LIB_PREFIX=lib
- DLL_SUFFIX=so
-+ DLL_PREFIX=lib
- ASM_SUFFIX=s
- MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
- PR_MD_ASFILES=
-***************
-*** 3465,3471 ****
- EOF
-
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
---- 3466,3472 ----
- EOF
-
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
-***************
-*** 3832,3837 ****
---- 3833,3839 ----
- MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
- DSO_CFLAGS=-fPIC
- DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
-+ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
- OS_LIBS="$OS_LIBS -lc"
- _OPTIMIZE_FLAGS=-O2
- _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
-***************
-*** 3901,3907 ****
- CC="$CC -mno-cygwin"
- CXX="$CXX -mno-cygwin"
- DLL_SUFFIX=dll
-! MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
- # Use temp file for windres (bug 213281)
- RC="$WINDRES -O coff --use-temp-file"
- else
---- 3903,3910 ----
- CC="$CC -mno-cygwin"
- CXX="$CXX -mno-cygwin"
- DLL_SUFFIX=dll
-! DLL_PREFIX=
-! MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
- # Use temp file for windres (bug 213281)
- RC="$WINDRES -O coff --use-temp-file"
- else
-***************
-*** 3918,3923 ****
---- 3921,3927 ----
- LIB_SUFFIX=lib
- LIB_PREFIX=
- DLL_SUFFIX=dll
-+ DLL_PREFIX=
-
- CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
-
-***************
-*** 4318,4323 ****
---- 4322,4328 ----
- NSINSTALL=nsinstall
- LIB_PREFIX=
- LIB_SUFFIX=lib
-+ DLL_PREFIX=
- DLL_SUFFIX=dll
- DLLTOOL=''
- RC=rc.exe
-***************
-*** 4685,4690 ****
---- 4690,4696 ----
- LD=/usr/ccs/bin/ld
- RANLIB=/usr/ccs/bin/ranlib
- DSO_LDOPTS='-G -h $(notdir $@)'
-+ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
- if test -n "$GNU_CC"; then
- DSO_CFLAGS=-fPIC
- else
-***************
-*** 5882,5887 ****
---- 5888,5894 ----
- s%@LIB_SUFFIX@%$LIB_SUFFIX%g
- s%@LIB_PREFIX@%$LIB_PREFIX%g
- s%@DLL_SUFFIX@%$DLL_SUFFIX%g
-+ s%@DLL_PREFIX@%$DLL_PREFIX%g
- s%@ASM_SUFFIX@%$ASM_SUFFIX%g
- s%@PROG_SUFFIX@%$PROG_SUFFIX%g
- s%@MKSHLIB@%$MKSHLIB%g
-*** misc/mozilla/directory/c-sdk/configure.in Tue Sep 14 23:14:38 2004
---- misc/build/mozilla/directory/c-sdk/configure.in Tue Jan 15 13:34:32 2008
-***************
-*** 511,516 ****
---- 511,517 ----
- LIB_SUFFIX=a
- LIB_PREFIX=lib
- DLL_SUFFIX=so
-+ DLL_PREFIX=lib
- ASM_SUFFIX=s
- MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
- PR_MD_ASFILES=
-***************
-*** 896,902 ****
- AC_DEFINE(FREEBSD)
- AC_DEFINE(HAVE_BSD_FLOCK)
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
---- 897,903 ----
- AC_DEFINE(FREEBSD)
- AC_DEFINE(HAVE_BSD_FLOCK)
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
-***************
-*** 1144,1149 ****
---- 1145,1151 ----
- MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
- DSO_CFLAGS=-fPIC
- DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
-+ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
- OS_LIBS="$OS_LIBS -lc"
- _OPTIMIZE_FLAGS=-O2
- _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
-***************
-*** 1195,1200 ****
---- 1197,1204 ----
- CC="$CC -mno-cygwin"
- CXX="$CXX -mno-cygwin"
- DLL_SUFFIX=dll
-+ DLL_SUFFIX=dll
-+ DLL_PREFIX=
- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
- # Use temp file for windres (bug 213281)
- RC="$WINDRES -O coff --use-temp-file"
-***************
-*** 1212,1217 ****
---- 1216,1222 ----
- LIB_SUFFIX=lib
- LIB_PREFIX=
- DLL_SUFFIX=dll
-+ DLL_PREFIX=
-
- CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
-
-***************
-*** 1686,1691 ****
---- 1691,1697 ----
- LD=/usr/ccs/bin/ld
- RANLIB=/usr/ccs/bin/ranlib
- DSO_LDOPTS='-G -h $(notdir $@)'
-+ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
- if test -n "$GNU_CC"; then
- DSO_CFLAGS=-fPIC
- else
-***************
-*** 2272,2277 ****
---- 2278,2284 ----
- AC_SUBST(LIB_SUFFIX)
- AC_SUBST(LIB_PREFIX)
- AC_SUBST(DLL_SUFFIX)
-+ AC_SUBST(DLL_PREFIX)
- AC_SUBST(ASM_SUFFIX)
- AC_SUBST(PROG_SUFFIX)
- AC_SUBST(MKSHLIB)
-*** misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in Wed Mar 10 19:47:25 2004
---- misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 93,99 ****
- HDIR = $(topsrcdir)/ldap/include
-
- LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
---- 93,99 ----
- HDIR = $(topsrcdir)/ldap/include
-
- LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
-*** misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in Wed Mar 10 19:47:26 2004
---- misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 46,52 ****
- LIBPRLDAP =
- endif
- DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
-! $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
---- 46,52 ----
- LIBPRLDAP =
- endif
- DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
-! $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
-*** misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile Wed Feb 11 05:01:15 2004
---- misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile Tue Jan 15 13:34:32 2008
-***************
-*** 41,47 ****
- HDIR = $(topsrcdir)/ldap/include
-
- LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
---- 41,47 ----
- HDIR = $(topsrcdir)/ldap/include
-
- LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
-***************
-*** 92,97 ****
---- 92,106 ----
- endif
-
- ifeq ($(OS_ARCH), WINNT)
-+ ifdef NS_USE_GCC
-+ EXTRA_DLL_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME) -l$(PRLDAP_LIBNAME) \
-+ -l$(NSS_LIBNAME)
-+ ifeq ($(NSS_DYNAMIC_SOFTOKN),1)
-+ EXTRA_DLL_LIBS += -l$(SOFTOKN_LIBNAME)
-+ endif
-+ EXTRA_DLL_LIBS += -l$(SSL_LIBNAME) \
-+ -l$(PLC_BASENAME) -l$(PLDS_BASENAME) -l$(NSPR_BASENAME)
-+ else
- EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
- comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
- rpcrt4.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib
-***************
-*** 105,110 ****
---- 114,120 ----
- EXTRA_LIBS += $(dist_libdir)/$(SOFTOKN_LIBNAME).lib
- endif
- EXTRA_LIBS += $(dist_libdir)/$(SSL_LIBNAME).lib
-+ endif
- endif
-
- ifeq ($(OS_ARCH),OS2)
-*** misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in Fri Mar 7 21:57:17 2003
---- misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 40,46 ****
- HDIR = $(topsrcdir)/ldap/include
-
- LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
---- 40,46 ----
- HDIR = $(topsrcdir)/ldap/include
-
- LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-! DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-
- INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
-
-*** misc/mozilla/embedding/browser/gtk/src/Makefile.in Thu Apr 8 21:18:25 2004
---- misc/build/mozilla/embedding/browser/gtk/src/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 111,117 ****
- gtkmozembed_internal.h
-
- ifdef MOZ_ENABLE_GTK
-! EXTRA_DSO_LDOPTS = \
- $(MOZ_COMPONENT_LIBS) \
- $(XPCOM_GLUE_LIBS) \
- -lgtksuperwin \
---- 111,117 ----
- gtkmozembed_internal.h
-
- ifdef MOZ_ENABLE_GTK
-! EXTRA_DSO_LDOPTS += \
- $(MOZ_COMPONENT_LIBS) \
- $(XPCOM_GLUE_LIBS) \
- -lgtksuperwin \
-***************
-*** 119,125 ****
- endif
-
- ifdef MOZ_ENABLE_GTK2
-! EXTRA_DSO_LDOPTS = \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
- endif
---- 119,125 ----
- endif
-
- ifdef MOZ_ENABLE_GTK2
-! EXTRA_DSO_LDOPTS += \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
- endif
-*** misc/mozilla/embedding/browser/gtk/tests/Makefile.in Tue Oct 7 04:43:00 2003
---- misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 46,54 ****
- TestGtkEmbedNotebook.cpp \
- TestGtkEmbedSocket.cpp \
- TestGtkEmbedChild.cpp
-- endif
-
- SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
-
- # ENABLE_GNOME=1
-
---- 46,55 ----
- TestGtkEmbedNotebook.cpp \
- TestGtkEmbedSocket.cpp \
- TestGtkEmbedChild.cpp
-
- SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
-+
-+ endif
-
- # ENABLE_GNOME=1
-
-*** misc/mozilla/embedding/config/Makefile.in Mon Jul 7 10:02:25 2003
---- misc/build/mozilla/embedding/config/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 85,91 ****
- $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
- $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
- ifndef MINIMO
-! -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
- endif
- ifeq ($(OS_ARCH),WINNT)
- ifeq ($(WINAPP),mfcembed)
---- 85,91 ----
- $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
- $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
- ifndef MINIMO
-! -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
- endif
- ifeq ($(OS_ARCH),WINNT)
- ifeq ($(WINAPP),mfcembed)
-*** misc/mozilla/extensions/p3p/Makefile.in Thu Dec 4 19:20:16 2003
---- misc/build/mozilla/extensions/p3p/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 62,84 ****
- p3p200010.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2000/10/18/P3Pv1 \
-! -DHAS_TMPL_RETENTION\
- $< > $@
-
- p3p200012.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2000/12/P3Pv1 \
-! -DHAS_CALL_OURS\
- $< > $@
-
- p3p200109.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2001/09/P3Pv1 \
-! -DHAS_CALL_OURS\
- $< > $@
-
- p3p200201.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2002/01/P3Pv1 \
-! -DHAS_CALL_OURS -DHAS_PURPOSE_SRC\
- $< > $@
---- 62,84 ----
- p3p200010.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2000/10/18/P3Pv1 \
-! -DHAS_TMPL_RETENTION \
- $< > $@
-
- p3p200012.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2000/12/P3Pv1 \
-! -DHAS_CALL_OURS \
- $< > $@
-
- p3p200109.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2001/09/P3Pv1 \
-! -DHAS_CALL_OURS \
- $< > $@
-
- p3p200201.xsl: resources/content/p3p.xsl.in Makefile.in
- @$(RM) -f $@
- $(PP) -DNAMESPACE=http://www.w3.org/2002/01/P3Pv1 \
-! -DHAS_CALL_OURS -DHAS_PURPOSE_SRC \
- $< > $@
-*** misc/mozilla/extensions/pref/autoconfig/src/Makefile.in Wed Jan 7 14:36:25 2004
---- misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 68,74 ****
- endif
-
-
-! EXTRA_DSO_LDOPTS = \
- $(LIBS_DIR) \
- $(MOZ_JS_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
---- 68,74 ----
- endif
-
-
-! EXTRA_DSO_LDOPTS += \
- $(LIBS_DIR) \
- $(MOZ_JS_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
-*** misc/mozilla/extensions/sql/build/Makefile.in Sun Feb 8 22:51:04 2004
---- misc/build/mozilla/extensions/sql/build/Makefile.in Tue Jan 15 13:34:32 2008
-***************
-*** 52,56 ****
- cd $(DIST); zip -r $(XPI_FILE) \
- bin/components/sql.xpt \
- bin/components/sqlpgsql.xpt \
-! bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
- bin/chrome/sql.jar
---- 52,56 ----
- cd $(DIST); zip -r $(XPI_FILE) \
- bin/components/sql.xpt \
- bin/components/sqlpgsql.xpt \
-! bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
- bin/chrome/sql.jar
-*** misc/mozilla/gfx/idl/nsIFreeType2.idl Fri Apr 16 03:09:33 2004
---- misc/build/mozilla/gfx/idl/nsIFreeType2.idl Tue Jan 15 13:34:33 2008
-***************
-*** 76,85 ****
- native FT_Sfnt_Tag(FT_Sfnt_Tag);
- native FT_Size(FT_Size);
-
-! [ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
- native FTC_Face_Requester(FTC_Face_Requester);
- native FTC_Font(FTC_Font);
-! native FTC_Image_Cache(FTC_Image_Cache);
- native FTC_Manager(FTC_Manager);
-
- // #ifdef MOZ_SVG
---- 76,86 ----
- native FT_Sfnt_Tag(FT_Sfnt_Tag);
- native FT_Size(FT_Size);
-
-! [ptr] native FTC_ImageType_p(FTC_ImageType);
- native FTC_Face_Requester(FTC_Face_Requester);
- native FTC_Font(FTC_Font);
-! native FTC_FaceID(FTC_FaceID);
-! native FTC_ImageCache(FTC_ImageCache);
- native FTC_Manager(FTC_Manager);
-
- // #ifdef MOZ_SVG
-***************
-*** 99,105 ****
-
- readonly attribute FT_Library library;
- readonly attribute FTC_Manager FTCacheManager;
-! readonly attribute FTC_Image_Cache ImageCache;
-
- void doneFace(in FT_Face face);
- void doneFreeType(in FT_Library lib);
---- 100,106 ----
-
- readonly attribute FT_Library library;
- readonly attribute FTC_Manager FTCacheManager;
-! readonly attribute FTC_ImageCache ImageCache;
-
- void doneFace(in FT_Face face);
- void doneFreeType(in FT_Library lib);
-***************
-*** 115,130 ****
- void outlineDecompose(in FT_Outline_p outline,
- in const_FT_Outline_Funcs_p funcs, in voidPtr p);
- void setCharmap(in FT_Face face, in FT_CharMap charmap);
-! void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
- in FT_UInt gindex, out FT_Glyph glyph);
-! void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
-! out FT_Face face, out FT_Size size);
- void managerDone(in FTC_Manager manager);
- void managerNew(in FT_Library lib, in FT_UInt max_faces,
- in FT_UInt max_sizes, in FT_ULong max_bytes,
- in FTC_Face_Requester requester, in FT_Pointer req_data,
- out FTC_Manager manager);
-! void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
- /* #ifdef MOZ_SVG */
- void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
- in FT_Vector_p delta);
---- 116,131 ----
- void outlineDecompose(in FT_Outline_p outline,
- in const_FT_Outline_Funcs_p funcs, in voidPtr p);
- void setCharmap(in FT_Face face, in FT_CharMap charmap);
-! void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
- in FT_UInt gindex, out FT_Glyph glyph);
-! void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
-! out FT_Face face);
- void managerDone(in FTC_Manager manager);
- void managerNew(in FT_Library lib, in FT_UInt max_faces,
- in FT_UInt max_sizes, in FT_ULong max_bytes,
- in FTC_Face_Requester requester, in FT_Pointer req_data,
- out FTC_Manager manager);
-! void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
- /* #ifdef MOZ_SVG */
- void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
- in FT_Vector_p delta);
-*** misc/mozilla/gfx/src/freetype/nsFreeType.cpp Sat Feb 7 16:22:30 2004
---- misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 111,117 ****
- {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
- {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
- {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
-! {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
- {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
- {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
- {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
---- 111,117 ----
- {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
- {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
- {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
-! {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
- {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
- {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
- {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
-***************
-*** 282,288 ****
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
- FT_UInt glyphID, FT_Glyph *glyph)
- {
- // call the FreeType2 function via the function pointer
---- 282,288 ----
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
- FT_UInt glyphID, FT_Glyph *glyph)
- {
- // call the FreeType2 function via the function pointer
-***************
-*** 291,301 ****
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
-! FT_Face *face, FT_Size *size)
- {
- // call the FreeType2 function via the function pointer
-! FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
- return error ? NS_ERROR_FAILURE : NS_OK;
- }
-
---- 291,301 ----
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
-! FT_Face *face)
- {
- // call the FreeType2 function via the function pointer
-! FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
- return error ? NS_ERROR_FAILURE : NS_OK;
- }
-
-***************
-*** 320,326 ****
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
- {
- // call the FreeType2 function via the function pointer
- FT_Error error = nsFTC_Image_Cache_New(manager, cache);
---- 320,326 ----
- }
-
- NS_IMETHODIMP
-! nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
- {
- // call the FreeType2 function via the function pointer
- FT_Error error = nsFTC_Image_Cache_New(manager, cache);
-***************
-*** 389,395 ****
- }
-
- NS_IMETHODIMP
-! nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
- {
- *aCache = mImageCache;
- return NS_OK;
---- 389,395 ----
- }
-
- NS_IMETHODIMP
-! nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
- {
- *aCache = mImageCache;
- return NS_OK;
-*** misc/mozilla/gfx/src/freetype/nsFreeType.h Fri Apr 16 23:31:42 2004
---- misc/build/mozilla/gfx/src/freetype/nsFreeType.h Tue Jan 15 13:34:33 2008
-***************
-*** 104,116 ****
- typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
- typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
- typedef FT_Error (*FTC_Image_Cache_Lookup_t)
-! (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
-! typedef FT_Error (*FTC_Manager_Lookup_Size_t)
-! (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
- typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
- typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
- FTC_Face_Requester, FT_Pointer, FTC_Manager*);
-! typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
- // #ifdef MOZ_SVG
- typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
- typedef FT_Error (*FT_Get_Kerning_t)
---- 104,116 ----
- typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
- typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
- typedef FT_Error (*FTC_Image_Cache_Lookup_t)
-! (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
-! typedef FT_Error (*FTC_Manager_LookupFace_t)
-! (FTC_Manager, FTC_FaceID, FT_Face*);
- typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
- typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
- FTC_Face_Requester, FT_Pointer, FTC_Manager*);
-! typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
- // #ifdef MOZ_SVG
- typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
- typedef FT_Error (*FT_Get_Kerning_t)
-***************
-*** 165,171 ****
- FT_Outline_Decompose_t nsFT_Outline_Decompose;
- FT_Set_Charmap_t nsFT_Set_Charmap;
- FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
-! FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
- FTC_Manager_Done_t nsFTC_Manager_Done;
- FTC_Manager_New_t nsFTC_Manager_New;
- FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
---- 165,171 ----
- FT_Outline_Decompose_t nsFT_Outline_Decompose;
- FT_Set_Charmap_t nsFT_Set_Charmap;
- FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
-! FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
- FTC_Manager_Done_t nsFTC_Manager_Done;
- FTC_Manager_New_t nsFTC_Manager_New;
- FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
-***************
-*** 213,219 ****
- PRLibrary *mSharedLib;
- FT_Library mFreeTypeLibrary;
- FTC_Manager mFTCacheManager;
-! FTC_Image_Cache mImageCache;
-
- static nsHashtable *sFontFamilies;
- static nsHashtable *sRange1CharSetNames;
---- 213,219 ----
- PRLibrary *mSharedLib;
- FT_Library mFreeTypeLibrary;
- FTC_Manager mFTCacheManager;
-! FTC_ImageCache mImageCache;
-
- static nsHashtable *sFontFamilies;
- static nsHashtable *sRange1CharSetNames;
-*** misc/mozilla/gfx/src/gtk/Makefile.in Mon Nov 10 13:24:51 2003
---- misc/build/mozilla/gfx/src/gtk/Makefile.in Tue Jan 15 13:34:33 2008
-***************
-*** 176,181 ****
---- 176,185 ----
- CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
- CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
-
-+ ifeq ($(OS_ARCH), Darwin)
-+ EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
-+ endif
-+
- ifeq ($(OS_ARCH), SunOS)
- ifndef GNU_CC
- # When using Sun's WorkShop compiler, including
-*** misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp Thu Feb 5 02:57:05 2004
---- misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 1141,1150 ****
-
- mPixelSize = NSToIntRound(app2dev * mFont->size);
-
-! mImageDesc.font.face_id = (void*)mEntry;
-! mImageDesc.font.pix_width = mPixelSize;
-! mImageDesc.font.pix_height = mPixelSize;
-! mImageDesc.image_type = 0;
-
- nsresult rv;
- mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
---- 1141,1150 ----
-
- mPixelSize = NSToIntRound(app2dev * mFont->size);
-
-! mImageDesc->face_id = (FTC_FaceID)&mEntry;
-! mImageDesc->width = mPixelSize;
-! mImageDesc->height = mPixelSize;
-! mImageDesc->flags = 0;
-
- nsresult rv;
- mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
-***************
-*** 1190,1196 ****
- if (!face)
- return 0;
-
-! FTC_Image_Cache iCache;
- nsresult rv = mFt2->GetImageCache(&iCache);
- if (NS_FAILED(rv)) {
- NS_ERROR("Failed to get Image Cache");
---- 1190,1196 ----
- if (!face)
- return 0;
-
-! FTC_ImageCache iCache;
- nsresult rv = mFt2->GetImageCache(&iCache);
- if (NS_FAILED(rv)) {
- NS_ERROR("Failed to get Image Cache");
-***************
-*** 1228,1235 ****
-
- FTC_Manager cManager;
- mFt2->GetFTCacheManager(&cManager);
-! nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
-! &face, nsnull);
- NS_ASSERTION(rv==0, "failed to get face/size");
- if (rv)
- return nsnull;
---- 1228,1235 ----
-
- FTC_Manager cManager;
- mFt2->GetFTCacheManager(&cManager);
-! nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
-! &face);
- NS_ASSERTION(rv==0, "failed to get face/size");
- if (rv)
- return nsnull;
-***************
-*** 1622,1637 ****
- mEntry->GetFamilyName(fontName);
- mEntry->GetStyleName(styleName);
-
-! mImageDesc.font.face_id = (void*)mEntry;
- // TT glyph has no relation to size
-! mImageDesc.font.pix_width = 16;
-! mImageDesc.font.pix_height = 16;
-! mImageDesc.image_type = 0;
- FT_Face face = nsnull;
- FTC_Manager cManager;
- mFt2->GetFTCacheManager(&cManager);
-! nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
-! &face, nsnull);
- if (NS_FAILED(rv))
- return;
-
---- 1622,1637 ----
- mEntry->GetFamilyName(fontName);
- mEntry->GetStyleName(styleName);
-
-! mImageDesc->face_id = (FTC_FaceID)&mEntry;
- // TT glyph has no relation to size
-! mImageDesc->width = 16;
-! mImageDesc->height = 16;
-! mImageDesc->flags = 0;
- FT_Face face = nsnull;
- FTC_Manager cManager;
- mFt2->GetFTCacheManager(&cManager);
-! nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
-! &face);
- if (NS_FAILED(rv))
- return;
-
-*** misc/mozilla/gfx/src/ps/nsFontMetricsPS.h Tue Apr 22 18:25:09 2003
---- misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h Tue Jan 15 13:34:33 2008
-***************
-*** 320,326 ****
- nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
- nsCOMPtr<nsIFreeType2> mFt2;
- PRUint16 mPixelSize;
-! FTC_Image_Desc mImageDesc;
-
-
- static PRBool AddUserPref(nsIAtom *aLang, const nsFont& aFont,
---- 320,326 ----
- nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
- nsCOMPtr<nsIFreeType2> mFt2;
- PRUint16 mPixelSize;
-! FTC_ImageType mImageDesc;
-
-
- static PRBool AddUserPref(nsIAtom *aLang, const nsFont& aFont,
-***************
-*** 363,369 ****
- protected:
- nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
- nsCOMPtr<nsIFreeType2> mFt2;
-! FTC_Image_Desc mImageDesc;
- };
- #endif
-
---- 363,369 ----
- protected:
- nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
- nsCOMPtr<nsIFreeType2> mFt2;
-! FTC_ImageType mImageDesc;
- };
- #endif
-
-*** misc/mozilla/gfx/src/windows/nsDeviceContextWin.cpp Tue Jun 8 00:17:11 2004
---- misc/build/mozilla/gfx/src/windows/nsDeviceContextWin.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 378,384 ****
---- 378,388 ----
- memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
- else {
- MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
-+ #ifdef __MINGW32__
-+ strlen(ptrLogFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
-+ #else
- strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
-+ #endif
- }
- aFont->name = name;
-
-***************
-*** 601,607 ****
---- 605,615 ----
- LOGFONT logFont;
- logFont.lfCharSet = DEFAULT_CHARSET;
- logFont.lfPitchAndFamily = 0;
-+ #ifdef __MINGW32__
-+ int outlen = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aFontName.get()), aFontName.Length() + 1,
-+ #else
- int outlen = WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
-+ #endif
- logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
-
- // somehow the WideCharToMultiByte failed, let's try the old code
-***************
-*** 928,934 ****
---- 936,946 ----
- if(acp)
- {
- int outlen = ::WideCharToMultiByte( CP_ACP, 0,
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPCWSTR, PromiseFlatString(aStr).get()), aStr.Length(),
-+ #else
- PromiseFlatString(aStr).get(), aStr.Length(),
-+ #endif
- acp, acplen, NULL, NULL);
- if ( outlen > 0)
- acp[outlen] = '\0'; // null terminate
-*** misc/mozilla/gfx/src/windows/nsFontMetricsWin.cpp Sat Oct 16 06:14:42 2004
---- misc/build/mozilla/gfx/src/windows/nsFontMetricsWin.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 1259,1265 ****
---- 1259,1269 ----
- PRUnichar fname[LF_FACESIZE];
- fname[0] = 0;
- MultiByteToWideChar(CP_ACP, 0, aFontName,
-+ #ifdef __MINGW32__
-+ strlen(aFontName) + 1, NS_REINTERPRET_CAST(LPWSTR, fname), sizeof(fname)/sizeof(fname[0]));
-+ #else
- strlen(aFontName) + 1, fname, sizeof(fname)/sizeof(fname[0]));
-+ #endif
- name.Assign(NS_LITERAL_CSTRING("encoding.") + NS_ConvertUCS2toUTF8(fname) + NS_LITERAL_CSTRING(".ttf"));
- }
-
-***************
-*** 2121,2127 ****
---- 2125,2135 ----
- }
- // get the final rightBearing and width. Possible kerning is taken into account.
- SIZE size;
-+ #ifdef __MIGW32__
-+ ::GetTextExtentPointW(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-+ #else
- ::GetTextExtentPointW(aDC, aString, aLength, &size);
-+ #endif
- size.cx -= aOverhangCorrection;
- aBoundingMetrics.width = size.cx;
- aBoundingMetrics.rightBearing = size.cx - gm.gmCellIncX + gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
-***************
-*** 2352,2358 ****
---- 2360,2370 ----
- * but we don't really have a choice since CreateFontIndirectW is
- * not supported on Windows 9X (see below) -- erik
- */
-+ #ifdef __MINGW32__
-+ WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aName.get()), aName.Length() + 1,
-+ #else
- WideCharToMultiByte(CP_ACP, 0, aName.get(), aName.Length() + 1,
-+ #endif
- aLogFont->lfFaceName, sizeof(aLogFont->lfFaceName), nsnull, nsnull);
-
- if (mFont.sizeAdjust <= 0) {
-***************
-*** 2502,2508 ****
---- 2514,2524 ----
- PRUnichar name[LF_FACESIZE];
- name[0] = 0;
- MultiByteToWideChar(CP_ACP, 0, logFont->lfFaceName,
-+ #ifdef __MINGW32__
-+ strlen(logFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
-+ #else
- strlen(logFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
-+ #endif
-
- nsGlobalFont* font = new nsGlobalFont;
- if (!font) {
-***************
-*** 2943,2949 ****
---- 2959,2969 ----
- // Look for all of the weights for a given font.
- LOGFONT logFont;
- logFont.lfCharSet = DEFAULT_CHARSET;
-+ #ifdef __MINGW32__
-+ WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aFontName.get()), aFontName.Length() + 1,
-+ #else
- WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
-+ #endif
- logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
- logFont.lfPitchAndFamily = 0;
-
-***************
-*** 4098,4111 ****
---- 4118,4139 ----
-
- static PRBool
- NS_ExtTextOutW(HDC aDC, nsFontWin* aFont, PRInt32 aX, PRInt32 aY, UINT uOptions,
-+ #ifdef __MINGW32__
-+ LPCRECT lprc, const PRUnichar* aString, UINT aLength, INT *lpDx)
-+ #else
- LPCRECT lprc, LPCWSTR aString, UINT aLength, INT *lpDx)
-+ #endif
- {
- RECT clipRect;
- if (!lpDx && !lprc && aFont->FillClipRect(aX, aY, aLength, uOptions, clipRect)) {
- lprc = &clipRect;
- uOptions |= ETO_CLIPPED;
- }
-+ #ifdef __MINGW32__
-+ return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, lpDx);
-+ #else
- return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, aString, aLength, lpDx);
-+ #endif
- }
-
- void
-***************
-*** 4150,4156 ****
---- 4178,4188 ----
- CheckLength(&aLength);
-
- SIZE size;
-+ #ifdef __MINGW32__
-+ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-+ #else
- ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
-+ #endif
- size.cx -= mOverhangCorrection;
- return size.cx;
- }
-***************
-*** 4177,4183 ****
---- 4209,4219 ----
- // Clip out the extra underline/strikethru caused by the
- // bug in WIN95.
- SIZE size;
-+ #ifdef __MINGW32__
-+ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-+ #else
- ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
-+ #endif
- size.cx -= mOverhangCorrection;
- RECT clipRect;
- clipRect.top = aY - size.cy;
-***************
-*** 4260,4266 ****
---- 4296,4306 ----
- if (!mIsWide)
- ::GetTextExtentPoint32A(aDC, buffer.get(), destLength, &size);
- else
-+ #ifdef __MINGW32__
-+ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), destLength / 2, &size);
-+ #else
- ::GetTextExtentPoint32W(aDC, (const PRUnichar*) buffer.get(), destLength / 2, &size);
-+ #endif
- size.cx -= mOverhangCorrection;
-
- return size.cx;
-***************
-*** 4435,4441 ****
---- 4475,4485 ----
- if (NS_FAILED(rv) || !aLength) return 0;
-
- SIZE size;
-+ #ifdef __MINGW32__
-+ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), aLength, &size);
-+ #else
- ::GetTextExtentPoint32W(aDC, buffer.get(), aLength, &size);
-+ #endif
- size.cx -= mOverhangCorrection;
-
- return size.cx;
-***************
-*** 4640,4652 ****
---- 4684,4704 ----
- {
- *aResultLength = 0;
- // Get the number of bytes needed for the conversion
-+ #ifdef __MINGW32__
-+ int nb = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
-+ #else
- int nb = WideCharToMultiByte(mCodePage, 0, aString, aLength,
-+ #endif
- nsnull, 0, nsnull, nsnull);
-
- if (!nb || !aResult.EnsureElemCapacity(nb)) return;
- char* buf = aResult.get();
- // Convert the Unicode string to ANSI
-+ #ifdef __MINGW32__
-+ *aResultLength = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
-+ #else
- *aResultLength = WideCharToMultiByte(mCodePage, 0, aString, aLength,
-+ #endif
- buf, nb, nsnull, nsnull);
- }
-
-*** misc/mozilla/gfx/src/windows/nsRenderingContextWin.cpp Thu Feb 5 02:57:06 2004
---- misc/build/mozilla/gfx/src/windows/nsRenderingContextWin.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 2939,2955 ****
---- 2939,2967 ----
-
- GCP_RESULTSW gcpResult;
- gcpResult.lStructSize = sizeof(GCP_RESULTS);
-+ #ifdef __MINGW32__
-+ gcpResult.lpOutString = NS_REINTERPRET_CAST(LPWSTR, outStr); // Output string
-+ #else
- gcpResult.lpOutString = outStr; // Output string
-+ #endif
- gcpResult.lpOrder = nsnull; // Ordering indices
- gcpResult.lpDx = distanceArray; // Distances between character cells
- gcpResult.lpCaretPos = nsnull; // Caret positions
- gcpResult.lpClass = nsnull; // Character classifications
-+ #ifdef __MINGW32__
-+ gcpResult.lpGlyphs = NS_REINTERPRET_CAST(LPWSTR, glyphArray); // Character glyphs
-+ #else
- gcpResult.lpGlyphs = glyphArray; // Character glyphs
-+ #endif
- gcpResult.nGlyphs = 2; // Array size
-
- PRUnichar inStr[] = {araAin, one};
-
-+ #ifdef __MINGW32__
-+ if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
-+ #else
- if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
-+ #endif
- && (inStr[0] == outStr[1]) ) {
- gBidiInfo = GCP_REORDER | GCP_GLYPHSHAPE;
- #ifdef NS_DEBUG
-***************
-*** 2960,2966 ****
---- 2972,2982 ----
- const PRUnichar hebAlef = 0x05D0;
- inStr[0] = hebAlef;
- inStr[1] = one;
-+ #ifdef __MINGW32__
-+ if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
-+ #else
- if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
-+ #endif
- && (inStr[0] == outStr[1]) ) {
- gBidiInfo = GCP_REORDER;
- #ifdef NS_DEBUG
-*** misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp Thu Dec 25 09:24:52 2003
---- misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 177,183 ****
- FTC_Manager mgr;
- nsresult rv;
- mFt2->GetFTCacheManager(&mgr);
-! rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
- NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
- if (NS_FAILED(rv))
- return nsnull;
---- 177,183 ----
- FTC_Manager mgr;
- nsresult rv;
- mFt2->GetFTCacheManager(&mgr);
-! rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
- NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
- if (NS_FAILED(rv))
- return nsnull;
-***************
-*** 191,212 ****
- PRBool embedded_bimap = PR_FALSE;
- mFaceID = aFaceID;
- mPixelSize = aPixelSize;
-! mImageDesc.font.face_id = (void*)mFaceID;
-! mImageDesc.font.pix_width = aPixelSize;
-! mImageDesc.font.pix_height = aPixelSize;
-! mImageDesc.image_type = 0;
-
- if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
-- mImageDesc.image_type |= ftc_image_mono;
- anti_alias = PR_FALSE;
- }
-
-- if (nsFreeType2::gFreeType2Autohinted)
-- mImageDesc.image_type |= ftc_image_flag_autohinted;
--
-- if (nsFreeType2::gFreeType2Unhinted)
-- mImageDesc.image_type |= ftc_image_flag_unhinted;
--
- PRUint32 num_embedded_bitmaps, i;
- PRInt32* embedded_bitmapheights;
- mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
---- 191,205 ----
- PRBool embedded_bimap = PR_FALSE;
- mFaceID = aFaceID;
- mPixelSize = aPixelSize;
-! mImageDesc->face_id = (FTC_FaceID)&mFaceID;
-! mImageDesc->width = aPixelSize;
-! mImageDesc->height = aPixelSize;
-! mImageDesc->flags = 0;
-
- if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
- anti_alias = PR_FALSE;
- }
-
- PRUint32 num_embedded_bitmaps, i;
- PRInt32* embedded_bitmapheights;
- mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
-***************
-*** 218,224 ****
- if (embedded_bitmapheights[i] == aPixelSize) {
- embedded_bimap = PR_TRUE;
- // unhinted must be set for embedded bitmaps to be used
-- mImageDesc.image_type |= ftc_image_flag_unhinted;
- break;
- }
- }
---- 211,216 ----
-***************
-*** 312,318 ****
- if (!face)
- return NS_ERROR_FAILURE;
-
-! FTC_Image_Cache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return NS_ERROR_FAILURE;
---- 304,310 ----
- if (!face)
- return NS_ERROR_FAILURE;
-
-! FTC_ImageCache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return NS_ERROR_FAILURE;
-***************
-*** 401,407 ****
- if (!face)
- return 0;
-
-! FTC_Image_Cache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return 0;
---- 393,399 ----
- if (!face)
- return 0;
-
-! FTC_ImageCache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return 0;
-***************
-*** 723,729 ****
- if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
- #endif
-
-! FTC_Image_Cache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return 0;
---- 715,721 ----
- if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
- #endif
-
-! FTC_ImageCache icache;
- mFt2->GetImageCache(&icache);
- if (!icache)
- return 0;
-*** misc/mozilla/gfx/src/x11shared/nsFontFreeType.h Tue Apr 22 18:25:13 2003
---- misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h Tue Jan 15 13:34:33 2008
-***************
-*** 110,116 ****
- XImage *GetXImage(PRUint32 width, PRUint32 height);
- nsITrueTypeFontCatalogEntry *mFaceID;
- PRUint16 mPixelSize;
-! FTC_Image_Desc mImageDesc;
- nsCOMPtr<nsIFreeType2> mFt2;
- };
-
---- 110,116 ----
- XImage *GetXImage(PRUint32 width, PRUint32 height);
- nsITrueTypeFontCatalogEntry *mFaceID;
- PRUint16 mPixelSize;
-! FTC_ImageType mImageDesc;
- nsCOMPtr<nsIFreeType2> mFt2;
- };
-
-*** misc/mozilla/jpeg/jmorecfg.h Fri Mar 26 02:17:16 2004
---- misc/build/mozilla/jpeg/jmorecfg.h Tue Jan 15 13:34:33 2008
-***************
-*** 108,115 ****
- /* Defines for MMX/SSE2 support. */
-
- #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
-! #define HAVE_MMX_INTEL_MNEMONICS
-! #define HAVE_SSE2_INTEL_MNEMONICS
- #endif
-
- /* Compressed datastreams are represented as arrays of JOCTET.
---- 108,115 ----
- /* Defines for MMX/SSE2 support. */
-
- #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
-! //#define HAVE_MMX_INTEL_MNEMONICS
-! //#define HAVE_SSE2_INTEL_MNEMONICS
- #endif
-
- /* Compressed datastreams are represented as arrays of JOCTET.
-*** misc/mozilla/js/src/xpconnect/src/Makefile.in Wed Jan 7 14:36:33 2004
---- misc/build/mozilla/js/src/xpconnect/src/Makefile.in Tue Jan 15 13:34:33 2008
-***************
-*** 148,151 ****
- .NOTPARALLEL::
- endif
- endif
--
---- 148,150 ----
-*** misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp Fri Mar 19 02:36:16 2004
---- misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 440,458 ****
- return;
- }
-
-! FTC_Image_Desc imageDesc;
-! imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
- float twipstopixel = GetTwipsToPixels();
- float scale = GetPixelScale();
-! imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
-! imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
-! imageDesc.image_type |= ftc_image_grays;
-
- // get the face
- nsresult rv;
- FTC_Manager mgr;
- nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
-! rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
- NS_ASSERTION(mFace, "failed to get face/size");
- }
-
---- 440,458 ----
- return;
- }
-
-! FTC_ImageType imageDesc;
-! imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
- float twipstopixel = GetTwipsToPixels();
- float scale = GetPixelScale();
-! imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
-! imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
-! imageDesc->flags |= /* ftc_image_grays */0;
-
- // get the face
- nsresult rv;
- FTC_Manager mgr;
- nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
-! rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
- NS_ASSERTION(mFace, "failed to get face/size");
- }
-
-*** misc/mozilla/mailnews/addrbook/src/Makefile.in Mon Oct 6 19:48:56 2003
---- misc/build/mozilla/mailnews/addrbook/src/Makefile.in Tue Jan 15 13:34:33 2008
-***************
-*** 86,91 ****
---- 86,92 ----
- nsVCard.cpp \
- nsVCardObj.cpp \
- nsMsgVCardService.cpp \
-+ nsAbMD5sum.cpp \
- $(NULL)
-
- EXPORTS = \
-*** misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp Fri Oct 11 10:17:13 2002
---- misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp Tue Jan 15 13:34:33 2008
-***************
-*** 39,44 ****
---- 39,45 ----
- #include "nsAbBoolExprToLDAPFilter.h"
- #include "nsAbLDAPProperties.h"
- #include "nsXPIDLString.h"
-+ #include "nsAbUtils.h"
-
- const int nsAbBoolExprToLDAPFilter::TRANSLATE_CARD_PROPERTY = 1 << 0 ;
- const int nsAbBoolExprToLDAPFilter::ALLOW_NON_CONVERTABLE_CARD_PROPERTY = 1 << 1 ;
-***************
-*** 186,198 ****
- rv = condition->GetName (getter_Copies (name));
- NS_ENSURE_SUCCESS(rv, rv);
-
-! const char* ldapProperty = name.get ();
- if (flags & TRANSLATE_CARD_PROPERTY)
- {
-! const MozillaLdapPropertyRelation* p =
-! MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ());
-! if (p)
-! ldapProperty = p->ldapProperty;
- else if (!(flags & ALLOW_NON_CONVERTABLE_CARD_PROPERTY))
- return NS_OK;
- }
---- 187,202 ----
- rv = condition->GetName (getter_Copies (name));
- NS_ENSURE_SUCCESS(rv, rv);
-
-! CharPtrArrayGuard attrs;
- if (flags & TRANSLATE_CARD_PROPERTY)
- {
-! if(const MozillaLdapPropertyRelation* property =
-! MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ()))
-! {
-! // allow even single ldap attribute mapppings to go through this to simplify the filter creation later.
-! rv = MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (property->ldapProperty, attrs.GetSizeAddr(), attrs.GetArrayAddr() );
-! NS_ENSURE_SUCCESS(rv, rv);
-! }
- else if (!(flags & ALLOW_NON_CONVERTABLE_CARD_PROPERTY))
- return NS_OK;
- }
-***************
-*** 202,207 ****
---- 206,242 ----
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ConvertUCS2toUTF8 vUTF8 (value);
-
-+ // check if using multiple ldap attributes
-+ if(attrs.GetSize() == 1 )
-+ GenerateSingleFilter(conditionType,filter,vUTF8,attrs.GetArray()[0]);
-+ else
-+ {
-+ // add the opening brace if using multiple ldap attributes
-+ switch (conditionType)
-+ {
-+ // 'NOT' conditionals use the 'AND' operator
-+ case nsIAbBooleanConditionTypes::DoesNotExist:
-+ case nsIAbBooleanConditionTypes::DoesNotContain:
-+ case nsIAbBooleanConditionTypes::IsNot:
-+ filter += NS_LITERAL_CSTRING("(&");
-+ break;
-+ default:
-+ filter += NS_LITERAL_CSTRING("(|");
-+ break;
-+ }
-+ GenerateMultipleFilter(conditionType,filter,vUTF8,&attrs);
-+ // add the closing brace if using multiple ldap attributes
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+
-+ return rv;
-+ }
-+ void nsAbBoolExprToLDAPFilter:: GenerateSingleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ const char *ldapProperty)
-+ {
- switch (conditionType)
- {
- case nsIAbBooleanConditionTypes::DoesNotExist:
-***************
-*** 282,288 ****
- default:
- break;
- }
--
-- return rv;
- }
-
---- 317,363 ----
- default:
- break;
- }
- }
-+ void nsAbBoolExprToLDAPFilter:: GenerateMultipleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ CharPtrArrayGuard *pAttrs)
-+ {
-+ PRUint16 i = 0;
-+ PRUint16 inner = 0;
-+
-+ /*
-+ * This function is based on the fact that we are trying to generate support
-+ * for multiple occurring ldap attributes. Consider the following query:
-+ * (PagerNumber,=,123456) where PagerNumber = pager|pagerphone translates to:
-+ * (|(&(pager=*)(pager=123456))(&(!(pager=*))(pagerphone=123456)))
-+ * This can be shortened to:
-+ * (|(pager=123456)(&(!(pager=*))(pagerphone=123456)))
-+ *
-+ * i.e. use the first occurring attribute if it exists otherwise if first
-+ * does not exist use the second etc. The assumption is that the first
-+ * always takes precedence.
-+ * This translates to:
-+ * GenerateSingleFilter(Is);
-+ * GenerateSingleFilter(DoesNotExists);
-+ * GenerateSingleFilter(Is);
-+ */
-
-+ for (i = 0; i < pAttrs->GetSize(); i++)
-+ {
-+ if(i == 0)
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ else
-+ {
-+ filter += NS_LITERAL_CSTRING("(&");
-+ nsAbBooleanConditionType doesNotExistsType = nsIAbBooleanConditionTypes::DoesNotExist;
-+ for(inner = 0; inner < i; ++inner)
-+ {
-+ GenerateSingleFilter(doesNotExistsType,filter,vUTF8,pAttrs->GetArray()[inner]);
-+ }
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+ }
-+ }
-*** misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h Fri Sep 28 22:06:21 2001
---- misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h Tue Jan 15 13:34:34 2008
-***************
-*** 42,47 ****
---- 42,48 ----
- #include "nsIAbBooleanExpression.h"
- #include "nsCOMPtr.h"
- #include "nsString.h"
-+ #include "nsAbUtils.h"
-
- class nsAbBoolExprToLDAPFilter
- {
-***************
-*** 67,72 ****
---- 68,83 ----
- nsIAbBooleanConditionString* condition,
- nsCString& filter,
- int flags);
-+ static void GenerateMultipleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ CharPtrArrayGuard *pAttrs);
-+ static void GenerateSingleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ const char *ldapProperty);
- };
-
- #endif
-*** misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp Sat Feb 14 03:09:27 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 118,128 ****
-
- // use mURINoQuery to get a prefName
- nsCAutoString prefName;
-! prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
-
- // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
- nsXPIDLCString URI;
-! rv = prefs->CopyCharPref(prefName.get(), getter_Copies(URI));
- if (NS_FAILED(rv))
- {
- /*
---- 118,130 ----
-
- // use mURINoQuery to get a prefName
- nsCAutoString prefName;
-! prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) ;
-
- // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
- nsXPIDLCString URI;
-! nsCAutoString uriPrefName;
-! uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
-! rv = prefs->CopyCharPref(uriPrefName.get(), getter_Copies(URI));
- if (NS_FAILED(rv))
- {
- /*
-***************
-*** 146,151 ****
---- 148,174 ----
- nsCAutoString tempLDAPURL(mURINoQuery);
- tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
- rv = mURL->SetSpec(tempLDAPURL);
-+ NS_ENSURE_SUCCESS(rv,rv);
-+
-+ nsCAutoString aHost;
-+ mURL->GetHost(aHost);
-+ aHost.ReplaceChar('.','_');
-+ prefName = nsDependentCString("ldap_2.servers.") + aHost;
-+ PRBool useSSL=0;
-+ rv = prefs->GetBoolPref(
-+ PromiseFlatCString(prefName
-+ + NS_LITERAL_CSTRING(".UseSSL")).get(),
-+ &useSSL
-+ );
-+
-+ // If use SSL,ldap url will look like this ldaps://host:port/.....
-+ if (!NS_FAILED(rv) && useSSL)
-+ {
-+ tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
-+ rv = mURL->SetSpec(tempLDAPURL);
-+ }
-+ //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
-+ rv = 0;
- }
- else
- {
-***************
-*** 156,179 ****
- // get the login information, if there is any
- //
- rv = prefs->GetCharPref(
-! PromiseFlatCString(
-! Substring(mURINoQuery, kLDAPDirectoryRootLen,
-! mURINoQuery.Length() - kLDAPDirectoryRootLen)
- + NS_LITERAL_CSTRING(".auth.dn")).get(),
- getter_Copies(mLogin));
- if (NS_FAILED(rv)) {
- mLogin.Truncate(); // zero out mLogin
- }
-
- // get the protocol version, if there is any. using a string pref
- // here instead of an int, as protocol versions sometimes have names like
- // "4bis".
- //
- nsXPIDLCString protocolVersion;
- rv = prefs->GetCharPref(
-! PromiseFlatCString(
-! Substring(mURINoQuery, kLDAPDirectoryRootLen,
-! mURINoQuery.Length() - kLDAPDirectoryRootLen)
- + NS_LITERAL_CSTRING(".protocolVersion")).get(),
- getter_Copies(protocolVersion));
-
---- 179,207 ----
- // get the login information, if there is any
- //
- rv = prefs->GetCharPref(
-! PromiseFlatCString(prefName
- + NS_LITERAL_CSTRING(".auth.dn")).get(),
- getter_Copies(mLogin));
- if (NS_FAILED(rv)) {
- mLogin.Truncate(); // zero out mLogin
- }
-
-+ // get the password information, if there is any
-+ //
-+ rv = prefs->GetCharPref(
-+ PromiseFlatCString(prefName
-+ + NS_LITERAL_CSTRING(".auth.pwd")).get(),
-+ getter_Copies(mPassword));
-+ if (NS_FAILED(rv)) {
-+ mPassword.Truncate(); // zero out mLogin
-+ }
- // get the protocol version, if there is any. using a string pref
- // here instead of an int, as protocol versions sometimes have names like
- // "4bis".
- //
- nsXPIDLCString protocolVersion;
- rv = prefs->GetCharPref(
-! PromiseFlatCString(prefName
- + NS_LITERAL_CSTRING(".protocolVersion")).get(),
- getter_Copies(protocolVersion));
-
-*** misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp Sat Feb 14 03:09:27 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 74,80 ****
- PRInt32 resultLimit = -1,
- PRInt32 timeOut = 0);
- virtual ~nsAbQueryLDAPMessageListener ();
-!
- protected:
- nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
- nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
---- 74,80 ----
- PRInt32 resultLimit = -1,
- PRInt32 timeOut = 0);
- virtual ~nsAbQueryLDAPMessageListener ();
-! void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
- protected:
- nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
- nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
-***************
-*** 105,110 ****
---- 105,112 ----
- PRBool mInitialized;
- PRBool mCanceled;
-
-+ nsAutoString m_sPassword;
-+
- nsCOMPtr<nsILDAPOperation> mSearchOperation;
-
- PRLock* mLock;
-***************
-*** 255,261 ****
-
- // If mLogin is set, we're expected to use it to get a password.
- //
-! if (!mDirectoryQuery->mLogin.IsEmpty()) {
- // XXX hack until nsUTF8AutoString exists
- #define nsUTF8AutoString nsCAutoString
- nsUTF8AutoString spec;
---- 257,263 ----
-
- // If mLogin is set, we're expected to use it to get a password.
- //
-! if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
- // XXX hack until nsUTF8AutoString exists
- #define nsUTF8AutoString nsCAutoString
- nsUTF8AutoString spec;
-***************
-*** 398,407 ****
- rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
- NS_ENSURE_SUCCESS(rv, rv);
-
-! // Bind
-! rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
- NS_ENSURE_SUCCESS(rv, rv);
--
- return rv;
- }
-
---- 400,412 ----
- rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
- NS_ENSURE_SUCCESS(rv, rv);
-
-!
-! // Bind
-! if (m_sPassword.Length())
-! rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
-! else
-! rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
- NS_ENSURE_SUCCESS(rv, rv);
- return rv;
- }
-
-***************
-*** 685,691 ****
- rv = getLdapReturnAttributes (arguments, returnAttributes);
- NS_ENSURE_SUCCESS(rv, rv);
-
-!
- // Get the filter
- nsCOMPtr<nsISupports> supportsExpression;
- rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
---- 690,696 ----
- rv = getLdapReturnAttributes (arguments, returnAttributes);
- NS_ENSURE_SUCCESS(rv, rv);
-
-!
- // Get the filter
- nsCOMPtr<nsISupports> supportsExpression;
- rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
-***************
-*** 811,816 ****
---- 816,826 ----
- timeOut);
- if (_messageListener == NULL)
- return NS_ERROR_OUT_OF_MEMORY;
-+
-+ nsAutoString wPassword;
-+ wPassword.AssignWithConversion(mPassword.get());
-+ _messageListener->SetPassword(wPassword);
-+
- messageListener = _messageListener;
- nsVoidKey key (NS_REINTERPRET_CAST(void *,contextID));
-
-*** misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h Sat Feb 14 03:09:27 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h Tue Jan 15 13:34:34 2008
-***************
-*** 74,79 ****
---- 74,80 ----
- nsresult RemoveListener (PRInt32 contextID);
- nsresult Initiate ();
- nsXPIDLCString mLogin; // authenticate to the LDAP server as...
-+ nsXPIDLCString mPassword; // password to the LDAP server as...
- nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
- PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
-
-*** misc/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp Sat Mar 22 16:43:29 2003
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 39,44 ****
---- 39,45 ----
- #include "nsAbLDAPProperties.h"
-
- #include "nsAbUtils.h"
-+ #include "nsCRT.h"
-
- #include "nsCOMPtr.h"
- #include "nsString.h"
-***************
-*** 59,64 ****
---- 60,80 ----
- If there are multiple entries for a mozilla
- property the first takes precedence.
-
-+ But where we need to do a query against
-+ a multiple occurring ldap attribute we
-+ need to OR all the possible ldap entries e.g.
-+
-+ (CellularNumber=123456) translates to
-+ (|(mobile=123456)(&(!(mobile=*))(cellphone=123456))(&(!(mobile=*))(!(cellphone=*))(carphone=123456)))
-+
-+ i.e. use the first occurring attribute otherwise if
-+ first does not exist use the second etc.
-+
-+ [Multiple occurring ldap attributes do not
-+ include aliases. We have also ignored the case
-+ for including 'displayname' as the first occurring
-+ attribute 'cn' is a required attribute.]
-+
- This ensures that
-
- 1) Generality is maintained when mapping from
-***************
-*** 101,152 ****
- {MozillaProperty_String, "FaxNumber", "fax"},
- // organizationalPerson
- {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber"},
-! // inetOrgPerson
-! {MozillaProperty_String, "PagerNumber", "pager"},
-! // ?
-! {MozillaProperty_String, "PagerNumber", "pagerphone"},
-! // inetOrgPerson
-! {MozillaProperty_String, "CellularNumber", "mobile"},
-! // ?
-! {MozillaProperty_String, "CellularNumber", "cellphone"},
-! // ?
-! {MozillaProperty_String, "CellularNumber", "carphone"},
-
- // No Home* properties defined yet
-
-! // organizationalPerson
-! {MozillaProperty_String, "WorkAddress", "postofficebox"},
-! // ?
-! {MozillaProperty_String, "WorkAddress", "streetaddress"},
- // ?
- {MozillaProperty_String, "WorkCity", "l"},
- // ?
- {MozillaProperty_String, "WorkCity", "locality"},
- // ?
-! {MozillaProperty_String, "WorkState", "st"},
-! // ?
-! {MozillaProperty_String, "WorkState", "region"},
-! // organizationalPerson
-! {MozillaProperty_String, "WorkZipCode", "postalcode"},
-! // ?
-! {MozillaProperty_String, "WorkZipCode", "zip"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
-
- // organizationalPerson
- {MozillaProperty_String, "JobTitle", "title"},
- // ?
-! {MozillaProperty_String, "Department", "ou"},
-! // ?
-! {MozillaProperty_String, "Department", "orgunit"},
-! // ?
-! {MozillaProperty_String, "Department", "department"},
-! // ?
-! {MozillaProperty_String, "Department", "departmentnumber"},
-! // inetOrgPerson
-! {MozillaProperty_String, "Company", "o"},
-! // ?
-! {MozillaProperty_String, "Company", "company"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
- // ?
---- 117,148 ----
- {MozillaProperty_String, "FaxNumber", "fax"},
- // organizationalPerson
- {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber"},
-! // inetOrgPerson,?
-! {MozillaProperty_String, "PagerNumber", "pager,pagerphone"},
-! // inetOrgPerson,?,?
-! {MozillaProperty_String, "CellularNumber", "mobile,cellphone,carphone"},
-
- // No Home* properties defined yet
-
-! // organizationalPerson,?
-! {MozillaProperty_String, "WorkAddress", "postofficebox,streetaddress"},
- // ?
- {MozillaProperty_String, "WorkCity", "l"},
- // ?
- {MozillaProperty_String, "WorkCity", "locality"},
- // ?
-! {MozillaProperty_String, "WorkState", "st,region"},
-! // organizationalPerson,?
-! {MozillaProperty_String, "WorkZipCode", "postalcode,zip"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
-
- // organizationalPerson
- {MozillaProperty_String, "JobTitle", "title"},
- // ?
-! {MozillaProperty_String, "Department", "ou,orgunit,department,departmentnumber"},
-! // inetOrgPerson,?
-! {MozillaProperty_String, "Company", "o,company"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
- // ?
-***************
-*** 168,177 ****
- // ?
- {MozillaProperty_String, "Custom4", "custom4"},
-
-! // ?
-! {MozillaProperty_String, "Notes", "notes"},
-! // person
-! {MozillaProperty_String, "Notes", "description"},
-
- // mozilla specfic
- {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail"},
---- 164,171 ----
- // ?
- {MozillaProperty_String, "Custom4", "custom4"},
-
-! // ?,person
-! {MozillaProperty_String, "Notes", "notes,description"},
-
- // mozilla specfic
- {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail"},
-***************
-*** 209,218 ****
- if (IsInitialized) { return ; }
-
- for (int i = tableSize - 1 ; i >= 0 ; -- i) {
-- nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
-- nsCStringKey keyLdap (table [i].ldapProperty, -1, nsCStringKey::NEVER_OWN);
-
- mLdapToMozilla.Put(&keyLdap, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
- mMozillaToLdap.Put(&keyMozilla, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
- }
- IsInitialized = PR_TRUE;
---- 203,224 ----
- if (IsInitialized) { return ; }
-
- for (int i = tableSize - 1 ; i >= 0 ; -- i) {
-
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsCRT::strdup(table[i].ldapProperty);
-+ char *tmpLDAPProperty;
-+
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (attrToken != nsnull)
-+ {
-+ while ( ' ' == *attrToken)
-+ attrToken++;
-+ nsCStringKey keyLdap (attrToken, -1, nsCStringKey::NEVER_OWN);
- mLdapToMozilla.Put(&keyLdap, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
-+ }
-+
-+ nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
- mMozillaToLdap.Put(&keyMozilla, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
- }
- IsInitialized = PR_TRUE;
-***************
-*** 234,243 ****
- const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (const char* ldapProperty)
- {
- Initialize();
- // ensure that we always do a case insensitive comparison
- // against the incoming ldap attributes.
-! nsCAutoString lowercasedProp(ldapProperty);
-! ToLowerCase(nsDependentCString(ldapProperty), lowercasedProp);
- nsCStringKey key(lowercasedProp);
-
- return NS_REINTERPRET_CAST(const MozillaLdapPropertyRelation *, mLdapToMozilla.Get(&key)) ;
---- 240,252 ----
- const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (const char* ldapProperty)
- {
- Initialize();
-+ char *attrToken;
-+ char *tmpLDAPProperty;
-+ attrToken = nsCRT::strtok(NS_CONST_CAST(char *,ldapProperty), ",", &tmpLDAPProperty);
- // ensure that we always do a case insensitive comparison
- // against the incoming ldap attributes.
-! nsCAutoString lowercasedProp (attrToken) ;
-! ToLowerCase(nsDependentCString(attrToken),lowercasedProp);
- nsCStringKey key(lowercasedProp);
-
- return NS_REINTERPRET_CAST(const MozillaLdapPropertyRelation *, mLdapToMozilla.Get(&key)) ;
-***************
-*** 287,291 ****
---- 296,361 ----
- }
- }
-
-+ return rv;
-+ }
-+
-+ // Parse the input string which may contain a single ldap attribute or multiple attributes in the form
-+ // "string" or "string1,string2,string3" respectively and assign to the array.
-+ nsresult MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes)
-+ {
-+ NS_ENSURE_ARG_POINTER(aAttrCount);
-+ NS_ENSURE_ARG_POINTER(aAttributes);
-+
-+ nsresult rv = NS_OK;
-+
-+ *aAttributes = 0;
-+ // we must have at least one attribute
-+ *aAttrCount = 1;
-+
-+ // if no multiple ldap attributes then allocate our single entry and exit
-+ if (!strchr(aLDAPProperty,','))
-+ {
-+ if (!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ if (!((*aAttributes)[0] = nsCRT::strdup(aLDAPProperty)))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ return rv;
-+ }
-+
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsnull;
-+ char *tmpLDAPProperty;
-+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ // set our tokenizer to the start
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+
-+ // Count up the attribute names
-+ while ((attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty)) != nsnull)
-+ *aAttrCount += 1;
-+
-+ nsCRT::free (LDAPProperty);
-+ if(!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(*aAttrCount * sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
-+
-+ PRInt32 j = 0;
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (nsnull != attrToken) {
-+ if(((*aAttributes)[j++] = nsCRT::strdup(attrToken)) == nsnull)
-+ {
-+ nsCRT::free(LDAPProperty);
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ }
-+
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
-+ }
-+
-+ nsCRT::free(LDAPProperty);
- return rv;
- }
-*** misc/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h Tue Apr 9 11:27:24 2002
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h Tue Jan 15 13:34:34 2008
-***************
-*** 85,90 ****
---- 85,91 ----
- static nsresult createCardPropertyFromLDAPMessage (nsILDAPMessage* message,
- nsIAbCard* card,
- PRBool* hasSetCardProperty);
-+ static nsresult getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes);
- };
-
- #endif
-*** misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp Tue Jan 15 13:43:17 2008
---- misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 1 ****
-! dummy
---- 1,633 ----
-! /*
-! * The contents of this file are subject to the Mozilla Public
-! * License Version 1.1 (the "License"); you may not use this file
-! * except in compliance with the License. You may obtain a copy of
-! * the License at http://www.mozilla.org/MPL/
-! *
-! * Software distributed under the License is distributed on an "AS
-! * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-! * implied. See the License for the specific language governing
-! * rights and limitations under the License.
-! *
-! * The Original Code is the Netscape security libraries.
-! *
-! * The Initial Developer of the Original Code is Netscape
-! * Communications Corporation. Portions created by Netscape are
-! * Copyright (C) 1994-2000 Netscape Communications Corporation. All
-! * Rights Reserved.
-! *
-! * Contributor(s):
-! *
-! * Alternatively, the contents of this file may be used under the
-! * terms of the GNU General Public License Version 2 or later (the
-! * "GPL"), in which case the provisions of the GPL are applicable
-! * instead of those above. If you wish to allow use of your
-! * version of this file only under the terms of the GPL and not to
-! * allow others to use your version of this file under the MPL,
-! * indicate your decision by deleting the provisions above and
-! * replace them with the notice and other provisions required by
-! * the GPL. If you do not delete the provisions above, a recipient
-! * may use your version of this file under either the MPL or the
-! * GPL.
-! */
-! #include <stdio.h>
-! #include <stdlib.h>
-!
-! #include "prerr.h"
-!
-! #include "prtypes.h"
-! #include "prlong.h"
-! #include "plstr.h"
-! #include "nsMemory.h"
-!
-! #define MD5_HASH_LEN 16
-! #define MD5_BUFFER_SIZE 64
-! #define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
-!
-! #define CV0_1 0x67452301
-! #define CV0_2 0xefcdab89
-! #define CV0_3 0x98badcfe
-! #define CV0_4 0x10325476
-!
-! #define T1_0 0xd76aa478
-! #define T1_1 0xe8c7b756
-! #define T1_2 0x242070db
-! #define T1_3 0xc1bdceee
-! #define T1_4 0xf57c0faf
-! #define T1_5 0x4787c62a
-! #define T1_6 0xa8304613
-! #define T1_7 0xfd469501
-! #define T1_8 0x698098d8
-! #define T1_9 0x8b44f7af
-! #define T1_10 0xffff5bb1
-! #define T1_11 0x895cd7be
-! #define T1_12 0x6b901122
-! #define T1_13 0xfd987193
-! #define T1_14 0xa679438e
-! #define T1_15 0x49b40821
-!
-! #define T2_0 0xf61e2562
-! #define T2_1 0xc040b340
-! #define T2_2 0x265e5a51
-! #define T2_3 0xe9b6c7aa
-! #define T2_4 0xd62f105d
-! #define T2_5 0x02441453
-! #define T2_6 0xd8a1e681
-! #define T2_7 0xe7d3fbc8
-! #define T2_8 0x21e1cde6
-! #define T2_9 0xc33707d6
-! #define T2_10 0xf4d50d87
-! #define T2_11 0x455a14ed
-! #define T2_12 0xa9e3e905
-! #define T2_13 0xfcefa3f8
-! #define T2_14 0x676f02d9
-! #define T2_15 0x8d2a4c8a
-!
-! #define T3_0 0xfffa3942
-! #define T3_1 0x8771f681
-! #define T3_2 0x6d9d6122
-! #define T3_3 0xfde5380c
-! #define T3_4 0xa4beea44
-! #define T3_5 0x4bdecfa9
-! #define T3_6 0xf6bb4b60
-! #define T3_7 0xbebfbc70
-! #define T3_8 0x289b7ec6
-! #define T3_9 0xeaa127fa
-! #define T3_10 0xd4ef3085
-! #define T3_11 0x04881d05
-! #define T3_12 0xd9d4d039
-! #define T3_13 0xe6db99e5
-! #define T3_14 0x1fa27cf8
-! #define T3_15 0xc4ac5665
-!
-! #define T4_0 0xf4292244
-! #define T4_1 0x432aff97
-! #define T4_2 0xab9423a7
-! #define T4_3 0xfc93a039
-! #define T4_4 0x655b59c3
-! #define T4_5 0x8f0ccc92
-! #define T4_6 0xffeff47d
-! #define T4_7 0x85845dd1
-! #define T4_8 0x6fa87e4f
-! #define T4_9 0xfe2ce6e0
-! #define T4_10 0xa3014314
-! #define T4_11 0x4e0811a1
-! #define T4_12 0xf7537e82
-! #define T4_13 0xbd3af235
-! #define T4_14 0x2ad7d2bb
-! #define T4_15 0xeb86d391
-!
-! #define R1B0 0
-! #define R1B1 1
-! #define R1B2 2
-! #define R1B3 3
-! #define R1B4 4
-! #define R1B5 5
-! #define R1B6 6
-! #define R1B7 7
-! #define R1B8 8
-! #define R1B9 9
-! #define R1B10 10
-! #define R1B11 11
-! #define R1B12 12
-! #define R1B13 13
-! #define R1B14 14
-! #define R1B15 15
-!
-! #define R2B0 1
-! #define R2B1 6
-! #define R2B2 11
-! #define R2B3 0
-! #define R2B4 5
-! #define R2B5 10
-! #define R2B6 15
-! #define R2B7 4
-! #define R2B8 9
-! #define R2B9 14
-! #define R2B10 3
-! #define R2B11 8
-! #define R2B12 13
-! #define R2B13 2
-! #define R2B14 7
-! #define R2B15 12
-!
-! #define R3B0 5
-! #define R3B1 8
-! #define R3B2 11
-! #define R3B3 14
-! #define R3B4 1
-! #define R3B5 4
-! #define R3B6 7
-! #define R3B7 10
-! #define R3B8 13
-! #define R3B9 0
-! #define R3B10 3
-! #define R3B11 6
-! #define R3B12 9
-! #define R3B13 12
-! #define R3B14 15
-! #define R3B15 2
-!
-! #define R4B0 0
-! #define R4B1 7
-! #define R4B2 14
-! #define R4B3 5
-! #define R4B4 12
-! #define R4B5 3
-! #define R4B6 10
-! #define R4B7 1
-! #define R4B8 8
-! #define R4B9 15
-! #define R4B10 6
-! #define R4B11 13
-! #define R4B12 4
-! #define R4B13 11
-! #define R4B14 2
-! #define R4B15 9
-!
-! #define S1_0 7
-! #define S1_1 12
-! #define S1_2 17
-! #define S1_3 22
-!
-! #define S2_0 5
-! #define S2_1 9
-! #define S2_2 14
-! #define S2_3 20
-!
-! #define S3_0 4
-! #define S3_1 11
-! #define S3_2 16
-! #define S3_3 23
-!
-! #define S4_0 6
-! #define S4_1 10
-! #define S4_2 15
-! #define S4_3 21
-!
-! struct MD5ContextStr {
-! PRUint32 lsbInput;
-! PRUint32 msbInput;
-! PRUint32 cv[4];
-! union {
-! PRUint8 b[64];
-! PRUint32 w[16];
-! } u;
-! };
-! typedef struct MD5ContextStr MD5Context;
-!
-! #define inBuf u.b
-!
-! int MD5_Hash(unsigned char *dest, const char *src);
-! int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
-! MD5Context * MD5_NewContext(void);
-! void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
-! void MD5_Begin(MD5Context *cx);
-! static void md5_compress(MD5Context *cx);
-! void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
-! void MD5_End(MD5Context *cx, unsigned char *digest,
-! unsigned int *digestLen, unsigned int maxDigestLen);
-! unsigned int MD5_FlattenSize(MD5Context *cx);
-! int MD5_Flatten(MD5Context *cx, unsigned char *space);
-! MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
-! void MD5_TraceState(MD5Context *cx);
-!
-! int
-! MD5_Hash(unsigned char *dest, const char *src)
-! {
-! return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
-! }
-!
-! int
-! MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
-! {
-! unsigned int len;
-! MD5Context *cx = MD5_NewContext();
-! if (cx == NULL) {
-! // PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-! return -1;
-! }
-! MD5_Begin(cx);
-! MD5_Update(cx, src, src_length);
-! MD5_End(cx, dest, &len, MD5_HASH_LEN);
-! MD5_DestroyContext(cx, PR_TRUE);
-! return 0;
-! }
-!
-! MD5Context *
-! MD5_NewContext(void)
-! {
-! MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
-! if (cx == NULL) {
-! // PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-! return NULL;
-! }
-! return cx;
-! }
-!
-! void
-! MD5_DestroyContext(MD5Context *cx, PRBool freeit)
-! {
-! if (freeit) {
-! free(cx);
-! }
-! }
-!
-! void
-! MD5_Begin(MD5Context *cx)
-! {
-! cx->lsbInput = 0;
-! cx->msbInput = 0;
-! memset(cx->inBuf, 0, sizeof(cx->inBuf));
-! cx->cv[0] = CV0_1;
-! cx->cv[1] = CV0_2;
-! cx->cv[2] = CV0_3;
-! cx->cv[3] = CV0_4;
-! }
-!
-! #define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
-!
-! #define MASK 0x00ff00ff
-! #ifdef IS_LITTLE_ENDIAN
-! #define lendian(i32) \
-! (i32)
-! #else
-! #define lendian(i32) \
-! (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
-! #endif
-!
-! #if defined(SOLARIS) || defined(HPUX)
-! #define addto64(sumhigh, sumlow, addend) \
-! sumlow += addend; sumhigh += (sumlow < addend);
-! #else
-! #define addto64(sumhigh, sumlow, addend) \
-! sumlow += addend; if (sumlow < addend) ++sumhigh;
-! #endif
-!
-! #define F(X, Y, Z) \
-! ((X & Y) | ((~X) & Z))
-!
-! #define G(X, Y, Z) \
-! ((X & Z) | (Y & (~Z)))
-!
-! #define H(X, Y, Z) \
-! (X ^ Y ^ Z)
-!
-! #define I(X, Y, Z) \
-! (Y ^ (X | (~Z)))
-!
-! #define FF(a, b, c, d, bufint, s, ti) \
-! a = b + cls(a + F(b, c, d) + bufint + ti, s)
-!
-! #define GG(a, b, c, d, bufint, s, ti) \
-! a = b + cls(a + G(b, c, d) + bufint + ti, s)
-!
-! #define HH(a, b, c, d, bufint, s, ti) \
-! a = b + cls(a + H(b, c, d) + bufint + ti, s)
-!
-! #define II(a, b, c, d, bufint, s, ti) \
-! a = b + cls(a + I(b, c, d) + bufint + ti, s)
-!
-! static void
-! md5_compress(MD5Context *cx)
-! {
-! PRUint32 a, b, c, d;
-! PRUint32 tmp;
-! a = cx->cv[0];
-! b = cx->cv[1];
-! c = cx->cv[2];
-! d = cx->cv[3];
-! #ifndef IS_LITTLE_ENDIAN
-! cx->u.w[0] = lendian(cx->u.w[0]);
-! cx->u.w[1] = lendian(cx->u.w[1]);
-! cx->u.w[2] = lendian(cx->u.w[2]);
-! cx->u.w[3] = lendian(cx->u.w[3]);
-! cx->u.w[4] = lendian(cx->u.w[4]);
-! cx->u.w[5] = lendian(cx->u.w[5]);
-! cx->u.w[6] = lendian(cx->u.w[6]);
-! cx->u.w[7] = lendian(cx->u.w[7]);
-! cx->u.w[8] = lendian(cx->u.w[8]);
-! cx->u.w[9] = lendian(cx->u.w[9]);
-! cx->u.w[10] = lendian(cx->u.w[10]);
-! cx->u.w[11] = lendian(cx->u.w[11]);
-! cx->u.w[12] = lendian(cx->u.w[12]);
-! cx->u.w[13] = lendian(cx->u.w[13]);
-! cx->u.w[14] = lendian(cx->u.w[14]);
-! cx->u.w[15] = lendian(cx->u.w[15]);
-! #endif
-! FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
-! FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
-! FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
-! FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
-! FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
-! FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
-! FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
-! FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
-! FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
-! FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
-! FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
-! FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
-! FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
-! FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
-! FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
-! FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
-! GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
-! GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
-! GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
-! GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
-! GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
-! GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
-! GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
-! GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
-! GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
-! GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
-! GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
-! GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
-! GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
-! GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
-! GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
-! GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
-! HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
-! HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
-! HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
-! HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
-! HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
-! HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
-! HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
-! HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
-! HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
-! HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
-! HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
-! HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
-! HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
-! HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
-! HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
-! HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
-! II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
-! II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
-! II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
-! II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
-! II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
-! II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
-! II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
-! II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
-! II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
-! II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
-! II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
-! II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
-! II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
-! II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
-! II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
-! II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
-! cx->cv[0] += a;
-! cx->cv[1] += b;
-! cx->cv[2] += c;
-! cx->cv[3] += d;
-! }
-!
-! void
-! MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
-! {
-! PRUint32 bytesToConsume;
-! PRUint32 inBufIndex = cx->lsbInput & 63;
-!
-! /* Add the number of input bytes to the 64-bit input counter. */
-! addto64(cx->msbInput, cx->lsbInput, inputLen);
-! if (inBufIndex) {
-! /* There is already data in the buffer. Fill with input. */
-! bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
-! memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
-! if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
-! /* The buffer is filled. Run the compression function. */
-! md5_compress(cx);
-! /* Remaining input. */
-! inputLen -= bytesToConsume;
-! input += bytesToConsume;
-! }
-!
-! /* Iterate over 64-byte chunks of the message. */
-! while (inputLen >= MD5_BUFFER_SIZE) {
-! memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
-! md5_compress(cx);
-! inputLen -= MD5_BUFFER_SIZE;
-! input += MD5_BUFFER_SIZE;
-! }
-!
-! /* Tail of message (message bytes mod 64). */
-! if (inputLen)
-! memcpy(cx->inBuf, input, inputLen);
-! }
-!
-! static const unsigned char padbytes[] = {
-! 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-! 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-! };
-!
-! void
-! MD5_End(MD5Context *cx, unsigned char *digest,
-! unsigned int *digestLen, unsigned int maxDigestLen)
-! {
-! #ifndef IS_LITTLE_ENDIAN
-! PRUint32 tmp;
-! #endif
-! PRUint32 lowInput, highInput;
-! PRUint32 inBufIndex = cx->lsbInput & 63;
-!
-! if (maxDigestLen < MD5_HASH_LEN) {
-! // PORT_SetError(SEC_ERROR_INVALID_ARGS);
-! return;
-! }
-!
-! /* Copy out the length of bits input before padding. */
-! lowInput = cx->lsbInput;
-! highInput = (cx->msbInput << 3) | (lowInput >> 29);
-! lowInput <<= 3;
-!
-! if (inBufIndex < MD5_END_BUFFER) {
-! MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
-! } else {
-! MD5_Update(cx, padbytes,
-! MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
-! }
-!
-! /* Store the number of bytes input (before padding) in final 64 bits. */
-! cx->u.w[14] = lendian(lowInput);
-! cx->u.w[15] = lendian(highInput);
-!
-! /* Final call to compress. */
-! md5_compress(cx);
-!
-! /* Copy the resulting values out of the chain variables into return buf. */
-! *digestLen = MD5_HASH_LEN;
-! #ifndef IS_LITTLE_ENDIAN
-! cx->cv[0] = lendian(cx->cv[0]);
-! cx->cv[1] = lendian(cx->cv[1]);
-! cx->cv[2] = lendian(cx->cv[2]);
-! cx->cv[3] = lendian(cx->cv[3]);
-! #endif
-! memcpy(digest, cx->cv, MD5_HASH_LEN);
-! }
-!
-! unsigned int
-! MD5_FlattenSize(MD5Context *cx)
-! {
-! return sizeof(*cx);
-! }
-!
-! int
-! MD5_Flatten(MD5Context *cx, unsigned char *space)
-! {
-! memcpy(space, cx, sizeof(*cx));
-! return 0;
-! }
-!
-! MD5Context *
-! MD5_Resurrect(unsigned char *space, void *arg)
-! {
-! MD5Context *cx = MD5_NewContext();
-! if (cx)
-! memcpy(cx, space, sizeof(*cx));
-! return cx;
-! }
-!
-! void
-! MD5_TraceState(MD5Context *cx)
-! {
-! // PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
-! }
-!
-! int
-! md5_stream (FILE *stream, unsigned char *dest)
-! {
-! /* Important: BLOCKSIZE must be a multiple of 64. */
-! #define BLOCKSIZE 4096
-! unsigned int len;
-! MD5Context *cx = MD5_NewContext();
-! if (cx == NULL) {
-! // PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-! return -1;
-! }
-!
-! unsigned char buffer[BLOCKSIZE + 72];
-! size_t sum;
-!
-! /* Initialize the computation context. */
-! MD5_Begin(cx);
-!
-! /* Iterate over full file contents. */
-! while (1)
-! {
-! /* We read the file in blocks of BLOCKSIZE bytes. One call of the
-! computation function processes the whole buffer so that with the
-! next round of the loop another block can be read. */
-! size_t n;
-! sum = 0;
-!
-! /* Read block. Take care for partial reads. */
-! do
-! {
-! n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-!
-! sum += n;
-! }
-! while (sum < BLOCKSIZE && n != 0);
-! if (n == 0 && ferror (stream))
-! return 1;
-!
-! /* If end of file is reached, end the loop. */
-! if (n == 0)
-! break;
-!
-! /* Process buffer with BLOCKSIZE bytes. Note that
-! BLOCKSIZE % 64 == 0
-! */
-! MD5_Update(cx, buffer, BLOCKSIZE);
-! }
-!
-! /* Add the last bytes if necessary. */
-! if (sum > 0)
-! MD5_Update(cx, buffer, sum);
-!
-! MD5_End(cx, dest, &len, MD5_HASH_LEN);
-! MD5_DestroyContext(cx, PR_TRUE);
-! return len;
-!
-! }
-!
-! int getMD5sum(const char * fileName,char * sum)
-! {
-! unsigned char bin_sum[16];
-! int len=0;
-! if (fileName)
-! {
-! FILE *fp=fopen(fileName,"rb");
-! if (fp)
-! {
-! len=md5_stream(fp,bin_sum);
-! memset(sum,0,33);
-! for (int i = 0; i < len; ++i)
-! sprintf (sum,"%s%02x",sum, bin_sum[i]);
-! fclose(fp);
-! return 0;
-! }
-! }
-! return 1;
-! }
-!
-! int testMD5sum(const char * fileName,char * sum)
-! {
-! char newSum[33]="";
-! if (getMD5sum(fileName,newSum))
-! return 1;
-! return strcmp(newSum,sum);
-! }
-*** misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp Tue Nov 12 20:19:56 2002
---- misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 266,273 ****
- if (mCardDatabase)
- {
- mCardDatabase->EditCard(this, PR_TRUE);
-! mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-! return NS_OK;
- }
- else
- return NS_ERROR_FAILURE;
---- 266,272 ----
- if (mCardDatabase)
- {
- mCardDatabase->EditCard(this, PR_TRUE);
-! return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
- }
- else
- return NS_ERROR_FAILURE;
-*** misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp Tue Mar 9 15:42:24 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 537,543 ****
- }
- }
- }
-! mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
- }
- return rv;
- }
---- 537,543 ----
- }
- }
- }
-! rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
- }
- return rv;
- }
-***************
-*** 684,689 ****
---- 684,690 ----
- return NS_ERROR_NOT_IMPLEMENTED;
-
- nsresult rv = NS_OK;
-+
- if (!mDatabase)
- rv = GetAbDatabase();
-
-***************
-*** 713,722 ****
- mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE);
- else
- mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
-! mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-
- NS_IF_ADDREF(*addedCard = newCard);
-! return NS_OK;
- }
-
- NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
---- 714,724 ----
- mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE);
- else
- mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
-! rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-
-+ NS_ENSURE_SUCCESS(rv, rv);
- NS_IF_ADDREF(*addedCard = newCard);
-! return rv;
- }
-
- NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
-*** misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp Tue Mar 9 16:18:40 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 97,102 ****
---- 97,103 ----
- {
- index_DisplayName = 0,
- index_EmailAddress,
-+ index_SecondEmailAddress,
- index_FirstName,
- index_LastName,
- index_NickName,
-***************
-*** 124,155 ****
-
- static const ULONG OutlookCardMAPIProps [] =
- {
-! PR_DISPLAY_NAME_W,
-! PR_EMAIL_ADDRESS_W,
-! PR_GIVEN_NAME_W,
-! PR_SURNAME_W,
-! PR_NICKNAME_W,
-! PR_BUSINESS_TELEPHONE_NUMBER_W,
-! PR_HOME_TELEPHONE_NUMBER_W,
-! PR_BUSINESS_FAX_NUMBER_W,
-! PR_PAGER_TELEPHONE_NUMBER_W,
-! PR_MOBILE_TELEPHONE_NUMBER_W,
-! PR_HOME_ADDRESS_CITY_W,
-! PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
-! PR_HOME_ADDRESS_POSTAL_CODE_W,
-! PR_HOME_ADDRESS_COUNTRY_W,
-! PR_BUSINESS_ADDRESS_CITY_W,
-! PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
-! PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
-! PR_BUSINESS_ADDRESS_COUNTRY_W,
-! PR_TITLE_W,
-! PR_DEPARTMENT_NAME_W,
-! PR_COMPANY_NAME_W,
-! PR_BUSINESS_HOME_PAGE_W,
-! PR_PERSONAL_HOME_PAGE_W,
-! PR_COMMENT_W
- } ;
-
- nsresult nsAbOutlookCard::Init(const char *aUri)
- {
- nsresult retCode = nsRDFResource::Init(aUri) ;
---- 125,158 ----
-
- static const ULONG OutlookCardMAPIProps [] =
- {
-! PR_DISPLAY_NAME_A,//0x8035001E
-! PR_EMAIL_ADDRESS_A,//0x8034001E
-! PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
-! PR_GIVEN_NAME_A,
-! PR_SURNAME_A,
-! PR_NICKNAME_A,
-! PR_BUSINESS_TELEPHONE_NUMBER_A,
-! PR_HOME_TELEPHONE_NUMBER_A,
-! PR_BUSINESS_FAX_NUMBER_A,
-! PR_PAGER_TELEPHONE_NUMBER_A,
-! PR_MOBILE_TELEPHONE_NUMBER_A,
-! PR_HOME_ADDRESS_CITY_A,
-! PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
-! PR_HOME_ADDRESS_POSTAL_CODE_A,
-! PR_HOME_ADDRESS_COUNTRY_A,
-! PR_BUSINESS_ADDRESS_CITY_A,
-! PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
-! PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
-! PR_BUSINESS_ADDRESS_COUNTRY_A,
-! PR_TITLE_A,
-! PR_DEPARTMENT_NAME_A,
-! PR_COMPANY_NAME_A,
-! PR_BUSINESS_HOME_PAGE_A,
-! PR_PERSONAL_HOME_PAGE_A,
-! PR_COMMENT_A
- } ;
-
-+
- nsresult nsAbOutlookCard::Init(const char *aUri)
- {
- nsresult retCode = nsRDFResource::Init(aUri) ;
-***************
-*** 176,181 ****
---- 179,185 ----
- SetDisplayName(unichars [index_DisplayName]->get()) ;
- SetNickName(unichars [index_NickName]->get()) ;
- SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
-+ SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
- SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
- SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
- SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
-***************
-*** 210,221 ****
- nsAutoString unichar ;
- nsAutoString unicharBis ;
-
-! if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
- splitString(unichar, unicharBis) ;
- SetHomeAddress(unichar.get()) ;
- SetHomeAddress2(unicharBis.get()) ;
- }
-! if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
- splitString(unichar, unicharBis) ;
- SetWorkAddress(unichar.get()) ;
- SetWorkAddress2(unicharBis.get()) ;
---- 214,225 ----
- nsAutoString unichar ;
- nsAutoString unicharBis ;
-
-! if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
- splitString(unichar, unicharBis) ;
- SetHomeAddress(unichar.get()) ;
- SetHomeAddress2(unicharBis.get()) ;
- }
-! if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
- splitString(unichar, unicharBis) ;
- SetWorkAddress(unichar.get()) ;
- SetWorkAddress2(unicharBis.get()) ;
-***************
-*** 297,302 ****
---- 301,307 ----
- SetDisplayName(properties [index_DisplayName]) ;
- GetNickName(getter_Copies(properties [index_NickName])) ;
- GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
-+ GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
- GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
- GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
- GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
-***************
-*** 316,324 ****
- GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
- GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
- GetNotes(getter_Copies(properties [index_Comments])) ;
-! if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
-! index_LastProp, properties)) {
-! PRINTF(("Cannot set general properties.\n")) ;
- }
- delete [] properties ;
- nsXPIDLString unichar ;
---- 321,336 ----
- GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
- GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
- GetNotes(getter_Copies(properties [index_Comments])) ;
-!
-! int i=0;
-! for (i=0;i<index_LastProp;i++)
-! {
-! if (!mapiAddBook->SetPropertyUString(*mMapiData,
-! OutlookCardMAPIProps[i],
-! properties[i]))
-! {
-! PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
-! }
- }
- delete [] properties ;
- nsXPIDLString unichar ;
-*** misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp Tue Feb 25 22:36:33 2003
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 124,131 ****
- nsCAutoString uri ;
- nsCOMPtr<nsIRDFResource> resource ;
-
-! for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
-! folders.mEntries [i].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
- uri.Append(entryId) ;
-
---- 124,131 ----
- nsCAutoString uri ;
- nsCOMPtr<nsIRDFResource> resource ;
-
-! for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
-! folders[i].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
- uri.Append(entryId) ;
-
-*** misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp Thu Feb 5 19:33:06 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 126,132 ****
- PRINTF(("Cannot get type.\n")) ;
- return NS_ERROR_FAILURE ;
- }
-! if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
- PRINTF(("Cannot get name.\n")) ;
- return NS_ERROR_FAILURE ;
- }
---- 126,132 ----
- PRINTF(("Cannot get type.\n")) ;
- return NS_ERROR_FAILURE ;
- }
-! if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
- PRINTF(("Cannot get name.\n")) ;
- return NS_ERROR_FAILURE ;
- }
-***************
-*** 163,207 ****
- return retCode;
- }
-
- NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
- {
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsCOMPtr<nsISupportsArray> cardList ;
- nsresult retCode ;
-
-- mCardList.Reset() ;
- if (mIsQueryURI) {
- retCode = StartSearch() ;
-- NS_NewISupportsArray(getter_AddRefs(cardList)) ;
- }
- else {
-! retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
- }
- if (NS_SUCCEEDED(retCode)) {
- // Fill the results array and update the card list
- // Also update the address list and notify any changes.
- PRUint32 nbCards = 0 ;
-! nsCOMPtr<nsISupports> element ;
-
-- cardList->Enumerate(aCards) ;
-- cardList->Count(&nbCards) ;
- for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
-! cardList->GetElementAt(i, getter_AddRefs(element)) ;
-! nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
-! nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
-
-! if (!oldElement) {
- // We are dealing with a new element (probably directly
- // added from Outlook), we may need to sync m_AddressList
-! mCardList.Put(&newKey, element) ;
-! nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- PRBool isMailList = PR_FALSE ;
-
- retCode = card->GetIsMailList(&isMailList) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- if (isMailList) {
- // We can have mailing lists only in folder,
- // we must add the directory to m_AddressList
---- 163,247 ----
- return retCode;
- }
-
-+ nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
-+ PRBool aSearchForOld, PRBool& aIsNewCard)
-+ {
-+ nsresult retCode = NS_OK ;
-+ if (aSearchForOld) {
-+ nsCStringKey key(uriName) ;
-+ nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
-+
-+ if (existingCard) {
-+ nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
-+
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ NS_IF_ADDREF(*aNewCard = card) ;
-+ aIsNewCard = PR_FALSE ;
-+ return retCode ;
-+ }
-+ }
-+ aIsNewCard = PR_TRUE ;
-+ nsCOMPtr<nsIRDFResource> resource ;
-+
-+ nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ resource = do_QueryInterface(childCard, &retCode) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ retCode = resource->Init(uriName.get()) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ NS_IF_ADDREF(*aNewCard = childCard);
-+ return retCode ;
-+ }
-+
- NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
- {
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsCOMPtr<nsISupportsArray> cardList ;
-+ nsCStringArray uriList ;
-+ nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
- nsresult retCode ;
-
- if (mIsQueryURI) {
- retCode = StartSearch() ;
- }
- else {
-! retCode = GetChildCards(uriList, nsnull) ;
- }
-+ NS_NewISupportsArray(getter_AddRefs(cardList)) ;
- if (NS_SUCCEEDED(retCode)) {
- // Fill the results array and update the card list
- // Also update the address list and notify any changes.
- PRUint32 nbCards = 0 ;
-! nsCAutoString uriName;
-! nsCOMPtr <nsIAbCard> childCard;
-! PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
-!
-! nbCards = uriList.Count();
-! NS_NewISupportsArray(getter_AddRefs(m_AddressList));
-
- for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
-! PRBool isNewCard = PR_FALSE ;
-
-! uriList.CStringAt(i,uriName);
-! retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! cardList->AppendElement(childCard);
-!
-! if (isNewCard) {
- // We are dealing with a new element (probably directly
- // added from Outlook), we may need to sync m_AddressList
-! nsCStringKey newKey(uriName) ;
-!
-! mCardList.Put(&newKey, childCard) ;
-! nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- PRBool isMailList = PR_FALSE ;
-
- retCode = card->GetIsMailList(&isMailList) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
- if (isMailList) {
- // We can have mailing lists only in folder,
- // we must add the directory to m_AddressList
-***************
-*** 224,241 ****
- NotifyItemAddition(card) ;
- }
- }
-- else {
-- NS_ASSERTION(oldElement == element, "Different card stored") ;
- }
- }
- }
- return retCode ;
- }
-
- NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
- {
- if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
-! nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
-
- *aHasCard = mCardList.Exists(&key) ;
- return NS_OK ;
---- 264,296 ----
- NotifyItemAddition(card) ;
- }
- }
- }
- }
-+ return cardList->Enumerate(aCards) ;
- }
-+
-+ static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
-+ nsresult retCode = NS_OK ;
-+ nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
-+
-+ // Receiving a non-RDF card is accepted
-+ if (NS_FAILED(retCode)) { return NS_OK ; }
-+ nsXPIDLCString uri ;
-+
-+ retCode = resource->GetValue(getter_Copies(uri)) ;
-+ NS_ENSURE_SUCCESS(retCode, retCode) ;
-+ aUri = uri.get() ;
- return retCode ;
- }
-
- NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
- {
- if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
-! *aHasCard = PR_FALSE ;
-! nsCString uri ;
-!
-! ExtractUriFromCard(aCard, uri) ;
-! nsCStringKey key(uri) ;
-
- *aHasCard = mCardList.Exists(&key) ;
- return NS_OK ;
-***************
-*** 317,323 ****
- PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
- }
- else {
-! nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
-
- mCardList.Remove(&key) ;
- if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
---- 372,381 ----
- PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
- }
- else {
-! nsCString uri ;
-!
-! ExtractUriFromCard(card, uri) ;
-! nsCStringKey key(uri) ;
-
- mCardList.Remove(&key) ;
- if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
-***************
-*** 386,392 ****
- }
- retCode = CreateCard(aData, addedCard) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
-
- mCardList.Put(&newKey, *addedCard) ;
- if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
---- 444,453 ----
- }
- retCode = CreateCard(aData, addedCard) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! nsCString uri ;
-!
-! ExtractUriFromCard(*addedCard, uri) ;
-! nsCStringKey newKey(uri) ;
-
- mCardList.Put(&newKey, *addedCard) ;
- if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
-***************
-*** 457,463 ****
- if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
- retCode = GetDirName(getter_Copies(name)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
- return NS_ERROR_FAILURE ;
- }
- retCode = CommitAddressList() ;
---- 518,524 ----
- if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
- retCode = GetDirName(getter_Copies(name)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
- return NS_ERROR_FAILURE ;
- }
- retCode = CommitAddressList() ;
-***************
-*** 518,523 ****
---- 579,585 ----
- {"DisplayName", PR_DISPLAY_NAME_A},
- {"NickName", PR_NICKNAME_A},
- {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
-+ {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
- {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
- {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
- {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
-***************
-*** 1032,1038 ****
-
- nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
- {
-! nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
- nsresult retCode = NS_OK ;
-
- mCardList.Put(&newKey, aCard) ;
---- 1094,1103 ----
-
- nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
- {
-! nsCString uri ;
-!
-! ExtractUriFromCard(aCard, uri) ;
-! nsCStringKey newKey(uri) ;
- nsresult retCode = NS_OK ;
-
- mCardList.Put(&newKey, aCard) ;
-***************
-*** 1056,1069 ****
- retCode = BuildRestriction(aArguments, arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsISupportsArray> resultsArray ;
- PRUint32 nbResults = 0 ;
-
-! retCode = GetChildCards(getter_AddRefs(resultsArray),
- arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
- DestroyRestriction(arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! retCode = resultsArray->Count(&nbResults) ;
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIAbDirectoryQueryResult> result ;
- nsAbDirectoryQueryResult *newResult = nsnull ;
-
---- 1121,1134 ----
- retCode = BuildRestriction(aArguments, arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsISupportsArray> resultsArray ;
-+ nsCStringArray uriArray ;
- PRUint32 nbResults = 0 ;
-
-! retCode = GetChildCards(uriArray,
- arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
- DestroyRestriction(arguments) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-! nbResults = uriArray.Count() ;
- nsCOMPtr<nsIAbDirectoryQueryResult> result ;
- nsAbDirectoryQueryResult *newResult = nsnull ;
-
-***************
-*** 1071,1085 ****
- nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
- }
- PRUint32 i = 0 ;
-- nsCOMPtr<nsISupports> element ;
- nsCOMPtr<nsISupportsArray> propertyValues ;
-
- for (i = 0 ; i < nbResults ; ++ i) {
-! retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
- newResult = new nsAbDirectoryQueryResult(0, aArguments,
- nsIAbDirectoryQueryResult::queryResultMatch,
---- 1136,1153 ----
- nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
- }
- PRUint32 i = 0 ;
- nsCOMPtr<nsISupportsArray> propertyValues ;
-
-+ nsCAutoString uriName;
-+ nsCOMPtr <nsIAbCard> card;
-+
- for (i = 0 ; i < nbResults ; ++ i) {
-! PRBool isNewCard = PR_FALSE ;
-
-+ uriArray.CStringAt(i,uriName);
-+ retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-+
- FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
- newResult = new nsAbDirectoryQueryResult(0, aArguments,
- nsIAbDirectoryQueryResult::queryResultMatch,
-***************
-*** 1104,1116 ****
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsresult retCode = NS_OK ;
-! nsCOMPtr<nsISupportsArray> cards ;
- nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
- nsMapiEntryArray cardEntries ;
- LPSRestriction restriction = (LPSRestriction) aRestriction ;
-
- if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
-- retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
- PRINTF(("Cannot get cards.\n")) ;
---- 1172,1214 ----
- if (!aCards) { return NS_ERROR_NULL_POINTER ; }
- *aCards = nsnull ;
- nsresult retCode = NS_OK ;
-!
-! nsCOMPtr<nsISupportsArray> cards;
-! retCode = NS_NewISupportsArray(getter_AddRefs(cards));
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-!
-! nsCStringArray uriList;
-! retCode = GetChildCards(uriList,aRestriction);
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-!
-! nsCAutoString uriName;
-! nsCOMPtr <nsIAbCard> childCard;
-! PRUint32 nbURIs = 0 ;
-! nbURIs = uriList.Count();
-! PRUint32 i = 0 ;
-!
-! for (i = 0 ; i < nbURIs ; ++ i) {
-! PRBool isNewCard = PR_FALSE ;
-!
-! uriList.CStringAt(i,uriName);
-! retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! cards->AppendElement(childCard);
-! }
-!
-! NS_IF_ADDREF(*aCards = cards);
-! return retCode ;
-! }
-!
-! nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
-! void *aRestriction)
-! {
-! nsresult retCode = NS_OK ;
- nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
- nsMapiEntryArray cardEntries ;
- LPSRestriction restriction = (LPSRestriction) aRestriction ;
-
- if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
- PRINTF(("Cannot get cards.\n")) ;
-***************
-*** 1119,1140 ****
- nsCAutoString entryId ;
- nsCAutoString uriName ;
- nsCOMPtr<nsIRDFResource> resource ;
-! nsCOMPtr <nsIAbCard> childCard;
-!
-! for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
-! cardEntries.mEntries [card].ToString(entryId) ;
- buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
-! childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! resource = do_QueryInterface(childCard, &retCode) ;
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! retCode = resource->Init(uriName.get()) ;
-! NS_ENSURE_SUCCESS(retCode, retCode) ;
-! cards->AppendElement(childCard) ;
- }
-- *aCards = cards ;
-- NS_ADDREF(*aCards) ;
- return retCode ;
- }
-
---- 1217,1230 ----
- nsCAutoString entryId ;
- nsCAutoString uriName ;
- nsCOMPtr<nsIRDFResource> resource ;
-! aURI.Clear();
-!
-! for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
-! cardEntries [card].ToString(entryId) ;
- buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
-! aURI.AppendCString(uriName);
- }
- return retCode ;
- }
-
-***************
-*** 1158,1165 ****
- nsCAutoString uriName ;
- nsCOMPtr <nsIRDFResource> resource ;
-
-! for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
-! nodeEntries.mEntries [node].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
- retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
---- 1248,1255 ----
- nsCAutoString uriName ;
- nsCOMPtr <nsIRDFResource> resource ;
-
-! for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
-! nodeEntries [node].ToString(entryId) ;
- buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
- uriName.Append(entryId) ;
- retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
-***************
-*** 1280,1286 ****
- // In the case of a mailing list, we cannot directly create a new card,
- // we have to create a temporary one in a real folder (to be able to use
- // templates) and then copy it to the mailing list.
-! if (m_IsMailList) {
- nsMapiEntry parentEntry ;
- nsMapiEntry temporaryEntry ;
-
---- 1370,1376 ----
- // In the case of a mailing list, we cannot directly create a new card,
- // we have to create a temporary one in a real folder (to be able to use
- // templates) and then copy it to the mailing list.
-! if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
- nsMapiEntry parentEntry ;
- nsMapiEntry temporaryEntry ;
-
-*** misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h Thu Feb 5 19:33:06 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h Tue Jan 15 13:34:34 2008
-***************
-*** 46,51 ****
---- 46,52 ----
- #include "nsHashtable.h"
-
- #include "nsISupportsArray.h"
-+ #include "nsVoidArray.h"
-
- struct nsMapiEntry ;
-
-***************
-*** 92,97 ****
---- 93,100 ----
- protected:
- // Retrieve hierarchy as cards, with an optional restriction
- nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
-+ // Retrieve hierarchy as URIs, with an optional restriction
-+ nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
- // Retrieve hierarchy as directories
- nsresult GetChildNodes(nsISupportsArray **aNodes) ;
- // Create a new card
-***************
-*** 103,108 ****
---- 106,114 ----
- nsresult CommitAddressList(void) ;
- // Read MAPI repository
- nsresult UpdateAddressList(void) ;
-+ // Search for an existing card or build a new one
-+ nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
-+ PRBool aSearchForOld, PRBool& aIsNewCard) ;
-
- nsMapiEntry *mMapiData ;
- // Container for the query threads
-*** misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp Wed Apr 14 22:16:12 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 41,46 ****
---- 41,49 ----
- #define USES_IID_IABContainer
- #define USES_IID_IMAPITable
- #define USES_IID_IDistList
-+ #define USES_IID_IMsgStore
-+ #define USES_IID_IMessage
-+ #define USES_IID_IMAPIFolder
-
- #include "nsAbWinHelper.h"
- #include "nsAbUtils.h"
-***************
-*** 59,77 ****
-
- #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
-
-- // Small utility to ensure release of all MAPI interfaces
-- template <class tInterface> struct nsMapiInterfaceWrapper
-- {
-- tInterface mInterface ;
--
-- nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-- ~nsMapiInterfaceWrapper(void) {
-- if (mInterface != NULL) { mInterface->Release() ; }
-- }
-- operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-- tInterface operator -> (void) const { return mInterface ; }
-- operator tInterface *(void) { return &mInterface ; }
-- } ;
-
- static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
- {
---- 62,67 ----
-***************
-*** 249,272 ****
- MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
-
- nsMapiEntryArray::nsMapiEntryArray(void)
-- : mEntries(NULL), mNbEntries(0)
- {
- MOZ_COUNT_CTOR(nsMapiEntryArray) ;
- }
-
- nsMapiEntryArray::~nsMapiEntryArray(void)
- {
-! if (mEntries) { delete [] mEntries ; }
- MOZ_COUNT_DTOR(nsMapiEntryArray) ;
- }
-!
- void nsMapiEntryArray::CleanUp(void)
- {
-! if (mEntries != NULL) {
-! delete [] mEntries ;
-! mEntries = NULL ;
-! mNbEntries = 0 ;
- }
- }
-
- MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
---- 239,266 ----
- MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
-
- nsMapiEntryArray::nsMapiEntryArray(void)
- {
- MOZ_COUNT_CTOR(nsMapiEntryArray) ;
- }
-
- nsMapiEntryArray::~nsMapiEntryArray(void)
- {
-! CleanUp();
- MOZ_COUNT_DTOR(nsMapiEntryArray) ;
- }
-! void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
-! {
-! m_array.AppendElement(aEntries);
-! }
- void nsMapiEntryArray::CleanUp(void)
- {
-! nsMapiEntry *pEntries;
-! for (int i = 0; i < m_array.Count(); i++)
-! {
-! pEntries = (nsMapiEntry *)m_array.ElementAt( i);
-! delete pEntries;
- }
-+ m_array.Clear();
- }
-
- MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
-***************
-*** 280,379 ****
- // same protection (MAPI is supposed to be thread-safe).
- PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
-
- nsAbWinHelper::nsAbWinHelper(void)
-! : mAddressBook(NULL), mLastError(S_OK)
- {
- MOZ_COUNT_CTOR(nsAbWinHelper) ;
- }
-
- nsAbWinHelper::~nsAbWinHelper(void)
- {
- MOZ_COUNT_DTOR(nsAbWinHelper) ;
-! }
-!
-! BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
- {
-! aFolders.CleanUp() ;
-! nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-! nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-! ULONG objType = 0 ;
-! ULONG rowCount = 0 ;
-! SRestriction restriction ;
-! SPropTagArray folderColumns ;
-!
-! mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
-! rootFolder) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot open root %08x.\n", mLastError)) ;
-! return FALSE ;
- }
-- mLastError = rootFolder->GetHierarchyTable(0, folders) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
-- return FALSE ;
- }
-! // We only take into account modifiable containers,
-! // otherwise, we end up with all the directory services...
-! restriction.rt = RES_BITMASK ;
-! restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-! restriction.res.resBitMask.relBMR = BMR_NEZ ;
-! restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-! mLastError = folders->Restrict(&restriction, 0) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-! }
-! folderColumns.cValues = 1 ;
-! folderColumns.aulPropTag [0] = PR_ENTRYID ;
-! mLastError = folders->SetColumns(&folderColumns, 0) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! mLastError = folders->GetRowCount(0, &rowCount) ;
-! if (HR_SUCCEEDED(mLastError)) {
-! aFolders.mEntries = new nsMapiEntry [rowCount] ;
-! aFolders.mNbEntries = 0 ;
-! do {
-! LPSRowSet rowSet = NULL ;
-!
-! rowCount = 0 ;
-! mLastError = folders->QueryRows(1, 0, &rowSet) ;
-! if (HR_SUCCEEDED(mLastError)) {
-! rowCount = rowSet->cRows ;
-! if (rowCount > 0) {
-! nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
-! SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
-!
-! current.Assign(currentValue.Value.bin.cb,
-! NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-! }
-! MyFreeProws(rowSet) ;
-! }
-! else {
-! PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-! }
-! } while (rowCount > 0) ;
-! }
-! return HR_SUCCEEDED(mLastError) ;
-! }
-
- BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards)
- {
- aCards.CleanUp() ;
-! return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
- }
-
- BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
- {
- aNodes.CleanUp() ;
-! return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
- }
-
- BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
- {
-! aNbCards = 0 ;
-! return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
- }
-
- BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
---- 274,328 ----
- // same protection (MAPI is supposed to be thread-safe).
- PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
-
-+ int nsAbWinHelper::m_clients = 0;
-+
-+ PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
-+ int nsAbWinHelper::m_uniBuffLen = 0;
-+ char * nsAbWinHelper::m_pCStrBuff = NULL;
-+ int nsAbWinHelper::m_cstrBuffLen = 0;
-+
- nsAbWinHelper::nsAbWinHelper(void)
-! :mLastError(S_OK)
- {
- MOZ_COUNT_CTOR(nsAbWinHelper) ;
-+ m_clients++;
- }
-
- nsAbWinHelper::~nsAbWinHelper(void)
- {
- MOZ_COUNT_DTOR(nsAbWinHelper) ;
-! m_clients--;
-! if (!m_clients)
- {
-! delete [] m_pUniBuff;
-! m_pUniBuff = NULL;
-! m_uniBuffLen = 0;
-! delete [] m_pCStrBuff;
-! m_pCStrBuff = NULL;
-! m_cstrBuffLen = 0;
- }
- }
-!
-
- BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards)
- {
- aCards.CleanUp() ;
-! return GetContents(aParent, aRestriction, &aCards, 0) ;
- }
-
- BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
- {
- aNodes.CleanUp() ;
-! return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
- }
-
- BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
- {
-! nsMapiEntryArray aCards;
-! BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
-! aNbCards=aCards.GetSize();
-! return ret;
- }
-
- BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
-***************
-*** 390,396 ****
- aName = values->Value.lpszA ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
-! aName.AssignWithConversion(values->Value.lpszW) ;
- }
- }
- FreeBuffer(values) ;
---- 339,345 ----
- aName = values->Value.lpszA ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
-! UnicodeToCStr(values->Value.lpszW,aName) ;
- }
- }
- FreeBuffer(values) ;
-***************
-*** 410,416 ****
- aName = values->Value.lpszW ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
-! aName.AssignWithConversion(values->Value.lpszA) ;
- }
- }
- FreeBuffer(values) ;
---- 359,365 ----
- aName = values->Value.lpszW ;
- }
- else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
-! CStrToUnicode(values->Value.lpszA,aName) ;
- }
- }
- FreeBuffer(values) ;
-***************
-*** 431,446 ****
- ULONG i = 0 ;
-
- for (i = 0 ; i < valueCount ; ++ i) {
-! if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
- if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
- nsAutoString temp ;
-
-! temp.AssignWithConversion (values [i].Value.lpszA) ;
- aNames.AppendString(temp) ;
- }
- else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
- aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
- }
- else {
- aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
- }
---- 380,401 ----
- ULONG i = 0 ;
-
- for (i = 0 ; i < valueCount ; ++ i) {
-! if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
- if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
- nsAutoString temp ;
-
-! CStrToUnicode(values [i].Value.lpszA,temp) ;
- aNames.AppendString(temp) ;
- }
- else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
- aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
- }
-+ else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
-+ nsAutoString temp ;
-+
-+ CStrToUnicode (values [i].Value.lpszA,temp) ;
-+ aNames.AppendString(temp) ;
-+ }
- else {
- aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
- }
-***************
-*** 466,472 ****
- if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
- if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
- SYSTEMTIME readableTime ;
--
- if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
- aYear = readableTime.wYear ;
- aMonth = readableTime.wMonth ;
---- 421,426 ----
-***************
-*** 518,524 ****
- nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
- ULONG objType = 0 ;
-
-! mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IMAPIContainer, 0, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
---- 472,478 ----
- nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
- ULONG objType = 0 ;
-
-! mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IMAPIContainer, 0, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-***************
-*** 537,543 ****
- SBinary entry ;
- SBinaryArray entryArray ;
-
-! mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
---- 491,497 ----
- SBinary entry ;
- SBinaryArray entryArray ;
-
-! mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-***************
-*** 567,580 ****
- value.Value.lpszW = NS_CONST_CAST(WORD *, aValue) ;
- }
- else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
-! alternativeValue.AssignWithConversion(aValue) ;
- value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
- }
- else {
- PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
- return TRUE ;
- }
-! return SetMAPIProperties(aObject, 1, &value) ;
- }
-
- BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
---- 521,535 ----
- value.Value.lpszW = NS_CONST_CAST(WORD *, aValue) ;
- }
- else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
-! UnicodeToCStr(aValue,alternativeValue) ;
- value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
- }
- else {
- PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
- return TRUE ;
- }
-! LPSPropValue values=&value;
-! return SetMAPIProperties(aObject, 1, values) ;
- }
-
- BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-***************
-*** 595,601 ****
- values [currentValue ++].Value.lpszW = NS_CONST_CAST(WORD *, aValues [i].get()) ;
- }
- else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
-! alternativeValue.AssignWithConversion(aValues [i].get()) ;
- char *av = nsCRT::strdup(alternativeValue.get()) ;
- if (!av) {
- retCode = FALSE ;
---- 550,556 ----
- values [currentValue ++].Value.lpszW = NS_CONST_CAST(WORD *, aValues [i].get()) ;
- }
- else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
-! UnicodeToCStr(aValues [i].get(),alternativeValue) ;
- char *av = nsCRT::strdup(alternativeValue.get()) ;
- if (!av) {
- retCode = FALSE ;
-***************
-*** 633,639 ****
- readableTime.wSecond = 0 ;
- readableTime.wMilliseconds = 0 ;
- if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
-! return SetMAPIProperties(aObject, 1, &value) ;
- }
- return TRUE ;
- }
---- 588,595 ----
- readableTime.wSecond = 0 ;
- readableTime.wMilliseconds = 0 ;
- if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
-! LPSPropValue values=&value;
-! return SetMAPIProperties(aObject, 1, values) ;
- }
- return TRUE ;
- }
-***************
-*** 645,651 ****
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
---- 601,607 ----
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-***************
-*** 708,714 ****
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
---- 664,670 ----
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-***************
-*** 773,779 ****
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
---- 729,735 ----
- nsMapiInterfaceWrapper<LPABCONT> container ;
- ULONG objType = 0 ;
-
-! mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
- &IID_IABContainer, MAPI_MODIFY, &objType,
- container) ;
- if (HR_FAILED(mLastError)) {
-***************
-*** 810,1003 ****
- return TRUE ;
- }
-
-- BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
-- {
-- LPENTRYID entryId = NULL ;
-- ULONG byteCount = 0 ;
--
-- mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
-- if (HR_FAILED(mLastError)) {
-- PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
-- return FALSE ;
-- }
-- aContainer.Assign(byteCount, entryId) ;
-- FreeBuffer(entryId) ;
-- return TRUE ;
-- }
-
-- enum
-- {
-- ContentsColumnEntryId = 0,
-- ContentsColumnObjectType,
-- ContentsColumnsSize
-- } ;
-
-- static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-- {
-- ContentsColumnsSize,
-- {
-- PR_ENTRYID,
-- PR_OBJECT_TYPE
-- }
-- } ;
-
-! BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-! nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
- {
-! if (aList != NULL) { *aList = NULL ; }
-! aNbElements = 0 ;
-! nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-! nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-! ULONG objType = 0 ;
-! ULONG rowCount = 0 ;
-
-! mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-! &IID_IMAPIContainer, 0, &objType,
-! parent) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! // Here, flags for WAB and MAPI could be different, so this works
-! // only as long as we don't want to use any flag in GetContentsTable
-! mLastError = parent->GetContentsTable(0, contents) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-! return FALSE ;
- }
-! if (aRestriction != NULL) {
-! mLastError = contents->Restrict(aRestriction, 0) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! }
-! mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! mLastError = contents->GetRowCount(0, &rowCount) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
-! aNbElements = 0 ;
-! do {
-! LPSRowSet rowSet = NULL ;
-!
-! rowCount = 0 ;
-! mLastError = contents->QueryRows(1, 0, &rowSet) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! rowCount = rowSet->cRows ;
-! if (rowCount > 0 &&
-! (aMapiType == 0 ||
-! rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
-! if (aList != NULL) {
-! nsMapiEntry& current = (*aList) [aNbElements] ;
-! SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-!
-! current.Assign(currentValue.Value.bin.cb,
-! NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
- }
-! ++ aNbElements ;
- }
-- MyFreeProws(rowSet) ;
-- } while (rowCount > 0) ;
-- return TRUE ;
- }
-!
-! BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-! ULONG aNbProperties, LPSPropValue& aValue,
-! ULONG& aValueCount)
- {
-! nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-! ULONG objType = 0 ;
-! LPSPropTagArray properties = NULL ;
-! ULONG i = 0 ;
-!
-! mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-! &IID_IMAPIProp, 0, &objType,
-! object) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-! return FALSE ;
- }
-! AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-! NS_REINTERPRET_CAST(void **, &properties)) ;
-! properties->cValues = aNbProperties ;
-! for (i = 0 ; i < aNbProperties ; ++ i) {
-! properties->aulPropTag [i] = aPropertyTags [i] ;
-! }
-! mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
-! FreeBuffer(properties) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot get props %08x.\n", mLastError)) ;
- }
-- return HR_SUCCEEDED(mLastError) ;
- }
-
-! BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-! const LPSPropValue& aValues)
-! {
-! nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-! ULONG objType = 0 ;
-! LPSPropProblemArray problems = NULL ;
-
-! mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-! &IID_IMAPIProp, MAPI_MODIFY, &objType,
-! object) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-! return FALSE ;
-! }
-! if (problems != NULL) {
-! for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-! PRINTF(("Problem %d: index %d code %08x.\n", i,
-! problems->aProblem [i].ulIndex,
-! problems->aProblem [i].scode)) ;
-! }
-! }
-! mLastError = object->SaveChanges(0) ;
-! if (HR_FAILED(mLastError)) {
-! PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-! }
-! return HR_SUCCEEDED(mLastError) ;
- }
-
-! void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
-! {
-! if (aRowset == NULL) { return ; }
-! ULONG i = 0 ;
-
-! for (i = 0 ; i < aRowset->cRows ; ++ i) {
-! FreeBuffer(aRowset->aRow [i].lpProps) ;
-! }
-! FreeBuffer(aRowset) ;
- }
-
- nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
- : mHelper(NULL)
- {
- switch(aType) {
-! case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
-! case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
- default: break ;
- }
- }
-
- nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
- {
-- delete mHelper ;
- }
-
- const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
---- 766,842 ----
- return TRUE ;
- }
-
-
-
-
-! void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
- {
-! if (aRowset == NULL) { return ; }
-! ULONG i = 0 ;
-
-! for (i = 0 ; i < aRowset->cRows ; ++ i) {
-! FreeBuffer(aRowset->aRow [i].lpProps) ;
- }
-! FreeBuffer(aRowset) ;
-! }
-! void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
-! {
-! result.Truncate( 0);
-! int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
-! if (wLen >= m_uniBuffLen)
-! {
-! delete [] m_pUniBuff;
-! m_pUniBuff = new PRUnichar[wLen + 64];
-! m_uniBuffLen = wLen + 64;
- }
-! if (wLen)
-! {
-! MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
-! result = m_pUniBuff;
- }
- }
-! void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
- {
-! result.Truncate( 0);
-! int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
-! if (cLen >= m_cstrBuffLen) {
-! if (m_pCStrBuff)
-! delete [] m_pCStrBuff;
-! m_pCStrBuff = new char[cLen + 64];
-! m_cstrBuffLen = cLen + 64;
- }
-! if (cLen) {
-! WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
-! result = m_pCStrBuff;
- }
- }
-
-! static nsAbWinHelper *getOutlookAddressBook(void) {
-! static nsMapiAddressBook *addressBook = NULL ;
-
-! if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
-! return addressBook ;
- }
-
-! static nsAbWinHelper *getOutlookExpAddressBook(void) {
-! static nsWabAddressBook *addressBook = NULL ;
-
-! if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
-! return addressBook ;
- }
-
- nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
- : mHelper(NULL)
- {
- switch(aType) {
-! case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
-! case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
- default: break ;
- }
- }
-
- nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
- {
- }
-
- const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
-*** misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h Wed Apr 14 22:16:12 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h Tue Jan 15 13:34:34 2008
-***************
-*** 45,50 ****
---- 45,68 ----
- #include "nsVoidArray.h"
- #include "nsXPIDLString.h"
-
-+ #define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
-+ #define PR_SCREEN_NAME_A 0x805B001E
-+
-+
-+ // Small utility to ensure release of all MAPI interfaces
-+ template <class tInterface> struct nsMapiInterfaceWrapper
-+ {
-+ tInterface mInterface ;
-+
-+ nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-+ ~nsMapiInterfaceWrapper(void) {
-+ if (mInterface ) { mInterface->Release() ; }
-+ }
-+ operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-+ tInterface operator -> (void) const { return mInterface ; }
-+ operator tInterface *(void) { return &mInterface ; }
-+ } ;
-+
- struct nsMapiEntry
- {
- ULONG mByteCount ;
-***************
-*** 62,75 ****
-
- struct nsMapiEntryArray
- {
-- nsMapiEntry *mEntries ;
-- ULONG mNbEntries ;
-
- nsMapiEntryArray(void) ;
- ~nsMapiEntryArray(void) ;
-
-! const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
- void CleanUp(void) ;
- } ;
-
- class nsAbWinHelper
---- 80,107 ----
-
- struct nsMapiEntryArray
- {
-
- nsMapiEntryArray(void) ;
- ~nsMapiEntryArray(void) ;
-
-! void AddItem(nsMapiEntry * aEntries);
-! void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
-! {
-! nsMapiEntry * aEntries=new nsMapiEntry();
-! aEntries->Assign(mByteCount,mEntryId);
-! AddItem(aEntries);
-! }
-!
-! ULONG GetSize( void) { return( m_array.Count());}
-! nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
-! nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
- void CleanUp(void) ;
-+ void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
-+ void Remove(int index){ m_array.RemoveElementAt(index); }
-+ ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
-+ private:
-+ nsVoidArray m_array;
-+
- } ;
-
- class nsAbWinHelper
-***************
-*** 79,85 ****
- virtual ~nsAbWinHelper(void) ;
-
- // Get the top address books
-! BOOL GetFolders(nsMapiEntryArray& aFolders) ;
- // Get a list of entries for cards/mailing lists in a folder/mailing list
- BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards) ;
---- 111,117 ----
- virtual ~nsAbWinHelper(void) ;
-
- // Get the top address books
-! virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
- // Get a list of entries for cards/mailing lists in a folder/mailing list
- BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
- nsMapiEntryArray& aCards) ;
-***************
-*** 97,114 ****
- BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
- ULONG aNbProperties, nsStringArray& aValues) ;
- // Get the value of a MAPI property of type SYSTIME
-! BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD& aYear, WORD& aMonth, WORD& aDay) ;
-- // Get the value of a MAPI property of type LONG
-- BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
- // Get the value of a MAPI property of type BIN
- BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
- // Tests if a container contains an entry
- BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-- // Delete an entry in the address book
-- BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
- // Set the value of a MAPI property of type string in unicode
-! BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
- const PRUnichar *aValue) ;
- // Same as previous, but with a bunch of properties in one call
- BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
---- 129,142 ----
- BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
- ULONG aNbProperties, nsStringArray& aValues) ;
- // Get the value of a MAPI property of type SYSTIME
-! virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD& aYear, WORD& aMonth, WORD& aDay) ;
- // Get the value of a MAPI property of type BIN
- BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
- // Tests if a container contains an entry
- BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
- // Set the value of a MAPI property of type string in unicode
-! virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
- const PRUnichar *aValue) ;
- // Same as previous, but with a bunch of properties in one call
- BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-***************
-*** 117,148 ****
- BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD aYear, WORD aMonth, WORD aDay) ;
- // Create entry in the address book
-! BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
- // Create a distribution list in the address book
-! BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
- // Copy an existing entry in the address book
-! BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
- // Get a default address book container
-! BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
- // Is the helper correctly initialised?
-! BOOL IsOK(void) const { return mAddressBook != NULL ; }
-
- protected:
- HRESULT mLastError ;
-- LPADRBOOK mAddressBook ;
- static PRUint32 mEntryCounter ;
- static PRLock *mMutex ;
-
- // Retrieve the contents of a container, with an optional restriction
-! BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-! nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
- // Retrieve the values of a set of properties on a MAPI object
-! BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
- ULONG aNbProperties,
-! LPSPropValue& aValues, ULONG& aValueCount) ;
- // Set the values of a set of properties on a MAPI object
-! BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-! const LPSPropValue& aValues) ;
- // Clean-up a rowset returned by QueryRows
- void MyFreeProws(LPSRowSet aSet) ;
- // Allocation of a buffer for transmission to interfaces
---- 145,188 ----
- BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
- WORD aYear, WORD aMonth, WORD aDay) ;
- // Create entry in the address book
-! virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-! // Delete an entry in the address book
-! virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
- // Create a distribution list in the address book
-! virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
- // Copy an existing entry in the address book
-! virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
- // Get a default address book container
-! virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
- // Is the helper correctly initialised?
-! virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
-!
-! // Get the value of a MAPI property of type LONG
-! virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
-
- protected:
- HRESULT mLastError ;
- static PRUint32 mEntryCounter ;
- static PRLock *mMutex ;
-
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ ) = 0;
-+
- // Retrieve the contents of a container, with an optional restriction
-! virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-! nsMapiEntryArray *aList, ULONG aMapiType) =0;
- // Retrieve the values of a set of properties on a MAPI object
-! virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
- ULONG aNbProperties,
-! LPSPropValue& aValues, ULONG& aValueCount) =0;
- // Set the values of a set of properties on a MAPI object
-! virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-! LPSPropValue& aValues) =0;
- // Clean-up a rowset returned by QueryRows
- void MyFreeProws(LPSRowSet aSet) ;
- // Allocation of a buffer for transmission to interfaces
-***************
-*** 150,156 ****
---- 190,205 ----
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
-
-+ static void CStrToUnicode( const char *pStr, nsString& result);
-+ static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
-+
- private:
-+ static int m_clients;
-+ static PRUnichar * m_pUniBuff;
-+ static int m_uniBuffLen;
-+ static char * m_pCStrBuff;
-+ static int m_cstrBuffLen;
-+
- } ;
-
- enum nsAbWinType
-***************
-*** 168,173 ****
---- 217,223 ----
-
- nsAbWinHelper *operator ->(void) { return mHelper ; }
-
-+ static void FreeWinAbLibrarys();
- private:
- nsAbWinHelper *mHelper ;
- } ;
-*** misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp Wed Dec 24 18:18:08 2003
---- misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 97,102 ****
---- 97,105 ----
-
- static const char kMailListAddressFormat[] = "Address%d";
-
-+ extern int getMD5sum(const char * fileName,char * sum);
-+ extern int testMD5sum(const char * fileName,char * sum);
-+
- static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
-
- nsAddrDatabase::nsAddrDatabase()
-***************
-*** 166,171 ****
---- 169,175 ----
- m_LastRecordKey(0),
- m_dbDirectory(nsnull)
- {
-+ memset(m_dbMd5Sum,0,33);
- }
-
- nsAddrDatabase::~nsAddrDatabase()
-***************
-*** 720,726 ****
- NS_RELEASE(oldFile); // always release our file ref, store has own
- }
- }
-!
- nsCRT::free(nativeFileName);
-
- if (NS_SUCCEEDED(ret) && thumb)
---- 724,734 ----
- NS_RELEASE(oldFile); // always release our file ref, store has own
- }
- }
-!
-! ret = getMD5sum(nativeFileName,m_dbMd5Sum);
-! if (ret == 1)
-! ret = NS_ERROR_FAILURE;
-!
- nsCRT::free(nativeFileName);
-
- if (NS_SUCCEEDED(ret) && thumb)
-***************
-*** 817,822 ****
---- 825,841 ----
- nsresult err = NS_OK;
- nsIMdbThumb *commitThumb = nsnull;
-
-+ const char *pFilename = m_dbName.GetCString(); /* do not free */
-+ char *nativeFileName = nsCRT::strdup(pFilename);
-+ #if defined(XP_PC) || defined(XP_MAC)
-+ UnixToNative(nativeFileName);
-+ #endif
-+ if (testMD5sum(nativeFileName,m_dbMd5Sum))
-+ {
-+ nsCRT::free(nativeFileName);
-+ return NS_ERROR_FILE_ACCESS_DENIED;
-+ }
-+
- if (commitType == nsAddrDBCommitType::kLargeCommit || commitType == nsAddrDBCommitType::kSessionCommit)
- {
- mdb_percent outActualWaste = 0;
-***************
-*** 867,872 ****
---- 886,895 ----
- // ### do something with error, but clear it now because mork errors out on commits.
- if (GetEnv())
- GetEnv()->ClearErrors();
-+ if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
-+ err = NS_ERROR_FAILURE;
-+ nsCRT::free(nativeFileName);
-+
- return err;
- }
-
-*** misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h Wed Jan 28 18:22:13 2004
---- misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h Tue Jan 15 13:34:34 2008
-***************
-*** 396,401 ****
---- 396,402 ----
- nsIMdbTable *m_mdbPabTable;
- nsIMdbTable *m_mdbDeletedCardsTable;
- nsFileSpec m_dbName;
-+ char m_dbMd5Sum[33];
- PRBool m_mdbTokensInitialized;
- nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
-
-*** misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp Tue Oct 30 08:59:16 2001
---- misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp Tue Jan 15 13:34:34 2008
-***************
-*** 41,46 ****
---- 41,62 ----
-
- #include "prlog.h"
-
-+ static char * stristr(const char *big, const char *little)
-+ {
-+ PRUint32 len;
-+
-+ if (!big || !little || !*big || !*little)
-+ return 0;
-+ len = strlen(little);
-+
-+ for( ; *big; big++ )
-+ if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
-+ return (char *)big;
-+
-+ return (char *)0;
-+
-+ }
-+
- #ifdef PR_LOGGING
- static PRLogModuleInfo* gMapiAddressBookLog
- = PR_NewLogModule("nsMapiAddressBookLog");
-***************
-*** 48,53 ****
---- 64,123 ----
-
- #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
-
-+ #define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
-+ #define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
-+ #define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
-+ #define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
-+ #define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
-+ #define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
-+ #define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
-+
-+ static const TagMap TagMaps[]={
-+ {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
-+ {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
-+ {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
-+ {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
-+
-+ enum {
-+ ieidPR_ENTRYID = 0,
-+ ieidPR_OBJECT_TYPE,
-+ ieidPR_DISPLAY_NAME,
-+ ieidPR_MESSAGE_CLASS,
-+ ieidPR_STORE_ENTRYID,
-+ ieidPR_MESSAGE_RECIPIENTS,
-+ ieidMax
-+ };
-+
-+ static const SizedSPropTagArray(ieidMax, ptaEid)=
-+ {
-+ ieidMax,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE,
-+ PR_DISPLAY_NAME,
-+ PR_MESSAGE_CLASS,
-+ PR_STORE_ENTRYID,
-+ PR_MESSAGE_RECIPIENTS
-+ }
-+ };
-+
-+ enum
-+ {
-+ ContentsColumnEntryId = 0,
-+ ContentsColumnObjectType,
-+ ContentsColumnMessageClass,
-+ ContentsColumnsSize
-+ } ;
-+
-+ static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-+ {
-+ ContentsColumnsSize,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE,
-+ PR_MESSAGE_CLASS
-+ }
-+ } ;
-
- HMODULE nsMapiAddressBook::mLibrary = NULL ;
- PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
-***************
-*** 60,66 ****
- BOOL nsMapiAddressBook::mInitialized = FALSE ;
- BOOL nsMapiAddressBook::mLogonDone = FALSE ;
- LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
-! LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
-
- BOOL nsMapiAddressBook::LoadMapiLibrary(void)
- {
---- 130,136 ----
- BOOL nsMapiAddressBook::mInitialized = FALSE ;
- BOOL nsMapiAddressBook::mLogonDone = FALSE ;
- LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
-! #define MAPI_NO_COINIT 8
-
- BOOL nsMapiAddressBook::LoadMapiLibrary(void)
- {
-***************
-*** 92,98 ****
- mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
- GetProcAddress(mLibrary, "MAPILogonEx")) ;
- if (!mMAPILogonEx) { return FALSE ; }
-! MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
- HRESULT retCode = mMAPIInitialize(&mapiInit) ;
-
- if (HR_FAILED(retCode)) {
---- 162,168 ----
- mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
- GetProcAddress(mLibrary, "MAPILogonEx")) ;
- if (!mMAPILogonEx) { return FALSE ; }
-! MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
- HRESULT retCode = mMAPIInitialize(&mapiInit) ;
-
- if (HR_FAILED(retCode)) {
-***************
-*** 106,127 ****
- MAPI_NEW_SESSION,
- &mRootSession) ;
- if (HR_FAILED(retCode)) {
-! PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
- }
- mLogonDone = TRUE ;
-! retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
-! if (HR_FAILED(retCode)) {
-! PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
-! }
- return HR_SUCCEEDED(retCode) ;
- }
-
- void nsMapiAddressBook::FreeMapiLibrary(void)
- {
- if (mLibrary) {
-! if (-- mLibUsage == 0) {
- {
-- if (mRootBook) { mRootBook->Release() ; }
- if (mRootSession) {
- if (mLogonDone) {
- mRootSession->Logoff(NULL, 0, 0) ;
---- 176,194 ----
- MAPI_NEW_SESSION,
- &mRootSession) ;
- if (HR_FAILED(retCode)) {
-! PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
-! return FALSE ;
- }
- mLogonDone = TRUE ;
-!
- return HR_SUCCEEDED(retCode) ;
- }
-
- void nsMapiAddressBook::FreeMapiLibrary(void)
- {
- if (mLibrary) {
-! if (--mLibUsage < 0) {
- {
- if (mRootSession) {
- if (mLogonDone) {
- mRootSession->Logoff(NULL, 0, 0) ;
-***************
-*** 135,140 ****
---- 202,208 ----
- }
- }
- FreeLibrary(mLibrary) ;
-+ mRootSession = NULL;
- mLibrary = NULL ;
- }
- }
-***************
-*** 146,152 ****
- : nsAbWinHelper()
- {
- BOOL result = Initialize() ;
--
- NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
- MOZ_COUNT_CTOR(nsMapiAddressBook) ;
- }
---- 214,219 ----
-***************
-*** 154,175 ****
- nsMapiAddressBook::~nsMapiAddressBook(void)
- {
- nsAutoLock guard(mMutex) ;
-!
- FreeMapiLibrary() ;
- MOZ_COUNT_DTOR(nsMapiAddressBook) ;
- }
-
- BOOL nsMapiAddressBook::Initialize(void)
- {
-! if (mAddressBook) { return TRUE ; }
- nsAutoLock guard(mMutex) ;
-
- if (!LoadMapiLibrary()) {
- PRINTF(("Cannot load library.\n")) ;
- return FALSE ;
- }
-! mAddressBook = mRootBook ;
-! return TRUE ;
- }
-
- void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
---- 221,1102 ----
- nsMapiAddressBook::~nsMapiAddressBook(void)
- {
- nsAutoLock guard(mMutex) ;
-! CleanUpMDB();
- FreeMapiLibrary() ;
- MOZ_COUNT_DTOR(nsMapiAddressBook) ;
- }
-
-+ LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
-+ {
-+ if (!pProp)
-+ return( NULL);
-+
-+ int sz = CbNewSPropTagArray( 1);
-+ SPropTagArray *pTag = (SPropTagArray *) new char[sz];
-+ pTag->cValues = 1;
-+ pTag->aulPropTag[0] = tag;
-+ LPSPropValue lpProp = NULL;
-+ ULONG cValues = 0;
-+ HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
-+ delete pTag;
-+ if (HR_FAILED( hr) || (cValues != 1)) {
-+ if (lpProp)
-+ mMAPIFreeBuffer( lpProp);
-+ return( NULL);
-+ }
-+ else {
-+ if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
-+ if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
-+ mMAPIFreeBuffer( lpProp);
-+ lpProp = NULL;
-+ }
-+ }
-+ }
-+
-+ return( lpProp);
-+ }
-+ BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
-+ {
-+ if (!pVal)
-+ return( FALSE);
-+
-+ BOOL bResult = TRUE;
-+ switch (PROP_TYPE(pVal->ulPropTag))
-+ {
-+ case PT_BINARY:
-+ cbEntryId = pVal->Value.bin.cb;
-+ mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
-+ memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
-+ break;
-+
-+ default:
-+ PRINTF(( "EntryId not in BINARY prop value\n"));
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (pVal && delVal)
-+ mMAPIFreeBuffer( pVal);
-+
-+ return( bResult);
-+ }
-+
-+ BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-+ {
-+ LPMDB lpMsgStore;
-+ ULONG objType=0;
-+ HRESULT hr;
-+
-+ if (oType == MAPI_MESSAGE)
-+ return FALSE;
-+ if (oType == MAPI_STORE)
-+ {
-+ hr=mRootSession->OpenEntry(
-+ cb,
-+ pEntry,
-+ &IID_IMsgStore,
-+ MAPI_BEST_ACCESS,
-+ &objType,
-+ (IUnknown**)&lpMsgStore);
-+ if (FAILED(hr))
-+ return FALSE ;
-+ //Add MDB to a list to make it can be released when class destroyed.
-+ //We must leave it openned or else we can't open address store in it.
-+ AddToMDBArray(lpMsgStore);
-+
-+ LPSPropValue pVal;
-+ pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
-+
-+
-+ if (pVal) {
-+ ULONG cbEntry;
-+ LPENTRYID pEntry;
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
-+
-+ if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
-+ // Open up the folder!
-+ BOOL bResult = TRUE;
-+ bResult = lpMsgStore->OpenEntry(
-+ cbEntry,
-+ pEntry,
-+ NULL,
-+ MAPI_BEST_ACCESS,
-+ &objType,
-+ lpSubTree);
-+ mMAPIFreeBuffer( pEntry);
-+ if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
-+ // Iterate the subtree with the results going into the folder list
-+ bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
-+ }
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
-+ }
-+ }
-+ else {
-+ PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
-+ }
-+ }
-+ else
-+ {
-+ PRINTF(("Type:%d\n",oType));
-+ }
-+
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
-+ {
-+ // flags can be CONVENIENT_DEPTH or 0
-+ // CONVENIENT_DEPTH will return all depths I believe instead
-+ // of just children
-+ HRESULT hr;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
-+ hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
-+ }
-+
-+ ULONG rowCount;
-+ hr = lpTable->GetRowCount( 0, &rowCount);
-+ if (!rowCount) {
-+ return( TRUE);
-+ }
-+
-+ hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
-+ }
-+
-+ hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-+ if (HR_FAILED(hr)) {
-+ PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ return( FALSE);
-+ }
-+
-+ int cNumRows = 0;
-+ LPSRowSet lpRow;
-+ BOOL keepGoing = TRUE;
-+ BOOL bResult = TRUE;
-+ do {
-+
-+ lpRow = NULL;
-+ hr = lpTable->QueryRows( 1, 0, &lpRow);
-+
-+ if (HR_FAILED(hr))
-+ {
-+ PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (lpRow){
-+ cNumRows = lpRow->cRows;
-+
-+ if (cNumRows) {
-+ LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-+ ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-+
-+ keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
-+
-+ }
-+ MyFreeProws(lpRow);
-+ }
-+
-+ } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
-+
-+
-+ if (bResult && !keepGoing)
-+ bResult = FALSE;
-+
-+ return( bResult);
-+ }
-+ BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-+ {
-+ ULONG objType=0;
-+ if (oType == MAPI_FOLDER)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
-+ if (!mRootSession->OpenEntry(
-+ cb,
-+ pEntry,
-+ 0,
-+ MAPI_BEST_ACCESS,
-+ &objType,
-+ pFolder))
-+ {
-+ LPSPropValue pVal;
-+
-+
-+ pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
-+ if (pVal)
-+ {
-+ if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
-+ {
-+ SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
-+
-+ aFolders.AddItem(currentValue->Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
-+
-+ }
-+ }
-+ }
-+ }
-+ else
-+ {
-+ PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
-+ }
-+
-+ return( TRUE);
-+ }
-+
-+
-+ BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-+ {
-+ aFolders.CleanUp() ;
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
-+
-+ mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
-+ return mLastError;
-+ }
-+
-+ mLastError = lpTable->GetRowCount( 0, &rowCount);
-+
-+ mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-+ if (FAILED(mLastError))
-+ return( mLastError);
-+ mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-+ if (FAILED(mLastError))
-+ return mLastError;
-+
-+ int cNumRows = 0;
-+ LPSRowSet lpRow;
-+ BOOL keepGoing = TRUE;
-+ BOOL bResult = TRUE;
-+ do {
-+
-+ lpRow = NULL;
-+ mLastError = lpTable->QueryRows( 1, 0, &lpRow);
-+
-+ if (HR_FAILED(mLastError)){
-+ bResult = FALSE;
-+ break;
-+ }
-+
-+ if (lpRow){
-+ cNumRows = lpRow->cRows;
-+
-+ if (cNumRows) {
-+ LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-+ ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-+ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-+
-+
-+ keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
-+ }
-+ MyFreeProws( lpRow);
-+ }
-+
-+ } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
-+
-+
-+ return HR_SUCCEEDED(mLastError) ;
-+ }
-+ BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
-+ {
-+ ULONG conditionType = 0 ;
-+ ULONG ulResIndex;
-+ if (!aRestriction)
-+ return FALSE;
-+ for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
-+ {
-+ conditionType = aRestriction[ulResIndex].rt;
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ aRestriction[ulResIndex].res.resExist.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
-+ break ;
-+ case RES_BITMASK :
-+ aRestriction[ulResIndex].res.resBitMask.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
-+ break ;
-+ case RES_CONTENT :
-+ aRestriction[ulResIndex].res.resContent.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
-+ aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
-+ break ;
-+ case RES_PROPERTY :
-+ aRestriction[ulResIndex].res.resProperty.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
-+ aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
-+ break ;
-+ case RES_SIZE :
-+ aRestriction[ulResIndex].res.resSize.ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
-+ break ;
-+ case RES_COMPAREPROPS :
-+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
-+ aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
-+ break ;
-+ case RES_NOT :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
-+ break;
-+ case RES_AND :
-+ CorrectRestriction(aMapiProp,
-+ aRestriction[ulResIndex].res.resAnd.cRes,
-+ aRestriction[ulResIndex].res.resAnd.lpRes);
-+ break;
-+ case RES_OR :
-+ CorrectRestriction(aMapiProp,
-+ aRestriction[ulResIndex].res.resOr.cRes,
-+ aRestriction[ulResIndex].res.resOr.lpRes);
-+ break;
-+
-+ case RES_COMMENT :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
-+ aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
-+ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
-+ break;
-+ case RES_SUBRESTRICTION :
-+ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
-+ break;
-+ default:
-+ return FALSE;
-+ }
-+ }
-+ return TRUE;
-+ }
-+ BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
-+ {
-+ if (!aRestriction)
-+ return FALSE;
-+
-+ ULONG conditionType = 0 ;
-+
-+ nsMapiEntryArray listOut;
-+ ULONG listindex=0;
-+
-+ nsMapiEntryArray listDel;
-+ ULONG delindex=0;
-+
-+ ULONG listsize;
-+ ULONG resCount = 0;
-+ ULONG resIndex = 0;
-+
-+ listsize = aList->GetSize();
-+ conditionType = aRestriction->rt;
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ case RES_BITMASK :
-+ case RES_CONTENT :
-+ case RES_PROPERTY :
-+ case RES_SIZE :
-+ case RES_COMPAREPROPS :
-+ case RES_COMMENT :
-+ case RES_SUBRESTRICTION :
-+ {
-+ while(listindex < aList->GetSize())
-+ {
-+ if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
-+ aList->Remove(listindex);
-+ else
-+ listindex++;
-+ }
-+ }
-+ break;
-+ case RES_NOT :
-+ aRestriction->res.resNot.ulReserved = 1;
-+ case RES_AND :
-+ case RES_OR :
-+ {
-+ if (conditionType == RES_OR)
-+ {
-+ for(listindex=0;listindex<aList->GetSize();listindex++)
-+ {
-+ listDel.AddItem(aList->ElementAt(listindex));
-+ }
-+ }
-+
-+ resCount = aRestriction->res.resAnd.cRes;
-+ //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
-+ //use the same struct
-+ for (resIndex = 0;resIndex < resCount;resIndex++)
-+ {
-+ //can't call listOut.CleanUp() here
-+ //because it will destroy all Element too
-+ while(listOut.GetSize())
-+ {
-+ listOut.Remove(0);
-+ }
-+
-+ for(listindex=0;listindex<aList->GetSize();listindex++)
-+ {
-+ listOut.AddItem(aList->ElementAt(listindex));
-+ }
-+
-+ Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
-+ if (conditionType == RES_NOT)
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ aList->Remove(listOut.ElementAt(listindex));
-+ }
-+ }
-+ else if (conditionType == RES_AND )
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ if (!aList->IndexOf(listOut.ElementAt(listindex)))
-+ {
-+ aList->Remove(listOut.ElementAt(listindex));
-+ }
-+ }
-+ }
-+ else if (conditionType == RES_OR )
-+ {
-+ for(listindex=0;listindex<listOut.GetSize();listindex++)
-+ {
-+ listDel.Remove(listOut.ElementAt(listindex));
-+ }
-+ if (listDel.GetSize() == 0)
-+ {
-+ break;
-+ }
-+ }
-+ }
-+ if (conditionType == RES_OR)
-+ {
-+ for(listindex=0;listindex<listDel.GetSize();listindex++)
-+ {
-+ aList->Remove(listDel.ElementAt(listindex));
-+ }
-+ }
-+ }
-+
-+ }
-+ while(listDel.GetSize())
-+ {
-+ listDel.Remove(0);
-+ }
-+ while(listOut.GetSize())
-+ {
-+ listOut.Remove(0);
-+ }
-+
-+
-+ return TRUE;
-+ }
-+
-+ BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
-+ {
-+ LPMAPIPROP object ;
-+ ULONG objType = 0 ;
-+ LPSPropValue realValue = NULL ;
-+ LPSPropValue resValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ (IUnknown **)&object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ ULONG conditionType = 0 ;
-+ conditionType = aRestriction->rt;
-+
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = NULL;
-+ break ;
-+ case RES_CONTENT :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = aRestriction->res.resContent.lpProp;
-+ break ;
-+ case RES_PROPERTY :
-+ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
-+ return FALSE;
-+ resValue = aRestriction->res.resProperty.lpProp;
-+ break ;
-+ case RES_BITMASK :
-+ return FALSE; //not support
-+ break ;
-+ case RES_SIZE :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_COMPAREPROPS :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_NOT :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_AND :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_OR :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_COMMENT :
-+ return TRUE;//comment
-+ break;
-+ case RES_SUBRESTRICTION :
-+ return FALSE;//not been used now
-+ break ;
-+ }
-+ return AtomyFilter(aRestriction,realValue,resValue);
-+
-+ }
-+
-+ BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
-+ {
-+ ULONG conditionType = 0 ;
-+ conditionType = aRestriction->rt;
-+
-+ BOOL bTagEq=(aRealValue &&
-+ PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
-+ aFilterValue;
-+ // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
-+ switch (conditionType)
-+ {
-+ case RES_EXIST :
-+ return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
-+ break ;
-+ case RES_CONTENT :
-+ if (bTagEq)
-+ {
-+ switch(aRestriction->res.resContent.ulFuzzyLevel)
-+ {
-+ case FL_FULLSTRING :
-+ return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
-+ break;
-+ case FL_PREFIX :
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
-+ break;
-+ case FL_SUBSTRING :
-+ default:
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-+ break;
-+ }
-+ }
-+ return FALSE;
-+ break ;
-+ case RES_PROPERTY :
-+ if (bTagEq)
-+ {
-+ switch(aRestriction->res.resProperty.relop)
-+ {
-+ case RELOP_GE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
-+ break;
-+ case RELOP_GT :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
-+ break;
-+ case RELOP_LE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
-+ break;
-+ case RELOP_LT :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
-+ break;
-+ case RELOP_EQ :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
-+ break;
-+ case RELOP_NE :
-+ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
-+ break;
-+ case RELOP_RE :
-+ default:
-+ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-+ break;
-+
-+ }
-+ }
-+ return FALSE;
-+ break ;
-+ case RES_BITMASK :
-+ return FALSE; //not support
-+ break ;
-+ case RES_SIZE :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_COMPAREPROPS :
-+ return FALSE;//not been used now
-+ break ;
-+ case RES_NOT :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_AND :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_OR :
-+ return FALSE;//not need care here
-+ break;
-+ case RES_COMMENT :
-+ return TRUE;//comment
-+ break;
-+ case RES_SUBRESTRICTION :
-+ return FALSE;//not been used now
-+ break ;
-+ }
-+ return TRUE;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType)
-+ {
-+ if (aList)
-+ aList->CleanUp();
-+
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
-+ nsCString cs;
-+ aParent.ToString(cs);
-+
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ 0, MAPI_BEST_ACCESS, &objType, pFolder);
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ HRESULT hr;
-+ LPSPropValue aValue = NULL ;
-+ ULONG aValueCount = 0 ;
-+
-+ LPSPropTagArray properties = NULL ;
-+ mMAPIAllocateBuffer(CbNewSPropTagArray(1),
-+ (void **)&properties);
-+ properties->cValues = 1;
-+ properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
-+ hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
-+
-+ SBinaryArray *sa=&aValue->Value.MVbin;
-+
-+ LPENTRYID lpEID;
-+ ULONG cbEID;
-+
-+ ULONG idx;
-+ nsMapiEntry testEntry;
-+ nsCString sClass;
-+ for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
-+ {
-+ lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
-+ cbEID = sa->lpbin[idx].cb;
-+ testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
-+
-+ if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
-+ {
-+ aList->AddItem(cbEID,lpEID);
-+ }
-+ }
-+ Filter(aRestriction,aList);
-+ }
-+ else
-+ {
-+ if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
-+ return FALSE;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
-+ parent) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mLastError = parent->GetContentsTable(0, contents) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+ if (aRestriction) {
-+ mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+ mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = contents->GetRowCount(0, &rowCount) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = contents->QueryRows(1, 0, &rowSet) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0 && aList)
-+ {
-+ if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
-+ {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+ }
-+ else if (aMapiType == MAPI_DISTLIST)
-+ {
-+ if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
-+ {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+
-+ }
-+ }
-+
-+ }
-+ MyFreeProws(rowSet) ;
-+ } while (rowCount > 0) ;
-+ }
-+
-+
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties, LPSPropValue& aValue,
-+ ULONG& aValueCount)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ LPSPropTagArray properties = NULL ;
-+ ULONG i = 0 ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-+ NS_REINTERPRET_CAST(void **, &properties));
-+ properties->cValues = aNbProperties ;
-+ for (i = 0 ; i < aNbProperties ; ++ i)
-+ {
-+ properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
-+ }
-+ mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
-+ FreeBuffer(properties) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Error get props %08x.\n", mLastError)) ;
-+ }
-+ return HR_SUCCEEDED(mLastError);
-+ }
-+
-+ BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues)
-+ {
-+ nsMapiInterfaceWrapper<LPMESSAGE> object;
-+ ULONG objType = 0 ;
-+ LPSPropProblemArray problems = NULL ;
-+ ULONG i = 0 ;
-+
-+ LPMDB lpMsgStore=GetMsgStore(aObject);
-+
-+ if (!lpMsgStore)
-+ {
-+ return FALSE;
-+ }
-+ mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
-+ object) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ for (i = 0 ; i < aNbProperties ; ++ i)
-+ {
-+ aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
-+ }
-+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (problems) {
-+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-+ PRINTF(("Problem %d: index %d code %08x.\n", i,
-+ problems->aProblem [i].ulIndex,
-+ problems->aProblem [i].scode)) ;
-+ }
-+ }
-+ mLastError = object->SaveChanges(0) ;
-+ if (MAPI_E_OBJECT_CHANGED == mLastError)
-+ {
-+ mLastError = object->SaveChanges(FORCE_SAVE ) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-+ {
-+ return FALSE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::IsOK(void)
-+ {
-+ return mRootSession && mLibUsage;
-+ }
-+
- BOOL nsMapiAddressBook::Initialize(void)
- {
-!
- nsAutoLock guard(mMutex) ;
-
- if (!LoadMapiLibrary()) {
- PRINTF(("Cannot load library.\n")) ;
- return FALSE ;
- }
-! return TRUE;
- }
-
- void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
-***************
-*** 182,188 ****
---- 1109,1911 ----
- mMAPIFreeBuffer(aBuffer) ;
- }
-
-+ ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
-+ {
-+ static GUID emailGUID =
-+ {
-+ 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
-+ };
-+
-+
-+ MAPINAMEID mapiNameID;
-+ mapiNameID.lpguid = &emailGUID;
-+ mapiNameID.ulKind = MNID_ID;
-+ mapiNameID.Kind.lID = nameID;
-+
-+ LPMAPINAMEID lpMapiNames = &mapiNameID;
-+ LPSPropTagArray lpMailTagArray = NULL;
-+
-+ HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
-+ if (result == S_OK)
-+ {
-+ ULONG lTag = lpMailTagArray->aulPropTag[0];
-+ mMAPIFreeBuffer(lpMailTagArray);
-+ return lTag;
-+ }
-+ return 0L;
-+ }
-+ ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
-+ {
-+ LPSPropValue addr;
-+ ULONG upRealTag=aPropertyTag;
-+ ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
-+
-+ for(int i=0; i<lSize; i++)
-+ {
-+ if (TagMaps[i].AddressTag == aPropertyTag)
-+ {
-+
-+ ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
-+ if (aTest)
-+ {
-+ if (PR_DISPLAY_NAME_A == aPropertyTag)
-+ {
-+ //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
-+ LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
-+ if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+ else
-+ {
-+ FreeBuffer(msgClass);
-+ upRealTag = aPropertyTag;
-+ }
-+ }
-+ else //PR_DISPLAY_NAME_A == aPropertyTag
-+ {
-+ addr=GetMapiProperty(lpProp,aPropertyTag);
-+ if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
-+ addr->Value.l == MAPI_E_NOT_FOUND)
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+ }
-+ }
-+ else //aTest
-+ {
-+ if (kPriEmailColumn)
-+ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
-+ }
-+
-+ break; //we find it,exit
-+ }
-+ }
-+
-+ return upRealTag;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
-+ ULONG aPropertyTag,
-+ ULONG& aValue)
-+ {
-+ aValue = 0 ;
-+ LPSPropValue values = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (PR_OBJECT_TYPE == aPropertyTag)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
-+ ULONG objType=0;
-+ mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
-+ NULL,MAPI_BEST_ACCESS,&objType, pFolder);
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ FreeBuffer(msgClass);
-+ aValue = MAPI_DISTLIST;
-+ return TRUE;
-+ }
-+ }
-
-+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
-+ return FALSE ;
-
-+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
-+ aValue = values->Value.ul ;
-+ }
-+ FreeBuffer(values) ;
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ WORD& aYear, WORD& aMonth, WORD& aDay)
-+ {
-+ aYear = 0;
-+ aMonth = 0;
-+ aDay = 0;
-+ LPSPropValue values = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
-+ return FALSE ;
-+
-+ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
-+ SYSTEMTIME readableTime ;
-+ FILETIME localTime ;
-+ FileTimeToLocalFileTime(&values->Value.ft,&localTime);
-+ if (FileTimeToSystemTime(&localTime, &readableTime)) {
-+ aYear = readableTime.wYear ;
-+ aMonth = readableTime.wMonth ;
-+ aDay = readableTime.wDay ;
-+ }
-+ }
-+ FreeBuffer(values) ;
-+ return TRUE ;
-+ }
-+
-+ HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ )
-+ {
-+
-+ int err;
-+ HRESULT rv;
-+ __try
-+ {
-+ rv=mRootSession->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags ,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }__except(err)
-+ {
-+ return (-1);
-+ }
-+
-+ if (HR_FAILED(rv) && !m_MDBArray.Count())
-+ {
-+ //There are no openned Message store,so we have to open them all
-+ nsMapiEntryArray aFolders;
-+ if (GetFolders(aFolders))
-+ {
-+ __try
-+ {
-+ rv=mRootSession->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags ,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }__except(err)
-+ {
-+ return (-1);
-+ }
-+ }
-+ }
-+ return rv;
-+
-+ }
-+
-+ BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ return FALSE;
-+
-+ LPMDB lpMsgStore=GetMsgStore(parentEntry);
-+
-+ if (!lpMsgStore)
-+ return FALSE;
-+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE ;
-+
-+
-+ /*
-+ When add mail address to distlist,Mapi need update 2 tag.
-+ */
-+ //update OUTLOOK_EMAIL_LIST1
-+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-+ SBinaryArray oldChilds;
-+ LPSBinary bins=NULL;
-+ SBinaryArray newChilds;
-+ LPSPropValue oldChildValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues + 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (ULONG i=0;i<oldChilds.cValues;i++)
-+ {
-+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-+
-+ nsMapiEntry orgEntryID;
-+ if (!GetPropertyBin(aNewEntry,
-+ GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
-+ orgEntryID))
-+ {
-+ return FALSE;
-+ }
-+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
-+
-+ SPropValue childs;
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+
-+ LPSPropProblemArray problems = NULL ;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ //update OUTLOOK_EMAIL_LIST2
-+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues + 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (ULONG i=0;i<oldChilds.cValues;i++)
-+ {
-+ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-+ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-+
-+ /*
-+ Need more work here.
-+ There are two kind of mail address in outlook DistList.
-+ One is sample,not include in parent folder.
-+ The other is a link to a unattached address in parents folders.
-+ Currently we can only add first kind of address to a outlook distlist.
-+ */
-+
-+ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-+ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
-+
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ if (HR_FAILED(mLastError))
-+ {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mMAPIFreeBuffer(bins);
-+
-+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ return TRUE ;
-+ }
-+ BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ return FALSE;
-+
-+ LPMDB lpMsgStore=GetMsgStore(parentEntry);
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE ;
-+ /*
-+ When delete mail address from distlist,Mapi need update 2 tag.
-+ */
-+ //update OUTLOOK_EMAIL_LIST1
-+ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-+
-+ SBinaryArray oldChilds;
-+ LPSBinary bins=NULL;
-+ SBinaryArray newChilds;
-+ LPSPropValue oldChildValue = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ newChilds.lpbin=NULL;
-+
-+ ULONG lDeleteEntry=0;
-+ ULONG newIndex=0;
-+ ULONG oldIndex=0;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues - 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-+ {
-+ if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
-+ !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
-+ (void*)(aNewEntry.mEntryId->ab),
-+ oldChilds.lpbin[oldIndex].cb-4))
-+ {
-+ lDeleteEntry=oldIndex;
-+ }
-+ else
-+ {
-+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-+ newIndex++;
-+ }
-+ }
-+ }
-+ else
-+ return FALSE;
-+
-+
-+ SPropValue childs;
-+ LPSPropProblemArray problems = NULL ;
-+
-+ if (newChilds.cValues == 0)
-+ {
-+ SPropTagArray delTags;
-+ delTags.cValues = 1;
-+ delTags.aulPropTag[0] = listTag;
-+
-+ mLastError = container->DeleteProps(&delTags, &problems) ;
-+ }
-+ else
-+ {
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ }
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ //update OUTLOOK_EMAIL_LIST2
-+ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-+ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-+ {
-+ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-+ return FALSE;
-+ }
-+
-+ newIndex=0;
-+ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-+ {
-+ oldChilds = oldChildValue->Value.MVbin;
-+ newChilds.cValues=oldChilds.cValues - 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-+ {
-+ if (oldIndex != lDeleteEntry)
-+ {
-+ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-+ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-+ newIndex++;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ newChilds.cValues = 1;
-+ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-+ newChilds.lpbin = bins;
-+ }
-
-
-+
-+ if (newChilds.cValues == 0)
-+ {
-+ SPropTagArray delTags;
-+ delTags.cValues = 1;
-+ delTags.aulPropTag[0] = listTag;
-+
-+ mLastError = container->DeleteProps(&delTags, &problems) ;
-+ }
-+ else
-+ {
-+ childs.ulPropTag = listTag;
-+ childs.Value.MVbin = newChilds;
-+ mLastError = container->SetProps(1, &childs, &problems) ;
-+ }
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mMAPIFreeBuffer(bins);
-+
-+ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ (IUnknown **)&object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
-+
-+ if (parentID->Value.l == MAPI_E_NOT_FOUND)
-+ return FALSE;
-+ aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
-+ return TRUE;
-+ }
-+ BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiEntry parentEntry;
-+ if (!GetEntryParent(aDistlist,parentEntry))
-+ {
-+ return FALSE;
-+ }
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+ if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
-+ return FALSE;
-+
-+ return AddEntryToList(aDistlist,aNewEntry);
-+ }
-+
-+ BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
-+
-+ LPMDB lpMsgStore=GetMsgStore(aParent);
-+
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError))
-+ return FALSE;
-+
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+
-+ mLastError = container->CreateMessage(&IID_IMessage,
-+ 0,
-+ newEntry) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue messageclass ;
-+ LPSPropProblemArray problems = NULL ;
-+ nsCString tempName ;
-+
-+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-+ tempName.Assign("IPM.Contact") ;
-+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ SPropTagArray property ;
-+ LPSPropValue value = NULL ;
-+ ULONG valueCount = 0 ;
-+
-+ property.cValues = 1 ;
-+ property.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-+ if (HR_FAILED(mLastError) || valueCount != 1) {
-+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-+ FreeBuffer(value) ;
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+
-+ LPMDB lpMsgStore=GetMsgStore(aParent);
-+ if (!lpMsgStore)
-+ return FALSE;
-+ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-+ mLastError = container->CreateMessage(&IID_IMAPIProp,
-+ 0,
-+ newEntry) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ SPropValue messageclass ;
-+ LPSPropProblemArray problems = NULL ;
-+ nsCString tempName ;
-+
-+ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-+ tempName.Assign("IPM.DistList") ;
-+ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-+ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ ULONG valueCount = 0 ;
-+ SPropTagArray property ;
-+ LPSPropValue value = NULL ;
-+
-+ property.cValues = 1 ;
-+ property.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-+ if (HR_FAILED(mLastError) || valueCount != 1) {
-+ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-+
-+ FreeBuffer(value) ;
-+ return TRUE ;
-+ }
-+
-+
-+ BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
-+ nsMapiEntry& aTarget)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
-+ ULONG objType = 0 ;
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ {
-+ //Add Entry To DistList
-+ if (!AddEntryToList(aContainer,aSource))
-+ return FALSE;
-+ aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
-+ return TRUE;
-+ }
-+
-+ SBinary entry ;
-+ SBinaryArray entryArray ;
-+
-+ entry.cb = aSource.mByteCount ;
-+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
-+ entryArray.cValues = 1 ;
-+ entryArray.lpbin = &entry ;
-+
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
-+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-+ targetFolder) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
-+
-+ mLastError = container->CopyMessages(&entryArray,
-+ &IID_IMessage,
-+ (void*)&targetFolder,
-+ 0,
-+ NULL,
-+ NULL) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ return TRUE ;
-+ }
-+
-+ BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-+ ULONG objType = 0 ;
-+ SBinary entry ;
-+ SBinaryArray entryArray ;
-+
-+
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-+
-+ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-+ return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
-+
-+ LPMDB lpMsgStore=GetMsgStore(aContainer);
-+ if (!lpMsgStore)
-+ return FALSE;
-+
-+ mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-+ container) ;
-+ lpMsgStore->Release();
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ entry.cb = aEntry.mByteCount ;
-+ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
-+ entryArray.cValues = 1 ;
-+ entryArray.lpbin = &entry ;
-+ mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ return TRUE ;
-+ }
-+
-+ //Use to open message store in write mode
-+ LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object;
-+ ULONG objType=0;
-+
-+ mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
-+ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
-+ object) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+ SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
-+
-+ LPMDB lpMsgStore=NULL;
-+ mLastError=mRootSession->OpenMsgStore(0,
-+ svMsgSore->Value.bin.cb,
-+ (ENTRYID*)svMsgSore->Value.bin.lpb,
-+ &IID_IMsgStore,
-+ MAPI_BEST_ACCESS ,
-+ &lpMsgStore);
-+
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
-+ return NULL ;
-+ }
-+
-+ return lpMsgStore;
-+ }
-*** misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h Fri Sep 28 22:06:25 2001
---- misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h Tue Jan 15 13:34:35 2008
-***************
-*** 40,51 ****
---- 40,81 ----
-
- #include "nsAbWinHelper.h"
-
-+ struct TagMap
-+ {
-+ ULONG AddressTag;
-+ ULONG NameID;
-+ ULONG TypeMask;
-+ };
- class nsMapiAddressBook : public nsAbWinHelper
- {
- public :
- nsMapiAddressBook(void) ;
- virtual ~nsMapiAddressBook(void) ;
-
-+ // Get the top address books
-+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-+
-+ // Get a default address book container
-+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-+ // Is the helper correctly initialised?
-+ virtual BOOL IsOK(void);
-+ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
-+ ULONG aPropertyTag,
-+ ULONG& aValue);
-+ // Get the value of a MAPI property of type SYSTIME
-+ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-+ WORD& aYear, WORD& aMonth, WORD& aDay);
-+ // Create entry in the address book
-+ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ // Delete an entry in the address book
-+ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-+ // Create a distribution list in the address book
-+ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+ // Copy an existing entry in the address book
-+ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-+
-+ static void FreeMapiLibrary(void) ;
-+
- protected :
- // Class members to handle the library/entry points
- static HMODULE mLibrary ;
-***************
-*** 67,85 ****
- static BOOL mInitialized ;
- static BOOL mLogonDone ;
- static LPMAPISESSION mRootSession ;
-! static LPADRBOOK mRootBook ;
-
- // Load the MAPI environment
- BOOL Initialize(void) ;
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Library management
- static BOOL LoadMapiLibrary(void) ;
-! static void FreeMapiLibrary(void) ;
-
- private :
- } ;
-
- #endif // nsMapiAddressBook_h___
---- 97,173 ----
- static BOOL mInitialized ;
- static BOOL mLogonDone ;
- static LPMAPISESSION mRootSession ;
-!
-
- // Load the MAPI environment
- BOOL Initialize(void) ;
-+
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ );
-+
-+
-+ // Retrieve the contents of a container, with an optional restriction
-+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType) ;
-+ // Retrieve the values of a set of properties on a MAPI object
-+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties,
-+ LPSPropValue& aValues, ULONG& aValueCount) ;
-+ // Set the values of a set of properties on a MAPI object
-+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues);
-+
-+
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Library management
- static BOOL LoadMapiLibrary(void) ;
-!
-! BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-! LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
-! BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
-! BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-! BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
-! ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
-! ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
-! LPMDB GetMsgStore(const nsMapiEntry& aEntry);
-! BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
-! BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
-! BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
-! BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
-! BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
-!
-! //filter
-! BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
-! BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
-! BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
-!
-! void AddToMDBArray(LPMDB aMDB)
-! {
-! m_MDBArray.AppendElement(aMDB);
-! }
-! void CleanUpMDB()
-! {
-! LPMDB mdb;
-! for (int i = 0; i < m_MDBArray.Count(); i++)
-! {
-! mdb = (LPMDB)m_MDBArray.ElementAt(i);
-! mdb->Release();
-! }
-! m_MDBArray.Clear();
-! }
-
- private :
-+ //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
-+ //so we have to kill message stores openned
-+ nsVoidArray m_MDBArray;
- } ;
-
- #endif // nsMapiAddressBook_h___
-*** misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp Tue Oct 30 08:59:16 2001
---- misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp Tue Jan 15 13:34:35 2008
-***************
-*** 47,52 ****
---- 47,68 ----
-
- #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
-
-+ enum
-+ {
-+ ContentsColumnEntryId = 0,
-+ ContentsColumnObjectType,
-+ ContentsColumnsSize
-+ } ;
-+
-+ static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-+ {
-+ ContentsColumnsSize,
-+ {
-+ PR_ENTRYID,
-+ PR_OBJECT_TYPE
-+ }
-+ } ;
-+
- HMODULE nsWabAddressBook::mLibrary = NULL ;
- PRInt32 nsWabAddressBook::mLibUsage = 0 ;
- LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
-***************
-*** 95,101 ****
- MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
-
- nsWabAddressBook::nsWabAddressBook(void)
-! : nsAbWinHelper()
- {
- BOOL result = Initialize() ;
-
---- 111,117 ----
- MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
-
- nsWabAddressBook::nsWabAddressBook(void)
-! : nsAbWinHelper(),mAddressBook(NULL)
- {
- BOOL result = Initialize() ;
-
-***************
-*** 110,118 ****
- MOZ_COUNT_DTOR(nsWabAddressBook) ;
- }
-
- BOOL nsWabAddressBook::Initialize(void)
- {
-- if (mAddressBook) { return TRUE ; }
- nsAutoLock guard(mMutex) ;
-
- if (!LoadWabLibrary()) {
---- 126,379 ----
- MOZ_COUNT_DTOR(nsWabAddressBook) ;
- }
-
-+ BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-+ {
-+ aFolders.CleanUp() ;
-+ nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+ SRestriction restriction ;
-+ SPropTagArray folderColumns ;
-+
-+ mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
-+ rootFolder);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot open root %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ mLastError = rootFolder->GetHierarchyTable(0, folders);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ // We only take into account modifiable containers,
-+ // otherwise, we end up with all the directory services...
-+ restriction.rt = RES_BITMASK ;
-+ restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-+ restriction.res.resBitMask.relBMR = BMR_NEZ ;
-+ restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-+ mLastError = folders->Restrict(&restriction, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-+ }
-+ folderColumns.cValues = 1 ;
-+ folderColumns.aulPropTag [0] = PR_ENTRYID ;
-+ mLastError = folders->SetColumns(&folderColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = folders->GetRowCount(0, &rowCount) ;
-+ if (HR_SUCCEEDED(mLastError)) {
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = folders->QueryRows(1, 0, &rowSet) ;
-+ if (HR_SUCCEEDED(mLastError)) {
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0) {
-+ SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
-+
-+ aFolders.AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+ }
-+ MyFreeProws(rowSet) ;
-+ }
-+ else {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ }
-+ } while (rowCount > 0) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+ }
-+ BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType)
-+ {
-+ if (aList) { aList->CleanUp(); }
-+ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-+ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-+ ULONG objType = 0 ;
-+ ULONG rowCount = 0 ;
-+
-+ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+ &IID_IMAPIContainer, 0, &objType,
-+ parent) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ // Here, flags for WAB and MAPI could be different, so this works
-+ // only as long as we don't want to use any flag in GetContentsTable
-+ mLastError = parent->GetContentsTable(0, contents) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (aRestriction) {
-+ mLastError = contents->Restrict(aRestriction, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+ int entryId = ContentsColumnEntryId ;
-+ int objectType = ContentsColumnObjectType ;
-+
-+ if (aRestriction)
-+ {
-+ LPSPropTagArray allColumns = NULL ;
-+
-+ mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+
-+ for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
-+ if (allColumns->aulPropTag [j] == PR_ENTRYID) {
-+ entryId = j ;
-+ }
-+ else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
-+ objectType = j ;
-+ }
-+ }
-+ mLastError = contents->SetColumns(allColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ FreeBuffer(allColumns) ;
-+ }
-+ else
-+ {
-+
-+ mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ }
-+
-+ mLastError = contents->GetRowCount(0, &rowCount) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ do {
-+ LPSRowSet rowSet = NULL ;
-+
-+ rowCount = 0 ;
-+ mLastError = contents->QueryRows(1, 0, &rowSet) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ rowCount = rowSet->cRows ;
-+ if (rowCount > 0 &&
-+ (aMapiType == 0 ||
-+ rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
-+ if (aList) {
-+ SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
-+
-+ aList->AddItem(currentValue.Value.bin.cb,
-+ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+
-+ }
-+ }
-+ MyFreeProws(rowSet) ;
-+ } while (rowCount > 0) ;
-+ return TRUE ;
-+ }
-+
-+ BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties, LPSPropValue& aValue,
-+ ULONG& aValueCount)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ IMsgStore * mdb=NULL;
-+ ULONG objType = 0 ;
-+ LPSPropTagArray properties = NULL ;
-+ ULONG i = 0 ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, 0, &objType,
-+ object) ;
-+
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot open entry %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-+ NS_REINTERPRET_CAST(void **, &properties));
-+ properties->cValues = aNbProperties;
-+ for (i = 0 ; i < aNbProperties ; ++ i) {
-+ properties->aulPropTag [i] = aPropertyTags [i];
-+ }
-+ mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
-+ FreeBuffer(properties);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get props %08x.\n", mLastError));
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+ }
-+
-+ BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues)
-+ {
-+ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+ ULONG objType = 0 ;
-+ LPSPropProblemArray problems = NULL ;
-+
-+ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+ &IID_IMAPIProp, MAPI_MODIFY, &objType,
-+ object) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-+ return FALSE ;
-+ }
-+ if (problems) {
-+ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-+ PRINTF(("Problem %d: index %d code %08x.\n", i,
-+ problems->aProblem [i].ulIndex,
-+ problems->aProblem [i].scode));
-+ }
-+ }
-+ mLastError = object->SaveChanges(0) ;
-+ if (HR_FAILED(mLastError)) {
-+ PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-+ }
-+ return HR_SUCCEEDED(mLastError) ;
-+ }
-+
-+ BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-+ {
-+ LPENTRYID entryId = NULL;
-+ ULONG byteCount = 0;
-+
-+ mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
-+ if (HR_FAILED(mLastError)){
-+ PRINTF(("Cannot get PAB %08x.\n", mLastError));
-+ return FALSE;
-+ }
-+ aContainer.Assign(byteCount, entryId);
-+ FreeBuffer(entryId) ;
-+ return TRUE ;
-+ }
-+
-+ BOOL nsWabAddressBook::IsOK(void)
-+ {
-+ return mAddressBook != NULL ;
-+ }
-+
- BOOL nsWabAddressBook::Initialize(void)
- {
- nsAutoLock guard(mMutex) ;
-
- if (!LoadWabLibrary()) {
-*** misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h Fri Sep 28 22:06:25 2001
---- misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h Tue Jan 15 13:34:35 2008
-***************
-*** 47,52 ****
---- 47,61 ----
- nsWabAddressBook(void) ;
- virtual ~nsWabAddressBook(void) ;
-
-+ // Get the top address books
-+ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-+
-+ // Get a default address book container
-+ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-+ // Is the helper correctly initialised?
-+ virtual BOOL IsOK(void);
-+ static void FreeWabLibrary(void) ;
-+
- protected :
- // Session and address book that will be shared by all instances
- // (see nsMapiAddressBook.h for details)
-***************
-*** 57,71 ****
- static HMODULE mLibrary ;
- static LPWABOPEN mWABOpen ;
-
- // Load the WAB environment
- BOOL Initialize(void) ;
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Manage the library
- static BOOL LoadWabLibrary(void) ;
-- static void FreeWabLibrary(void) ;
-
- private :
- } ;
---- 66,111 ----
- static HMODULE mLibrary ;
- static LPWABOPEN mWABOpen ;
-
-+ LPADRBOOK mAddressBook ;
-+
- // Load the WAB environment
- BOOL Initialize(void) ;
-+
-+ virtual HRESULT OpenEntry(ULONG cbEntryID,
-+ LPENTRYID lpEntryID,
-+ LPCIID lpInterface,
-+ ULONG ulFlags,
-+ ULONG FAR * lpulObjType,
-+ LPUNKNOWN FAR * lppUnk
-+ )
-+ {
-+ return mAddressBook->OpenEntry(cbEntryID,
-+ lpEntryID,
-+ lpInterface,
-+ ulFlags,
-+ lpulObjType,
-+ lppUnk
-+ );
-+ }
-+
-+
-+ // Retrieve the contents of a container, with an optional restriction
-+ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+ nsMapiEntryArray *aList, ULONG aMapiType) ;
-+ // Retrieve the values of a set of properties on a MAPI object
-+ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-+ ULONG aNbProperties,
-+ LPSPropValue& aValues, ULONG& aValueCount) ;
-+ // Set the values of a set of properties on a MAPI object
-+ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
-+ LPSPropValue& aValues) ;
-+
- // Allocation of a buffer for transmission to interfaces
- virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
- // Destruction of a buffer provided by the interfaces
- virtual void FreeBuffer(LPVOID aBuffer) ;
- // Manage the library
- static BOOL LoadWabLibrary(void) ;
-
- private :
- } ;
-*** misc/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp Mon Feb 9 23:48:47 2004
---- misc/build/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp Tue Jan 15 13:34:35 2008
-***************
-*** 713,720 ****
---- 713,725 ----
-
- if (mUseWideCharBiffIcon)
- {
-+ #ifdef __MINGW32__
-+ ::wcsncpy( mWideBiffIconData.szTip, NS_REINTERPRET_CAST(LPCWSTR, aToolTipString), toolTipBufSize);
-+ if (wcslen(NS_REINTERPRET_CAST(LPCWSTR, aToolTipString)) >= toolTipBufSize)
-+ #else
- ::wcsncpy( mWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
- if (wcslen(aToolTipString) >= toolTipBufSize)
-+ #endif
- mWideBiffIconData.szTip[toolTipBufSize - 1] = 0;
- }
- else
-***************
-*** 754,760 ****
---- 759,769 ----
- // now we need to copy over any left over tool tip strings
- if (mWideBiffIconData.szTip)
- {
-+ #ifdef __MINGW32__
-+ const PRUnichar * oldTooltipString = reinterpret_cast<PRUnichar*>(mWideBiffIconData.szTip);
-+ #else
- const PRUnichar * oldTooltipString = mWideBiffIconData.szTip;
-+ #endif
- SetToolTipStringOnIconData(oldTooltipString);
- }
- }
-***************
-*** 954,960 ****
---- 963,973 ----
- registryUnreadMailCountKey,
- sizeof(registryUnreadMailCountKey))))
- {
-+ #ifdef __MINGW32__
-+ if (wcscmp(registryUnreadMailCountKey, NS_REINTERPRET_CAST(LPCWSTR, currentUnreadMailCountKey.get()))==0) {
-+ #else
- if (wcscmp(registryUnreadMailCountKey, currentUnreadMailCountKey.get())==0) {
-+ #endif
- nsAutoString deleteKey;
- deleteKey.Assign(NS_LITERAL_STRING(UNREADMAILNODEKEY).get());
- deleteKey.Append(currentUnreadMailCountKey.get());
-***************
-*** 1016,1024 ****
---- 1029,1043 ----
- }
-
- // Write the info into the registry
-+ #ifdef __MINGW32__
-+ HRESULT hr = mSHSetUnreadMailCount(NS_REINTERPRET_CAST(LPCWSTR, pBuffer.get()),
-+ mCurrentUnreadCount,
-+ NS_REINTERPRET_CAST(LPCWSTR, commandLinerForAppLaunch.get()));
-+ #else
- HRESULT hr = mSHSetUnreadMailCount(pBuffer.get(),
- mCurrentUnreadCount,
- commandLinerForAppLaunch.get());
-+ #endif
- }
-
- // do this last
-*** misc/mozilla/mailnews/mime/src/mimeeobj.h Fri Sep 28 22:07:42 2001
---- misc/build/mozilla/mailnews/mime/src/mimeeobj.h Tue Jan 15 13:34:35 2008
-***************
-*** 54,60 ****
- MimeLeafClass leaf;
- };
-
-! extern MimeExternalObjectClass mimeExternalObjectClass;
-
- struct MimeExternalObject {
- MimeLeaf leaf;
---- 54,60 ----
- MimeLeafClass leaf;
- };
-
-! extern "C" MimeExternalObjectClass mimeExternalObjectClass;
-
- struct MimeExternalObject {
- MimeLeaf leaf;
-*** misc/mozilla/modules/libpref/src/Makefile.in Fri Jan 16 20:22:37 2004
---- misc/build/mozilla/modules/libpref/src/Makefile.in Tue Jan 15 13:34:35 2008
-***************
-*** 78,84 ****
- PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
- endif
-
-! EXTRA_DSO_LDOPTS = \
- $(LIBS_DIR) \
- $(MOZ_JS_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
---- 78,84 ----
- PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
- endif
-
-! EXTRA_DSO_LDOPTS += \
- $(LIBS_DIR) \
- $(MOZ_JS_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
-***************
-*** 89,91 ****
---- 89,92 ----
- GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, \
- all.js mailnews.js editor.js \
- aix.js beos.js unix.js winpref.js os2prefs.js openvms.js photon.js)
-+
-*** misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp Thu Sep 2 01:45:24 2004
---- misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp Tue Jan 15 13:34:35 2008
-***************
-*** 834,841 ****
- void
- nsHttpConnectionMgr::OnMsgUpdateParam(nsresult status, void *param)
- {
-! PRUint16 name = (PRUint32(param) & 0xFFFF0000) >> 16;
-! PRUint16 value = PRUint32(param) & 0x0000FFFF;
-
- switch (name) {
- case MAX_CONNECTIONS:
---- 834,841 ----
- void
- nsHttpConnectionMgr::OnMsgUpdateParam(nsresult status, void *param)
- {
-! PRUint16 name = (NS_PTR_TO_INT32(param) & 0xFFFF0000) >> 16;
-! PRUint16 value = NS_PTR_TO_INT32(param) & 0x0000FFFF;
-
- switch (name) {
- case MAX_CONNECTIONS:
-*** misc/mozilla/nsprpub/build/cygwin-wrapper Thu Apr 3 01:22:38 2003
---- misc/build/mozilla/nsprpub/build/cygwin-wrapper Tue Jan 15 13:34:35 2008
-***************
-*** 1,4 ****
-! #!/bin/sh
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
---- 1,4 ----
-! #!/bin/bash
- #
- # Stupid wrapper to avoid win32 dospath/cygdrive issues
- #
-***************
-*** 18,23 ****
- shift
- args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
- else
-! args=`echo $* | sed -e "s|${mountpoint}/\([a-zA-Z]\)/|\1:/|g;"`
- fi
- exec $prog $args
---- 18,57 ----
- shift
- args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
- else
-! for i in "${@}"
-! do
-! # The original version missed mounted paths, the new version below
-! # doesn't transform /para as this is most likely a parameter.
-! eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-! if ! test "$notinpath" = "$i"; then
-! # found $mountpoint
-! eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
-! eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
-! driveletter=${withdrive%%/*}
-! i=${notinpath}${driveletter}:/${restpath}
-! else
-! # check for potential path. Precheck using shell methods
-! doconvert=""
-! # Shortcut -X<path> when path does not begin with '/'
-! noswitch=${i#-[a-zA-Z]}
-! if test "$noswitch" != "$i"; then
-! test "${noswitch#/}" != "$noswitch" && doconvert="1"
-! fi
-! # Precheck for possible path. Consider only absolute paths that contain at least
-! # a second / to prevent converting of /abc parameters.
-! test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
-! if test -n "$doconvert"; then
-! # Can be a path. If forking grep would be faster or we could require bash 3
-! # this regexp would be all that's needed to find pathnames that need converting
-! pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
-! eval 'notinpath=${i%'${pathname}'}'
-! if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
-! pathname=`cygpath -am "$pathname"`
-! i=${notinpath}${pathname}
-! fi
-! fi
-! fi
-! args="${args} ${i}"
-! done
- fi
- exec $prog $args
-*** misc/mozilla/nsprpub/config/autoconf.mk.in Sat Mar 22 16:28:52 2003
---- misc/build/mozilla/nsprpub/config/autoconf.mk.in Tue Jan 15 13:34:35 2008
-***************
-*** 22,27 ****
---- 22,28 ----
- RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
- OBJDIR_NAME = @OBJDIR_NAME@
- OBJDIR = @OBJDIR@
-+ LIB_PREFIX = @LIB_PREFIX@
- OBJ_SUFFIX = @OBJ_SUFFIX@
- LIB_SUFFIX = @LIB_SUFFIX@
- DLL_SUFFIX = @DLL_SUFFIX@
-*** misc/mozilla/nsprpub/config/rules.mk Tue Sep 16 04:00:28 2003
---- misc/build/mozilla/nsprpub/config/rules.mk Tue Jan 15 13:34:35 2008
-***************
-*** 101,119 ****
- ifdef LIBRARY_NAME
- ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
-
-! #
-! # Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
-! # other platforms do not.
-! #
-! ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
-! LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
- SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-! IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
-! else
-! LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
-! SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-! IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
-! endif
-
- else
-
---- 101,109 ----
- ifdef LIBRARY_NAME
- ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
-
-! LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
- SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-! IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
-
- else
-
-*** misc/mozilla/nsprpub/configure Tue Sep 14 23:14:38 2004
---- misc/build/mozilla/nsprpub/configure Tue Jan 15 13:34:35 2008
-***************
-*** 2724,2729 ****
---- 2724,2730 ----
- LIB_SUFFIX=a
- DLL_SUFFIX=so
- ASM_SUFFIX=s
-+ LIB_PREFIX=lib
- MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
- PR_MD_ASFILES=
- PR_MD_CSRCS=
-***************
-*** 3407,3413 ****
- EOF
-
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
---- 3408,3414 ----
- EOF
-
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
-***************
-*** 3861,3867 ****
- CC="$CC -mno-cygwin"
- CXX="$CXX -mno-cygwin"
- DLL_SUFFIX=dll
-! MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
- RC=$WINDRES
- # Use temp file for windres (bug 213281)
- RCFLAGS='-O coff --use-temp-file'
---- 3862,3868 ----
- CC="$CC -mno-cygwin"
- CXX="$CXX -mno-cygwin"
- DLL_SUFFIX=dll
-! MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
- RC=$WINDRES
- # Use temp file for windres (bug 213281)
- RCFLAGS='-O coff --use-temp-file'
-***************
-*** 3878,3883 ****
---- 3879,3885 ----
- OBJ_SUFFIX=obj
- LIB_SUFFIX=lib
- DLL_SUFFIX=dll
-+ LIB_PREFIX=
-
- CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
-
-***************
-*** 5634,5639 ****
---- 5636,5642 ----
- CC="\$(CYGWIN_WRAPPER) $CC"
- CXX="\$(CYGWIN_WRAPPER) $CXX"
- RC="\$(CYGWIN_WRAPPER) $RC"
-+ LD="\$(CYGWIN_WRAPPER) $LD"
- ;;
- esac
-
-***************
-*** 6004,6009 ****
---- 6007,6013 ----
- s%@LIB_SUFFIX@%$LIB_SUFFIX%g
- s%@DLL_SUFFIX@%$DLL_SUFFIX%g
- s%@ASM_SUFFIX@%$ASM_SUFFIX%g
-+ s%@LIB_PREFIX@%$LIB_PREFIX%g
- s%@MKSHLIB@%$MKSHLIB%g
- s%@DSO_CFLAGS@%$DSO_CFLAGS%g
- s%@DSO_LDOPTS@%$DSO_LDOPTS%g
-*** misc/mozilla/nsprpub/configure.in Tue Sep 14 23:14:38 2004
---- misc/build/mozilla/nsprpub/configure.in Tue Jan 15 13:34:36 2008
-***************
-*** 922,928 ****
- AC_DEFINE(HAVE_BSD_FLOCK)
- AC_DEFINE(HAVE_SOCKLEN_T)
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
---- 922,928 ----
- AC_DEFINE(HAVE_BSD_FLOCK)
- AC_DEFINE(HAVE_SOCKLEN_T)
- CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-! MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
- if test "$MOZ_OBJFORMAT" = "elf"; then
- DLL_SUFFIX=so
- else
-*** misc/mozilla/nsprpub/lib/ds/Makefile.in Wed Apr 9 23:49:32 2003
---- misc/build/mozilla/nsprpub/lib/ds/Makefile.in Tue Jan 15 13:34:36 2008
-***************
-*** 80,97 ****
- OS_LIBS = -lc
- endif
-
- ifeq ($(OS_ARCH),SunOS)
- OS_LIBS = -lc
- MAPFILE = $(OBJDIR)/pldsmap.sun
- GARBAGE += $(MAPFILE)
- ifdef NS_USE_GCC
- ifdef GCC_USE_GNU_LD
-! MKSHLIB += -Wl,--version-script,$(MAPFILE)
- else
-! MKSHLIB += -Wl,-M,$(MAPFILE)
- endif
- else
-! MKSHLIB += -M $(MAPFILE)
- endif
- endif
-
---- 80,101 ----
- OS_LIBS = -lc
- endif
-
-+ ifeq ($(OS_ARCH),Linux)
-+ MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ endif
-+
- ifeq ($(OS_ARCH),SunOS)
- OS_LIBS = -lc
- MAPFILE = $(OBJDIR)/pldsmap.sun
- GARBAGE += $(MAPFILE)
- ifdef NS_USE_GCC
- ifdef GCC_USE_GNU_LD
-! MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
- else
-! MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
- endif
- else
-! MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
- endif
- endif
-
-*** misc/mozilla/nsprpub/lib/libc/src/Makefile.in Wed Apr 9 23:49:35 2003
---- misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in Tue Jan 15 13:34:36 2008
-***************
-*** 90,107 ****
- OS_LIBS = -lc
- endif
-
- ifeq ($(OS_ARCH),SunOS)
- OS_LIBS = -lc
- MAPFILE = $(OBJDIR)/plcmap.sun
- GARBAGE += $(MAPFILE)
- ifdef NS_USE_GCC
- ifdef GCC_USE_GNU_LD
-! MKSHLIB += -Wl,--version-script,$(MAPFILE)
- else
-! MKSHLIB += -Wl,-M,$(MAPFILE)
- endif
- else
-! MKSHLIB += -M $(MAPFILE)
- endif
- endif
-
---- 90,111 ----
- OS_LIBS = -lc
- endif
-
-+ ifeq ($(OS_ARCH),Linux)
-+ MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ endif
-+
- ifeq ($(OS_ARCH),SunOS)
- OS_LIBS = -lc
- MAPFILE = $(OBJDIR)/plcmap.sun
- GARBAGE += $(MAPFILE)
- ifdef NS_USE_GCC
- ifdef GCC_USE_GNU_LD
-! MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
- else
-! MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
- endif
- else
-! MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
- endif
- endif
-
-*** misc/mozilla/nsprpub/pr/include/prtypes.h Tue Sep 16 22:30:38 2003
---- misc/build/mozilla/nsprpub/pr/include/prtypes.h Tue Jan 15 13:34:36 2008
-***************
-*** 450,456 ****
- */
- #ifndef __PRUNICHAR__
- #define __PRUNICHAR__
-! #if defined(WIN32) || defined(XP_MAC)
- typedef wchar_t PRUnichar;
- #else
- typedef PRUint16 PRUnichar;
---- 450,456 ----
- */
- #ifndef __PRUNICHAR__
- #define __PRUNICHAR__
-! #if !defined(__MINGW32__) && (defined(WIN32) || defined(XP_MAC))
- typedef wchar_t PRUnichar;
- #else
- typedef PRUint16 PRUnichar;
-*** misc/mozilla/nsprpub/pr/src/misc/prnetdb.c Thu Sep 2 01:44:37 2004
---- misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c Tue Jan 15 13:34:36 2008
-***************
-*** 105,111 ****
- #define _PR_HAVE_GETPROTO_R_INT
- #endif
-
-! #if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
- #define _PR_HAVE_GETPROTO_R
- #define _PR_HAVE_5_ARG_GETPROTO_R
- #endif
---- 105,112 ----
- #define _PR_HAVE_GETPROTO_R_INT
- #endif
-
-! #if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
-! (defined(__FreeBSD__) && __FreeBSD_version > 601103)
- #define _PR_HAVE_GETPROTO_R
- #define _PR_HAVE_5_ARG_GETPROTO_R
- #endif
-*** misc/mozilla/profile/src/nsProfile.cpp Sat Apr 24 19:15:40 2004
---- misc/build/mozilla/profile/src/nsProfile.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 37,43 ****
---- 37,45 ----
-
- #include "nscore.h"
- #include "nsProfile.h"
-+ #ifdef MOZ_PROFILELOCKING
- #include "nsProfileLock.h"
-+ #endif
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
-
-***************
-*** 499,510 ****
---- 501,514 ----
- profileURLStr = PROFILE_MANAGER_URL;
- if (exists)
- {
-+ #ifdef MOZ_PROFILELOCKING
- // If the profile is locked, we need the UI
- nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(curProfileDir));
- nsProfileLock tempLock;
- rv = tempLock.Lock(localFile);
- if (NS_FAILED(rv))
- profileURLStr = PROFILE_MANAGER_URL;
-+ #endif
- }
- }
- else
-***************
-*** 1173,1179 ****
- }
- else
- isSwitch = PR_FALSE;
-!
- nsProfileLock localLock;
- nsCOMPtr<nsILocalFile> localProfileDir(do_QueryInterface(profileDir, &rv));
- if (NS_FAILED(rv)) return rv;
---- 1177,1183 ----
- }
- else
- isSwitch = PR_FALSE;
-! #ifdef MOZ_PROFILELOCKING
- nsProfileLock localLock;
- nsCOMPtr<nsILocalFile> localProfileDir(do_QueryInterface(profileDir, &rv));
- if (NS_FAILED(rv)) return rv;
-***************
-*** 1183,1189 ****
- NS_ERROR("Could not get profile directory lock.");
- return rv;
- }
-!
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
---- 1187,1193 ----
- NS_ERROR("Could not get profile directory lock.");
- return rv;
- }
-! #endif
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-***************
-*** 1237,1244 ****
---- 1241,1250 ----
- UpdateCurrentProfileModTime(PR_FALSE);
- }
-
-+ #ifdef MOZ_PROFILELOCKING
- // Do the profile switch
- localLock.Unlock(); // gDirServiceProvider will get and hold its own lock
-+ #endif
- gDirServiceProvider->SetProfileDir(profileDir);
- mCurrentProfileName.Assign(aCurrentProfile);
- gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
-*** misc/mozilla/security/coreconf/FreeBSD.mk Thu Mar 27 02:17:25 2003
---- misc/build/mozilla/security/coreconf/FreeBSD.mk Tue Jan 15 13:34:36 2008
-***************
-*** 63,69 ****
-
- ARCH = freebsd
-
-! MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
-
- ifeq ($(MOZ_OBJFORMAT),elf)
- DLL_SUFFIX = so
---- 63,69 ----
-
- ARCH = freebsd
-
-! MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
-
- ifeq ($(MOZ_OBJFORMAT),elf)
- DLL_SUFFIX = so
-*** misc/mozilla/security/coreconf/Linux.mk Wed Feb 11 03:33:51 2004
---- misc/build/mozilla/security/coreconf/Linux.mk Tue Jan 15 13:34:36 2008
-***************
-*** 54,59 ****
---- 54,66 ----
- OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
- CPU_ARCH = m68k
- else
-+ ifeq ($(OS_TEST),ppc64)
-+ OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
-+ CPU_ARCH = ppc
-+ ifeq ($(USE_64),1)
-+ ARCHFLAG = -m64
-+ endif
-+ else
- ifeq ($(OS_TEST),ppc)
- OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
- CPU_ARCH = ppc
-***************
-*** 117,129 ****
- endif
- endif
- endif
-
-
- LIBC_TAG = _glibc
-
- ifeq ($(OS_RELEASE),2.0)
- OS_REL_CFLAGS += -DLINUX2_0
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 124,137 ----
- endif
- endif
- endif
-+ endif
-
-
- LIBC_TAG = _glibc
-
- ifeq ($(OS_RELEASE),2.0)
- OS_REL_CFLAGS += -DLINUX2_0
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-***************
-*** 138,144 ****
- OS_PTHREAD = -lpthread
- endif
-
-! OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe -DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR
- OS_LIBS = -L/lib $(OS_PTHREAD) -ldl -lc
-
- ifdef USE_PTHREADS
---- 146,152 ----
- OS_PTHREAD = -lpthread
- endif
-
-! OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -ansi -Wall -pipe -DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR
- OS_LIBS = -L/lib $(OS_PTHREAD) -ldl -lc
-
- ifdef USE_PTHREADS
-***************
-*** 148,154 ****
- ARCH = linux
-
- DSO_CFLAGS = -fPIC
-! DSO_LDOPTS = -shared
- DSO_LDFLAGS =
-
- # INCLUDES += -I/usr/include -Y/usr/include/linux
---- 156,163 ----
- ARCH = linux
-
- DSO_CFLAGS = -fPIC
-! DSO_LDOPTS = -shared $(ARCHFLAG)
-! DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
- DSO_LDFLAGS =
-
- # INCLUDES += -I/usr/include -Y/usr/include/linux
-*** misc/mozilla/security/coreconf/Linux2.1.mk Wed Nov 7 21:58:09 2001
---- misc/build/mozilla/security/coreconf/Linux2.1.mk Tue Jan 15 13:34:36 2008
-***************
-*** 36,42 ****
- include $(CORE_DEPTH)/coreconf/Linux.mk
- ifeq ($(OS_RELEASE),2.1)
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 36,42 ----
- include $(CORE_DEPTH)/coreconf/Linux.mk
- ifeq ($(OS_RELEASE),2.1)
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-*** misc/mozilla/security/coreconf/Linux2.2.mk Wed Nov 7 21:56:18 2001
---- misc/build/mozilla/security/coreconf/Linux2.2.mk Tue Jan 15 13:34:36 2008
-***************
-*** 36,42 ****
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 36,42 ----
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-*** misc/mozilla/security/coreconf/Linux2.4.mk Wed Nov 7 21:56:18 2001
---- misc/build/mozilla/security/coreconf/Linux2.4.mk Tue Jan 15 13:34:36 2008
-***************
-*** 36,42 ****
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 36,42 ----
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-*** misc/mozilla/security/coreconf/Linux2.5.mk Sun Jan 27 01:45:37 2002
---- misc/build/mozilla/security/coreconf/Linux2.5.mk Tue Jan 15 13:34:36 2008
-***************
-*** 36,42 ****
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 36,42 ----
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-*** misc/mozilla/security/coreconf/Linux2.6.mk Sat Jul 19 23:21:50 2003
---- misc/build/mozilla/security/coreconf/Linux2.6.mk Tue Jan 15 13:34:36 2008
-***************
-*** 36,42 ****
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
---- 36,42 ----
- include $(CORE_DEPTH)/coreconf/Linux.mk
-
- OS_REL_CFLAGS += -DLINUX2_1
-! MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
- ifdef BUILD_OPT
- OPTIMIZER = -O2
- endif
-*** misc/mozilla/security/coreconf/SunOS5.mk Sat Oct 16 01:52:29 2004
---- misc/build/mozilla/security/coreconf/SunOS5.mk Tue Jan 15 13:34:36 2008
-***************
-*** 164,175 ****
---- 164,177 ----
-
- # ld options:
- # -G: produce a shared object
-+ # -R '$ORIGIN': search for dependencies in same directory
- # -z defs: no unresolved symbols allowed
- ifdef NS_USE_GCC
- ifeq ($(USE_64), 1)
- DSO_LDOPTS += -m64
- endif
- DSO_LDOPTS += -shared -h $(notdir $@)
-+ DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
- else
- ifeq ($(USE_64), 1)
- ifeq ($(OS_TEST),i86pc)
-***************
-*** 179,184 ****
---- 181,187 ----
- endif
- endif
- DSO_LDOPTS += -G -h $(notdir $@)
-+ DSO_LDOPTS += -R '$$ORIGIN'
- endif
-
- # -KPIC generates position independent code for use in shared libraries.
-*** misc/mozilla/security/coreconf/WIN32.mk Tue Sep 14 23:14:39 2004
---- misc/build/mozilla/security/coreconf/WIN32.mk Tue Jan 15 13:34:36 2008
-***************
-*** 39,62 ****
- DEFAULT_COMPILER = cl
-
- ifdef NS_USE_GCC
-! CC = gcc
-! CCC = g++
-! LINK = ld
-! AR = ar
- AR += cr $@
-! RANLIB = ranlib
- BSDECHO = echo
-! RC = windres.exe -O coff --use-temp-file
-! LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
- else
-! CC = cl
-! CCC = cl
-! LINK = link
-! AR = lib
- AR += -NOLOGO -OUT:"$@"
- RANLIB = echo
- BSDECHO = echo
-! RC = rc.exe
- endif
-
- ifdef BUILD_TREE
---- 39,62 ----
- DEFAULT_COMPILER = cl
-
- ifdef NS_USE_GCC
-! CC = $(CYGWIN_WRAPPER) gcc
-! CCC = $(CYGWIN_WRAPPER) g++
-! LINK = $(CYGWIN_WRAPPER) ld
-! AR = $(CYGWIN_WRAPPER) ar
- AR += cr $@
-! RANLIB = $(CYGWIN_WRAPPER) ranlib
- BSDECHO = echo
-! RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
-! LINK_DLL =$(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
- else
-! CC = $(CYGWIN_WRAPPER) cl
-! CCC = $(CYGWIN_WRAPPER) cl
-! LINK = $(CYGWIN_WRAPPER) link
-! AR = $(CYGWIN_WRAPPER) lib
- AR += -NOLOGO -OUT:"$@"
- RANLIB = echo
- BSDECHO = echo
-! RC = $(CYGWIN_WRAPPER) rc.exe
- endif
-
- ifdef BUILD_TREE
-***************
-*** 64,70 ****
- else
- NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
- endif
-! NSINSTALL = nsinstall
-
- MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
- MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
---- 64,70 ----
- else
- NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
- endif
-! NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
-
- MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
- MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
-***************
-*** 87,93 ****
- ifdef NS_USE_GCC
- OS_CFLAGS += -mno-cygwin -mms-bitfields
- _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
-! DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
- ifdef BUILD_OPT
- OPTIMIZER += -O2
- DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
---- 87,93 ----
- ifdef NS_USE_GCC
- OS_CFLAGS += -mno-cygwin -mms-bitfields
- _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
-! DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
- ifdef BUILD_OPT
- OPTIMIZER += -O2
- DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
-*** misc/mozilla/security/coreconf/WIN954.0.mk Sat Oct 16 01:52:29 2004
---- misc/build/mozilla/security/coreconf/WIN954.0.mk Tue Jan 15 13:34:36 2008
-***************
-*** 64,66 ****
---- 64,70 ----
- endif
- endif
- DEFINES += -DWIN95
-+
-+ ifdef NS_USE_GCC
-+ NSPR31_LIB_PREFIX = lib
-+ endif
-*** misc/mozilla/security/coreconf/command.mk Fri Feb 15 23:53:12 2002
---- misc/build/mozilla/security/coreconf/command.mk Tue Jan 15 13:34:36 2008
-***************
-*** 42,48 ****
- LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
- LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
- NFSPWD = $(NSINSTALL_DIR)/nfspwd
-! CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
- $(XCFLAGS)
- RANLIB = echo
- TAR = /bin/tar
---- 42,48 ----
- LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
- LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
- NFSPWD = $(NSINSTALL_DIR)/nfspwd
-! CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
- $(XCFLAGS)
- RANLIB = echo
- TAR = /bin/tar
-*** misc/mozilla/security/coreconf/rules.mk Tue Mar 23 01:56:47 2004
---- misc/build/mozilla/security/coreconf/rules.mk Tue Jan 15 13:34:36 2008
-***************
-*** 286,292 ****
- $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
- @$(MAKE_OBJDIR)
- ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
-! $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
- else
- ifdef XP_OS2_VACPP
- $(MKPROG) -Fe$@ $(CFLAGS) $(OBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
---- 286,292 ----
- $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
- @$(MAKE_OBJDIR)
- ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
-! $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
- else
- ifdef XP_OS2_VACPP
- $(MKPROG) -Fe$@ $(CFLAGS) $(OBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
-***************
-*** 301,311 ****
- $(LIBRARY): $(OBJS)
- @$(MAKE_OBJDIR)
- rm -f $@
-- ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
-- $(AR) $(subst /,\\,$(OBJS))
-- else
- $(AR) $(OBJS)
-- endif
- $(RANLIB) $@
-
-
---- 301,307 ----
-***************
-*** 340,346 ****
- ifdef NS_USE_GCC
- $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
- else
-! $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
- endif
- else
- ifdef XP_OS2_VACPP
---- 336,342 ----
- ifdef NS_USE_GCC
- $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
- else
-! $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
- endif
- else
- ifdef XP_OS2_VACPP
-***************
-*** 406,423 ****
- endif
-
- ifdef NEED_ABSOLUTE_PATH
-! abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
- else
-! abspath = $(1)
- endif
-
- $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
- @$(MAKE_OBJDIR)
- ifdef USE_NT_C_SYNTAX
-! $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
- else
- $(CC) -o $@ -c $(CFLAGS) $<
- endif
---- 402,419 ----
- endif
-
- ifdef NEED_ABSOLUTE_PATH
-! mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
- else
-! mozabspath = $(1)
- endif
-
- $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
- @$(MAKE_OBJDIR)
- ifdef USE_NT_C_SYNTAX
-! $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- $(CC) -o $@ -c $(CFLAGS) $<
- endif
-***************
-*** 425,434 ****
-
- $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
- ifdef USE_NT_C_SYNTAX
-! $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
- else
- $(CC) -o $@ -c $(CFLAGS) $<
- endif
---- 421,430 ----
-
- $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
- ifdef USE_NT_C_SYNTAX
-! $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- $(CC) -o $@ -c $(CFLAGS) $<
- endif
-***************
-*** 457,466 ****
- $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
- @$(MAKE_OBJDIR)
- ifdef USE_NT_C_SYNTAX
-! $(CCC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CCC) -o $@ -c $(CFLAGS) $(call abspath,$<)
- else
- $(CCC) -o $@ -c $(CFLAGS) $<
- endif
---- 453,462 ----
- $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
- @$(MAKE_OBJDIR)
- ifdef USE_NT_C_SYNTAX
-! $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- $(CCC) -o $@ -c $(CFLAGS) $<
- endif
-***************
-*** 481,490 ****
- rm -f $(OBJDIR)/t_$*.cc
- else
- ifdef USE_NT_C_SYNTAX
-! $(CCC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CCC) -o $@ -c $(CFLAGS) $(call abspath,$<)
- else
- $(CCC) -o $@ -c $(CFLAGS) $<
- endif
---- 477,486 ----
- rm -f $(OBJDIR)/t_$*.cc
- else
- ifdef USE_NT_C_SYNTAX
-! $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- ifdef NEED_ABSOLUTE_PATH
-! $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
- else
- $(CCC) -o $@ -c $(CFLAGS) $<
- endif
-*** misc/mozilla/security/manager/Makefile.in Tue Mar 23 05:15:56 2004
---- misc/build/mozilla/security/manager/Makefile.in Tue Jan 15 13:34:36 2008
-***************
-*** 89,94 ****
---- 89,95 ----
- endif
- ifeq ($(OS_ARCH),WINNT)
- DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
-+ DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
- ifdef MOZ_DEBUG
- ifndef MOZ_NO_DEBUG_RTL
- DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
-*** misc/mozilla/security/nss/cmd/shlibsign/Makefile Wed Apr 16 00:42:09 2003
---- misc/build/mozilla/security/nss/cmd/shlibsign/Makefile Tue Jan 15 13:34:36 2008
-***************
-*** 103,109 ****
---- 103,113 ----
- ifeq ($(OS_TARGET), OS2)
- @cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $<
- else
-+ ifeq ($(OS_TARGET), WIN95)
-+ @sh $(CYGWIN_WRAPPER) ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $<
-+ else
- @sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $<
-+ endif
- endif
-
- libs install :: $(CHECKLOC)
-*** misc/mozilla/security/nss/lib/ckfw/builtins/config.mk Sat Oct 16 01:52:32 2004
---- misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk Tue Jan 15 13:34:36 2008
-***************
-*** 59,67 ****
- DSO_LDOPTS = -bundle
- endif
-
-- ifeq ($(OS_TARGET),SunOS)
-- # The -R '$ORIGIN' linker option instructs this library to search for its
-- # dependencies in the same directory where it resides.
-- MKSHLIB += -R '$$ORIGIN'
-- endif
-
---- 59,62 ----
-*** misc/mozilla/security/nss/lib/freebl/Makefile Sat Oct 16 01:52:33 2004
---- misc/build/mozilla/security/nss/lib/freebl/Makefile Tue Jan 15 13:34:36 2008
-***************
-*** 179,189 ****
-
- # Note: -xarch=v8 or v9 is now done in coreconf
- ifeq ($(OS_TARGET),SunOS)
--
-- # The -R '$ORIGIN' linker option instructs this library to search for its
-- # dependencies in the same directory where it resides.
-- MKSHLIB += -R '$$ORIGIN'
--
- ifeq ($(CPU_ARCH),sparc)
- ifndef NS_USE_GCC
- ifdef USE_HYBRID
---- 179,184 ----
-***************
-*** 199,205 ****
- MKSHLIB += -Wl,-B,symbolic,-z,defs,-z,now,-z,text,-M,mapfile.Solaris
- endif # GCC_USE_GNU_LD
- else
-! MKSHLIB += -B symbolic -z defs -z now -z text -M mapfile.Solaris
- endif # NS_USE_GCC
- ifdef USE_PURE_32
- # this builds for Sparc v8 pure 32-bit architecture
---- 194,200 ----
- MKSHLIB += -Wl,-B,symbolic,-z,defs,-z,now,-z,text,-M,mapfile.Solaris
- endif # GCC_USE_GNU_LD
- else
-! MKSHLIB += -z defs -z now -z text -M mapfile.Solaris
- endif # NS_USE_GCC
- ifdef USE_PURE_32
- # this builds for Sparc v8 pure 32-bit architecture
-*** misc/mozilla/security/nss/lib/nss/config.mk Sat Oct 16 01:52:33 2004
---- misc/build/mozilla/security/nss/lib/nss/config.mk Tue Jan 15 13:34:36 2008
-***************
-*** 107,120 ****
- # The -R '$ORIGIN' linker option instructs this library to search for its
- # dependencies in the same directory where it resides.
- ifeq ($(USE_64), 1)
-! MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/sparcv9:/usr/lib/mps/sparcv9'
- else
-! MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
-! endif
-! else
-! MKSHLIB += -R '$$ORIGIN'
-! endif
-! endif
-
-
- ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
---- 107,118 ----
- # The -R '$ORIGIN' linker option instructs this library to search for its
- # dependencies in the same directory where it resides.
- ifeq ($(USE_64), 1)
-! DSO_LDOPTS += -R /usr/lib/mps/secv1/sparcv9:/usr/lib/mps/sparcv9
- else
-! DSO_LDOPTS += -R /usr/lib/mps/secv1:/usr/lib/mps
-! endif # USE_64
-! endif # BUILD_SUN_PKG
-! endif # SunOS
-
-
- ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
-*** misc/mozilla/security/nss/lib/nss/nss.def Sat Oct 16 01:52:33 2004
---- misc/build/mozilla/security/nss/lib/nss/nss.def Tue Jan 15 13:34:36 2008
-***************
-*** 60,65 ****
---- 60,66 ----
- CERT_CheckCertValidTimes;
- CERT_CreateCertificateRequest;
- CERT_ChangeCertTrust;
-+ CERT_DecodeDERCertificate;
- CERT_DecodeDERCrl;
- CERT_DestroyCertificateRequest;
- CERT_DestroyCertList;
-*** misc/mozilla/security/nss/lib/pki1/oiddata.h Fri Jan 4 06:22:07 2002
---- misc/build/mozilla/security/nss/lib/pki1/oiddata.h Tue Jan 15 13:34:36 2008
-***************
-*** 39,49 ****
- static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$ $Name$ ; @(#) $RCSfile$ $Revision$ $Date$ $Name$";
- #endif /* DEBUG */
-
- #ifndef NSSPKI1T_H
- #include "nsspki1t.h"
- #endif /* NSSPKI1T_H */
-
-! extern const NSSOID nss_builtin_oids[];
- extern const PRUint32 nss_builtin_oid_count;
-
- /*extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];*/
---- 39,50 ----
- static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$ $Name$ ; @(#) $RCSfile$ $Revision$ $Date$ $Name$";
- #endif /* DEBUG */
-
-+ #include "pki1t.h"
- #ifndef NSSPKI1T_H
- #include "nsspki1t.h"
- #endif /* NSSPKI1T_H */
-
-! extern const NSSOID *nss_builtin_oids;
- extern const PRUint32 nss_builtin_oid_count;
-
- /*extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];*/
-*** misc/mozilla/security/nss/lib/smime/config.mk Sat Oct 16 01:52:34 2004
---- misc/build/mozilla/security/nss/lib/smime/config.mk Tue Jan 15 13:34:36 2008
-***************
-*** 85,94 ****
- ../pkcs12 \
- ../pkcs7 \
- $(NULL)
--
-- ifeq ($(OS_TARGET),SunOS)
-- # The -R '$ORIGIN' linker option instructs this library to search for its
-- # dependencies in the same directory where it resides.
-- MKSHLIB += -R '$$ORIGIN'
-- endif
--
---- 85,87 ----
-*** misc/mozilla/security/nss/lib/softoken/config.mk Sat Oct 16 01:52:35 2004
---- misc/build/mozilla/security/nss/lib/softoken/config.mk Tue Jan 15 13:34:36 2008
-***************
-*** 83,94 ****
- $(NULL)
- endif
-
-- ifeq ($(OS_TARGET),SunOS)
-- # The -R '$ORIGIN' linker option instructs this library to search for its
-- # dependencies in the same directory where it resides.
-- MKSHLIB += -R '$$ORIGIN'
-- endif
--
- ifeq ($(OS_TARGET),WINCE)
- DEFINES += -DDBM_USING_NSPR
- endif
---- 83,88 ----
-*** misc/mozilla/security/nss/lib/ssl/config.mk Sat Oct 16 01:52:35 2004
---- misc/build/mozilla/security/nss/lib/ssl/config.mk Tue Jan 15 13:34:36 2008
-***************
-*** 78,87 ****
- EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
- endif
-
-- ifeq ($(OS_TARGET),SunOS)
-- # The -R '$ORIGIN' linker option instructs this library to search for its
-- # dependencies in the same directory where it resides.
-- MKSHLIB += -R '$$ORIGIN'
-- endif
--
- endif
---- 78,81 ----
-*** misc/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp Wed Oct 20 18:26:10 2004
---- misc/build/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 171,183 ****
---- 171,191 ----
- }
-
- DWORD bufSz;
-+ #ifdef __MINGW32__
-+ LONG err = ::RegQueryValueExW( hKey, NS_REINTERPRET_CAST(LPCWSTR, pValueName), NULL, NULL, NULL, &bufSz);
-+ #else
- LONG err = ::RegQueryValueExW( hKey, pValueName, NULL, NULL, NULL, &bufSz);
-+ #endif
- if (err == ERROR_SUCCESS) {
- PRUnichar* pBytes = new PRUnichar[bufSz];
- if (!pBytes)
- return PR_FALSE;
-
-+ #ifdef __MINGW32__
-+ err = ::RegQueryValueExW( hKey, NS_REINTERPRET_CAST(LPCWSTR, pValueName), NULL, NULL, (BYTE*)pBytes, &bufSz);
-+ #else
- err = ::RegQueryValueExW( hKey, pValueName, NULL, NULL, (BYTE*)pBytes, &bufSz);
-+ #endif
- if (err != ERROR_SUCCESS) {
- delete [] pBytes;
- return PR_FALSE;
-***************
-*** 263,269 ****
---- 271,281 ----
- HKEY fileTypeKey = 0;
- LONG rc;
- if (mIsNT) {
-+ #ifdef __MINGW32__
-+ rc = ::RegOpenKeyExW( HKEY_CLASSES_ROOT, NS_REINTERPRET_CAST(LPCWSTR, fileType.get()), 0, KEY_QUERY_VALUE, &fileTypeKey );
-+ #else
- rc = ::RegOpenKeyExW( HKEY_CLASSES_ROOT, fileType.get(), 0, KEY_QUERY_VALUE, &fileTypeKey );
-+ #endif
- }
- else {
- nsCAutoString ansiKey;
-*** misc/mozilla/webshell/tests/viewer/Makefile.in Thu Apr 8 10:06:32 2004
---- misc/build/mozilla/webshell/tests/viewer/Makefile.in Tue Jan 15 13:34:36 2008
-***************
-*** 163,169 ****
- GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
-
- XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
-! XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
-
- EXTRA_DEPS = \
- $(XP_DIST_DEP_LIBS) \
---- 163,169 ----
- GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
-
- XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
-! XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
-
- EXTRA_DEPS = \
- $(XP_DIST_DEP_LIBS) \
-*** misc/mozilla/widget/src/gtk2/nsDragService.cpp Thu Oct 30 02:48:41 2003
---- misc/build/mozilla/widget/src/gtk2/nsDragService.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 838,844 ****
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- listTarget->target = g_strdup(gMimeListType);
- listTarget->flags = 0;
-! listTarget->info = (guint)listAtom;
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with id %ld\n",
- listTarget->target, listAtom));
---- 838,844 ----
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- listTarget->target = g_strdup(gMimeListType);
- listTarget->flags = 0;
-! listTarget->info = GPOINTER_TO_UINT(listAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with id %ld\n",
- listTarget->target, listAtom));
-***************
-*** 877,883 ****
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- listTarget->target = g_strdup(gTextUriListType);
- listTarget->flags = 0;
-! listTarget->info = (guint)listAtom;
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", listTarget->target, listAtom));
---- 877,883 ----
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- listTarget->target = g_strdup(gTextUriListType);
- listTarget->flags = 0;
-! listTarget->info = GPOINTER_TO_UINT(listAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", listTarget->target, listAtom));
-***************
-*** 914,920 ****
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- target->target = g_strdup(flavorStr);
- target->flags = 0;
-! target->info = (guint)atom;
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("adding target %s with id %ld\n",
- target->target, atom));
---- 914,920 ----
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- target->target = g_strdup(flavorStr);
- target->flags = 0;
-! target->info = GPOINTER_TO_UINT(atom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("adding target %s with id %ld\n",
- target->target, atom));
-***************
-*** 931,937 ****
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- plainTarget->target = g_strdup(kTextMime);
- plainTarget->flags = 0;
-! plainTarget->info = (guint)plainAtom;
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", plainTarget->target, plainAtom));
---- 931,937 ----
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- plainTarget->target = g_strdup(kTextMime);
- plainTarget->flags = 0;
-! plainTarget->info = GPOINTER_TO_UINT(plainAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", plainTarget->target, plainAtom));
-***************
-*** 948,954 ****
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- urlTarget->target = g_strdup(gMozUrlType);
- urlTarget->flags = 0;
-! urlTarget->info = (guint)urlAtom;
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", urlTarget->target, urlAtom));
---- 948,954 ----
- (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
- urlTarget->target = g_strdup(gMozUrlType);
- urlTarget->flags = 0;
-! urlTarget->info = GPOINTER_TO_UINT(urlAtom);
- PR_LOG(sDragLm, PR_LOG_DEBUG,
- ("automatically adding target %s with \
- id %ld\n", urlTarget->target, urlAtom));
-*** misc/mozilla/widget/src/windows/nsDataObj.cpp Wed Oct 27 07:50:31 2004
---- misc/build/mozilla/widget/src/windows/nsDataObj.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 504,515 ****
---- 504,523 ----
- return E_OUTOFMEMORY;
-
- char titleStr[MAX_PATH+1];
-+ #ifdef __MINGW32__
-+ int lenTitleStr = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, title.get()), title.Length(), titleStr, MAX_PATH, NULL, NULL);
-+ #else
- int lenTitleStr = WideCharToMultiByte(CP_ACP, 0, title.get(), title.Length(), titleStr, MAX_PATH, NULL, NULL);
-+ #endif
- if (!lenTitleStr && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
- // this is a very rare situation
- int len = title.Length() - 1;
- while ((len > 0) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
-+ #ifdef __MINGW32__
-+ lenTitleStr = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, title.get()), len--, titleStr, MAX_PATH, NULL, NULL);
-+ #else
- lenTitleStr = WideCharToMultiByte(CP_ACP, 0, title.get(), len--, titleStr, MAX_PATH, NULL, NULL);
-+ #endif
- }
- }
- titleStr[lenTitleStr] = '\0';
-*** misc/mozilla/widget/src/windows/nsFilePicker.cpp Wed Dec 8 22:58:30 2004
---- misc/build/mozilla/widget/src/windows/nsFilePicker.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 117,123 ****
---- 117,127 ----
-
- PRBool result = PR_FALSE;
- PRUnichar fileBuffer[FILE_BUFFER_SIZE+1];
-+ #ifdef __MINGW32__
-+ wcsncpy(NS_REINTERPRET_CAST(LPWSTR, fileBuffer), NS_REINTERPRET_CAST(LPCWSTR, mDefault.get()), FILE_BUFFER_SIZE);
-+ #else
- wcsncpy(fileBuffer, mDefault.get(), FILE_BUFFER_SIZE);
-+ #endif
-
- NS_NAMED_LITERAL_STRING(htmExt, "html");
- nsAutoString initialDir;
-***************
-*** 133,146 ****
---- 137,158 ----
-
- if (mMode == modeGetFolder) {
- PRUnichar dirBuffer[MAX_PATH+1];
-+ #ifdef __MINGW32__
-+ wcsncpy(NS_REINTERPRET_CAST(LPWSTR, dirBuffer), NS_REINTERPRET_CAST(LPCWSTR, initialDir.get()), MAX_PATH);
-+ #else
- wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
-+ #endif
-
- BROWSEINFOW browserInfo;
- browserInfo.hwndOwner = (HWND)
- (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
- browserInfo.pidlRoot = nsnull;
- browserInfo.pszDisplayName = (LPWSTR)dirBuffer;
-+ #ifdef __MINGW32__
-+ browserInfo.lpszTitle = NS_REINTERPRET_CAST(LPCWSTR, mTitle.get());
-+ #else
- browserInfo.lpszTitle = mTitle.get();
-+ #endif
- browserInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
- if (initialDir.Length()) // convert folder path to native, the strdup copy will be released in BrowseCallbackProc
- {
-***************
-*** 183,189 ****
---- 195,205 ----
- nsString filterBuffer = mFilterList;
-
- if (!initialDir.IsEmpty()) {
-+ #ifdef __MINGW32__
-+ ofn.lpstrInitialDir = NS_REINTERPRET_CAST(LPCWSTR, initialDir.get());
-+ #else
- ofn.lpstrInitialDir = initialDir.get();
-+ #endif
- }
-
- ofn.lpstrTitle = (LPCWSTR)mTitle.get();
-***************
-*** 191,203 ****
---- 207,227 ----
- ofn.nFilterIndex = mSelectedType;
- ofn.hwndOwner = (HWND)
- (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
-+ #ifdef __MINGW32__
-+ ofn.lpstrFile = NS_REINTERPRET_CAST(LPWSTR, fileBuffer);
-+ #else
- ofn.lpstrFile = fileBuffer;
-+ #endif
- ofn.nMaxFile = FILE_BUFFER_SIZE;
-
- ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
-
- if (!mDefaultExtension.IsEmpty()) {
-+ #ifdef __MINGW32__
-+ ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, mDefaultExtension.get());
-+ #else
- ofn.lpstrDefExt = mDefaultExtension.get();
-+ #endif
- }
- else {
- // Get file extension from suggested filename
-***************
-*** 217,223 ****
---- 241,251 ----
- //XXX Actually, behavior is sort of weird:
- // often appends ".html" even if you have an extension
- // It obeys your extension if you put quotes around name
-+ #ifdef __MINGW32__
-+ ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, htmExt.get());
-+ #else
- ofn.lpstrDefExt = htmExt.get();
-+ #endif
- }
- }
- }
-*** misc/mozilla/widget/src/windows/nsWindow.cpp Sat May 29 22:27:51 2004
---- misc/build/mozilla/widget/src/windows/nsWindow.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 444,449 ****
---- 444,452 ----
-
- // VC++5.0 header doesn't have reconvertion structure and message.
- #ifndef WM_IME_REQUEST
-+ #define WM_IME_REQUEST 0x0288
-+ #endif
-+ #ifndef IMR_RECONVERTSTRING
- typedef struct tagRECONVERTSTRING {
- DWORD dwSize;
- DWORD dwVersion;
-***************
-*** 456,462 ****
- } RECONVERTSTRING, FAR * LPRECONVERTSTRING;
-
- #define IMR_RECONVERTSTRING 0x0004
-- #define WM_IME_REQUEST 0x0288
- #endif
-
- // from http://msdn.microsoft.com/library/specs/msime.h
---- 459,464 ----
-***************
-*** 480,486 ****
---- 482,490 ----
- //
- #ifndef WM_APPCOMMAND
- #define WM_APPCOMMAND 0x0319
-+ #endif
-
-+ #ifndef APPCOMMAND_BROWSER_BACKWARD
- #define APPCOMMAND_BROWSER_BACKWARD 1
- #define APPCOMMAND_BROWSER_FORWARD 2
- #define APPCOMMAND_BROWSER_REFRESH 3
-***************
-*** 517,523 ****
- //#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
- //#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
-
-! #endif // #ifndef WM_APPCOMMAND
-
- static PRBool LangIDToCP(WORD aLangID, UINT& oCP)
- {
---- 521,527 ----
- //#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
- //#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
-
-! #endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
-
- static PRBool LangIDToCP(WORD aLangID, UINT& oCP)
- {
-***************
-*** 5529,5535 ****
---- 5533,5543 ----
- if(acp)
- {
- int outlen = ::WideCharToMultiByte( CP_ACP, 0,
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPCWSTR, aStr.get()), aStr.Length(),
-+ #else
- aStr.get(), aStr.Length(),
-+ #endif
- acp, acplen, NULL, NULL);
- if ( outlen >= 0)
- acp[outlen] = '\0'; // null terminate
-***************
-*** 5696,5702 ****
---- 5704,5714 ----
- unicharSize = ::MultiByteToWideChar(gCurrentKeyboardCP,MB_PRECOMPOSED,
- mIMECompString->get(),
- mIMECompString->Length(),
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPWSTR, mIMECompUnicode->BeginWriting()),
-+ #else
- mIMECompUnicode->BeginWriting(),
-+ #endif
- unicharSize+1);
- mIMECompUnicode->SetLength(unicharSize);
- }
-***************
-*** 6472,6478 ****
---- 6484,6494 ----
- *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
- } else {
- len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPCWSTR, mIMEReconvertUnicode),
-+ #else
- mIMEReconvertUnicode,
-+ #endif
- nsCRT::strlen(mIMEReconvertUnicode),
- NULL, 0, NULL, NULL);
- *oResult = sizeof(RECONVERTSTRING) + len;
-***************
-*** 6491,6497 ****
---- 6507,6517 ----
- *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
- } else {
- len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPCWSTR, mIMEReconvertUnicode),
-+ #else
- mIMEReconvertUnicode,
-+ #endif
- nsCRT::strlen(mIMEReconvertUnicode),
- NULL, 0, NULL, NULL);
- *oResult = sizeof(RECONVERTSTRING) + len;
-***************
-*** 6512,6518 ****
---- 6532,6542 ----
- mIMEReconvertUnicode, len * sizeof(WCHAR));
- } else {
- ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-+ #ifdef __MINGW32__
-+ NS_REINTERPRET_CAST(LPCWSTR, mIMEReconvertUnicode),
-+ #else
- mIMEReconvertUnicode,
-+ #endif
- nsCRT::strlen(mIMEReconvertUnicode),
- (LPSTR) (aData + sizeof(RECONVERTSTRING)),
- len,
-*** misc/mozilla/xpcom/base/nsStackFrameUnix.cpp Mon Mar 8 08:47:44 2004
---- misc/build/mozilla/xpcom/base/nsStackFrameUnix.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 78,102 ****
- }
-
-
-! #if defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
-
-- #include <setjmp.h>
-- //
-
- void DumpStackToFile(FILE* aStream)
- {
-- jmp_buf jb;
-- setjmp(jb);
--
- // Stack walking code courtesy Kipp's "leaky".
-
-! // Get the frame pointer out of the jmp_buf
-! void **bp = (void**)
-! #if defined(__i386)
-! (jb[0].__jmpbuf[JB_BP]);
-! #elif defined(PPC)
-! (jb[0].__jmpbuf[JB_GPR1]);
-! #endif
-
- int skip = 2;
- for ( ; (void**)*bp > bp; bp = (void**)*bp) {
---- 78,92 ----
- }
-
-
-! #if defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code
-
-
- void DumpStackToFile(FILE* aStream)
- {
- // Stack walking code courtesy Kipp's "leaky".
-
-! // Get the frame pointer
-! void **bp = (void**) __builtin_frame_address(0);
-
- int skip = 2;
- for ( ; (void**)*bp > bp; bp = (void**)*bp) {
-*** misc/mozilla/xpcom/base/nsTraceRefcntImpl.cpp Wed Feb 11 08:16:10 2004
---- misc/build/mozilla/xpcom/base/nsTraceRefcntImpl.cpp Tue Jan 15 13:34:36 2008
-***************
-*** 50,68 ****
-
- #if defined(_WIN32)
- #include <windows.h>
-- #elif defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))
-- #include <setjmp.h>
--
-- //
-- // On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed
-- // if __USE_GNU is defined. I suppose its some kind of standards
-- // adherence thing.
-- //
-- #if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU)
-- #define __USE_GNU
-- #endif
--
-- #include <dlfcn.h>
- #endif
-
- #ifdef HAVE_LIBDL
---- 50,55 ----
-***************
-*** 484,490 ****
-
- #endif /* NS_BUILD_REFCNT_LOGGING */
-
-! nsresult
- nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out)
- {
- nsresult rv = NS_OK;
---- 471,477 ----
-
- #endif /* NS_BUILD_REFCNT_LOGGING */
-
-! NS_COM nsresult
- nsTraceRefcntImpl::DumpStatistics(StatisticsType type, FILE* out)
- {
- nsresult rv = NS_OK;
-***************
-*** 561,567 ****
- return rv;
- }
-
-! void
- nsTraceRefcntImpl::ResetStatistics()
- {
- #ifdef NS_BUILD_REFCNT_LOGGING
---- 548,554 ----
- return rv;
- }
-
-! NS_COM void
- nsTraceRefcntImpl::ResetStatistics()
- {
- #ifdef NS_BUILD_REFCNT_LOGGING
-***************
-*** 850,856 ****
-
- #if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code
- #include "nsStackFrameWin.h"
-! void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- DumpStackToFile(aStream);
---- 837,843 ----
-
- #if defined(_WIN32) && defined(_M_IX86) // WIN32 x86 stack walking code
- #include "nsStackFrameWin.h"
-! NS_COM void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- DumpStackToFile(aStream);
-***************
-*** 858,866 ****
-
- // WIN32 x86 stack walking code
- // i386 or PPC Linux stackwalking code or Solaris
-! #elif (defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
- #include "nsStackFrameUnix.h"
-! void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- DumpStackToFile(aStream);
---- 845,853 ----
-
- // WIN32 x86 stack walking code
- // i386 or PPC Linux stackwalking code or Solaris
-! #elif (defined(linux) && defined(__GNUC__) && (defined(__i386) || defined(PPC))) || (defined(__sun) && (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
- #include "nsStackFrameUnix.h"
-! NS_COM void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- DumpStackToFile(aStream);
-***************
-*** 960,966 ****
-
- #else // unsupported platform.
-
-! void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- fprintf(aStream, "write me, dammit!\n");
---- 947,953 ----
-
- #else // unsupported platform.
-
-! NS_COM void
- nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
- {
- fprintf(aStream, "write me, dammit!\n");
-*** misc/mozilla/xpcom/base/nscore.h Thu Mar 25 20:55:16 2004
---- misc/build/mozilla/xpcom/base/nscore.h Tue Jan 15 13:34:37 2008
-***************
-*** 282,288 ****
- * commercial build. When this is fixed there will be no need for the
- * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
- */
-! #if defined(HAVE_CPP_2BYTE_WCHAR_T) && (defined(NS_WIN32) || defined(XP_MAC))
- typedef wchar_t PRUnichar;
- #else
- typedef PRUint16 PRUnichar;
---- 282,288 ----
- * commercial build. When this is fixed there will be no need for the
- * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
- */
-! #if defined(HAVE_CPP_2BYTE_WCHAR_T) && !defined(__MINGW32__) && (defined(NS_WIN32) || defined(XP_MAC))
- typedef wchar_t PRUnichar;
- #else
- typedef PRUint16 PRUnichar;
-*** misc/mozilla/xpcom/io/nsLocalFileWin.cpp Thu May 13 22:59:45 2004
---- misc/build/mozilla/xpcom/io/nsLocalFileWin.cpp Tue Jan 15 13:34:37 2008
-***************
-*** 552,558 ****
---- 552,562 ----
- }
-
- if (gResolver)
-+ #ifdef __MINGW32__
-+ rv = gResolver->Resolve(NS_REINTERPRET_CAST(LPCWSTR, ucsBuf.get()), temp);
-+ #else
- rv = gResolver->Resolve(ucsBuf.get(), temp);
-+ #endif
- else
- rv = NS_ERROR_FAILURE;
-
-*** misc/mozilla/xpcom/io/nsNativeCharsetUtils.cpp Mon Nov 8 15:44:27 2004
---- misc/build/mozilla/xpcom/io/nsNativeCharsetUtils.cpp Tue Jan 15 13:34:37 2008
-***************
-*** 890,896 ****
---- 890,900 ----
-
- PRUnichar *result = out_iter.get();
-
-+ #ifdef __MINGW32__
-+ ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, NS_REINTERPRET_CAST(LPWSTR, result), resultLen);
-+ #else
- ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen);
-+ #endif
- }
- return NS_OK;
- }
-***************
-*** 908,914 ****
---- 912,922 ----
- // determine length of result
- PRUint32 resultLen = 0;
-
-+ #ifdef __MINGW32__
-+ int n = ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, NULL, 0, NULL, NULL);
-+ #else
- int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, NULL, 0, NULL, NULL);
-+ #endif
- if (n > 0)
- resultLen += n;
-
-***************
-*** 924,930 ****
---- 932,942 ----
-
- char *result = out_iter.get();
-
-+ #ifdef __MINGW32__
-+ ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, result, resultLen,
-+ #else
- ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen,
-+ #endif
- &defaultChar, NULL);
- }
- return NS_OK;
-*** misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h Wed Jun 25 00:12:34 2003
---- misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h Tue Jan 15 13:34:37 2008
-***************
-*** 132,138 ****
- }
-
- PRBool IsArray() const
-! {return (PRBool) TagPart() == T_ARRAY;}
-
- // 'Dependent' means that params of this type are dependent upon other
- // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
---- 132,138 ----
- }
-
- PRBool IsArray() const
-! {return (PRBool) (TagPart() == T_ARRAY);}
-
- // 'Dependent' means that params of this type are dependent upon other
- // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
-***************
-*** 152,158 ****
- uint8 TagPart() const
- {return (uint8) (flags & XPT_TDP_TAGMASK);}
-
-! enum
- {
- T_I8 = TD_INT8 ,
- T_I16 = TD_INT16 ,
---- 152,158 ----
- uint8 TagPart() const
- {return (uint8) (flags & XPT_TDP_TAGMASK);}
-
-! enum _xpttype
- {
- T_I8 = TD_INT8 ,
- T_I16 = TD_INT16 ,
-*** misc/mozilla/xpfe/appshell/src/nsXULWindow.cpp Sat Aug 21 19:17:14 2004
---- misc/build/mozilla/xpfe/appshell/src/nsXULWindow.cpp Tue Jan 15 13:34:37 2008
-***************
-*** 73,79 ****
---- 73,81 ----
- #include "nsStyleConsts.h"
-
- // XXX Get rid of this
-+ #ifdef _MSC_VER
- #pragma message("WARNING: XXX bad include, remove it.")
-+ #endif
- #include "nsIWebShellWindow.h"
- #include "nsWebShellWindow.h" // get rid of this one, too...
-
-*** misc/mozilla/xpfe/bootstrap/Makefile.in Thu Jun 24 20:58:48 2004
---- misc/build/mozilla/xpfe/bootstrap/Makefile.in Tue Jan 15 13:34:37 2008
-***************
-*** 84,93 ****
---- 84,96 ----
-
- include $(topsrcdir)/config/config.mk
-
-+ # reduce prerequisites by disabling mozilla binary
-+ ifndef DISABLE_MOZ_EXECUTABLE
- ifeq ($(USE_SHORT_LIBNAME),1)
- PROGRAM = mozilla$(BIN_SUFFIX)
- else
- PROGRAM = mozilla-bin$(BIN_SUFFIX)
-+ endif
- endif
-
- # Force applications to be built non-statically
-*** misc/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp Tue Dec 14 17:26:56 2004
---- misc/build/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp Tue Jan 15 13:34:37 2008
-***************
-*** 113,119 ****
---- 113,123 ----
- int acplen = aStr.Length() * 2 + 1;
- char * acp = new char[ acplen ];
- if( acp ) {
-+ #ifdef __MINGW32__
-+ int outlen = ::WideCharToMultiByte( CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aStr.get()), aStr.Length(),
-+ #else
- int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
-+ #endif
- acp, acplen, NULL, NULL );
- if ( outlen >= 0)
- acp[ outlen ] = '\0'; // null terminate
-***************
-*** 2423,2429 ****
---- 2427,2437 ----
- }
- // Create menu and add item.
- mTrayIconMenu = ::CreatePopupMenu();
-+ #ifdef __MINGW32__
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, NS_REINTERPRET_CAST(LPCWSTR, navigatorText.get()) );
-+ #else
- ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, navigatorText.get() );
-+ #endif
- if ( ::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
- AppendMenuItem( mTrayIconMenu, TURBO_NAVIGATOR, navigatorText );
- if ( isMail )
-***************
-*** 2437,2442 ****
---- 2445,2459 ----
- }
- else {
- if (isMail)
-+ #ifdef __MINGW32__
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, NS_REINTERPRET_CAST(LPCWSTR, mailText.get()) );
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, NS_REINTERPRET_CAST(LPCWSTR, editorText.get()) );
-+ if (isMail)
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_ADDRESSBOOK, NS_REINTERPRET_CAST(LPCWSTR, addressbookText.get()) );
-+ ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, NS_REINTERPRET_CAST(LPCWSTR, disableText.get()) );
-+ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, NS_REINTERPRET_CAST(LPCWSTR, exitText.get()) );
-+ #else
- ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, mailText.get() );
- ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, editorText.get() );
- if (isMail)
-***************
-*** 2444,2449 ****
---- 2461,2467 ----
- ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
- ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, disableText.get() );
- ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, exitText.get() );
-+ #endif
- }
- }
-
-*** misc/mozilla/nsprpub/pr/include/md/_pth.h
---- misc/build/mozilla/nsprpub/pr/include/md/_pth.h
-***************
-*** 198,204 ****
- /*
- * These platforms don't have pthread_kill()
- */
-! #if defined(DARWIN)
- #define pthread_kill(thread, sig) ENOSYS
- #endif
-
---- 198,204 ----
- /*
- * These platforms don't have pthread_kill()
- */
-! #if defined(DARWIN) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
- #define pthread_kill(thread, sig) ENOSYS
- #endif
-
-*** misc/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp
---- misc/build/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp
-***************
-*** 25,31 ****
- #include "xptcprivate.h"
-
- #include <stdint.h>
-- #include <iostream.h>
-
- // "This code is for IA64 only"
-
---- 25,30 ----
diff --git a/moz/patches/consecutive_ldap_queries.patch b/moz/patches/consecutive_ldap_queries.patch
new file mode 100644
index 000000000000..d82d594bce09
--- /dev/null
+++ b/moz/patches/consecutive_ldap_queries.patch
@@ -0,0 +1,13 @@
+--- mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:39:32.054968600 +0100
++++ mozilla.patched/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:35:35.633832119 +0100
+@@ -833,6 +833,10 @@
+ if (msgListener)
+ {
+ msgListener->mUrl = url;
++ msgListener->mQueryListener = listener;
++ msgListener->mResultLimit = resultLimit;
++ msgListener->mTimeOut = timeOut;
++ msgListener->mQueryArguments = arguments;
+ return msgListener->DoSearch();
+ }
+ }
diff --git a/moz/patches/cygwin_paths_in_ldap_sdk.patch b/moz/patches/cygwin_paths_in_ldap_sdk.patch
new file mode 100644
index 000000000000..e0983aecbe74
--- /dev/null
+++ b/moz/patches/cygwin_paths_in_ldap_sdk.patch
@@ -0,0 +1,12 @@
+--- mozilla.org/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
++++ mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-10-31 23:34:41.695625000 +0100
+@@ -85,6 +85,9 @@
+
+ ###########################################################################
+
++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
++
+ all export:: $(INCLUDEDIR) $(GENHEADERS)
+ $(NSINSTALL) -D $(PRIVATEINCDIR)
+ $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
diff --git a/moz/patches/embed_manifest.patch b/moz/patches/embed_manifest.patch
new file mode 100644
index 000000000000..3b0e80b3ab81
--- /dev/null
+++ b/moz/patches/embed_manifest.patch
@@ -0,0 +1,142 @@
+--- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200
++++ mozilla/configure 2008-11-09 23:59:19.984375000 +0100
+@@ -1068,6 +1068,8 @@
+ GCONF_VERSION=1.2.1
+ LIBGNOME_VERSION=2.0
+
++MSMANIFEST_TOOL=
++
+ MISSING_X=
+ for ac_prog in gawk mawk nawk awk
+ do
+@@ -3025,6 +3027,22 @@
+ else
+ { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
+ fi
++
++ # bug #249782
++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
++ if test "$_CC_SUITE" -ge "8"; then
++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
++ if test -n "MSMT_TOOL"; then
++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
++ if test -z "MSMANIFEST_TOOL_VERSION"; then
++ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
++ fi
++ MSMANIFEST_TOOL=1
++ unset MSMT_TOOL
++ else
++ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
++ fi
++ fi
+
+ # Check linker version
+ _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+--- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200
++++ mozilla/configure.in 2008-11-09 23:59:20.000000000 +0100
+@@ -126,6 +126,8 @@
+ GCONF_VERSION=1.2.1
+ LIBGNOME_VERSION=2.0
+
++MSMANIFEST_TOOL=
++
+ dnl Set various checks
+ dnl ========================================================
+ MISSING_X=
+@@ -428,6 +430,22 @@
+ else
+ AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
+ fi
++
++ # bug #249782
++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
++ if test "$_CC_SUITE" -ge "8"; then
++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
++ if test -n "MSMT_TOOL"; then
++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
++ if test -z "MSMANIFEST_TOOL_VERSION"; then
++ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
++ fi
++ MSMANIFEST_TOOL=1
++ unset MSMT_TOOL
++ else
++ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
++ fi
++ fi
+
+ # Check linker version
+ _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+@@ -7319,6 +7339,7 @@
+ AC_SUBST(USE_N32)
+ AC_SUBST(CC_VERSION)
+ AC_SUBST(CXX_VERSION)
++AC_SUBST(MSMANIFEST_TOOL)
+
+ if test "$USING_HCC"; then
+ CC='${topsrcdir}/build/hcc'
+--- mozilla.pure/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
++++ mozilla/config/rules.mk 2008-11-09 23:59:19.968750000 +0100
+@@ -811,6 +812,12 @@
+
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ ifeq ($(CPP_PROG_LINK),1)
+ $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
+@@ -843,6 +850,12 @@
+ else
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+ $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+@@ -866,6 +879,12 @@
+ else
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ ifeq ($(CPP_PROG_LINK),1)
+ $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
+@@ -1019,6 +1038,14 @@
+ endif # SHARED_LIBRARY_LIBS
+ endif # NO_LD_ARCHIVE_FLAGS
+ $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
++endif # WINNT && !GCC
+ @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
+ else # os2 vacpp
+ $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
+--- mozilla.pure/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
++++ mozilla/config/autoconf.mk.in 2008-11-09 23:59:19.953125000 +0100
+@@ -543,6 +543,7 @@
+ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
+ MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
+ MOZ_QUANTIFY = @MOZ_QUANTIFY@
++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
+
+ #python options
+ PYTHON = @MOZ_PYTHON@
diff --git a/moz/patches/index.txt b/moz/patches/index.txt
new file mode 100644
index 000000000000..fd27f442a05c
--- /dev/null
+++ b/moz/patches/index.txt
@@ -0,0 +1,65 @@
+====================================================================================
+File name
+---------
+ embed_manifest.patch
+
+Description
+-----------
+ When building Mozilla with MSVC2005, generated libraries and applications
+ require the manifest file (name.dll.manifest) to reside beside the file
+ itself, or to be embedded.
+
+ The patch does the latter: embedding the manifest file into the
+ library/application itself, using the Manifest Tool from the Platform SDK
+ resp. MSVC installation.
+
+ The patch is effectively the patch as was committed to the Mozilla trunk,
+ taken from here: https://bugzilla.mozilla.org/show_bug.cgi?id=249782#c81.
+
+====================================================================================
+File name
+---------
+ wchart_on_msvc8.patch
+
+Description
+-----------
+ For compiling with MSVC2005: See https://bugzilla.mozilla.org/show_bug.cgi?id=324842.
+
+====================================================================================
+File name
+---------
+ cygwin_paths_in_ldap_sdk.patch
+
+Description
+-----------
+ make 1.81, as currently part of cygwin, does not support Windows paths anymore.
+ So, targets, and target dependencies, in makefile may need to be converted to cygwin
+ notation. This patch does this for directory/c-sdk/ldap/include, other occurances are
+ not known, yet.
+
+====================================================================================
+File name
+---------
+ no_core_abspath_in_nss.patch
+
+Description
+-----------
+ On various platforms, building security/nss/cmd/shlibsign fails. In all cases, the
+ error messages indicate the core_abspath macro used in the Makefile is not resolved
+ properly.
+ This patch replaces the usage of core_abspath with platform-specific constructs.
+
+====================================================================================
+File name
+---------
+ consecutive_ldap_queries.patch
+
+Description
+-----------
+ Consecutive LDAP address book queries (using the same instance of nsAbLDAPDirectoryQuery,
+ but different parameters to the DoQuery method) do not work in OOo. The reason is that
+ the second call to DoQuery ignores most of its arguments, including the listener which
+ is to be notified about the query results, and re-uses the arguments from the first
+ call.
+ The patch changes the DoQuery behavior to respect the arguments of the second call.
+
diff --git a/moz/patches/no_core_abspath_in_nss.patch b/moz/patches/no_core_abspath_in_nss.patch
new file mode 100644
index 000000000000..026cc7e3eb92
--- /dev/null
+++ b/moz/patches/no_core_abspath_in_nss.patch
@@ -0,0 +1,52 @@
+--- mozilla.pure/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
++++ mozilla/security/nss/cmd/shlibsign/Makefile 2008-11-05 14:04:54.798875000 +0100
+@@ -86,18 +86,47 @@
+
+ include ../platrules.mk
+
+-SRCDIR = $(call core_abspath,.)
+-
++ifeq ($(OS_TARGET), Darwin)
++ SRCDIR = .
++else
++ifeq ($(OS_TARGET), Linux)
++ SRCDIR = .
++else
++ifeq ($(OS_TARGET), WIN95)
++ SRCDIR = $(shell cygpath -d $(SRCDIR))
++else
++ SRCDIR = $(call core_abspath,.)
++endif
++endif
++endif
+ %.chk: %.$(DLL_SUFFIX)
+ ifeq ($(OS_TARGET), OS2)
+ cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
+ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
+ else
++ifeq ($(OS_TARGET), WIN95)
++ sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
++ $(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
++ $(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
++else
++ifeq ($(OS_TARGET), Darwin)
++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++else
++ifeq ($(OS_TARGET), Linux)
++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++else
+ cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
+ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
+ endif
++endif
++endif
++endif
+
+ libs install :: $(CHECKLOC)
+
diff --git a/moz/patches/wchart_on_msvc8.patch b/moz/patches/wchart_on_msvc8.patch
new file mode 100644
index 000000000000..a8f31cd4c3e3
--- /dev/null
+++ b/moz/patches/wchart_on_msvc8.patch
@@ -0,0 +1,20 @@
+--- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200
++++ mozilla/configure.in 2008-11-10 16:15:36.859375000 +0100
+@@ -425,6 +425,7 @@
+ _CC_SUITE=7
+ elif test "$_CC_MAJOR_VERSION" = "14"; then
+ _CC_SUITE=8
++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
+ else
+ AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
+ fi
+--- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200
++++ mozilla/configure 2008-11-10 16:15:30.437500000 +0100
+@@ -3022,6 +3022,7 @@
+ _CC_SUITE=7
+ elif test "$_CC_MAJOR_VERSION" = "14"; then
+ _CC_SUITE=8
++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
+ else
+ { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
+ fi
diff --git a/moz/prj/build.lst b/moz/prj/build.lst
index f5593fae6d42..717c309da96e 100644
--- a/moz/prj/build.lst
+++ b/moz/prj/build.lst
@@ -1,4 +1,4 @@
-moz moz : solenv SO:so_prereq NULL
+moz moz : solenv SO:so_prereq NSS:nss NULL
moz moz usr1 - all moz_mkout NULL
moz moz nmake - all moz_mozilla NULL
moz moz\zipped nmake - all moz_zipped moz_mozilla NULL
diff --git a/moz/mozilla-source-1.7b.patch b/moz/seamonkey-source-1.1.14.patch
index 8c6ee36ec1c2..3aabbe1a5f44 100644
--- a/moz/mozilla-source-1.7b.patch
+++ b/moz/seamonkey-source-1.1.14.patch
@@ -1,179 +1,1188 @@
-Index: directory/xpcom/base/src/nsLDAPMessage.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/directory/xpcom/base/src/nsLDAPMessage.cpp,v
-retrieving revision 1.28
-diff -u -r1.28 nsLDAPMessage.cpp
---- misc/build/mozilla/directory/xpcom/base/src/nsLDAPMessage.cpp 29 Jan 2004 22:04:23 -0000 1.28
-+++ misc/build/mozilla/directory/xpcom/base/src/nsLDAPMessage.cpp 17 May 2004 03:23:37 -0000
-@@ -513,7 +513,11 @@
- //
- PRUint32 i;
- for ( i = 0 ; i < numVals ; i++ ) {
-- (*aValues)[i] = UTF8ToNewUnicode(nsDependentCString(values[i]));
-+ if (IsUTF8(nsDependentCString(values[i])))
-+ (*aValues)[i] = UTF8ToNewUnicode(nsDependentCString(values[i]));
-+ else
-+ (*aValues)[i] = ToNewUnicode(nsDependentCString(values[i]));
-+
- if ( ! (*aValues)[i] ) {
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, aValues);
- ldap_value_free(values);
-Index: mailnews/addrbook/src/Makefile.in
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/Makefile.in,v
-retrieving revision 1.47
-diff -u -r1.47 Makefile.in
---- misc/build/mozilla/mailnews/addrbook/src/Makefile.in 6 Oct 2003 17:48:56 -0000 1.47
-+++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 17 May 2004 03:23:53 -0000
-@@ -86,6 +86,7 @@
- nsVCard.cpp \
- nsVCardObj.cpp \
- nsMsgVCardService.cpp \
-+ nsAbMD5sum.cpp \
+--- misc/mozilla/build/autoconf/mozconfig-find 2007-02-16 03:19:06.000000000 +0100
++++ misc/build/mozilla/build/autoconf/mozconfig-find 2008-08-19 10:12:04.000000000 +0200
+@@ -51,10 +51,7 @@
+ "$topsrcdir/.mozconfig" \
+ "$topsrcdir/mozconfig" \
+ "$topsrcdir/mozconfig.sh" \
+- "$topsrcdir/myconfig.sh" \
+- "$HOME/.mozconfig" \
+- "$HOME/.mozconfig.sh" \
+- "$HOME/.mozmyconfig.sh"
++ "$topsrcdir/myconfig.sh"
+ do
+ if test -f "$_config"; then
+ echo "$_config";
+--- misc/mozilla/build/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
++++ misc/build/mozilla/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
+ # Try not to spawn programs from within this file. If the stuff in here looks royally
+@@ -57,12 +57,36 @@
+ i=-I${mountpoint}/${driveletter}/${pathname}
+ fi
+ else
+- eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
+- if ! test "${leader}" = "${i}"; then
+- eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
+- eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
+- driveletter=${no_mountpoint%%/*}
+- i=${leader}${driveletter}:/${pathname}
++ # The original version missed mounted paths, the new version below
++ # doesn't transform /para as this is most likely a parameter.
++ eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
++ if ! test "$notinpath" = "$i"; then
++ # found $mountpoint
++ eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
++ eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
++ driveletter=${withdrive%%/*}
++ i=${notinpath}${driveletter}:/${restpath}
++ else
++ # check for potential path. Precheck using shell methods
++ doconvert=""
++ # Shortcut -X<path> when path does not begin with '/'
++ noswitch=${i#-[a-zA-Z]}
++ if test "$noswitch" != "$i"; then
++ test "${noswitch#/}" != "$noswitch" && doconvert="1"
++ fi
++ # Precheck for possible path. Consider only absolute paths that contain at least
++ # a second / to prevent converting of /abc parameters.
++ test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
++ if test -n "$doconvert"; then
++ # Can be a path. If forking grep would be faster or we could require bash 3
++ # this regexp would be all that's needed to find pathnames that need converting
++ pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
++ eval 'notinpath=${i%'${pathname}'}'
++ if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
++ pathname=`cygpath -am "$pathname"`
++ i=${notinpath}${pathname}
++ fi
++ fi
+ fi
+ fi
+ fi
+--- misc/mozilla/config/Makefile.in 2006-12-22 14:50:41.000000000 +0100
++++ misc/build/mozilla/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -166,7 +166,7 @@
+
+ ifdef MOZ_ENABLE_GTK2
+ GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
+- GLIB_LIBS = $(MOZ_GTK2_LIBS)
++ GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
+ endif
+
+ build_number: FORCE
+--- misc/mozilla/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
++++ misc/build/mozilla/config/autoconf.mk.in 2008-11-07 16:08:52.937500000 +0100
+@@ -543,6 +543,7 @@
+ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
+ MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
+ MOZ_QUANTIFY = @MOZ_QUANTIFY@
++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
+
+ #python options
+ PYTHON = @MOZ_PYTHON@
+--- misc/mozilla/config/config.mk 2008-01-29 20:30:22.000000000 +0100
++++ misc/build/mozilla/config/config.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -758,6 +758,23 @@
+ endif
+
+ #
++# Shared library RUNPATH linker option(s)
++#
++ifeq ($(OS_ARCH),Linux)
++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
++ifdef IS_COMPONENT
++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
++endif # IS_COMPONENT
++endif # Linux
++
++ifeq ($(OS_ARCH),SunOS)
++EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
++ifdef IS_COMPONENT
++EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
++endif # IS_COMPONENT
++endif # SunOS
++
++#
+ # Include any personal overrides the user might think are needed.
+ #
+ -include $(MY_CONFIG)
+--- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
++++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100
+@@ -529,8 +529,9 @@
+ ifeq ($(OS_ARCH),WINNT)
+ ifdef GNU_CC
+ ifndef IS_COMPONENT
+-DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
++DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
+ endif
++DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
+ endif
+ endif
+
+@@ -811,6 +810,12 @@
+
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ ifeq ($(CPP_PROG_LINK),1)
+ $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
+@@ -843,6 +848,12 @@
+ else
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+ $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+@@ -866,6 +877,12 @@
+ else
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
+ else
+ ifeq ($(CPP_PROG_LINK),1)
+ $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
+@@ -1019,6 +1036,14 @@
+ endif # SHARED_LIBRARY_LIBS
+ endif # NO_LD_ARCHIVE_FLAGS
+ $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
++ifdef MSMANIFEST_TOOL
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
++ rm -f $@.manifest; \
++ fi
++endif # MSVC with manifest tool
++endif # WINNT && !GCC
+ @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
+ else # os2 vacpp
+ $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
+@@ -1043,7 +1070,7 @@
+ if test -d $(@D); then \
+ echo "Building deps for $<"; \
+ touch $(_MDDEPFILE) && \
+- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
++ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
+ mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
+ cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
+ fi
+@@ -1053,7 +1080,7 @@
+ if test -d $(@D); then \
+ echo "Building deps for $<"; \
+ touch $(_MDDEPFILE) && \
+- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
++ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
+ mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
+ cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
+ fi
+@@ -1325,6 +1352,7 @@
+
+ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
+ $(REPORT_BUILD)
++ echo "PATH=" $(PATH)
+ $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
+ @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
+ then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
+@@ -1696,14 +1724,14 @@
+ define MAKE_DEPS_NOAUTO
+ set -e ; \
+ touch $@ && \
+- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
++ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
+ mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
+ endef
+ else
+ define MAKE_DEPS_NOAUTO
+ set -e ; \
+ touch $@ && \
+- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
++ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
+ mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
+ endef
+ endif # WINNT
+--- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100
++++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100
+@@ -1068,6 +1068,8 @@
+ GCONF_VERSION=1.2.1
+ LIBGNOME_VERSION=2.0
+
++MSMANIFEST_TOOL=
++
+ MISSING_X=
+ for ac_prog in gawk mawk nawk awk
+ do
+@@ -3022,9 +3024,26 @@
+ _CC_SUITE=7
+ elif test "$_CC_MAJOR_VERSION" = "14"; then
+ _CC_SUITE=8
++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
+ else
+ { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
+ fi
++
++ # bug #249782
++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
++ if test "$_CC_SUITE" -ge "8"; then
++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
++ if test -n "MSMT_TOOL"; then
++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
++ if test -z "MSMANIFEST_TOOL_VERSION"; then
++ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
++ fi
++ MSMANIFEST_TOOL=1
++ unset MSMT_TOOL
++ else
++ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
++ fi
++ fi
+
+ # Check linker version
+ _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+@@ -3422,6 +3441,8 @@
+ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ cross_compiling=$ac_cv_prog_cc_cross
+ fi
++else
++ ac_cv_prog_CXXCPP="$CXXCPP"
+ fi
+ CXXCPP="$ac_cv_prog_CXXCPP"
+ echo "$ac_t""$CXXCPP" 1>&6
+@@ -5726,6 +5747,7 @@
+ if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
+ _pwd=`pwd`
+ CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
++ CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
+ fi
+ if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
+ AS_PERL=1
+@@ -6036,7 +6058,7 @@
+ CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
+ DLL_SUFFIX=".dylib"
+ DSO_LDOPTS=''
+- STRIP="$STRIP -x -S"
++ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
+ _PLATFORM_DEFAULT_TOOLKIT='mac'
+ MOZ_ENABLE_POSTSCRIPT=
+ TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
+@@ -6075,7 +6097,7 @@
+ ;;
+
+ *-freebsd*)
+- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
++ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
+ DLL_SUFFIX=".so.1.0"
+ DSO_LDOPTS="-shared"
+ fi
+@@ -6455,12 +6477,12 @@
+
+
+ case "$host" in
+- *-mingw*)
+- CYGPATH_W=echo
++ *-cygwin*|*-mingw*)
++ CYGPATH_W="cygpath -u"
+ CYGPATH_S=cat
+- MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
++ MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
+ ;;
+- *-cygwin*|*-msvc*|*-mks*)
++ *-msvc*|*-mks*)
+ CYGPATH_W="cygpath -a -w"
+ CYGPATH_S="sed -e s|\\\\|/|g"
+ MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
+@@ -6718,7 +6740,7 @@
+ MOZ_USER_DIR="Mozilla"
+
+ if test "$MOZTOOLS"; then
+- MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
++ MOZ_TOOLS_DIR=`echo $MOZTOOLS`
+ else
+ { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
+ fi
+@@ -8614,6 +8636,8 @@
+ case $target in
+ *-hpux11.*)
+ ;;
++*-freebsd*)
++ ;;
+ *)
+ echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
+ echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
+@@ -19233,7 +19257,8 @@
+ MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
+
+ if test "$MOZ_X11"; then
+- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
++# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
++ MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
+ fi
+ if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
+ MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
+@@ -20076,8 +20101,12 @@
+ WIN_TOP_SRC=`cd $srcdir; pwd -W`
+ ;;
+ cygwin*|msvc*|mks*)
+- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
+- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
++# Don't add the wrapper for the HOST_* versions as they contain an
++# unexpanded $CC and therfore wil get the wrapper below.
++ if test -n "$GNU_CC"; then
++ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
++ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
++ fi
+ CC="\$(CYGWIN_WRAPPER) $CC"
+ CXX="\$(CYGWIN_WRAPPER) $CXX"
+ CPP="\$(CYGWIN_WRAPPER) $CPP"
+--- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100
++++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100
+@@ -126,6 +126,8 @@
+ GCONF_VERSION=1.2.1
+ LIBGNOME_VERSION=2.0
+
++MSMANIFEST_TOOL=
++
+ dnl Set various checks
+ dnl ========================================================
+ MISSING_X=
+@@ -425,9 +427,26 @@
+ _CC_SUITE=7
+ elif test "$_CC_MAJOR_VERSION" = "14"; then
+ _CC_SUITE=8
++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
+ else
+ AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
+ fi
++
++ # bug #249782
++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
++ if test "$_CC_SUITE" -ge "8"; then
++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
++ if test -n "MSMT_TOOL"; then
++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
++ if test -z "MSMANIFEST_TOOL_VERSION"; then
++ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
++ fi
++ MSMANIFEST_TOOL=1
++ unset MSMT_TOOL
++ else
++ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
++ fi
++ fi
+
+ # Check linker version
+ _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+@@ -1530,7 +1549,7 @@
+ CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
+ DLL_SUFFIX=".dylib"
+ DSO_LDOPTS=''
+- STRIP="$STRIP -x -S"
++ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
+ _PLATFORM_DEFAULT_TOOLKIT='mac'
+ MOZ_ENABLE_POSTSCRIPT=
+ TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
+@@ -1552,7 +1571,7 @@
+ ;;
+
+ *-freebsd*)
+- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
++ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
+ DLL_SUFFIX=".so.1.0"
+ DSO_LDOPTS="-shared"
+ fi
+@@ -1853,10 +1872,10 @@
+
+ dnl MinGW/MSYS doesn't provide or need cygpath
+ case "$host" in
+- *-mingw*)
+- CYGPATH_W=echo
++ *-cygwin*|*-mingw*)
++ CYGPATH_W="cygpath -u"
+ CYGPATH_S=cat
+- MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
++ MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
+ ;;
+ *-cygwin*|*-msvc*|*-mks*)
+ CYGPATH_W="cygpath -a -w"
+@@ -2749,6 +2768,8 @@
+ case $target in
+ *-hpux11.*)
+ ;;
++*-freebsd*)
++ ;;
+ *)
+ AC_CHECK_LIB(c_r, gethostbyname_r)
+ ;;
+@@ -7321,6 +7342,7 @@
+ AC_SUBST(USE_N32)
+ AC_SUBST(CC_VERSION)
+ AC_SUBST(CXX_VERSION)
++AC_SUBST(MSMANIFEST_TOOL)
+
+ if test "$USING_HCC"; then
+ CC='${topsrcdir}/build/hcc'
+@@ -7416,8 +7438,12 @@
+ WIN_TOP_SRC=`cd $srcdir; pwd -W`
+ ;;
+ cygwin*|msvc*|mks*)
+- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
+- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
++# Don't add the wrapper for the HOST_* versions as they contain an
++# unexpanded $CC and therfore wil get the wrapper below.
++ if test -n "$GNU_CC"; then
++ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
++ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
++ fi
+ CC="\$(CYGWIN_WRAPPER) $CC"
+ CXX="\$(CYGWIN_WRAPPER) $CXX"
+ CPP="\$(CYGWIN_WRAPPER) $CPP"
+--- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -384,7 +384,7 @@
+ ifdef NS_USE_GCC
+ LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
+ LINK_LIB = $(AR) cr $@ $(OBJS)
+-LINK_DLL = $(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
++LINK_DLL = $(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(LIB_PREFIX)$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
+ else
+ DEBUG_LINK_OPT=-DEBUG
+ ifeq ($(BUILD_OPT), 1)
+--- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -70,7 +70,7 @@
+
+ ARCH = freebsd
+
+-MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
++MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
+
+ ifeq ($(MOZ_OBJFORMAT),elf)
+ DLL_SUFFIX = so
+--- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
+@@ -25,6 +25,7 @@
+ LIB_SUFFIX = @LIB_SUFFIX@
+ LIB_PREFIX = @LIB_PREFIX@
+ DLL_SUFFIX = @DLL_SUFFIX@
++DLL_PREFIX = @DLL_PREFIX@
+ ASM_SUFFIX = @ASM_SUFFIX@
+ PROG_SUFFIX = @PROG_SUFFIX@
+ MOD_NAME = @NSPR_MODNAME@
+--- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
++++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
+ # Try not to spawn programs from within this file. If the stuff in here looks royally
+--- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200
+@@ -2738,6 +2738,7 @@
+ LIB_SUFFIX=a
+ LIB_PREFIX=lib
+ DLL_SUFFIX=so
++DLL_PREFIX=lib
+ ASM_SUFFIX=s
+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
+ PR_MD_ASFILES=
+@@ -3444,7 +3445,7 @@
+ EOF
+
+ CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
+- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
+ if test "$MOZ_OBJFORMAT" = "elf"; then
+ DLL_SUFFIX=so
+ else
+@@ -3811,6 +3812,7 @@
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+ DSO_CFLAGS=-fPIC
+ DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
+ OS_LIBS="$OS_LIBS -lc"
+ _OPTIMIZE_FLAGS=-O2
+ _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
+@@ -3880,7 +3882,8 @@
+ CC="$CC -mno-cygwin"
+ CXX="$CXX -mno-cygwin"
+ DLL_SUFFIX=dll
+- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
++ DLL_PREFIX=
++ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
+ # Use temp file for windres (bug 213281)
+ RC="$WINDRES -O coff --use-temp-file"
+ else
+@@ -3897,6 +3900,7 @@
+ LIB_SUFFIX=lib
+ LIB_PREFIX=
+ DLL_SUFFIX=dll
++ DLL_PREFIX=
+
+ CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
+ DLLFLAGS='-OUT:"$@"'
+@@ -4293,6 +4297,7 @@
+ NSINSTALL=nsinstall
+ LIB_PREFIX=
+ LIB_SUFFIX=lib
++ DLL_PREFIX=
+ DLL_SUFFIX=dll
+ DLLTOOL=''
+ RC=rc.exe
+@@ -4660,6 +4665,7 @@
+ LD=/usr/ccs/bin/ld
+ RANLIB=/usr/ccs/bin/ranlib
+ DSO_LDOPTS='-G -h $(notdir $@)'
++ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
+ if test -n "$GNU_CC"; then
+ DSO_CFLAGS=-fPIC
+ else
+@@ -5844,6 +5850,7 @@
+ s%@LIB_SUFFIX@%$LIB_SUFFIX%g
+ s%@LIB_PREFIX@%$LIB_PREFIX%g
+ s%@DLL_SUFFIX@%$DLL_SUFFIX%g
++s%@DLL_PREFIX@%$DLL_PREFIX%g
+ s%@ASM_SUFFIX@%$ASM_SUFFIX%g
+ s%@PROG_SUFFIX@%$PROG_SUFFIX%g
+ s%@MKSHLIB@%$MKSHLIB%g
+--- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200
++++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200
+@@ -549,6 +549,7 @@
+ LIB_SUFFIX=a
+ LIB_PREFIX=lib
+ DLL_SUFFIX=so
++DLL_PREFIX=lib
+ ASM_SUFFIX=s
+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
+ PR_MD_ASFILES=
+@@ -1037,7 +1038,7 @@
+ AC_DEFINE(FREEBSD)
+ AC_DEFINE(HAVE_BSD_FLOCK)
+ CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
+- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
+ if test "$MOZ_OBJFORMAT" = "elf"; then
+ DLL_SUFFIX=so
+ else
+@@ -1285,6 +1286,7 @@
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+ DSO_CFLAGS=-fPIC
+ DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
+ OS_LIBS="$OS_LIBS -lc"
+ _OPTIMIZE_FLAGS=-O2
+ _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
+@@ -1336,6 +1338,8 @@
+ CC="$CC -mno-cygwin"
+ CXX="$CXX -mno-cygwin"
+ DLL_SUFFIX=dll
++ DLL_SUFFIX=dll
++ DLL_PREFIX=
+ MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
+ # Use temp file for windres (bug 213281)
+ RC="$WINDRES -O coff --use-temp-file"
+@@ -1353,6 +1357,7 @@
+ LIB_SUFFIX=lib
+ LIB_PREFIX=
+ DLL_SUFFIX=dll
++ DLL_PREFIX=
+
+ CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
+ DLLFLAGS='-OUT:"$@"'
+@@ -1820,6 +1825,7 @@
+ LD=/usr/ccs/bin/ld
+ RANLIB=/usr/ccs/bin/ranlib
+ DSO_LDOPTS='-G -h $(notdir $@)'
++ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
+ if test -n "$GNU_CC"; then
+ DSO_CFLAGS=-fPIC
+ else
+@@ -2410,6 +2416,7 @@
+ AC_SUBST(LIB_SUFFIX)
+ AC_SUBST(LIB_PREFIX)
+ AC_SUBST(DLL_SUFFIX)
++AC_SUBST(DLL_PREFIX)
+ AC_SUBST(ASM_SUFFIX)
+ AC_SUBST(PROG_SUFFIX)
+ AC_SUBST(MKSHLIB)
+--- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100
+@@ -85,6 +85,11 @@
+
+ ###########################################################################
+
++ifeq ($(TERM),cygwin)
++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
++endif
++
+ all export:: $(INCLUDEDIR) $(GENHEADERS)
+ $(NSINSTALL) -D $(PRIVATEINCDIR)
+ $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
+--- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -109,7 +109,7 @@
+ HDIR = $(topsrcdir)/ldap/include
+
+ LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
+-DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
++DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
+
+ INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
+
+@@ -320,6 +320,10 @@
+ -$(RM) $(SO_FILES_TO_REMOVE)
+ endif
+ $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
++ if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
++ rm -f $@.manifest; \
++ fi
+
+ veryclean:: clean
+
+--- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -62,7 +62,7 @@
+ LIBPRLDAP =
+ endif
+ DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
+- $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
++ $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
+
+ INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
+
+--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200
++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200
+@@ -41,7 +41,7 @@
+ HDIR = $(topsrcdir)/ldap/include
+
+ LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
+-DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
++DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
+
+ INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
+
+@@ -76,7 +92,7 @@
+
+ # variable definitions for exported symbols
+ ifeq ($(OS_ARCH), WINNT)
+- SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
++ SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
+ else
+ SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
+ endif
+--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -56,7 +56,7 @@
+ HDIR = $(topsrcdir)/ldap/include
+
+ LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
+-DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
++DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
+
+ INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
+
+--- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100
++++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -112,14 +112,14 @@
+ gtkmozembed_internal.h
+
+ ifdef MOZ_ENABLE_GTK
+-EXTRA_DSO_LDOPTS = \
++EXTRA_DSO_LDOPTS += \
+ $(MOZ_COMPONENT_LIBS) \
+ -lgtksuperwin \
$(NULL)
+ endif
- EXPORTS = \
-Index: mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp,v
-retrieving revision 1.4
-diff -u -r1.4 nsAbBoolExprToLDAPFilter.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp 11 Oct 2002 08:17:13 -0000 1.4
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.cpp 17 May 2004 03:23:53 -0000
-@@ -39,6 +39,7 @@
- #include "nsAbBoolExprToLDAPFilter.h"
- #include "nsAbLDAPProperties.h"
- #include "nsXPIDLString.h"
-+#include "nsAbUtils.h"
+ ifdef MOZ_ENABLE_GTK2
+-EXTRA_DSO_LDOPTS = \
++EXTRA_DSO_LDOPTS += \
+ $(MOZ_COMPONENT_LIBS) \
+ $(NULL)
+ endif
+--- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100
++++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -63,10 +63,11 @@
+ TestGtkEmbedNotebook.cpp \
+ TestGtkEmbedSocket.cpp \
+ TestGtkEmbedChild.cpp
+-endif
+
+ SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
+
++endif
++
+ # ENABLE_GNOME=1
+
+ ifdef ENABLE_GNOME
+--- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200
++++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100
+@@ -68,25 +68,15 @@
+
+ unexport CC CXX
+
+-ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
+-ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
+-export::
+- rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
+- ln -fs $(srcdir)/src
+- ln -fs $(srcdir)/res
+- ln -fs $(srcdir)/public
+- ln -fs $(srcdir)/Info-*.plist .
+-endif
+-
+ libs::
+ # Bug 297227: The next line doesn't need to stay around forever, only
+ # long enough to clean up existing depend builds from when xcodebuild
+ # was being instructed to "install"
+ if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
+
+- $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
+- mkdir -p $(DIST)/package
+- $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
++# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
++# mkdir -p $(DIST)/package
++# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
+
+ clean clobber::
+ rm -rf build
+--- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200
++++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -110,7 +110,7 @@
+ $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
+ $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
+ ifndef MINIMO
+- -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
++ -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
+ endif
+ ifeq ($(OS_ARCH),WINNT)
+ ifeq ($(WINAPP),mfcembed)
+--- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100
++++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -85,7 +85,7 @@
+ endif
- const int nsAbBoolExprToLDAPFilter::TRANSLATE_CARD_PROPERTY = 1 << 0 ;
- const int nsAbBoolExprToLDAPFilter::ALLOW_NON_CONVERTABLE_CARD_PROPERTY = 1 << 1 ;
-@@ -186,13 +187,16 @@
- rv = condition->GetName (getter_Copies (name));
- NS_ENSURE_SUCCESS(rv, rv);
-- const char* ldapProperty = name.get ();
-+ CharPtrArrayGuard attrs;
- if (flags & TRANSLATE_CARD_PROPERTY)
- {
-- const MozillaLdapPropertyRelation* p =
-- MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ());
-- if (p)
-- ldapProperty = p->ldapProperty;
-+ if(const MozillaLdapPropertyRelation* property =
-+ MozillaLdapPropertyRelator::findLdapPropertyFromMozilla (name.get ()))
-+ {
-+ // allow even single ldap attribute mapppings to go through this to simplify the filter creation later.
-+ rv = MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (property->ldapProperty, attrs.GetSizeAddr(), attrs.GetArrayAddr() );
-+ NS_ENSURE_SUCCESS(rv, rv);
-+ }
- else if (!(flags & ALLOW_NON_CONVERTABLE_CARD_PROPERTY))
- return NS_OK;
- }
-@@ -202,6 +206,37 @@
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ConvertUCS2toUTF8 vUTF8 (value);
+-EXTRA_DSO_LDOPTS = \
++EXTRA_DSO_LDOPTS += \
+ $(LIBS_DIR) \
+ $(MOZ_JS_LIBS) \
+ $(MOZ_COMPONENT_LIBS) \
+--- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100
++++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200
+@@ -55,5 +55,5 @@
+ bin/components/sqlpgsql.xpt \
+ bin/components/sqlsqlite.xpt \
+ bin/components/sqlmysql.xpt \
+- bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
++ bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
+ bin/chrome/sql.jar
+--- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200
++++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200
+@@ -76,10 +76,11 @@
+ native FT_Sfnt_Tag(FT_Sfnt_Tag);
+ native FT_Size(FT_Size);
+
+-[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
++[ptr] native FTC_ImageType_p(FTC_ImageType);
+ native FTC_Face_Requester(FTC_Face_Requester);
+ native FTC_Font(FTC_Font);
+-native FTC_Image_Cache(FTC_Image_Cache);
++native FTC_FaceID(FTC_FaceID);
++native FTC_ImageCache(FTC_ImageCache);
+ native FTC_Manager(FTC_Manager);
+
+ // #ifdef MOZ_SVG
+@@ -99,7 +100,7 @@
+
+ readonly attribute FT_Library library;
+ readonly attribute FTC_Manager FTCacheManager;
+- readonly attribute FTC_Image_Cache ImageCache;
++ readonly attribute FTC_ImageCache ImageCache;
+
+ void doneFace(in FT_Face face);
+ void doneFreeType(in FT_Library lib);
+@@ -115,16 +116,16 @@
+ void outlineDecompose(in FT_Outline_p outline,
+ in const_FT_Outline_Funcs_p funcs, in voidPtr p);
+ void setCharmap(in FT_Face face, in FT_CharMap charmap);
+- void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
++ void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
+ in FT_UInt gindex, out FT_Glyph glyph);
+- void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
+- out FT_Face face, out FT_Size size);
++ void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
++ out FT_Face face);
+ void managerDone(in FTC_Manager manager);
+ void managerNew(in FT_Library lib, in FT_UInt max_faces,
+ in FT_UInt max_sizes, in FT_ULong max_bytes,
+ in FTC_Face_Requester requester, in FT_Pointer req_data,
+ out FTC_Manager manager);
+- void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
++ void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
+ /* #ifdef MOZ_SVG */
+ void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
+ in FT_Vector_p delta);
+--- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200
++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -111,7 +111,7 @@
+ {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
+ {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
+ {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
+- {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
++ {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
+ {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
+ {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
+ {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
+@@ -288,7 +288,7 @@
+ }
+
+ NS_IMETHODIMP
+-nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
++nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
+ FT_UInt glyphID, FT_Glyph *glyph)
+ {
+ // call the FreeType2 function via the function pointer
+@@ -297,11 +297,11 @@
+ }
+
+ NS_IMETHODIMP
+-nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
+- FT_Face *face, FT_Size *size)
++nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
++ FT_Face *face)
+ {
+ // call the FreeType2 function via the function pointer
+- FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
++ FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
+ return error ? NS_ERROR_FAILURE : NS_OK;
+ }
+
+@@ -326,7 +326,7 @@
+ }
+
+ NS_IMETHODIMP
+-nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
++nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
+ {
+ // call the FreeType2 function via the function pointer
+ FT_Error error = nsFTC_Image_Cache_New(manager, cache);
+@@ -395,7 +395,7 @@
+ }
+
+ NS_IMETHODIMP
+-nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
++nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
+ {
+ *aCache = mImageCache;
+ return NS_OK;
+--- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200
++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200
+@@ -120,13 +120,13 @@
+ typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
+ typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
+ typedef FT_Error (*FTC_Image_Cache_Lookup_t)
+- (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
+-typedef FT_Error (*FTC_Manager_Lookup_Size_t)
+- (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
++ (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
++typedef FT_Error (*FTC_Manager_LookupFace_t)
++ (FTC_Manager, FTC_FaceID, FT_Face*);
+ typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
+ typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
+ FTC_Face_Requester, FT_Pointer, FTC_Manager*);
+-typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
++typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
+ // #ifdef MOZ_SVG
+ typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
+ typedef FT_Error (*FT_Get_Kerning_t)
+@@ -181,7 +181,7 @@
+ FT_Outline_Decompose_t nsFT_Outline_Decompose;
+ FT_Set_Charmap_t nsFT_Set_Charmap;
+ FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
+- FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
++ FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
+ FTC_Manager_Done_t nsFTC_Manager_Done;
+ FTC_Manager_New_t nsFTC_Manager_New;
+ FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
+@@ -229,7 +229,7 @@
+ PRLibrary *mSharedLib;
+ FT_Library mFreeTypeLibrary;
+ FTC_Manager mFTCacheManager;
+- FTC_Image_Cache mImageCache;
++ FTC_ImageCache mImageCache;
+
+ static nsHashtable *sFontFamilies;
+ static nsHashtable *sRange1CharSetNames;
+--- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200
++++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -211,6 +211,10 @@
+ CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
+ CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
+
++ifeq ($(OS_ARCH), Darwin)
++EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
++endif
++
+ ifeq ($(OS_ARCH), SunOS)
+ ifndef GNU_CC
+ # When using Sun's WorkShop compiler, including
+--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100
++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -1870,10 +1870,10 @@
+
+ mPixelSize = NSToIntRound(app2dev * mFont->size);
+
+- mImageDesc.font.face_id = (void*)mEntry;
+- mImageDesc.font.pix_width = mPixelSize;
+- mImageDesc.font.pix_height = mPixelSize;
+- mImageDesc.image_type = 0;
++ mImageDesc->face_id = (FTC_FaceID)&mEntry;
++ mImageDesc->width = mPixelSize;
++ mImageDesc->height = mPixelSize;
++ mImageDesc->flags = 0;
+
+ nsresult rv;
+ mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
+@@ -1907,7 +1907,7 @@
+ if (!face)
+ return 0;
+
+- FTC_Image_Cache iCache;
++ FTC_ImageCache iCache;
+ nsresult rv = mFt2->GetImageCache(&iCache);
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Failed to get Image Cache");
+@@ -1945,8 +1945,8 @@
+
+ FTC_Manager cManager;
+ mFt2->GetFTCacheManager(&cManager);
+- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
+- &face, nsnull);
++ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
++ &face);
+ NS_ASSERTION(rv==0, "failed to get face/size");
+ if (rv)
+ return nsnull;
+@@ -2392,16 +2392,16 @@
+ mEntry->GetFamilyName(fontName);
+ mEntry->GetStyleName(styleName);
+
+- mImageDesc.font.face_id = (void*)mEntry;
++ mImageDesc->face_id = (FTC_FaceID)&mEntry;
+ // TT glyph has no relation to size
+- mImageDesc.font.pix_width = 16;
+- mImageDesc.font.pix_height = 16;
+- mImageDesc.image_type = 0;
++ mImageDesc->width = 16;
++ mImageDesc->height = 16;
++ mImageDesc->flags = 0;
+ FT_Face face = nsnull;
+ FTC_Manager cManager;
+ mFt2->GetFTCacheManager(&cManager);
+- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
+- &face, nsnull);
++ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
++ &face);
+ if (NS_FAILED(rv))
+ return;
+
+--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200
++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200
+@@ -424,7 +424,7 @@
+ nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
+ nsCOMPtr<nsIFreeType2> mFt2;
+ PRUint16 mPixelSize;
+- FTC_Image_Desc mImageDesc;
++ FTC_ImageType mImageDesc;
+ nsCString mFontNameBase; // the base name of type 1 (sub) fonts
+ nscoord mHeight;
+
+@@ -493,7 +493,7 @@
+ protected:
+ nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
+ nsCOMPtr<nsIFreeType2> mFt2;
+- FTC_Image_Desc mImageDesc;
++ FTC_ImageType mImageDesc;
+ };
+ #endif // MOZ_ENABLE_FREETYPE2
+ #endif // MOZ_ENABLE_XFT
+--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200
++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -177,7 +177,7 @@
+ FTC_Manager mgr;
+ nsresult rv;
+ mFt2->GetFTCacheManager(&mgr);
+- rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
++ rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
+ NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
+ if (NS_FAILED(rv))
+ return nsnull;
+@@ -191,22 +191,15 @@
+ PRBool embedded_bimap = PR_FALSE;
+ mFaceID = aFaceID;
+ mPixelSize = aPixelSize;
+- mImageDesc.font.face_id = (void*)mFaceID;
+- mImageDesc.font.pix_width = aPixelSize;
+- mImageDesc.font.pix_height = aPixelSize;
+- mImageDesc.image_type = 0;
++ mImageDesc->face_id = (FTC_FaceID)&mFaceID;
++ mImageDesc->width = aPixelSize;
++ mImageDesc->height = aPixelSize;
++ mImageDesc->flags = 0;
+
+ if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
+- mImageDesc.image_type |= ftc_image_mono;
+ anti_alias = PR_FALSE;
+ }
-+ // check if using multiple ldap attributes
-+ if(attrs.GetSize() == 1 )
-+ GenerateSingleFilter(conditionType,filter,vUTF8,attrs.GetArray()[0]);
-+ else
-+ {
-+ // add the opening brace if using multiple ldap attributes
-+ switch (conditionType)
-+ {
-+ // 'NOT' conditionals use the 'AND' operator
-+ case nsIAbBooleanConditionTypes::DoesNotExist:
-+ case nsIAbBooleanConditionTypes::DoesNotContain:
-+ case nsIAbBooleanConditionTypes::IsNot:
-+ filter += NS_LITERAL_CSTRING("(&");
-+ break;
-+ default:
-+ filter += NS_LITERAL_CSTRING("(|");
-+ break;
-+ }
-+ GenerateMultipleFilter(conditionType,filter,vUTF8,&attrs);
-+ // add the closing brace if using multiple ldap attributes
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+
-+ return rv;
-+}
-+void nsAbBoolExprToLDAPFilter:: GenerateSingleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ const char *ldapProperty)
-+{
- switch (conditionType)
- {
- case nsIAbBooleanConditionTypes::DoesNotExist:
-@@ -282,7 +317,47 @@
- default:
- break;
- }
+- if (nsFreeType2::gFreeType2Autohinted)
+- mImageDesc.image_type |= ftc_image_flag_autohinted;
-
-- return rv;
+- if (nsFreeType2::gFreeType2Unhinted)
+- mImageDesc.image_type |= ftc_image_flag_unhinted;
+-
+ PRUint32 num_embedded_bitmaps, i;
+ PRInt32* embedded_bitmapheights;
+ mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
+@@ -218,7 +211,6 @@
+ if (embedded_bitmapheights[i] == aPixelSize) {
+ embedded_bimap = PR_TRUE;
+ // unhinted must be set for embedded bitmaps to be used
+- mImageDesc.image_type |= ftc_image_flag_unhinted;
+ break;
+ }
+ }
+@@ -312,7 +304,7 @@
+ if (!face)
+ return NS_ERROR_FAILURE;
+
+- FTC_Image_Cache icache;
++ FTC_ImageCache icache;
+ mFt2->GetImageCache(&icache);
+ if (!icache)
+ return NS_ERROR_FAILURE;
+@@ -401,7 +393,7 @@
+ if (!face)
+ return 0;
+
+- FTC_Image_Cache icache;
++ FTC_ImageCache icache;
+ mFt2->GetImageCache(&icache);
+ if (!icache)
+ return 0;
+@@ -723,7 +715,7 @@
+ if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
+ #endif
+
+- FTC_Image_Cache icache;
++ FTC_ImageCache icache;
+ mFt2->GetImageCache(&icache);
+ if (!icache)
+ return 0;
+--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200
++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200
+@@ -110,7 +110,7 @@
+ XImage *GetXImage(PRUint32 width, PRUint32 height);
+ nsITrueTypeFontCatalogEntry *mFaceID;
+ PRUint16 mPixelSize;
+- FTC_Image_Desc mImageDesc;
++ FTC_ImageType mImageDesc;
+ nsCOMPtr<nsIFreeType2> mFt2;
+ };
+
+--- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100
++++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200
+@@ -108,7 +108,7 @@
+ /* Defines for MMX/SSE2 support. */
+
+ #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
+-#define HAVE_MMX_INTEL_MNEMONICS
++//#define HAVE_MMX_INTEL_MNEMONICS
+
+ /* SSE2 code appears broken for some cpus (bug 247437) */
+ /* #define HAVE_SSE2_INTEL_MNEMONICS */
+--- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100
++++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -423,19 +423,19 @@
+ return;
+ }
+
+- FTC_Image_Desc imageDesc;
+- imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
++ FTC_ImageType imageDesc;
++ imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
+ float twipstopixel = GetTwipsToPixels();
+ float scale = GetPixelScale();
+- imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
+- imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
+- imageDesc.image_type |= ftc_image_grays;
++ imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
++ imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
++ imageDesc->flags |= /* ftc_image_grays */0;
+
+ // get the face
+ nsresult rv;
+ FTC_Manager mgr;
+ nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
+- rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
++ rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
+ NS_ASSERTION(mFace, "failed to get face/size");
}
-+void nsAbBoolExprToLDAPFilter:: GenerateMultipleFilter(
-+ nsAbBooleanConditionType conditionType,
-+ nsCString& filter,
-+ NS_ConvertUCS2toUTF8 &vUTF8,
-+ CharPtrArrayGuard *pAttrs)
-+{
-+ PRUint16 i = 0;
-+ PRUint16 inner = 0;
-+
-+ /*
-+ * This function is based on the fact that we are trying to generate support
-+ * for multiple occurring ldap attributes. Consider the following query:
-+ * (PagerNumber,=,123456) where PagerNumber = pager|pagerphone translates to:
-+ * (|(&(pager=*)(pager=123456))(&(!(pager=*))(pagerphone=123456)))
-+ * This can be shortened to:
-+ * (|(pager=123456)(&(!(pager=*))(pagerphone=123456)))
-+ *
-+ * i.e. use the first occurring attribute if it exists otherwise if first
-+ * does not exist use the second etc. The assumption is that the first
-+ * always takes precedence.
-+ * This translates to:
-+ * GenerateSingleFilter(Is);
-+ * GenerateSingleFilter(DoesNotExists);
-+ * GenerateSingleFilter(Is);
-+ */
-+ for (i = 0; i < pAttrs->GetSize(); i++)
-+ {
-+ if(i == 0)
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ else
-+ {
-+ filter += NS_LITERAL_CSTRING("(&");
-+ nsAbBooleanConditionType doesNotExistsType = nsIAbBooleanConditionTypes::DoesNotExist;
-+ for(inner = 0; inner < i; ++inner)
-+ {
-+ GenerateSingleFilter(doesNotExistsType,filter,vUTF8,pAttrs->GetArray()[inner]);
-+ }
-+ GenerateSingleFilter(conditionType,filter,vUTF8,pAttrs->GetArray()[i]);
-+ filter += NS_LITERAL_CSTRING(")");
-+ }
-+ }
-+}
-Index: mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h,v
-retrieving revision 1.2
-diff -u -r1.2 nsAbBoolExprToLDAPFilter.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 28 Sep 2001 20:06:21 -0000 1.2
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 17 May 2004 03:23:53 -0000
-@@ -42,6 +42,7 @@
+--- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200
+@@ -106,6 +106,7 @@
+ nsVCard.cpp \
+ nsVCardObj.cpp \
+ nsMsgVCardService.cpp \
++ nsAbMD5sum.cpp \
+ nsAbLDIFService.cpp \
+ $(NULL)
+
+@@ -114,7 +115,9 @@
+ nsDirPrefs.h \
+ nsAbCardProperty.h \
+ nsAbMDBCardProperty.h \
+- nsVCardObj.h \
++ nsVCardObj.h \
++ nsAbAddressCollecter.h \
++ nsAbDirectoryQuery.h \
+ $(NULL)
+
+ ifeq ($(OS_ARCH),WINNT)
+--- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200
+@@ -43,6 +43,7 @@
#include "nsIAbBooleanExpression.h"
#include "nsCOMPtr.h"
#include "nsString.h"
+#include "nsAbUtils.h"
- class nsAbBoolExprToLDAPFilter
- {
-@@ -67,6 +68,16 @@
+ class nsIAbLDAPAttributeMap;
+
+@@ -74,6 +75,16 @@
nsIAbBooleanConditionString* condition,
nsCString& filter,
int flags);
@@ -190,30 +1199,25 @@ diff -u -r1.2 nsAbBoolExprToLDAPFilter.h
};
#endif
-Index: mailnews/addrbook/src/nsAbLDAPDirectory.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp,v
-retrieving revision 1.17
-diff -u -r1.17 nsAbLDAPDirectory.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 14 Feb 2004 02:09:27 -0000 1.17
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 17 May 2004 03:23:53 -0000
-@@ -118,11 +118,13 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200
+@@ -126,11 +126,13 @@
// use mURINoQuery to get a prefName
nsCAutoString prefName;
- prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
-+ prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) ;
++ prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
// turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
nsXPIDLCString URI;
-- rv = prefs->CopyCharPref(prefName.get(), getter_Copies(URI));
+- rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
+ nsCAutoString uriPrefName;
+ uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
-+ rv = prefs->CopyCharPref(uriPrefName.get(), getter_Copies(URI));
++ rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
if (NS_FAILED(rv))
{
/*
-@@ -146,6 +148,27 @@
+@@ -154,6 +156,27 @@
nsCAutoString tempLDAPURL(mURINoQuery);
tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
rv = mURL->SetSpec(tempLDAPURL);
@@ -241,7 +1245,7 @@ diff -u -r1.17 nsAbLDAPDirectory.cpp
}
else
{
-@@ -156,24 +179,29 @@
+@@ -164,24 +187,29 @@
// get the login information, if there is any
//
rv = prefs->GetCharPref(
@@ -277,13 +1281,8 @@ diff -u -r1.17 nsAbLDAPDirectory.cpp
+ NS_LITERAL_CSTRING(".protocolVersion")).get(),
getter_Copies(protocolVersion));
-Index: mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp,v
-retrieving revision 1.22
-diff -u -r1.22 nsAbLDAPDirectoryQuery.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 14 Feb 2004 02:09:27 -0000 1.22
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 17 May 2004 03:23:53 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200
@@ -74,7 +74,7 @@
PRInt32 resultLimit = -1,
PRInt32 timeOut = 0);
@@ -293,16 +1292,16 @@ diff -u -r1.22 nsAbLDAPDirectoryQuery.cpp
protected:
nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
-@@ -105,6 +105,8 @@
- PRBool mInitialized;
+@@ -108,6 +108,8 @@
PRBool mCanceled;
+ PRBool mWaitingForPrevQueryToFinish;
+ nsAutoString m_sPassword;
+
nsCOMPtr<nsILDAPOperation> mSearchOperation;
PRLock* mLock;
-@@ -255,7 +257,7 @@
+@@ -272,7 +274,7 @@
// If mLogin is set, we're expected to use it to get a password.
//
@@ -311,7 +1310,7 @@ diff -u -r1.22 nsAbLDAPDirectoryQuery.cpp
// XXX hack until nsUTF8AutoString exists
#define nsUTF8AutoString nsCAutoString
nsUTF8AutoString spec;
-@@ -398,10 +400,13 @@
+@@ -415,10 +417,13 @@
rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
@@ -328,7 +1327,7 @@ diff -u -r1.22 nsAbLDAPDirectoryQuery.cpp
return rv;
}
-@@ -685,7 +690,7 @@
+@@ -707,7 +712,7 @@
rv = getLdapReturnAttributes (arguments, returnAttributes);
NS_ENSURE_SUCCESS(rv, rv);
@@ -337,279 +1336,679 @@ diff -u -r1.22 nsAbLDAPDirectoryQuery.cpp
// Get the filter
nsCOMPtr<nsISupports> supportsExpression;
rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
-@@ -811,6 +816,11 @@
+@@ -828,6 +833,10 @@
+ if (msgListener)
+ {
+ msgListener->mUrl = url;
++ msgListener->mQueryListener = listener;
++ msgListener->mResultLimit = resultLimit;
++ msgListener->mTimeOut = timeOut;
++ msgListener->mQueryArguments = arguments;
+ return msgListener->DoSearch();
+ }
+ }
+@@ -845,6 +854,11 @@
timeOut);
if (_messageListener == NULL)
return NS_ERROR_OUT_OF_MEMORY;
-+
++
+ nsAutoString wPassword;
+ wPassword.AssignWithConversion(mPassword.get());
+ _messageListener->SetPassword(wPassword);
+
- messageListener = _messageListener;
- nsVoidKey key (NS_REINTERPRET_CAST(void *,contextID));
-
-Index: mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h,v
-retrieving revision 1.6
-diff -u -r1.6 nsAbLDAPDirectoryQuery.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 14 Feb 2004 02:09:27 -0000 1.6
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 17 May 2004 03:23:53 -0000
-@@ -74,6 +74,7 @@
- nsresult RemoveListener (PRInt32 contextID);
+ mListener = _messageListener;
+ *_retval = 1;
+
+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200
+@@ -72,6 +72,7 @@
+ friend class nsAbQueryLDAPMessageListener;
nsresult Initiate ();
nsXPIDLCString mLogin; // authenticate to the LDAP server as...
+ nsXPIDLCString mPassword; // password to the LDAP server as...
nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
-Index: mailnews/addrbook/src/nsAbLDAPProperties.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp,v
-retrieving revision 1.11
-diff -u -r1.11 nsAbLDAPProperties.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp 22 Mar 2003 15:43:29 -0000 1.11
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.cpp 17 May 2004 03:23:53 -0000
-@@ -39,6 +39,7 @@
- #include "nsAbLDAPProperties.h"
-
- #include "nsAbUtils.h"
-+#include "nsCRT.h"
-
- #include "nsCOMPtr.h"
- #include "nsString.h"
-@@ -59,6 +60,21 @@
- If there are multiple entries for a mozilla
- property the first takes precedence.
-
-+ But where we need to do a query against
-+ a multiple occurring ldap attribute we
-+ need to OR all the possible ldap entries e.g.
+--- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -1 +1,633 @@
+-dummy
++/*
++ * The contents of this file are subject to the Mozilla Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is the Netscape security libraries.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1994-2000 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * Alternatively, the contents of this file may be used under the
++ * terms of the GNU General Public License Version 2 or later (the
++ * "GPL"), in which case the provisions of the GPL are applicable
++ * instead of those above. If you wish to allow use of your
++ * version of this file only under the terms of the GPL and not to
++ * allow others to use your version of this file under the MPL,
++ * indicate your decision by deleting the provisions above and
++ * replace them with the notice and other provisions required by
++ * the GPL. If you do not delete the provisions above, a recipient
++ * may use your version of this file under either the MPL or the
++ * GPL.
++ */
++#include <stdio.h>
++#include <stdlib.h>
+
-+ (CellularNumber=123456) translates to
-+ (|(mobile=123456)(&(!(mobile=*))(cellphone=123456))(&(!(mobile=*))(!(cellphone=*))(carphone=123456)))
++#include "prerr.h"
+
-+ i.e. use the first occurring attribute otherwise if
-+ first does not exist use the second etc.
++#include "prtypes.h"
++#include "prlong.h"
++#include "plstr.h"
++#include "nsMemory.h"
+
-+ [Multiple occurring ldap attributes do not
-+ include aliases. We have also ignored the case
-+ for including 'displayname' as the first occurring
-+ attribute 'cn' is a required attribute.]
++#define MD5_HASH_LEN 16
++#define MD5_BUFFER_SIZE 64
++#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
+
- This ensures that
-
- 1) Generality is maintained when mapping from
-@@ -101,52 +117,32 @@
- {MozillaProperty_String, "FaxNumber", "fax"},
- // organizationalPerson
- {MozillaProperty_String, "FaxNumber", "facsimiletelephonenumber"},
-- // inetOrgPerson
-- {MozillaProperty_String, "PagerNumber", "pager"},
-- // ?
-- {MozillaProperty_String, "PagerNumber", "pagerphone"},
-- // inetOrgPerson
-- {MozillaProperty_String, "CellularNumber", "mobile"},
-- // ?
-- {MozillaProperty_String, "CellularNumber", "cellphone"},
-- // ?
-- {MozillaProperty_String, "CellularNumber", "carphone"},
-+ // inetOrgPerson,?
-+ {MozillaProperty_String, "PagerNumber", "pager,pagerphone"},
-+ // inetOrgPerson,?,?
-+ {MozillaProperty_String, "CellularNumber", "mobile,cellphone,carphone"},
-
- // No Home* properties defined yet
-
-- // organizationalPerson
-- {MozillaProperty_String, "WorkAddress", "postofficebox"},
-- // ?
-- {MozillaProperty_String, "WorkAddress", "streetaddress"},
-+ // organizationalPerson,?
-+ {MozillaProperty_String, "WorkAddress", "postofficebox,streetaddress"},
- // ?
- {MozillaProperty_String, "WorkCity", "l"},
- // ?
- {MozillaProperty_String, "WorkCity", "locality"},
- // ?
-- {MozillaProperty_String, "WorkState", "st"},
-- // ?
-- {MozillaProperty_String, "WorkState", "region"},
-- // organizationalPerson
-- {MozillaProperty_String, "WorkZipCode", "postalcode"},
-- // ?
-- {MozillaProperty_String, "WorkZipCode", "zip"},
-+ {MozillaProperty_String, "WorkState", "st,region"},
-+ // organizationalPerson,?
-+ {MozillaProperty_String, "WorkZipCode", "postalcode,zip"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
-
- // organizationalPerson
- {MozillaProperty_String, "JobTitle", "title"},
- // ?
-- {MozillaProperty_String, "Department", "ou"},
-- // ?
-- {MozillaProperty_String, "Department", "orgunit"},
-- // ?
-- {MozillaProperty_String, "Department", "department"},
-- // ?
-- {MozillaProperty_String, "Department", "departmentnumber"},
-- // inetOrgPerson
-- {MozillaProperty_String, "Company", "o"},
-- // ?
-- {MozillaProperty_String, "Company", "company"},
-+ {MozillaProperty_String, "Department", "ou,orgunit,department,departmentnumber"},
-+ // inetOrgPerson,?
-+ {MozillaProperty_String, "Company", "o,company"},
- // ?
- {MozillaProperty_String, "WorkCountry", "countryname"},
- // ?
-@@ -168,10 +164,8 @@
- // ?
- {MozillaProperty_String, "Custom4", "custom4"},
-
-- // ?
-- {MozillaProperty_String, "Notes", "notes"},
-- // person
-- {MozillaProperty_String, "Notes", "description"},
-+ // ?,person
-+ {MozillaProperty_String, "Notes", "notes,description"},
-
- // mozilla specfic
- {MozillaProperty_Int, "PreferMailFormat", "xmozillausehtmlmail"},
-@@ -209,10 +203,22 @@
- if (IsInitialized) { return ; }
-
- for (int i = tableSize - 1 ; i >= 0 ; -- i) {
-- nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
-- nsCStringKey keyLdap (table [i].ldapProperty, -1, nsCStringKey::NEVER_OWN);
-
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsCRT::strdup(table[i].ldapProperty);
-+ char *tmpLDAPProperty;
-+
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (attrToken != nsnull)
-+ {
-+ while ( ' ' == *attrToken)
-+ attrToken++;
-+ nsCStringKey keyLdap (attrToken, -1, nsCStringKey::NEVER_OWN);
- mLdapToMozilla.Put(&keyLdap, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
-+ }
++#define CV0_1 0x67452301
++#define CV0_2 0xefcdab89
++#define CV0_3 0x98badcfe
++#define CV0_4 0x10325476
+
-+ nsCStringKey keyMozilla (table [i].mozillaProperty, -1, nsCStringKey::NEVER_OWN);
- mMozillaToLdap.Put(&keyMozilla, NS_REINTERPRET_CAST(void *, NS_CONST_CAST(MozillaLdapPropertyRelation*, &table[i]))) ;
- }
- IsInitialized = PR_TRUE;
-@@ -234,10 +240,13 @@
- const MozillaLdapPropertyRelation* MozillaLdapPropertyRelator::findMozillaPropertyFromLdap (const char* ldapProperty)
- {
- Initialize();
-+ char *attrToken;
-+ char *tmpLDAPProperty;
-+ attrToken = nsCRT::strtok(NS_CONST_CAST(char *,ldapProperty), ",", &tmpLDAPProperty);
- // ensure that we always do a case insensitive comparison
- // against the incoming ldap attributes.
-- nsCAutoString lowercasedProp(ldapProperty);
-- ToLowerCase(nsDependentCString(ldapProperty), lowercasedProp);
-+ nsCAutoString lowercasedProp (attrToken) ;
-+ ToLowerCase(nsDependentCString(attrToken),lowercasedProp);
- nsCStringKey key(lowercasedProp);
-
- return NS_REINTERPRET_CAST(const MozillaLdapPropertyRelation *, mLdapToMozilla.Get(&key)) ;
-@@ -287,5 +296,66 @@
- }
- }
-
-+ return rv;
++#define T1_0 0xd76aa478
++#define T1_1 0xe8c7b756
++#define T1_2 0x242070db
++#define T1_3 0xc1bdceee
++#define T1_4 0xf57c0faf
++#define T1_5 0x4787c62a
++#define T1_6 0xa8304613
++#define T1_7 0xfd469501
++#define T1_8 0x698098d8
++#define T1_9 0x8b44f7af
++#define T1_10 0xffff5bb1
++#define T1_11 0x895cd7be
++#define T1_12 0x6b901122
++#define T1_13 0xfd987193
++#define T1_14 0xa679438e
++#define T1_15 0x49b40821
++
++#define T2_0 0xf61e2562
++#define T2_1 0xc040b340
++#define T2_2 0x265e5a51
++#define T2_3 0xe9b6c7aa
++#define T2_4 0xd62f105d
++#define T2_5 0x02441453
++#define T2_6 0xd8a1e681
++#define T2_7 0xe7d3fbc8
++#define T2_8 0x21e1cde6
++#define T2_9 0xc33707d6
++#define T2_10 0xf4d50d87
++#define T2_11 0x455a14ed
++#define T2_12 0xa9e3e905
++#define T2_13 0xfcefa3f8
++#define T2_14 0x676f02d9
++#define T2_15 0x8d2a4c8a
++
++#define T3_0 0xfffa3942
++#define T3_1 0x8771f681
++#define T3_2 0x6d9d6122
++#define T3_3 0xfde5380c
++#define T3_4 0xa4beea44
++#define T3_5 0x4bdecfa9
++#define T3_6 0xf6bb4b60
++#define T3_7 0xbebfbc70
++#define T3_8 0x289b7ec6
++#define T3_9 0xeaa127fa
++#define T3_10 0xd4ef3085
++#define T3_11 0x04881d05
++#define T3_12 0xd9d4d039
++#define T3_13 0xe6db99e5
++#define T3_14 0x1fa27cf8
++#define T3_15 0xc4ac5665
++
++#define T4_0 0xf4292244
++#define T4_1 0x432aff97
++#define T4_2 0xab9423a7
++#define T4_3 0xfc93a039
++#define T4_4 0x655b59c3
++#define T4_5 0x8f0ccc92
++#define T4_6 0xffeff47d
++#define T4_7 0x85845dd1
++#define T4_8 0x6fa87e4f
++#define T4_9 0xfe2ce6e0
++#define T4_10 0xa3014314
++#define T4_11 0x4e0811a1
++#define T4_12 0xf7537e82
++#define T4_13 0xbd3af235
++#define T4_14 0x2ad7d2bb
++#define T4_15 0xeb86d391
++
++#define R1B0 0
++#define R1B1 1
++#define R1B2 2
++#define R1B3 3
++#define R1B4 4
++#define R1B5 5
++#define R1B6 6
++#define R1B7 7
++#define R1B8 8
++#define R1B9 9
++#define R1B10 10
++#define R1B11 11
++#define R1B12 12
++#define R1B13 13
++#define R1B14 14
++#define R1B15 15
++
++#define R2B0 1
++#define R2B1 6
++#define R2B2 11
++#define R2B3 0
++#define R2B4 5
++#define R2B5 10
++#define R2B6 15
++#define R2B7 4
++#define R2B8 9
++#define R2B9 14
++#define R2B10 3
++#define R2B11 8
++#define R2B12 13
++#define R2B13 2
++#define R2B14 7
++#define R2B15 12
++
++#define R3B0 5
++#define R3B1 8
++#define R3B2 11
++#define R3B3 14
++#define R3B4 1
++#define R3B5 4
++#define R3B6 7
++#define R3B7 10
++#define R3B8 13
++#define R3B9 0
++#define R3B10 3
++#define R3B11 6
++#define R3B12 9
++#define R3B13 12
++#define R3B14 15
++#define R3B15 2
++
++#define R4B0 0
++#define R4B1 7
++#define R4B2 14
++#define R4B3 5
++#define R4B4 12
++#define R4B5 3
++#define R4B6 10
++#define R4B7 1
++#define R4B8 8
++#define R4B9 15
++#define R4B10 6
++#define R4B11 13
++#define R4B12 4
++#define R4B13 11
++#define R4B14 2
++#define R4B15 9
++
++#define S1_0 7
++#define S1_1 12
++#define S1_2 17
++#define S1_3 22
++
++#define S2_0 5
++#define S2_1 9
++#define S2_2 14
++#define S2_3 20
++
++#define S3_0 4
++#define S3_1 11
++#define S3_2 16
++#define S3_3 23
++
++#define S4_0 6
++#define S4_1 10
++#define S4_2 15
++#define S4_3 21
++
++struct MD5ContextStr {
++ PRUint32 lsbInput;
++ PRUint32 msbInput;
++ PRUint32 cv[4];
++ union {
++ PRUint8 b[64];
++ PRUint32 w[16];
++ } u;
++};
++typedef struct MD5ContextStr MD5Context;
++
++#define inBuf u.b
++
++int MD5_Hash(unsigned char *dest, const char *src);
++int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
++MD5Context * MD5_NewContext(void);
++void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
++void MD5_Begin(MD5Context *cx);
++static void md5_compress(MD5Context *cx);
++void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
++void MD5_End(MD5Context *cx, unsigned char *digest,
++ unsigned int *digestLen, unsigned int maxDigestLen);
++unsigned int MD5_FlattenSize(MD5Context *cx);
++int MD5_Flatten(MD5Context *cx, unsigned char *space);
++MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
++void MD5_TraceState(MD5Context *cx);
++
++int
++MD5_Hash(unsigned char *dest, const char *src)
++{
++ return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
++}
++
++int
++MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
++{
++ unsigned int len;
++ MD5Context *cx = MD5_NewContext();
++ if (cx == NULL) {
++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
++ return -1;
++ }
++ MD5_Begin(cx);
++ MD5_Update(cx, src, src_length);
++ MD5_End(cx, dest, &len, MD5_HASH_LEN);
++ MD5_DestroyContext(cx, PR_TRUE);
++ return 0;
+}
+
-+// Parse the input string which may contain a single ldap attribute or multiple attributes in the form
-+// "string" or "string1,string2,string3" respectively and assign to the array.
-+nsresult MozillaLdapPropertyRelator::getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes)
++MD5Context *
++MD5_NewContext(void)
+{
-+ NS_ENSURE_ARG_POINTER(aAttrCount);
-+ NS_ENSURE_ARG_POINTER(aAttributes);
++ MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
++ if (cx == NULL) {
++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
++ return NULL;
++ }
++ return cx;
++}
+
-+ nsresult rv = NS_OK;
++void
++MD5_DestroyContext(MD5Context *cx, PRBool freeit)
++{
++ if (freeit) {
++ free(cx);
++ }
++}
+
-+ *aAttributes = 0;
-+ // we must have at least one attribute
-+ *aAttrCount = 1;
++void
++MD5_Begin(MD5Context *cx)
++{
++ cx->lsbInput = 0;
++ cx->msbInput = 0;
++ memset(cx->inBuf, 0, sizeof(cx->inBuf));
++ cx->cv[0] = CV0_1;
++ cx->cv[1] = CV0_2;
++ cx->cv[2] = CV0_3;
++ cx->cv[3] = CV0_4;
++}
+
-+ // if no multiple ldap attributes then allocate our single entry and exit
-+ if (!strchr(aLDAPProperty,','))
-+ {
-+ if (!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ if (!((*aAttributes)[0] = nsCRT::strdup(aLDAPProperty)))
-+ return NS_ERROR_OUT_OF_MEMORY;
++#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
+
-+ return rv;
-+ }
++#define MASK 0x00ff00ff
++#ifdef IS_LITTLE_ENDIAN
++#define lendian(i32) \
++ (i32)
++#else
++#define lendian(i32) \
++ (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
++#endif
+
-+ char *attrToken = nsnull;
-+ char *LDAPProperty = nsnull;
-+ char *tmpLDAPProperty;
++#if defined(SOLARIS) || defined(HPUX)
++#define addto64(sumhigh, sumlow, addend) \
++ sumlow += addend; sumhigh += (sumlow < addend);
++#else
++#define addto64(sumhigh, sumlow, addend) \
++ sumlow += addend; if (sumlow < addend) ++sumhigh;
++#endif
+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
++#define F(X, Y, Z) \
++ ((X & Y) | ((~X) & Z))
+
-+ // set our tokenizer to the start
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
++#define G(X, Y, Z) \
++ ((X & Z) | (Y & (~Z)))
+
-+ // Count up the attribute names
-+ while ((attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty)) != nsnull)
-+ *aAttrCount += 1;
++#define H(X, Y, Z) \
++ (X ^ Y ^ Z)
+
-+ nsCRT::free (LDAPProperty);
-+ if(!(*aAttributes = NS_STATIC_CAST(char **, nsMemory::Alloc(*aAttrCount * sizeof(char *)))))
-+ return NS_ERROR_OUT_OF_MEMORY;
++#define I(X, Y, Z) \
++ (Y ^ (X | (~Z)))
+
-+ if((LDAPProperty = nsCRT::strdup(aLDAPProperty)) == nsnull)
-+ return NS_ERROR_OUT_OF_MEMORY;
++#define FF(a, b, c, d, bufint, s, ti) \
++ a = b + cls(a + F(b, c, d) + bufint + ti, s)
+
-+ PRInt32 j = 0;
-+ attrToken = nsCRT::strtok(LDAPProperty, ",", &tmpLDAPProperty);
-+ while (nsnull != attrToken) {
-+ if(((*aAttributes)[j++] = nsCRT::strdup(attrToken)) == nsnull)
-+ {
-+ nsCRT::free(LDAPProperty);
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ }
-+
-+ attrToken = nsCRT::strtok(tmpLDAPProperty, ",", &tmpLDAPProperty);
++#define GG(a, b, c, d, bufint, s, ti) \
++ a = b + cls(a + G(b, c, d) + bufint + ti, s)
++
++#define HH(a, b, c, d, bufint, s, ti) \
++ a = b + cls(a + H(b, c, d) + bufint + ti, s)
++
++#define II(a, b, c, d, bufint, s, ti) \
++ a = b + cls(a + I(b, c, d) + bufint + ti, s)
++
++static void
++md5_compress(MD5Context *cx)
++{
++ PRUint32 a, b, c, d;
++ PRUint32 tmp;
++ a = cx->cv[0];
++ b = cx->cv[1];
++ c = cx->cv[2];
++ d = cx->cv[3];
++#ifndef IS_LITTLE_ENDIAN
++ cx->u.w[0] = lendian(cx->u.w[0]);
++ cx->u.w[1] = lendian(cx->u.w[1]);
++ cx->u.w[2] = lendian(cx->u.w[2]);
++ cx->u.w[3] = lendian(cx->u.w[3]);
++ cx->u.w[4] = lendian(cx->u.w[4]);
++ cx->u.w[5] = lendian(cx->u.w[5]);
++ cx->u.w[6] = lendian(cx->u.w[6]);
++ cx->u.w[7] = lendian(cx->u.w[7]);
++ cx->u.w[8] = lendian(cx->u.w[8]);
++ cx->u.w[9] = lendian(cx->u.w[9]);
++ cx->u.w[10] = lendian(cx->u.w[10]);
++ cx->u.w[11] = lendian(cx->u.w[11]);
++ cx->u.w[12] = lendian(cx->u.w[12]);
++ cx->u.w[13] = lendian(cx->u.w[13]);
++ cx->u.w[14] = lendian(cx->u.w[14]);
++ cx->u.w[15] = lendian(cx->u.w[15]);
++#endif
++ FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
++ FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
++ FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
++ FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
++ FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
++ FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
++ FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
++ FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
++ FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
++ FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
++ FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
++ FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
++ FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
++ FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
++ FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
++ FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
++ GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
++ GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
++ GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
++ GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
++ GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
++ GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
++ GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
++ GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
++ GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
++ GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
++ GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
++ GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
++ GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
++ GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
++ GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
++ GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
++ HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
++ HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
++ HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
++ HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
++ HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
++ HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
++ HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
++ HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
++ HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
++ HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
++ HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
++ HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
++ HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
++ HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
++ HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
++ HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
++ II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
++ II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
++ II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
++ II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
++ II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
++ II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
++ II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
++ II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
++ II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
++ II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
++ II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
++ II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
++ II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
++ II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
++ II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
++ II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
++ cx->cv[0] += a;
++ cx->cv[1] += b;
++ cx->cv[2] += c;
++ cx->cv[3] += d;
++}
++
++void
++MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
++{
++ PRUint32 bytesToConsume;
++ PRUint32 inBufIndex = cx->lsbInput & 63;
++
++ /* Add the number of input bytes to the 64-bit input counter. */
++ addto64(cx->msbInput, cx->lsbInput, inputLen);
++ if (inBufIndex) {
++ /* There is already data in the buffer. Fill with input. */
++ bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
++ memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
++ if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
++ /* The buffer is filled. Run the compression function. */
++ md5_compress(cx);
++ /* Remaining input. */
++ inputLen -= bytesToConsume;
++ input += bytesToConsume;
++ }
++
++ /* Iterate over 64-byte chunks of the message. */
++ while (inputLen >= MD5_BUFFER_SIZE) {
++ memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
++ md5_compress(cx);
++ inputLen -= MD5_BUFFER_SIZE;
++ input += MD5_BUFFER_SIZE;
++ }
++
++ /* Tail of message (message bytes mod 64). */
++ if (inputLen)
++ memcpy(cx->inBuf, input, inputLen);
++}
++
++static const unsigned char padbytes[] = {
++ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++
++void
++MD5_End(MD5Context *cx, unsigned char *digest,
++ unsigned int *digestLen, unsigned int maxDigestLen)
++{
++#ifndef IS_LITTLE_ENDIAN
++ PRUint32 tmp;
++#endif
++ PRUint32 lowInput, highInput;
++ PRUint32 inBufIndex = cx->lsbInput & 63;
++
++ if (maxDigestLen < MD5_HASH_LEN) {
++// PORT_SetError(SEC_ERROR_INVALID_ARGS);
++ return;
++ }
++
++ /* Copy out the length of bits input before padding. */
++ lowInput = cx->lsbInput;
++ highInput = (cx->msbInput << 3) | (lowInput >> 29);
++ lowInput <<= 3;
++
++ if (inBufIndex < MD5_END_BUFFER) {
++ MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
++ } else {
++ MD5_Update(cx, padbytes,
++ MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
++ }
++
++ /* Store the number of bytes input (before padding) in final 64 bits. */
++ cx->u.w[14] = lendian(lowInput);
++ cx->u.w[15] = lendian(highInput);
++
++ /* Final call to compress. */
++ md5_compress(cx);
++
++ /* Copy the resulting values out of the chain variables into return buf. */
++ *digestLen = MD5_HASH_LEN;
++#ifndef IS_LITTLE_ENDIAN
++ cx->cv[0] = lendian(cx->cv[0]);
++ cx->cv[1] = lendian(cx->cv[1]);
++ cx->cv[2] = lendian(cx->cv[2]);
++ cx->cv[3] = lendian(cx->cv[3]);
++#endif
++ memcpy(digest, cx->cv, MD5_HASH_LEN);
++}
++
++unsigned int
++MD5_FlattenSize(MD5Context *cx)
++{
++ return sizeof(*cx);
++}
++
++int
++MD5_Flatten(MD5Context *cx, unsigned char *space)
++{
++ memcpy(space, cx, sizeof(*cx));
++ return 0;
++}
++
++MD5Context *
++MD5_Resurrect(unsigned char *space, void *arg)
++{
++ MD5Context *cx = MD5_NewContext();
++ if (cx)
++ memcpy(cx, space, sizeof(*cx));
++ return cx;
++}
++
++void
++MD5_TraceState(MD5Context *cx)
++{
++// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
++}
++
++int
++md5_stream (FILE *stream, unsigned char *dest)
++{
++ /* Important: BLOCKSIZE must be a multiple of 64. */
++#define BLOCKSIZE 4096
++ unsigned int len;
++ MD5Context *cx = MD5_NewContext();
++ if (cx == NULL) {
++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
++ return -1;
++ }
++
++ unsigned char buffer[BLOCKSIZE + 72];
++ size_t sum;
++
++ /* Initialize the computation context. */
++ MD5_Begin(cx);
++
++ /* Iterate over full file contents. */
++ while (1)
++ {
++ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
++ computation function processes the whole buffer so that with the
++ next round of the loop another block can be read. */
++ size_t n;
++ sum = 0;
++
++ /* Read block. Take care for partial reads. */
++ do
++ {
++ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
++
++ sum += n;
++ }
++ while (sum < BLOCKSIZE && n != 0);
++ if (n == 0 && ferror (stream))
++ return 1;
++
++ /* If end of file is reached, end the loop. */
++ if (n == 0)
++ break;
++
++ /* Process buffer with BLOCKSIZE bytes. Note that
++ BLOCKSIZE % 64 == 0
++ */
++ MD5_Update(cx, buffer, BLOCKSIZE);
+ }
+
-+ nsCRT::free(LDAPProperty);
- return rv;
- }
-Index: mailnews/addrbook/src/nsAbLDAPProperties.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h,v
-retrieving revision 1.7
-diff -u -r1.7 nsAbLDAPProperties.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h 9 Apr 2002 09:27:24 -0000 1.7
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPProperties.h 17 May 2004 03:23:53 -0000
-@@ -85,6 +85,7 @@
- static nsresult createCardPropertyFromLDAPMessage (nsILDAPMessage* message,
- nsIAbCard* card,
- PRBool* hasSetCardProperty);
-+ static nsresult getAllLDAPAttrsFromMozilla (const char* aLDAPProperty, PRUint32 *aAttrCount, char * **aAttributes);
- };
-
- #endif
-Index: mailnews/addrbook/src/nsAbMDBCardProperty.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp,v
-retrieving revision 1.15
-diff -u -r1.15 nsAbMDBCardProperty.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 12 Nov 2002 19:19:56 -0000 1.15
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 17 May 2004 03:23:53 -0000
-@@ -266,8 +266,7 @@
++ /* Add the last bytes if necessary. */
++ if (sum > 0)
++ MD5_Update(cx, buffer, sum);
++
++ MD5_End(cx, dest, &len, MD5_HASH_LEN);
++ MD5_DestroyContext(cx, PR_TRUE);
++ return len;
++
++}
++
++int getMD5sum(const char * fileName,char * sum)
++{
++ unsigned char bin_sum[16];
++ int len=0;
++ if (fileName)
++ {
++ FILE *fp=fopen(fileName,"rb");
++ if (fp)
++ {
++ len=md5_stream(fp,bin_sum);
++ memset(sum,0,33);
++ for (int i = 0; i < len; ++i)
++ sprintf (sum,"%s%02x",sum, bin_sum[i]);
++ fclose(fp);
++ return 0;
++ }
++ }
++ return 1;
++}
++
++int testMD5sum(const char * fileName,char * sum)
++{
++ char newSum[33]="";
++ if (getMD5sum(fileName,newSum))
++ return 1;
++ return strcmp(newSum,sum);
++}
+--- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -273,8 +273,7 @@
if (mCardDatabase)
{
mCardDatabase->EditCard(this, PR_TRUE);
@@ -619,14 +2018,9 @@ diff -u -r1.15 nsAbMDBCardProperty.cpp
}
else
return NS_ERROR_FAILURE;
-Index: mailnews/addrbook/src/nsAbMDBDirectory.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp,v
-retrieving revision 1.36
-diff -u -r1.36 nsAbMDBDirectory.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 9 Mar 2004 14:42:24 -0000 1.36
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 17 May 2004 03:23:53 -0000
-@@ -537,7 +537,7 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -561,7 +561,7 @@
}
}
}
@@ -635,7 +2029,7 @@ diff -u -r1.36 nsAbMDBDirectory.cpp
}
return rv;
}
-@@ -684,6 +684,7 @@
+@@ -707,6 +707,7 @@
return NS_ERROR_NOT_IMPLEMENTED;
nsresult rv = NS_OK;
@@ -643,8 +2037,8 @@ diff -u -r1.36 nsAbMDBDirectory.cpp
if (!mDatabase)
rv = GetAbDatabase();
-@@ -713,10 +714,11 @@
- mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE);
+@@ -736,10 +737,11 @@
+ mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
else
mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
- mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
@@ -657,14 +2051,9 @@ diff -u -r1.36 nsAbMDBDirectory.cpp
}
NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
-Index: mailnews/addrbook/src/nsAbOutlookCard.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp,v
-retrieving revision 1.14
-diff -u -r1.14 nsAbOutlookCard.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 9 Mar 2004 15:18:40 -0000 1.14
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 17 May 2004 03:23:53 -0000
-@@ -97,6 +97,7 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -94,6 +94,7 @@
{
index_DisplayName = 0,
index_EmailAddress,
@@ -672,7 +2061,7 @@ diff -u -r1.14 nsAbOutlookCard.cpp
index_FirstName,
index_LastName,
index_NickName,
-@@ -124,32 +125,34 @@
+@@ -121,32 +122,34 @@
static const ULONG OutlookCardMAPIProps [] =
{
@@ -731,7 +2120,7 @@ diff -u -r1.14 nsAbOutlookCard.cpp
nsresult nsAbOutlookCard::Init(const char *aUri)
{
nsresult retCode = nsRDFResource::Init(aUri) ;
-@@ -176,6 +179,7 @@
+@@ -173,6 +176,7 @@
SetDisplayName(unichars [index_DisplayName]->get()) ;
SetNickName(unichars [index_NickName]->get()) ;
SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
@@ -739,7 +2128,7 @@ diff -u -r1.14 nsAbOutlookCard.cpp
SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
-@@ -210,12 +214,12 @@
+@@ -207,12 +211,12 @@
nsAutoString unichar ;
nsAutoString unicharBis ;
@@ -754,7 +2143,7 @@ diff -u -r1.14 nsAbOutlookCard.cpp
splitString(unichar, unicharBis) ;
SetWorkAddress(unichar.get()) ;
SetWorkAddress2(unicharBis.get()) ;
-@@ -297,6 +301,7 @@
+@@ -290,6 +294,7 @@
SetDisplayName(properties [index_DisplayName]) ;
GetNickName(getter_Copies(properties [index_NickName])) ;
GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
@@ -762,7 +2151,7 @@ diff -u -r1.14 nsAbOutlookCard.cpp
GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
-@@ -316,9 +321,16 @@
+@@ -309,9 +314,16 @@
GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
GetNotes(getter_Copies(properties [index_Comments])) ;
@@ -782,13 +2171,8 @@ diff -u -r1.14 nsAbOutlookCard.cpp
}
delete [] properties ;
nsXPIDLString unichar ;
-Index: mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp,v
-retrieving revision 1.9
-diff -u -r1.9 nsAbOutlookDirFactory.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 25 Feb 2003 21:36:33 -0000 1.9
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 17 May 2004 03:23:53 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200
@@ -124,8 +124,8 @@
nsCAutoString uri ;
nsCOMPtr<nsIRDFResource> resource ;
@@ -800,13 +2184,8 @@ diff -u -r1.9 nsAbOutlookDirFactory.cpp
buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
uri.Append(entryId) ;
-Index: mailnews/addrbook/src/nsAbOutlookDirectory.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp,v
-retrieving revision 1.18
-diff -u -r1.18 nsAbOutlookDirectory.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 5 Feb 2004 18:33:06 -0000 1.18
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 17 May 2004 03:23:53 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
@@ -126,7 +126,7 @@
PRINTF(("Cannot get type.\n")) ;
return NS_ERROR_FAILURE ;
@@ -992,7 +2371,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
{"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
{"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
{"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
-@@ -1032,7 +1094,10 @@
+@@ -1027,7 +1089,10 @@
nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
{
@@ -1004,7 +2383,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
nsresult retCode = NS_OK ;
mCardList.Put(&newKey, aCard) ;
-@@ -1056,14 +1121,14 @@
+@@ -1051,14 +1116,14 @@
retCode = BuildRestriction(aArguments, arguments) ;
NS_ENSURE_SUCCESS(retCode, retCode) ;
nsCOMPtr<nsISupportsArray> resultsArray ;
@@ -1022,7 +2401,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
nsCOMPtr<nsIAbDirectoryQueryResult> result ;
nsAbDirectoryQueryResult *newResult = nsnull ;
-@@ -1071,15 +1136,18 @@
+@@ -1066,15 +1131,18 @@
nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
}
PRUint32 i = 0 ;
@@ -1045,7 +2424,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
newResult = new nsAbDirectoryQueryResult(0, aArguments,
nsIAbDirectoryQueryResult::queryResultMatch,
-@@ -1104,13 +1172,43 @@
+@@ -1099,13 +1167,43 @@
if (!aCards) { return NS_ERROR_NULL_POINTER ; }
*aCards = nsnull ;
nsresult retCode = NS_OK ;
@@ -1091,7 +2470,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
NS_ENSURE_SUCCESS(retCode, retCode) ;
if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
PRINTF(("Cannot get cards.\n")) ;
-@@ -1119,22 +1217,14 @@
+@@ -1114,22 +1212,14 @@
nsCAutoString entryId ;
nsCAutoString uriName ;
nsCOMPtr<nsIRDFResource> resource ;
@@ -1119,7 +2498,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
return retCode ;
}
-@@ -1158,8 +1248,8 @@
+@@ -1153,8 +1243,8 @@
nsCAutoString uriName ;
nsCOMPtr <nsIRDFResource> resource ;
@@ -1130,7 +2509,7 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
uriName.Append(entryId) ;
retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
-@@ -1280,7 +1370,7 @@
+@@ -1275,7 +1365,7 @@
// In the case of a mailing list, we cannot directly create a new card,
// we have to create a temporary one in a real folder (to be able to use
// templates) and then copy it to the mailing list.
@@ -1139,13 +2518,8 @@ diff -u -r1.18 nsAbOutlookDirectory.cpp
nsMapiEntry parentEntry ;
nsMapiEntry temporaryEntry ;
-Index: mailnews/addrbook/src/nsAbOutlookDirectory.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h,v
-retrieving revision 1.6
-diff -u -r1.6 nsAbOutlookDirectory.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 5 Feb 2004 18:33:06 -0000 1.6
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 17 May 2004 03:23:53 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200
@@ -46,6 +46,7 @@
#include "nsHashtable.h"
@@ -1173,14 +2547,9 @@ diff -u -r1.6 nsAbOutlookDirectory.h
nsMapiEntry *mMapiData ;
// Container for the query threads
-Index: mailnews/addrbook/src/nsAbWinHelper.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp,v
-retrieving revision 1.13
-diff -u -r1.13 nsAbWinHelper.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 24 Dec 2003 19:55:05 -0000 1.13
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 17 May 2004 03:23:53 -0000
-@@ -41,6 +41,9 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -42,6 +42,9 @@
#define USES_IID_IABContainer
#define USES_IID_IMAPITable
#define USES_IID_IDistList
@@ -1189,7 +2558,7 @@ diff -u -r1.13 nsAbWinHelper.cpp
+#define USES_IID_IMAPIFolder
#include "nsAbWinHelper.h"
- #include "nsAbUtils.h"
+ #include "nsMapiAddressBook.h"
@@ -59,19 +62,6 @@
#define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
@@ -1441,7 +2810,7 @@ diff -u -r1.13 nsAbWinHelper.cpp
container) ;
if (HR_FAILED(mLastError)) {
@@ -567,14 +521,15 @@
- value.Value.lpszW = NS_CONST_CAST(WORD *, aValue) ;
+ value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
}
else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
- alternativeValue.AssignWithConversion(aValue) ;
@@ -1459,7 +2828,7 @@ diff -u -r1.13 nsAbWinHelper.cpp
BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
@@ -595,7 +550,7 @@
- values [currentValue ++].Value.lpszW = NS_CONST_CAST(WORD *, aValues [i].get()) ;
+ values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
}
else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
- alternativeValue.AssignWithConversion(aValues [i].get()) ;
@@ -1740,13 +3109,8 @@ diff -u -r1.13 nsAbWinHelper.cpp
}
const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
-Index: mailnews/addrbook/src/nsAbWinHelper.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAbWinHelper.h,v
-retrieving revision 1.2
-diff -u -r1.2 nsAbWinHelper.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 28 Sep 2001 20:06:23 -0000 1.2
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 17 May 2004 03:23:53 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200
@@ -45,6 +45,24 @@
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
@@ -1861,7 +3225,7 @@ diff -u -r1.2 nsAbWinHelper.h
protected:
HRESULT mLastError ;
- LPADRBOOK mAddressBook ;
- static ULONG mEntryCounter ;
+ static PRUint32 mEntryCounter ;
static PRLock *mMutex ;
+ virtual HRESULT OpenEntry(ULONG cbEntryID,
@@ -1916,14 +3280,9 @@ diff -u -r1.2 nsAbWinHelper.h
private:
nsAbWinHelper *mHelper ;
} ;
-Index: mailnews/addrbook/src/nsAddrDatabase.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp,v
-retrieving revision 1.118
-diff -u -r1.118 nsAddrDatabase.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 24 Dec 2003 17:18:08 -0000 1.118
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 17 May 2004 03:23:55 -0000
-@@ -97,6 +97,9 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200
+@@ -100,6 +100,9 @@
static const char kMailListAddressFormat[] = "Address%d";
@@ -1933,7 +3292,7 @@ diff -u -r1.118 nsAddrDatabase.cpp
static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
nsAddrDatabase::nsAddrDatabase()
-@@ -166,6 +169,7 @@
+@@ -171,6 +174,7 @@
m_LastRecordKey(0),
m_dbDirectory(nsnull)
{
@@ -1941,9 +3300,9 @@ diff -u -r1.118 nsAddrDatabase.cpp
}
nsAddrDatabase::~nsAddrDatabase()
-@@ -720,7 +724,11 @@
- NS_RELEASE(oldFile); // always release our file ref, store has own
- }
+@@ -790,7 +794,11 @@
+ if (NS_FAILED(ret))
+ ret = NS_ERROR_FILE_ACCESS_DENIED;
}
-
+
@@ -1954,58 +3313,48 @@ diff -u -r1.118 nsAddrDatabase.cpp
nsCRT::free(nativeFileName);
if (NS_SUCCEEDED(ret) && thumb)
-@@ -817,6 +825,17 @@
- nsresult err = NS_OK;
- nsIMdbThumb *commitThumb = nsnull;
-
-+ const char *pFilename = m_dbName.GetCString(); /* do not free */
-+ char *nativeFileName = nsCRT::strdup(pFilename);
+@@ -883,6 +891,17 @@
+ {
+ nsresult err = NS_OK;
+ nsIMdbThumb *commitThumb = nsnull;
++
++ const char *pFilename = m_dbName.GetCString(); /* do not free */
++ char *nativeFileName = nsCRT::strdup(pFilename);
+#if defined(XP_PC) || defined(XP_MAC)
-+ UnixToNative(nativeFileName);
++ UnixToNative(nativeFileName);
+#endif
-+ if (testMD5sum(nativeFileName,m_dbMd5Sum))
-+ {
-+ nsCRT::free(nativeFileName);
-+ return NS_ERROR_FILE_ACCESS_DENIED;
-+ }
-+
- if (commitType == nsAddrDBCommitType::kLargeCommit || commitType == nsAddrDBCommitType::kSessionCommit)
- {
- mdb_percent outActualWaste = 0;
-@@ -867,6 +886,10 @@
- // ### do something with error, but clear it now because mork errors out on commits.
- if (GetEnv())
- GetEnv()->ClearErrors();
-+ if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
-+ err = NS_ERROR_FAILURE;
-+ nsCRT::free(nativeFileName);
-+
- return err;
++ if (testMD5sum(nativeFileName,m_dbMd5Sum))
++ {
++ nsCRT::free(nativeFileName);
++ return NS_ERROR_FILE_ACCESS_DENIED;
++ }
+
+ if (commitType == nsAddrDBCommitType::kLargeCommit ||
+ commitType == nsAddrDBCommitType::kSessionCommit)
+@@ -936,6 +955,10 @@
+ // ### do something with error, but clear it now because mork errors out on commits.
+ if (m_mdbEnv)
+ m_mdbEnv->ClearErrors();
++ if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
++ err = NS_ERROR_FAILURE;
++ nsCRT::free(nativeFileName);
++
+ return err;
}
-Index: mailnews/addrbook/src/nsAddrDatabase.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsAddrDatabase.h,v
-retrieving revision 1.46
-diff -u -r1.46 nsAddrDatabase.h
---- misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 28 Jan 2004 17:22:13 -0000 1.46
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 17 May 2004 03:23:55 -0000
-@@ -396,6 +396,7 @@
- nsIMdbTable *m_mdbPabTable;
- nsIMdbTable *m_mdbDeletedCardsTable;
- nsFileSpec m_dbName;
-+ char m_dbMd5Sum[33];
- PRBool m_mdbTokensInitialized;
- nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
-
-Index: mailnews/addrbook/src/nsMapiAddressBook.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp,v
-retrieving revision 1.7
-diff -u -r1.7 nsMapiAddressBook.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 30 Oct 2001 07:59:16 -0000 1.7
-+++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 17 May 2004 03:23:55 -0000
-@@ -41,6 +41,22 @@
+--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200
+@@ -394,6 +394,7 @@
+ nsIMdbTable *m_mdbPabTable;
+ nsIMdbTable *m_mdbDeletedCardsTable;
+ nsFileSpec m_dbName;
++ char m_dbMd5Sum[33];
+ PRBool m_mdbTokensInitialized;
+ nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
+
+--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -40,6 +40,22 @@
#include "prlog.h"
@@ -2028,7 +3377,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
#ifdef PR_LOGGING
static PRLogModuleInfo* gMapiAddressBookLog
= PR_NewLogModule("nsMapiAddressBookLog");
-@@ -48,6 +64,60 @@
+@@ -47,6 +63,60 @@
#define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
@@ -2089,7 +3438,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
HMODULE nsMapiAddressBook::mLibrary = NULL ;
PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
-@@ -60,7 +130,7 @@
+@@ -59,7 +129,7 @@
BOOL nsMapiAddressBook::mInitialized = FALSE ;
BOOL nsMapiAddressBook::mLogonDone = FALSE ;
LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
@@ -2098,7 +3447,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
BOOL nsMapiAddressBook::LoadMapiLibrary(void)
{
-@@ -92,7 +162,7 @@
+@@ -91,7 +161,7 @@
mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
GetProcAddress(mLibrary, "MAPILogonEx")) ;
if (!mMAPILogonEx) { return FALSE ; }
@@ -2107,7 +3456,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
HRESULT retCode = mMAPIInitialize(&mapiInit) ;
if (HR_FAILED(retCode)) {
-@@ -106,22 +176,19 @@
+@@ -105,22 +175,19 @@
MAPI_NEW_SESSION,
&mRootSession) ;
if (HR_FAILED(retCode)) {
@@ -2134,7 +3483,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
if (mRootSession) {
if (mLogonDone) {
mRootSession->Logoff(NULL, 0, 0) ;
-@@ -135,6 +202,7 @@
+@@ -134,6 +201,7 @@
}
}
FreeLibrary(mLibrary) ;
@@ -2142,7 +3491,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
mLibrary = NULL ;
}
}
-@@ -146,7 +214,6 @@
+@@ -145,7 +213,6 @@
: nsAbWinHelper()
{
BOOL result = Initialize() ;
@@ -2150,7 +3499,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
MOZ_COUNT_CTOR(nsMapiAddressBook) ;
}
-@@ -154,22 +221,882 @@
+@@ -153,22 +220,882 @@
nsMapiAddressBook::~nsMapiAddressBook(void)
{
nsAutoLock guard(mMutex) ;
@@ -3037,7 +4386,7 @@ diff -u -r1.7 nsMapiAddressBook.cpp
}
void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
-@@ -182,7 +1109,803 @@
+@@ -181,7 +1108,803 @@
mMAPIFreeBuffer(aBuffer) ;
}
@@ -3841,13 +5190,8 @@ diff -u -r1.7 nsMapiAddressBook.cpp
+
+ return lpMsgStore;
+}
-Index: mailnews/addrbook/src/nsMapiAddressBook.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h,v
-retrieving revision 1.3
-diff -u -r1.3 nsMapiAddressBook.h
---- misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 28 Sep 2001 20:06:25 -0000 1.3
-+++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 17 May 2004 03:23:55 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200
@@ -40,12 +40,42 @@
#include "nsAbWinHelper.h"
@@ -3971,14 +5315,9 @@ diff -u -r1.3 nsMapiAddressBook.h
} ;
#endif // nsMapiAddressBook_h___
-Index: mailnews/addrbook/src/nsWabAddressBook.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp,v
-retrieving revision 1.6
-diff -u -r1.6 nsWabAddressBook.cpp
---- misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 30 Oct 2001 07:59:16 -0000 1.6
-+++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 17 May 2004 03:23:55 -0000
-@@ -47,6 +47,22 @@
+--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
+@@ -46,6 +46,22 @@
#define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
@@ -4001,7 +5340,7 @@ diff -u -r1.6 nsWabAddressBook.cpp
HMODULE nsWabAddressBook::mLibrary = NULL ;
PRInt32 nsWabAddressBook::mLibUsage = 0 ;
LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
-@@ -95,7 +111,7 @@
+@@ -94,7 +110,7 @@
MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
nsWabAddressBook::nsWabAddressBook(void)
@@ -4010,7 +5349,7 @@ diff -u -r1.6 nsWabAddressBook.cpp
{
BOOL result = Initialize() ;
-@@ -110,9 +126,254 @@
+@@ -109,9 +125,254 @@
MOZ_COUNT_DTOR(nsWabAddressBook) ;
}
@@ -4266,13 +5605,8 @@ diff -u -r1.6 nsWabAddressBook.cpp
nsAutoLock guard(mMutex) ;
if (!LoadWabLibrary()) {
-Index: mailnews/addrbook/src/nsWabAddressBook.h
-===================================================================
-RCS file: /cvsroot/mozilla/mailnews/addrbook/src/nsWabAddressBook.h,v
-retrieving revision 1.2
-diff -u -r1.2 nsWabAddressBook.h
---- misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 28 Sep 2001 20:06:25 -0000 1.2
-+++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 17 May 2004 03:23:55 -0000
+--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200
++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200
@@ -47,6 +47,15 @@
nsWabAddressBook(void) ;
virtual ~nsWabAddressBook(void) ;
@@ -4337,86 +5671,565 @@ diff -u -r1.2 nsWabAddressBook.h
private :
} ;
-Index: profile/src/nsProfile.cpp
-===================================================================
-RCS file: /cvsroot/mozilla/profile/src/nsProfile.cpp,v
-retrieving revision 1.298
-diff -u -r1.298 nsProfile.cpp
---- misc/build/mozilla/profile/src/nsProfile.cpp 28 Feb 2004 22:34:02 -0000 1.298
-+++ misc/build/mozilla/profile/src/nsProfile.cpp 17 May 2004 03:24:08 -0000
-@@ -37,7 +37,9 @@
-
- #include "nscore.h"
- #include "nsProfile.h"
-+#ifdef MOZ_PROFILELOCKING
- #include "nsProfileLock.h"
-+#endif
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
+--- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100
++++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -91,7 +91,7 @@
+ PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
+ endif
-@@ -499,12 +501,14 @@
- profileURLStr = PROFILE_MANAGER_URL;
- if (exists)
- {
-+#ifdef MOZ_PROFILELOCKING
- // If the profile is locked, we need the UI
- nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(curProfileDir));
- nsProfileLock tempLock;
- rv = tempLock.Lock(localFile);
- if (NS_FAILED(rv))
- profileURLStr = PROFILE_MANAGER_URL;
-+#endif
- }
- }
- else
-@@ -1173,7 +1177,7 @@
- }
+-EXTRA_DSO_LDOPTS = \
++EXTRA_DSO_LDOPTS += \
+ $(LIBS_DIR) \
+ $(MOZ_JS_LIBS) \
+ $(MOZ_COMPONENT_LIBS) \
+--- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200
++++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200
+@@ -277,7 +277,7 @@
+ nsresult
+ nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
+ {
+- PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
++ PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
+ return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
+ }
+
+--- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100
++++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
+ # Try not to spawn programs from within this file. If the stuff in here looks royally
+--- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100
++++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
+@@ -22,6 +22,7 @@
+ RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
+ OBJDIR_NAME = @OBJDIR_NAME@
+ OBJDIR = @OBJDIR@
++LIB_PREFIX = @LIB_PREFIX@
+ OBJ_SUFFIX = @OBJ_SUFFIX@
+ LIB_SUFFIX = @LIB_SUFFIX@
+ DLL_SUFFIX = @DLL_SUFFIX@
+--- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100
++++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100
+@@ -111,9 +111,9 @@
+ # other platforms do not.
+ #
+ ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
+-LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
++LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+ SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+-IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
++IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+ SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+ else
+ LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+@@ -340,6 +340,10 @@
+ else # AIX 4.1
+ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
++ @if test -f $@.manifest; then \
++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
++ rm -f $@.manifest; \
++ fi
+ else
+ ifeq ($(MOZ_OS2_TOOLS),VACPP)
+ $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
+--- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100
++++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200
+@@ -2737,6 +2737,7 @@
+ LIB_SUFFIX=a
+ DLL_SUFFIX=so
+ ASM_SUFFIX=s
++LIB_PREFIX=lib
+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
+ PR_MD_ASFILES=
+ PR_MD_CSRCS=
+@@ -3475,7 +3476,7 @@
+ EOF
+
+ CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
+- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
+ if test "$MOZ_OBJFORMAT" = "elf"; then
+ DLL_SUFFIX=so
else
- isSwitch = PR_FALSE;
--
-+#ifdef MOZ_PROFILELOCKING
- nsProfileLock localLock;
- nsCOMPtr<nsILocalFile> localProfileDir(do_QueryInterface(profileDir, &rv));
- if (NS_FAILED(rv)) return rv;
-@@ -1183,7 +1187,7 @@
- NS_ERROR("Could not get profile directory lock.");
- return rv;
- }
+@@ -3941,7 +3942,7 @@
+ CC="$CC -mno-cygwin"
+ CXX="$CXX -mno-cygwin"
+ DLL_SUFFIX=dll
+- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
++ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
+ RC=$WINDRES
+ # Use temp file for windres (bug 213281)
+ RCFLAGS='-O coff --use-temp-file'
+@@ -3958,6 +3959,7 @@
+ OBJ_SUFFIX=obj
+ LIB_SUFFIX=lib
+ DLL_SUFFIX=dll
++ LIB_PREFIX=
+
+ # Determine compiler version
+ CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
+@@ -5766,6 +5768,7 @@
+ CC="\$(CYGWIN_WRAPPER) $CC"
+ CXX="\$(CYGWIN_WRAPPER) $CXX"
+ RC="\$(CYGWIN_WRAPPER) $RC"
++ LD="\$(CYGWIN_WRAPPER) $LD"
+ ;;
+ esac
+
+@@ -6127,6 +6130,7 @@
+ s%@LIB_SUFFIX@%$LIB_SUFFIX%g
+ s%@DLL_SUFFIX@%$DLL_SUFFIX%g
+ s%@ASM_SUFFIX@%$ASM_SUFFIX%g
++s%@LIB_PREFIX@%$LIB_PREFIX%g
+ s%@MKSHLIB@%$MKSHLIB%g
+ s%@DSO_CFLAGS@%$DSO_CFLAGS%g
+ s%@DSO_LDOPTS@%$DSO_LDOPTS%g
+--- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100
++++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200
+@@ -1137,7 +1137,7 @@
+ AC_DEFINE(HAVE_BSD_FLOCK)
+ AC_DEFINE(HAVE_SOCKLEN_T)
+ CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
+- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
+ if test "$MOZ_OBJFORMAT" = "elf"; then
+ DLL_SUFFIX=so
+ else
+--- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100
++++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -79,18 +79,22 @@
+ OS_LIBS = -lc
+ endif
+
++ifeq ($(OS_ARCH),Linux)
++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
++endif
++
+ ifeq ($(OS_ARCH),SunOS)
+ OS_LIBS = -lc
+ MAPFILE = $(OBJDIR)/pldsmap.sun
+ GARBAGE += $(MAPFILE)
+ ifdef NS_USE_GCC
+ ifdef GCC_USE_GNU_LD
+-MKSHLIB += -Wl,--version-script,$(MAPFILE)
++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
+ else
+-MKSHLIB += -Wl,-M,$(MAPFILE)
++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
+ endif
+ else
+-MKSHLIB += -M $(MAPFILE)
++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
+ endif
+ # The -R '$ORIGIN' linker option instructs this library to search for its
+ # dependencies in the same directory where it resides.
+--- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100
++++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -89,18 +89,22 @@
+ OS_LIBS = -lc
+ endif
+
++ifeq ($(OS_ARCH),Linux)
++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
++endif
++
+ ifeq ($(OS_ARCH),SunOS)
+ OS_LIBS = -lc
+ MAPFILE = $(OBJDIR)/plcmap.sun
+ GARBAGE += $(MAPFILE)
+ ifdef NS_USE_GCC
+ ifdef GCC_USE_GNU_LD
+-MKSHLIB += -Wl,--version-script,$(MAPFILE)
++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
+ else
+-MKSHLIB += -Wl,-M,$(MAPFILE)
++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
+ endif
+ else
+-MKSHLIB += -M $(MAPFILE)
++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
+ endif
+ # The -R '$ORIGIN' linker option instructs this library to search for its
+ # dependencies in the same directory where it resides.
+--- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100
++++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200
+@@ -113,7 +113,8 @@
+ #define _PR_HAVE_5_ARG_GETPROTO_R
+ #endif
+
+-#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
++#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
++ (defined(__FreeBSD__) && __FreeBSD_version > 601103)
+ #define _PR_HAVE_GETPROTO_R
+ #define _PR_HAVE_5_ARG_GETPROTO_R
+ #endif
+--- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100
++++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -65,7 +65,7 @@
+
+ ARCH = freebsd
+
+-MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
++MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
+
+ ifeq ($(MOZ_OBJFORMAT),elf)
+ DLL_SUFFIX = so
+--- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100
++++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200
+@@ -139,7 +139,7 @@
+
+ ifeq ($(OS_RELEASE),2.0)
+ OS_REL_CFLAGS += -DLINUX2_0
+- MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
++ MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
+ ifdef MAPFILE
+ MKSHLIB += -Wl,--version-script,$(MAPFILE)
+ endif
+@@ -166,6 +166,7 @@
+
+ DSO_CFLAGS = -fPIC
+ DSO_LDOPTS = -shared $(ARCHFLAG)
++DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
+ DSO_LDFLAGS =
+ LDFLAGS += $(ARCHFLAG)
+
+--- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200
++++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -161,12 +161,14 @@
+
+ # ld options:
+ # -G: produce a shared object
++# -R '$ORIGIN': search for dependencies in same directory
+ # -z defs: no unresolved symbols allowed
+ ifdef NS_USE_GCC
+ ifeq ($(USE_64), 1)
+ DSO_LDOPTS += -m64
+ endif
+ DSO_LDOPTS += -shared -h $(notdir $@)
++ DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
+ else
+ ifeq ($(USE_64), 1)
+ ifeq ($(OS_TEST),i86pc)
+@@ -176,6 +178,7 @@
+ endif
+ endif
+ DSO_LDOPTS += -G -h $(notdir $@)
++ DSO_LDOPTS += -R '$$ORIGIN'
+ endif
+ DSO_LDOPTS += -z combreloc -z defs -z ignore
+
+--- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200
++++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200
+@@ -43,24 +43,24 @@
+ DEFAULT_COMPILER = cl
+
+ ifdef NS_USE_GCC
+- CC = gcc
+- CCC = g++
+- LINK = ld
+- AR = ar
++ CC = $(CYGWIN_WRAPPER) gcc
++ CCC = $(CYGWIN_WRAPPER) g++
++ LINK = $(CYGWIN_WRAPPER) ld
++ AR = $(CYGWIN_WRAPPER) ar
+ AR += cr $@
+- RANLIB = ranlib
++ RANLIB = $(CYGWIN_WRAPPER) ranlib
+ BSDECHO = echo
+- RC = windres.exe -O coff --use-temp-file
+- LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
++ RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
++ LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
+ else
+- CC = cl
+- CCC = cl
+- LINK = link
+- AR = lib
++ CC = $(CYGWIN_WRAPPER) cl
++ CCC = $(CYGWIN_WRAPPER) cl
++ LINK = $(CYGWIN_WRAPPER) link
++ AR = $(CYGWIN_WRAPPER) lib
+ AR += -NOLOGO -OUT:"$@"
+ RANLIB = echo
+ BSDECHO = echo
+- RC = rc.exe
++ RC = $(CYGWIN_WRAPPER) rc.exe
+ MT = mt.exe
+ endif
+
+@@ -69,7 +69,7 @@
+ else
+ NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
+ endif
+-NSINSTALL = nsinstall
++NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
+
+ MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
+ MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
+@@ -95,7 +95,7 @@
+ # dllimport cannot be used as as a constant address.
+ OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
+ _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
+- DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
++ DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
+ ifdef BUILD_OPT
+ OPTIMIZER += -O2
+ DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
+--- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200
++++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -72,3 +72,7 @@
+ endif
+ endif
+ DEFINES += -DWIN95
++
++ifdef NS_USE_GCC
++NSPR31_LIB_PREFIX = lib
++endif
+--- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200
++++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200
+@@ -45,7 +45,7 @@
+ CCF = $(CC) $(CFLAGS)
+ LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
+ LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
+-CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
++CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
+ $(XCFLAGS)
+ PERL = perl
+ RANLIB = echo
+--- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200
++++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200
+@@ -284,7 +284,7 @@
+ $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
+ @$(MAKE_OBJDIR)
+ ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
+- $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
++ $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
+ ifdef MT
+ if test -f $@.manifest; then \
+ $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+@@ -305,11 +305,7 @@
+ $(LIBRARY): $(OBJS)
+ @$(MAKE_OBJDIR)
+ rm -f $@
+-ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
+- $(AR) $(subst /,\\,$(OBJS))
+-else
+ $(AR) $(OBJS)
+-endif
+ $(RANLIB) $@
+
+
+@@ -344,7 +340,7 @@
+ ifdef NS_USE_GCC
+ $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
+ else
+- $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
++ $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
+ ifdef MT
+ if test -f $@.manifest; then \
+ $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
+@@ -429,15 +425,15 @@
+ endif
+ endif
+
+-core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
++mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
+
+ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
+ @$(MAKE_OBJDIR)
+ ifdef USE_NT_C_SYNTAX
+- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ ifdef NEED_ABSOLUTE_PATH
+- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ $(CC) -o $@ -c $(CFLAGS) $<
+ endif
+@@ -445,10 +441,10 @@
+
+ $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
+ ifdef USE_NT_C_SYNTAX
+- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ ifdef NEED_ABSOLUTE_PATH
+- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ $(CC) -o $@ -c $(CFLAGS) $<
+ endif
+@@ -477,10 +473,10 @@
+ $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
+ @$(MAKE_OBJDIR)
+ ifdef USE_NT_C_SYNTAX
+- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ ifdef NEED_ABSOLUTE_PATH
+- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ $(CCC) -o $@ -c $(CFLAGS) $<
+ endif
+@@ -501,10 +497,10 @@
+ rm -f $(OBJDIR)/t_$*.cc
+ else
+ ifdef USE_NT_C_SYNTAX
+- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ ifdef NEED_ABSOLUTE_PATH
+- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
++ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
+ else
+ $(CCC) -o $@ -c $(CFLAGS) $<
+ endif
+--- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200
++++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -123,8 +123,11 @@
+ ifdef CYGDRIVE_MOUNT
+ ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g')
+ endif
++ifneq (,$(filter cygwin%,$(host_os)))
++ABS_DIST := $(shell cygpath -u $(ABS_DIST))
++endif
+ ifneq (,$(filter mingw%,$(host_os)))
+-ABS_DIST := $(shell cd $(DIST) && pwd -W)
++ABS_DIST := $(shell cygpath -u $(ABS_DIST))
+ endif
+ endif
+ NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS)))
+@@ -172,6 +175,7 @@
+ endif
+ ifeq ($(OS_ARCH),WINNT)
+ DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
++DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
+ ifdef MOZ_DEBUG
+ ifndef MOZ_NO_DEBUG_RTL
+ DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
+--- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
++++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100
+@@ -86,17 +86,42 @@
+
+ include ../platrules.mk
+
+-SRCDIR = $(call core_abspath,.)
-
-+#endif
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-@@ -1237,8 +1241,10 @@
- UpdateCurrentProfileModTime(PR_FALSE);
- }
++ifeq ($(OS_TARGET), Darwin)
++ SRCDIR = .
++else
++ifeq ($(OS_TARGET), Linux)
++ SRCDIR = .
++else
++ SRCDIR = .
++endif
++endif
+ %.chk: %.$(DLL_SUFFIX)
+ ifeq ($(OS_TARGET), OS2)
+ cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
+ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
+ else
+- cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
+- $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+- $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
++ifeq ($(OS_TARGET), WIN95)
++ cd $(SRCDIR) ; sh $(CYGWIN_WRAPPER) ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++else
++ifeq ($(OS_TARGET), Darwin)
++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++else
++ifeq ($(OS_TARGET), Linux)
++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++else
++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
++ $(OBJDIR) $(OS_TARGET) \
++ $(NSPR_LIB_DIR) $<
++endif
++endif
++endif
+ endif
+
+ libs install :: $(CHECKLOC)
+--- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100
++++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200
+@@ -63,9 +63,4 @@
+ DSO_LDOPTS = -bundle
+ endif
+
+-ifeq ($(OS_TARGET),SunOS)
+-# The -R '$ORIGIN' linker option instructs this library to search for its
+-# dependencies in the same directory where it resides.
+-MKSHLIB += -R '$$ORIGIN'
+-endif
+
+--- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200
++++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200
+@@ -199,10 +199,6 @@
+ endif
-+#ifdef MOZ_PROFILELOCKING
- // Do the profile switch
- localLock.Unlock(); // gDirServiceProvider will get and hold its own lock
-+#endif
- gDirServiceProvider->SetProfileDir(profileDir);
- mCurrentProfileName.Assign(aCurrentProfile);
- gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
-Index: security/nss/lib/nss/config.mk
-===================================================================
-RCS file: /cvsroot/mozilla/security/nss/lib/nss/config.mk,v
-retrieving revision 1.21
-diff -u -r1.21 config.mk
---- misc/build/mozilla/security/nss/lib/nss/config.mk 20 Apr 2003 04:23:32 -0000 1.21
-+++ misc/build/mozilla/security/nss/lib/nss/config.mk 17 May 2004 03:24:08 -0000
-@@ -105,7 +105,7 @@
ifeq ($(OS_TARGET),SunOS)
- # The -R '$ORIGIN' linker option instructs libnss3.so to search for its
- # dependencies (libsoftokn3.so) in the same directory where it resides.
+-
+-# The -R '$ORIGIN' linker option instructs this library to search for its
+-# dependencies in the same directory where it resides.
-MKSHLIB += -R '$$ORIGIN'
-+#MKSHLIB += -R '$$ORIGIN'
+ ifdef NS_USE_GCC
+ ifdef GCC_USE_GNU_LD
+ MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
+@@ -210,7 +206,7 @@
+ MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
+ endif # GCC_USE_GNU_LD
+ else
+- MKSHLIB += -B symbolic -z now -z text
++ MKSHLIB += -z now -z text
+ endif # NS_USE_GCC
+
+ # Sun's WorkShop defines v8, v8plus and v9 architectures.
+--- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100
++++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200
+@@ -113,12 +113,10 @@
+ # The -R '$ORIGIN' linker option instructs this library to search for its
+ # dependencies in the same directory where it resides.
+ ifeq ($(USE_64), 1)
+-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
+ else
+-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
+ endif
+-else
+-MKSHLIB += -R '$$ORIGIN'
+ endif
endif
+@@ -127,9 +125,9 @@
+ # pa-risc
+ ifeq ($(USE_64), 1)
+ MKSHLIB += +b '$$ORIGIN'
+-endif
+-endif
+-endif
++endif # USE_64
++endif # OS_TEST
++endif # OS_ARCH
+
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
---- misc/build/mozilla/security/nss/lib/nss/nss.def 2004-07-13 10:38:04.000000000 +0800
-+++ misc/build/mozilla/security/nss/lib/nss/nss.def 2004-05-20 01:32:27.000000000 +0800
-@@ -60,6 +60,7 @@
+ ifndef NS_USE_GCC
+--- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200
++++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200
+@@ -61,6 +61,7 @@
CERT_CheckCertValidTimes;
CERT_CreateCertificateRequest;
CERT_ChangeCertTrust;
@@ -4424,684 +6237,110 @@ diff -u -r1.21 config.mk
CERT_DecodeDERCrl;
CERT_DestroyCertificateRequest;
CERT_DestroyCertList;
-@@ -212,6 +213,7 @@
- PK11_GetBestSlot;
- PK11_GetBestSlotMultiple;
- PK11_GetBestWrapMechanism;
-+PK11_GetCertFromPrivateKey;
- PK11_GetCurrentWrapIndex;
- PK11_GetMechanism;
- PK11_GetModuleID;
-Index: security/nss/lib/softoken/config.mk
-===================================================================
-RCS file: /cvsroot/mozilla/security/nss/lib/softoken/config.mk,v
-retrieving revision 1.14
-diff -u -r1.14 config.mk
---- misc/build/mozilla/security/nss/lib/softoken/config.mk 16 May 2003 20:21:20 -0000 1.14
-+++ misc/build/mozilla/security/nss/lib/softoken/config.mk 17 May 2004 03:24:08 -0000
-@@ -88,7 +88,7 @@
- ifeq ($(CPU_ARCH),sparc)
- # The -R '$ORIGIN' linker option instructs libsoftokn3.so to search for its
- # dependencies (libfreebl_*.so) in the same directory where it resides.
+--- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100
++++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200
+@@ -92,8 +92,3 @@
+ ../pkcs7 \
+ $(NULL)
+
+-ifeq ($(OS_TARGET),SunOS)
+-# The -R '$ORIGIN' linker option instructs this library to search for its
+-# dependencies in the same directory where it resides.
-MKSHLIB += -R '$$ORIGIN'
-+#MKSHLIB += -R '$$ORIGIN'
+-endif
+--- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100
++++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200
+@@ -87,13 +87,6 @@
+ $(NULL)
endif
+
+-ifeq ($(OS_TARGET),SunOS)
+-# The -R '$ORIGIN' linker option instructs this library to search for its
+-# dependencies in the same directory where it resides.
+-MKSHLIB += -R '$$ORIGIN'
+-OS_LIBS += -lbsm
+-endif
+-
+ ifeq ($(OS_TARGET),WINCE)
+ DEFINES += -DDBM_USING_NSPR
endif
+--- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200
++++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200
+@@ -116,13 +116,6 @@
+ EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
endif
-
-Index: mailnews/addrbook/src/nsAbMD5sum.cpp
-===================================================================
---- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2005-01-09 00:07:11.359375000 -0500
-+++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2004-03-29 16:43:58.000000000 +0800
-@@ -1 +1,633 @@
--dummy
-+/*
-+ * The contents of this file are subject to the Mozilla Public
-+ * License Version 1.1 (the "License"); you may not use this file
-+ * except in compliance with the License. You may obtain a copy of
-+ * the License at http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS
-+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-+ * implied. See the License for the specific language governing
-+ * rights and limitations under the License.
-+ *
-+ * The Original Code is the Netscape security libraries.
-+ *
-+ * The Initial Developer of the Original Code is Netscape
-+ * Communications Corporation. Portions created by Netscape are
-+ * Copyright (C) 1994-2000 Netscape Communications Corporation. All
-+ * Rights Reserved.
-+ *
-+ * Contributor(s):
-+ *
-+ * Alternatively, the contents of this file may be used under the
-+ * terms of the GNU General Public License Version 2 or later (the
-+ * "GPL"), in which case the provisions of the GPL are applicable
-+ * instead of those above. If you wish to allow use of your
-+ * version of this file only under the terms of the GPL and not to
-+ * allow others to use your version of this file under the MPL,
-+ * indicate your decision by deleting the provisions above and
-+ * replace them with the notice and other provisions required by
-+ * the GPL. If you do not delete the provisions above, a recipient
-+ * may use your version of this file under either the MPL or the
-+ * GPL.
-+ */
-+#include <stdio.h>
-+#include <stdlib.h>
-+
-+#include "prerr.h"
-+
-+#include "prtypes.h"
-+#include "prlong.h"
-+#include "plstr.h"
-+#include "nsMemory.h"
-+
-+#define MD5_HASH_LEN 16
-+#define MD5_BUFFER_SIZE 64
-+#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
-+
-+#define CV0_1 0x67452301
-+#define CV0_2 0xefcdab89
-+#define CV0_3 0x98badcfe
-+#define CV0_4 0x10325476
-+
-+#define T1_0 0xd76aa478
-+#define T1_1 0xe8c7b756
-+#define T1_2 0x242070db
-+#define T1_3 0xc1bdceee
-+#define T1_4 0xf57c0faf
-+#define T1_5 0x4787c62a
-+#define T1_6 0xa8304613
-+#define T1_7 0xfd469501
-+#define T1_8 0x698098d8
-+#define T1_9 0x8b44f7af
-+#define T1_10 0xffff5bb1
-+#define T1_11 0x895cd7be
-+#define T1_12 0x6b901122
-+#define T1_13 0xfd987193
-+#define T1_14 0xa679438e
-+#define T1_15 0x49b40821
-+
-+#define T2_0 0xf61e2562
-+#define T2_1 0xc040b340
-+#define T2_2 0x265e5a51
-+#define T2_3 0xe9b6c7aa
-+#define T2_4 0xd62f105d
-+#define T2_5 0x02441453
-+#define T2_6 0xd8a1e681
-+#define T2_7 0xe7d3fbc8
-+#define T2_8 0x21e1cde6
-+#define T2_9 0xc33707d6
-+#define T2_10 0xf4d50d87
-+#define T2_11 0x455a14ed
-+#define T2_12 0xa9e3e905
-+#define T2_13 0xfcefa3f8
-+#define T2_14 0x676f02d9
-+#define T2_15 0x8d2a4c8a
-+
-+#define T3_0 0xfffa3942
-+#define T3_1 0x8771f681
-+#define T3_2 0x6d9d6122
-+#define T3_3 0xfde5380c
-+#define T3_4 0xa4beea44
-+#define T3_5 0x4bdecfa9
-+#define T3_6 0xf6bb4b60
-+#define T3_7 0xbebfbc70
-+#define T3_8 0x289b7ec6
-+#define T3_9 0xeaa127fa
-+#define T3_10 0xd4ef3085
-+#define T3_11 0x04881d05
-+#define T3_12 0xd9d4d039
-+#define T3_13 0xe6db99e5
-+#define T3_14 0x1fa27cf8
-+#define T3_15 0xc4ac5665
-+
-+#define T4_0 0xf4292244
-+#define T4_1 0x432aff97
-+#define T4_2 0xab9423a7
-+#define T4_3 0xfc93a039
-+#define T4_4 0x655b59c3
-+#define T4_5 0x8f0ccc92
-+#define T4_6 0xffeff47d
-+#define T4_7 0x85845dd1
-+#define T4_8 0x6fa87e4f
-+#define T4_9 0xfe2ce6e0
-+#define T4_10 0xa3014314
-+#define T4_11 0x4e0811a1
-+#define T4_12 0xf7537e82
-+#define T4_13 0xbd3af235
-+#define T4_14 0x2ad7d2bb
-+#define T4_15 0xeb86d391
-+
-+#define R1B0 0
-+#define R1B1 1
-+#define R1B2 2
-+#define R1B3 3
-+#define R1B4 4
-+#define R1B5 5
-+#define R1B6 6
-+#define R1B7 7
-+#define R1B8 8
-+#define R1B9 9
-+#define R1B10 10
-+#define R1B11 11
-+#define R1B12 12
-+#define R1B13 13
-+#define R1B14 14
-+#define R1B15 15
-+
-+#define R2B0 1
-+#define R2B1 6
-+#define R2B2 11
-+#define R2B3 0
-+#define R2B4 5
-+#define R2B5 10
-+#define R2B6 15
-+#define R2B7 4
-+#define R2B8 9
-+#define R2B9 14
-+#define R2B10 3
-+#define R2B11 8
-+#define R2B12 13
-+#define R2B13 2
-+#define R2B14 7
-+#define R2B15 12
-+
-+#define R3B0 5
-+#define R3B1 8
-+#define R3B2 11
-+#define R3B3 14
-+#define R3B4 1
-+#define R3B5 4
-+#define R3B6 7
-+#define R3B7 10
-+#define R3B8 13
-+#define R3B9 0
-+#define R3B10 3
-+#define R3B11 6
-+#define R3B12 9
-+#define R3B13 12
-+#define R3B14 15
-+#define R3B15 2
-+
-+#define R4B0 0
-+#define R4B1 7
-+#define R4B2 14
-+#define R4B3 5
-+#define R4B4 12
-+#define R4B5 3
-+#define R4B6 10
-+#define R4B7 1
-+#define R4B8 8
-+#define R4B9 15
-+#define R4B10 6
-+#define R4B11 13
-+#define R4B12 4
-+#define R4B13 11
-+#define R4B14 2
-+#define R4B15 9
-+
-+#define S1_0 7
-+#define S1_1 12
-+#define S1_2 17
-+#define S1_3 22
-+
-+#define S2_0 5
-+#define S2_1 9
-+#define S2_2 14
-+#define S2_3 20
-+
-+#define S3_0 4
-+#define S3_1 11
-+#define S3_2 16
-+#define S3_3 23
-+
-+#define S4_0 6
-+#define S4_1 10
-+#define S4_2 15
-+#define S4_3 21
-+
-+struct MD5ContextStr {
-+ PRUint32 lsbInput;
-+ PRUint32 msbInput;
-+ PRUint32 cv[4];
-+ union {
-+ PRUint8 b[64];
-+ PRUint32 w[16];
-+ } u;
-+};
-+typedef struct MD5ContextStr MD5Context;
-+
-+#define inBuf u.b
-+
-+int MD5_Hash(unsigned char *dest, const char *src);
-+int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
-+MD5Context * MD5_NewContext(void);
-+void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
-+void MD5_Begin(MD5Context *cx);
-+static void md5_compress(MD5Context *cx);
-+void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
-+void MD5_End(MD5Context *cx, unsigned char *digest,
-+ unsigned int *digestLen, unsigned int maxDigestLen);
-+unsigned int MD5_FlattenSize(MD5Context *cx);
-+int MD5_Flatten(MD5Context *cx, unsigned char *space);
-+MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
-+void MD5_TraceState(MD5Context *cx);
-+
-+int
-+MD5_Hash(unsigned char *dest, const char *src)
-+{
-+ return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
-+}
-+
-+int
-+MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
-+{
-+ unsigned int len;
-+ MD5Context *cx = MD5_NewContext();
-+ if (cx == NULL) {
-+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-+ return -1;
-+ }
-+ MD5_Begin(cx);
-+ MD5_Update(cx, src, src_length);
-+ MD5_End(cx, dest, &len, MD5_HASH_LEN);
-+ MD5_DestroyContext(cx, PR_TRUE);
-+ return 0;
-+}
-+
-+MD5Context *
-+MD5_NewContext(void)
-+{
-+ MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
-+ if (cx == NULL) {
-+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-+ return NULL;
-+ }
-+ return cx;
-+}
-+
-+void
-+MD5_DestroyContext(MD5Context *cx, PRBool freeit)
-+{
-+ if (freeit) {
-+ free(cx);
-+ }
-+}
-+
-+void
-+MD5_Begin(MD5Context *cx)
-+{
-+ cx->lsbInput = 0;
-+ cx->msbInput = 0;
-+ memset(cx->inBuf, 0, sizeof(cx->inBuf));
-+ cx->cv[0] = CV0_1;
-+ cx->cv[1] = CV0_2;
-+ cx->cv[2] = CV0_3;
-+ cx->cv[3] = CV0_4;
-+}
-+
-+#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
-+
-+#define MASK 0x00ff00ff
-+#ifdef IS_LITTLE_ENDIAN
-+#define lendian(i32) \
-+ (i32)
-+#else
-+#define lendian(i32) \
-+ (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
-+#endif
-+
-+#if defined(SOLARIS) || defined(HPUX)
-+#define addto64(sumhigh, sumlow, addend) \
-+ sumlow += addend; sumhigh += (sumlow < addend);
-+#else
-+#define addto64(sumhigh, sumlow, addend) \
-+ sumlow += addend; if (sumlow < addend) ++sumhigh;
-+#endif
-+
-+#define F(X, Y, Z) \
-+ ((X & Y) | ((~X) & Z))
-+
-+#define G(X, Y, Z) \
-+ ((X & Z) | (Y & (~Z)))
-+
-+#define H(X, Y, Z) \
-+ (X ^ Y ^ Z)
-+
-+#define I(X, Y, Z) \
-+ (Y ^ (X | (~Z)))
-+
-+#define FF(a, b, c, d, bufint, s, ti) \
-+ a = b + cls(a + F(b, c, d) + bufint + ti, s)
-+
-+#define GG(a, b, c, d, bufint, s, ti) \
-+ a = b + cls(a + G(b, c, d) + bufint + ti, s)
-+
-+#define HH(a, b, c, d, bufint, s, ti) \
-+ a = b + cls(a + H(b, c, d) + bufint + ti, s)
-+
-+#define II(a, b, c, d, bufint, s, ti) \
-+ a = b + cls(a + I(b, c, d) + bufint + ti, s)
-+
-+static void
-+md5_compress(MD5Context *cx)
-+{
-+ PRUint32 a, b, c, d;
-+ PRUint32 tmp;
-+ a = cx->cv[0];
-+ b = cx->cv[1];
-+ c = cx->cv[2];
-+ d = cx->cv[3];
-+#ifndef IS_LITTLE_ENDIAN
-+ cx->u.w[0] = lendian(cx->u.w[0]);
-+ cx->u.w[1] = lendian(cx->u.w[1]);
-+ cx->u.w[2] = lendian(cx->u.w[2]);
-+ cx->u.w[3] = lendian(cx->u.w[3]);
-+ cx->u.w[4] = lendian(cx->u.w[4]);
-+ cx->u.w[5] = lendian(cx->u.w[5]);
-+ cx->u.w[6] = lendian(cx->u.w[6]);
-+ cx->u.w[7] = lendian(cx->u.w[7]);
-+ cx->u.w[8] = lendian(cx->u.w[8]);
-+ cx->u.w[9] = lendian(cx->u.w[9]);
-+ cx->u.w[10] = lendian(cx->u.w[10]);
-+ cx->u.w[11] = lendian(cx->u.w[11]);
-+ cx->u.w[12] = lendian(cx->u.w[12]);
-+ cx->u.w[13] = lendian(cx->u.w[13]);
-+ cx->u.w[14] = lendian(cx->u.w[14]);
-+ cx->u.w[15] = lendian(cx->u.w[15]);
-+#endif
-+ FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
-+ FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
-+ FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
-+ FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
-+ FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
-+ FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
-+ FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
-+ FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
-+ FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
-+ FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
-+ FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
-+ FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
-+ FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
-+ FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
-+ FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
-+ FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
-+ GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
-+ GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
-+ GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
-+ GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
-+ GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
-+ GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
-+ GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
-+ GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
-+ GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
-+ GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
-+ GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
-+ GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
-+ GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
-+ GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
-+ GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
-+ GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
-+ HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
-+ HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
-+ HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
-+ HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
-+ HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
-+ HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
-+ HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
-+ HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
-+ HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
-+ HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
-+ HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
-+ HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
-+ HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
-+ HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
-+ HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
-+ HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
-+ II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
-+ II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
-+ II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
-+ II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
-+ II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
-+ II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
-+ II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
-+ II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
-+ II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
-+ II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
-+ II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
-+ II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
-+ II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
-+ II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
-+ II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
-+ II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
-+ cx->cv[0] += a;
-+ cx->cv[1] += b;
-+ cx->cv[2] += c;
-+ cx->cv[3] += d;
-+}
-+
-+void
-+MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
-+{
-+ PRUint32 bytesToConsume;
-+ PRUint32 inBufIndex = cx->lsbInput & 63;
-+
-+ /* Add the number of input bytes to the 64-bit input counter. */
-+ addto64(cx->msbInput, cx->lsbInput, inputLen);
-+ if (inBufIndex) {
-+ /* There is already data in the buffer. Fill with input. */
-+ bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
-+ memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
-+ if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
-+ /* The buffer is filled. Run the compression function. */
-+ md5_compress(cx);
-+ /* Remaining input. */
-+ inputLen -= bytesToConsume;
-+ input += bytesToConsume;
-+ }
-+
-+ /* Iterate over 64-byte chunks of the message. */
-+ while (inputLen >= MD5_BUFFER_SIZE) {
-+ memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
-+ md5_compress(cx);
-+ inputLen -= MD5_BUFFER_SIZE;
-+ input += MD5_BUFFER_SIZE;
-+ }
-+
-+ /* Tail of message (message bytes mod 64). */
-+ if (inputLen)
-+ memcpy(cx->inBuf, input, inputLen);
-+}
-+
-+static const unsigned char padbytes[] = {
-+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-+};
-+
-+void
-+MD5_End(MD5Context *cx, unsigned char *digest,
-+ unsigned int *digestLen, unsigned int maxDigestLen)
-+{
-+#ifndef IS_LITTLE_ENDIAN
-+ PRUint32 tmp;
-+#endif
-+ PRUint32 lowInput, highInput;
-+ PRUint32 inBufIndex = cx->lsbInput & 63;
-+
-+ if (maxDigestLen < MD5_HASH_LEN) {
-+// PORT_SetError(SEC_ERROR_INVALID_ARGS);
-+ return;
-+ }
-+
-+ /* Copy out the length of bits input before padding. */
-+ lowInput = cx->lsbInput;
-+ highInput = (cx->msbInput << 3) | (lowInput >> 29);
-+ lowInput <<= 3;
-+
-+ if (inBufIndex < MD5_END_BUFFER) {
-+ MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
-+ } else {
-+ MD5_Update(cx, padbytes,
-+ MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
-+ }
-+
-+ /* Store the number of bytes input (before padding) in final 64 bits. */
-+ cx->u.w[14] = lendian(lowInput);
-+ cx->u.w[15] = lendian(highInput);
-+
-+ /* Final call to compress. */
-+ md5_compress(cx);
-+
-+ /* Copy the resulting values out of the chain variables into return buf. */
-+ *digestLen = MD5_HASH_LEN;
-+#ifndef IS_LITTLE_ENDIAN
-+ cx->cv[0] = lendian(cx->cv[0]);
-+ cx->cv[1] = lendian(cx->cv[1]);
-+ cx->cv[2] = lendian(cx->cv[2]);
-+ cx->cv[3] = lendian(cx->cv[3]);
-+#endif
-+ memcpy(digest, cx->cv, MD5_HASH_LEN);
-+}
-+
-+unsigned int
-+MD5_FlattenSize(MD5Context *cx)
-+{
-+ return sizeof(*cx);
-+}
-+
-+int
-+MD5_Flatten(MD5Context *cx, unsigned char *space)
-+{
-+ memcpy(space, cx, sizeof(*cx));
-+ return 0;
-+}
-+
-+MD5Context *
-+MD5_Resurrect(unsigned char *space, void *arg)
-+{
-+ MD5Context *cx = MD5_NewContext();
-+ if (cx)
-+ memcpy(cx, space, sizeof(*cx));
-+ return cx;
-+}
-+
-+void
-+MD5_TraceState(MD5Context *cx)
-+{
-+// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
-+}
-+
-+int
-+md5_stream (FILE *stream, unsigned char *dest)
-+{
-+ /* Important: BLOCKSIZE must be a multiple of 64. */
-+#define BLOCKSIZE 4096
-+ unsigned int len;
-+ MD5Context *cx = MD5_NewContext();
-+ if (cx == NULL) {
-+// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-+ return -1;
-+ }
-+
-+ unsigned char buffer[BLOCKSIZE + 72];
-+ size_t sum;
-+
-+ /* Initialize the computation context. */
-+ MD5_Begin(cx);
-+
-+ /* Iterate over full file contents. */
-+ while (1)
-+ {
-+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
-+ computation function processes the whole buffer so that with the
-+ next round of the loop another block can be read. */
-+ size_t n;
-+ sum = 0;
-+
-+ /* Read block. Take care for partial reads. */
-+ do
-+ {
-+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-+
-+ sum += n;
-+ }
-+ while (sum < BLOCKSIZE && n != 0);
-+ if (n == 0 && ferror (stream))
-+ return 1;
-+
-+ /* If end of file is reached, end the loop. */
-+ if (n == 0)
-+ break;
-+
-+ /* Process buffer with BLOCKSIZE bytes. Note that
-+ BLOCKSIZE % 64 == 0
-+ */
-+ MD5_Update(cx, buffer, BLOCKSIZE);
-+ }
-+
-+ /* Add the last bytes if necessary. */
-+ if (sum > 0)
-+ MD5_Update(cx, buffer, sum);
-+
-+ MD5_End(cx, dest, &len, MD5_HASH_LEN);
-+ MD5_DestroyContext(cx, PR_TRUE);
-+ return len;
-+
-+}
-+
-+int getMD5sum(const char * fileName,char * sum)
-+{
-+ unsigned char bin_sum[16];
-+ int len=0;
-+ if (fileName)
-+ {
-+ FILE *fp=fopen(fileName,"rb");
-+ if (fp)
-+ {
-+ len=md5_stream(fp,bin_sum);
-+ memset(sum,0,33);
-+ for (int i = 0; i < len; ++i)
-+ sprintf (sum,"%s%02x",sum, bin_sum[i]);
-+ fclose(fp);
-+ return 0;
-+ }
-+ }
-+ return 1;
-+}
-+
-+int testMD5sum(const char * fileName,char * sum)
-+{
-+ char newSum[33]="";
-+ if (getMD5sum(fileName,newSum))
-+ return 1;
-+ return strcmp(newSum,sum);
-+}
-
-Index: jmorecfg.h
-===================================================================
-RCS file: /cvsroot/mozilla/jpeg/jmorecfg.h,v
-retrieving revision 3.12
-diff -u -r3.12 jmorecfg.h
---- misc/build/mozilla/jpeg/jmorecfg.h 5 Mar 2004 22:17:45 -0000 3.12
-+++ misc/build/mozilla/jpeg/jmorecfg.h 17 May 2004 03:48:38 -0000
-@@ -108,8 +108,8 @@
- /* Defines for MMX/SSE2 support. */
- #if defined(XP_WIN32) && defined(_M_IX86)
--#define HAVE_MMX_INTEL_MNEMONICS
--#define HAVE_SSE2_INTEL_MNEMONICS
-+//#define HAVE_MMX_INTEL_MNEMONICS
-+//#define HAVE_SSE2_INTEL_MNEMONICS
- #endif
+-ifeq ($(OS_TARGET),SunOS)
+-# The -R '$ORIGIN' linker option instructs this library to search for its
+-# dependencies in the same directory where it resides.
+-MKSHLIB += -R '$$ORIGIN'
+-#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
+-endif
+-
+ endif
+
+ # indicates dependency on freebl static lib
+--- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200
++++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200
+@@ -181,7 +181,7 @@
+ GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
+
+ XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
+-XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
++XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
+
+ EXTRA_DEPS = \
+ $(XP_DIST_DEP_LIBS) \
+--- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200
++++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200
+@@ -132,7 +132,7 @@
+ }
+
+ PRBool IsArray() const
+- {return (PRBool) TagPart() == T_ARRAY;}
++ {return (PRBool) (TagPart() == T_ARRAY);}
+
+ // 'Dependent' means that params of this type are dependent upon other
+ // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
+@@ -152,7 +152,7 @@
+ uint8 TagPart() const
+ {return (uint8) (flags & XPT_TDP_TAGMASK);}
+
+- enum
++ enum _xpttype
+ {
+ T_I8 = TD_INT8 ,
+ T_I16 = TD_INT16 ,
+--- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200
++++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200
+@@ -115,11 +115,14 @@
+
+ include $(topsrcdir)/config/config.mk
+
++# reduce prerequisites by disabling mozilla binary
++ifndef DISABLE_MOZ_EXECUTABLE
+ ifeq ($(USE_SHORT_LIBNAME),1)
+ PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
+ else
+ PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
+ endif
++endif
+
+ # Force applications to be built non-statically
+ # when building the mozcomps meta component
+@@ -491,6 +494,7 @@
+ APP_NAME = $(MOZ_APP_DISPLAYNAME)
+ endif
+
++ifdef PROGRAM
+ libs:: $(PROGRAM)
+ mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
+ rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
+@@ -505,6 +509,7 @@
+ rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
+ cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
+ echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
++endif
+
+ clean clobber::
+ rm -rf $(DIST)/$(APP_NAME).app
diff --git a/moz/zipped/makefile.mk b/moz/zipped/makefile.mk
index 9015bed34d60..400b5767759c 100644
--- a/moz/zipped/makefile.mk
+++ b/moz/zipped/makefile.mk
@@ -55,7 +55,8 @@ ALLTAR:
ALLTAR: \
$(MISC)$/unpacked_$(TARGET)_inc \
$(MISC)$/unpacked_$(TARGET)_lib \
- $(BIN)$/mozruntime.zip
+ $(BIN)$/mozruntime.zip \
+ $(MISC)$/replace_old_nss_libs
.ENDIF
.IF "$(GUI)" == "UNX"
@@ -81,6 +82,120 @@ $(MISC)$/unpacked_$(TARGET)_inc : $(OS)$(COM)$(CPU)inc.zip
$(BIN)$/mozruntime.zip : $(OS)$(COM)$(CPU)runtime.zip
$(COPY) $(OS)$(COM)$(CPU)runtime.zip $(BIN)$/mozruntime.zip
+LIBLIST =
+BIN_RUNTIMELIST =
+NSS_INCLUDE_LIST =
+NSS_MODULE_RUNTIME_LIST =
+
+.IF "$(ENABLE_NSS_MODULE)"=="YES"
+# The prebuilt moz files include all the old NSS stuff from moz and not the new
+# NSS libs, headers, etc, from the separate nss module. If we use the nss module
+# then we must take care not to deliver the old NSS stuff from the "prebuilts"
+.IF "$(GUI)" == "WNT"
+ FREEBL_LIB_OLD=freebl3
+.ELSE # "$(GUI)" == "WNT"
+ .IF "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+ FREEBL_LIB_OLD=freebl_32fpu_3
+ .ELSE # "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+ FREEBL_LIB_OLD=freebl3
+ .ENDIF # "$(OS)$(CPUNAME)" == "SOLARISSPARC"
+.ENDIF # "$(GUI)" == "WNT"
+
+BIN_RUNTIMELIST= \
+ $(FREEBL_LIB_OLD) \
+ nspr4 \
+ plc4 \
+ plds4 \
+ nss3 \
+ ssl3 \
+ softokn3 \
+ smime3
+
+.IF "$(GUI)"=="WNT"
+.IF "$(COM)"=="GCC"
+LIBLIST= \
+ libnspr4.a \
+ libnss3.a \
+ libsmime3.a \
+ libplc4.a \
+ libplds4.a \
+ libssl3.a
-.ENDIF # unpack mozab zips
+.ELSE
+LIBLIST= \
+ nspr4.lib \
+ plc4.lib \
+ plds4.lib \
+ nss3.lib \
+ ssl3.lib\
+ smime3.lib
+.ENDIF
+.ELSE #"$(GUI)"=="WNT"
+LIBLIST= \
+ lib$(FREEBL_LIB_OLD)$(DLLPOST) \
+ libnspr4$(DLLPOST) \
+ libsoftokn3$(DLLPOST) \
+ libplc4$(DLLPOST) \
+ libplds4$(DLLPOST) \
+ libnss3$(DLLPOST) \
+ libssl3$(DLLPOST) \
+ libsmime3$(DLLPOST)
+
+.ENDIF # .IF "$(GUI)"=="WNT"
+
+
+NSS_INCLUDE_LIST= nspr nss
+
+
+.IF "$(OS)" == "SOLARIS"
+.IF "$(CPU)" == "S" #32bit
+FREEBL=freebl_32fpu_3 freebl_32int64_3 freebl_32int_3
+.ELIF "$(CPU)" == "U" #64bit unxsolu4
+FREEBL=freebl_64int_3 freebl_64fpu_3
+.ELSE
+FREEBL=freebl3
+.ENDIF #"$(CPU)" == "S"
+
+.ELSE # "$(OS)" == "SOLARIS"
+FREEBL=freebl3
+.ENDIF # "$(OS)" == "SOLARIS"
+
+
+NSS_MODULE_RUNTIME_LIST:= \
+ $(FREEBL) \
+ nspr4 \
+ nss3 \
+ nssckbi \
+ nssdbm3 \
+ nssutil3 \
+ plc4 \
+ plds4 \
+ smime3 \
+ softokn3 \
+ sqlite3 \
+ ssl3
+
+
+.ENDIF #.IF "$(ENABLE_NSS_MODULE)"=="YES"
+# Remove the nss libs build in moz and those build in the nss module
+$(MISC)$/replace_old_nss_libs : $(MISC)$/unpacked_$(TARGET)_lib \
+$(MISC)$/unpacked_$(TARGET)_inc $(BIN)$/mozruntime.zip
+ +$(foreach,dir,$(NSS_INCLUDE_LIST) $(RENAME:s/+//) $(INCCOM)$/$(dir) \
+ $(INCCOM)$/$(dir)_remove_me &&) echo >& $(NULLDEV)
+ $(foreach,dir,$(NSS_INCLUDE_LIST) rm -r -f $(INCCOM)$/$(dir)_remove_me &&) \
+ echo >& $(NULLDEV)
+ $(foreach,lib,$(LIBLIST) rm -f $(LB)$/$(lib) &&) \
+ echo >& $(NULLDEV)
+ $(foreach,lib,$(BIN_RUNTIMELIST) zip -d $(BIN)$/mozruntime.zip $(DLLPRE)$(lib)$(DLLPOST) &&) \
+ echo >& $(NULLDEV)
+.IF "$(GUI)"=="WNT"
+ $(foreach,lib,$(NSS_MODULE_RUNTIME_LIST) zip -g -j $(BIN)$/mozruntime.zip $(SOLARBINDIR)$/$(DLLPRE)$(lib)$(DLLPOST) &&) \
+ echo >& $(NULLDEV)
+.ELSE
+ $(foreach,lib,$(NSS_MODULE_RUNTIME_LIST) zip -g -j $(BIN)$/mozruntime.zip $(SOLARLIBDIR)$/$(DLLPRE)$(lib)$(DLLPOST) &&) \
+ echo >& $(NULLDEV)
+.ENDIF
+ $(TOUCH) $@
+
+.ENDIF # unpack mozab zips
diff --git a/neon/makefile.mk b/neon/makefile.mk
index 3973bd59d68f..247e640ce8b1 100644
--- a/neon/makefile.mk
+++ b/neon/makefile.mk
@@ -54,7 +54,7 @@ NEON_NAME=neon-0.28.2
TARFILE_NAME=$(NEON_NAME)
PATCH_FILES=neon.patch
-ADDITIONAL_FILES=src$/makefile.mk src$/config.h
+ADDITIONAL_FILES=src$/makefile.mk src$/config.h src$/ne_ntlm.h src$/ne_ntlm.c
BUILD_DIR=src
BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
diff --git a/neon/neon.patch b/neon/neon.patch
index bdc296483534..b9776097ecbb 100644
--- a/neon/neon.patch
+++ b/neon/neon.patch
@@ -1,6 +1,6 @@
---- misc/neon-0.28.2/src/config.h 2008-08-25 14:36:05.062500000 +0200
-+++ misc/build/neon-0.28.2/src/config.h 2008-08-25 14:32:17.656250000 +0200
-@@ -1 +1,479 @@
+--- misc/neon-0.28.2/src/config.h 2009-06-24 12:49:38.000000000 +0200
++++ misc/build/neon-0.28.2/src/config.h 2009-06-24 12:46:45.000000000 +0200
+@@ -1 +1,484 @@
-dummy
+
+/* Define to specific EGD socket path */
@@ -304,7 +304,7 @@
+#define NEON_IS_LIBRARY 1
+
+/* Define to be the neon version string */
-+#define NEON_VERSION "0.26.3"
++#define NEON_VERSION "0.28.2"
+
+/* Define to enable debugging */
+/* #undef NE_DEBUGGING */
@@ -360,10 +360,10 @@
+#define NE_VERSION_MAJOR (0)
+
+/* Define to be neon library minor version */
-+#define NE_VERSION_MINOR (26)
++#define NE_VERSION_MINOR (28)
+
+/* Define to be neon library patch version */
-+#define NE_VERSION_PATCH (3)
++#define NE_VERSION_PATCH (2)
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "neon@webdav.org"
@@ -372,13 +372,13 @@
+#define PACKAGE_NAME "neon"
+
+/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "neon 0.26.3"
++#define PACKAGE_STRING "neon 0.28.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "neon"
+
+/* Define to the version of this package. */
-+#define PACKAGE_VERSION "0.26.3"
++#define PACKAGE_VERSION "0.28.2"
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
@@ -469,8 +469,6 @@
+
+#include <io.h>
+
-+#define HAVE_SSPI 1
-+
+#define HAVE_MEMCPY 1
+
+#define strncasecmp strnicmp
@@ -480,10 +478,17 @@
+#define NOGDI
+#define NONLS
+#define NOCRYPT
++
+#endif
---- misc/neon-0.28.2/src/makefile.mk 2008-08-25 14:36:04.640625000 +0200
-+++ misc/build/neon-0.28.2/src/makefile.mk 2008-08-25 14:32:17.671875000 +0200
-@@ -1 +1,54 @@
++
++#ifdef WIN32
++#define HAVE_SSPI 1
++#else
++#define HAVE_NTLM 1
++#endif
+--- misc/neon-0.28.2/src/makefile.mk 2009-06-24 12:49:38.000000000 +0200
++++ misc/build/neon-0.28.2/src/makefile.mk 2009-06-24 12:46:45.000000000 +0200
+@@ -1 +1,59 @@
-dummy
+PRJ=..$/..$/..$/..$/..
+
@@ -521,14 +526,19 @@
+ $(SLO)$/ne_request.obj \
+ $(SLO)$/ne_session.obj \
+ $(SLO)$/ne_socket.obj \
-+ $(SLO)$/ne_sspi.obj \
+ $(SLO)$/ne_string.obj \
+ $(SLO)$/ne_uri.obj \
+ $(SLO)$/ne_utils.obj \
+ $(SLO)$/ne_xml.obj \
+ $(SLO)$/ne_xmlreq.obj \
+ $(SLO)$/ne_openssl.obj
-+
++
++.IF "$(OS)"=="WNT"
++SLOFILES+=$(SLO)$/ne_sspi.obj
++.ELSE
++SLOFILES+=$(SLO)$/ne_ntlm.obj
++.ENDIF
++
+# $(SLO)$/ne_gnutls.obj \
+# $(SLO)$/ne_stubssl.obj
+
@@ -539,31 +549,48 @@
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
---- misc/neon-0.28.2/src/ne_207.c 2006-01-02 12:43:19.000000000 +0100
-+++ misc/build/neon-0.28.2/src/ne_207.c 2009-01-09 10:12:39.563530700 +0100
-@@ -177,7 +177,6 @@
- /* Now we have the href, begin the response */
- if (p->start_response && HAVE_CDATA(p)) {
- ne_uri ref, resolved;
--
- if (ne_uri_parse(cdata, &ref) == 0) {
- ne_uri_resolve(&p->base, &ref, &resolved);
+--- misc/neon-0.28.2/src/ne_auth.c 2008-02-29 17:30:12.000000000 +0100
++++ misc/build/neon-0.28.2/src/ne_auth.c 2009-06-24 12:46:45.000000000 +0200
+@@ -77,6 +77,10 @@
+ #include "ne_sspi.h"
+ #endif
-@@ -367,5 +366,4 @@
- ne_request_destroy(req);
++#ifdef HAVE_NTLM
++#include "ne_ntlm.h"
++#endif
++
+ #define HOOK_SERVER_ID "http://webdav.org/neon/hooks/server-auth"
+ #define HOOK_PROXY_ID "http://webdav.org/neon/hooks/proxy-auth"
- return ret;
--}
--
-+}
---- misc/neon-0.28.2/src/ne_auth.c 2008-02-29 17:30:12.000000000 +0100
-+++ misc/build/neon-0.28.2/src/ne_auth.c 2008-08-25 14:35:18.453125000 +0200
-@@ -598,9 +598,10 @@
+@@ -173,6 +177,10 @@
+ char *sspi_token;
+ void *sspi_context;
+ #endif
++#ifdef HAVE_NTLM
++ /* This is used for NTLM auth */
++ ne_ntlm_context *ntlm_context;
++#endif
+ /* These all used for Digest auth */
+ char *realm;
+ char *nonce;
+@@ -287,6 +295,11 @@
+ ne_sspi_destroy_context(sess->sspi_context);
+ sess->sspi_context = NULL;
+ #endif
++#ifdef HAVE_NTLM
++ ne_ntlm_destroy_context(sess->ntlm_context);
++ sess->ntlm_context = NULL;
++#endif
++ sess->protocol = NULL;
+ }
+
+ /* Returns client nonce string. */
+@@ -598,9 +611,10 @@
int ntlm = ne_strcasecmp(parms->protocol->name, "NTLM") == 0;
int status;
char *response = NULL;
-
-+ char password[NE_ABUFSIZ];
++ char password[NE_ABUFSIZ];
+
NE_DEBUG(NE_DBG_HTTPAUTH, "auth: SSPI challenge.\n");
-
@@ -571,7 +598,7 @@
if (!sess->sspi_context) {
ne_uri uri = {0};
-@@ -614,8 +615,17 @@
+@@ -614,8 +628,17 @@
return status;
}
}
@@ -590,16 +617,95 @@
if (status) {
return status;
}
-@@ -1413,6 +1423,7 @@
- /* note above: allow a 401 in response to a CONNECT request
- * from a proxy since some buggy proxies send that. */
- NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Got challenge (code %d).\n", status->code);
-+
- if (!auth_challenge(sess, areq->attempt++, auth_hdr)) {
- ret = NE_RETRY;
- } else {
+@@ -685,6 +708,62 @@
+ return invalid;
+ }
+
++#ifdef HAVE_NTLM
++
++static char *request_ntlm(auth_session *sess, struct auth_request *request)
++{
++ char *token = ne_ntlm_getRequestToken(sess->ntlm_context);
++ if (token) {
++ char * req = ne_concat(sess->protocol->name, " ", token, "\r\n", NULL);
++ ne_free(token);
++ return req;
++ } else {
++ return NULL;
++ }
++}
++
++static int ntlm_challenge(auth_session *sess, int attempt,
++ struct auth_challenge *parms,
++ ne_buffer **errmsg)
++{
++ int status;
++
++ NE_DEBUG(NE_DBG_HTTPAUTH, "auth: NTLM challenge.\n");
++
++ if (!parms->opaque) {
++ char password[NE_ABUFSIZ];
++
++ if (get_credentials(sess, errmsg, attempt, parms, password)) {
++ /* Failed to get credentials */
++ return -1;
++ }
++
++ if (sess->ntlm_context) {
++ status = ne_ntlm_destroy_context(sess->ntlm_context);
++ sess->ntlm_context = NULL;
++ if (status) {
++ return status;
++ }
++ }
++
++ status = ne_ntlm_create_context(&sess->ntlm_context,
++ sess->username,
++ password);
++ if (status) {
++ return status;
++ }
++ }
++
++ status = ne_ntlm_authenticate(sess->ntlm_context, parms->opaque);
++ if (status) {
++ return status;
++ }
++
++ return 0;
++}
++#endif /* HAVE_NTLM */
++
++
+ /* Examine a digest challenge: return 0 if it is a valid Digest challenge,
+ * else non-zero. */
+ static int digest_challenge(auth_session *sess, int attempt,
+@@ -1134,6 +1213,11 @@
+ sspi_challenge, request_sspi, NULL,
+ AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH },
+ #endif
++#ifdef HAVE_NTLM
++ { NE_AUTH_NEGOTIATE, 30, "NTLM",
++ ntlm_challenge, request_ntlm, NULL,
++ AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH },
++#endif
+ { 0 }
+ };
+
+@@ -1431,6 +1515,11 @@
+ ne_sspi_clear_context(sess->sspi_context);
+ }
+ #endif
++#ifdef HAVE_NTLM
++ if (sess->ntlm_context) {
++ ne_ntlm_clear_context(sess->ntlm_context);
++ }
++#endif
+
+ return ret;
+ }
--- misc/neon-0.28.2/src/ne_defs.h 2006-10-24 21:40:09.000000000 +0200
-+++ misc/build/neon-0.28.2/src/ne_defs.h 2008-08-25 14:32:17.875000000 +0200
++++ misc/build/neon-0.28.2/src/ne_defs.h 2009-06-24 12:46:45.000000000 +0200
@@ -41,7 +41,7 @@
#endif
@@ -610,7 +716,7 @@
#endif
--- misc/neon-0.28.2/src/ne_locks.h 2006-01-02 12:43:19.000000000 +0100
-+++ misc/build/neon-0.28.2/src/ne_locks.h 2008-08-25 14:32:17.937500000 +0200
++++ misc/build/neon-0.28.2/src/ne_locks.h 2009-06-24 12:46:45.000000000 +0200
@@ -22,6 +22,10 @@
#ifndef NE_LOCKS_H
#define NE_LOCKS_H
@@ -622,8 +728,770 @@
#include "ne_request.h" /* for ne_session + ne_request */
#include "ne_uri.h" /* for ne_uri */
+--- misc/neon-0.28.2/src/ne_ntlm.c 2009-06-24 12:49:38.000000000 +0200
++++ misc/build/neon-0.28.2/src/ne_ntlm.c 2009-06-24 12:46:45.000000000 +0200
+@@ -1 +1,700 @@
+-dummy
++/*
++ Handling of NTLM Authentication
++ Copyright (C) 2003, Daniel Stenberg <daniel@haxx.se>
++ Copyright (C) 2009, Kai Sommerfeld <kso@openoffice.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Library General Public
++ License as published by the Free Software Foundation; either
++ version 2 of the License, or (at your option) any later version.
++
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ MA 02111-1307, USA
++
++*/
++
++/* NTLM details:
++
++ http://davenport.sourceforge.net/ntlm.html
++ http://www.innovation.ch/java/ntlm.html
++
++*/
++
++#include "ne_ntlm.h"
++
++#ifdef HAVE_NTLM
++
++#include "ne_string.h"
++
++typedef enum {
++ NTLMSTATE_NONE,
++ NTLMSTATE_TYPE1,
++ NTLMSTATE_TYPE2,
++ NTLMSTATE_TYPE3,
++ NTLMSTATE_LAST
++} NTLMState;
++
++struct ne_ntlm_context_s {
++ NTLMState state;
++ unsigned char nonce[8];
++ char *user;
++ char *passwd;
++ char *requestToken;
++};
++
++typedef enum {
++ NTLM_NONE, /* not a ntlm */
++ NTLM_BAD, /* an ntlm, but one we don't like */
++ NTLM_FIRST, /* the first 401-reply we got with NTLM */
++ NTLM_FINE, /* an ntlm we act on */
++
++ NTLM_LAST /* last entry in this enum, don't use */
++} ntlm;
++
++/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */
++
++#define NTLMFLAG_NEGOTIATE_UNICODE (1<<0)
++/* Indicates that Unicode strings are supported for use in security buffer
++ data. */
++
++#define NTLMFLAG_NEGOTIATE_OEM (1<<1)
++/* Indicates that OEM strings are supported for use in security buffer data. */
++
++#define NTLMFLAG_REQUEST_TARGET (1<<2)
++/* Requests that the server's authentication realm be included in the Type 2
++ message. */
++
++/* unknown (1<<3) */
++#define NTLMFLAG_NEGOTIATE_SIGN (1<<4)
++/* Specifies that authenticated communication between the client and server
++ should carry a digital signature (message integrity). */
++
++#define NTLMFLAG_NEGOTIATE_SEAL (1<<5)
++/* Specifies that authenticated communication between the client and server
++ should be encrypted (message confidentiality). */
++
++#define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6)
++/* unknown purpose */
++
++#define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7)
++/* Indicates that the LAN Manager session key should be used for signing and
++ sealing authenticated communications. */
++
++#define NTLMFLAG_NEGOTIATE_NETWARE (1<<8)
++/* unknown purpose */
++
++#define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9)
++/* Indicates that NTLM authentication is being used. */
++
++/* unknown (1<<10) */
++/* unknown (1<<11) */
++
++#define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12)
++/* Sent by the client in the Type 1 message to indicate that a desired
++ authentication realm is included in the message. */
++
++#define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13)
++/* Sent by the client in the Type 1 message to indicate that the client
++ workstation's name is included in the message. */
++
++#define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14)
++/* Sent by the server to indicate that the server and client are on the same
++ machine. Implies that the client may use a pre-established local security
++ context rather than responding to the challenge. */
++
++#define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15)
++/* Indicates that authenticated communication between the client and server
++ should be signed with a "dummy" signature. */
++
++#define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16)
++/* Sent by the server in the Type 2 message to indicate that the target
++ authentication realm is a domain. */
++
++#define NTLMFLAG_TARGET_TYPE_SERVER (1<<17)
++/* Sent by the server in the Type 2 message to indicate that the target
++ authentication realm is a server. */
++
++#define NTLMFLAG_TARGET_TYPE_SHARE (1<<18)
++/* Sent by the server in the Type 2 message to indicate that the target
++ authentication realm is a share. Presumably, this is for share-level
++ authentication. Usage is unclear. */
++
++#define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19)
++/* Indicates that the NTLM2 signing and sealing scheme should be used for
++ protecting authenticated communications. */
++
++#define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20)
++/* unknown purpose */
++
++#define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21)
++/* unknown purpose */
++
++#define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22)
++/* unknown purpose */
++
++#define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23)
++/* Sent by the server in the Type 2 message to indicate that it is including a
++ Target Information block in the message. */
++
++/* unknown (1<24) */
++/* unknown (1<25) */
++/* unknown (1<26) */
++/* unknown (1<27) */
++/* unknown (1<28) */
++
++#define NTLMFLAG_NEGOTIATE_128 (1<<29)
++/* Indicates that 128-bit encryption is supported. */
++
++#define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30)
++/* unknown purpose */
++
++#define NTLMFLAG_NEGOTIATE_56 (1<<31)
++/* Indicates that 56-bit encryption is supported. */
++
++#ifdef HAVE_OPENSSL
++/* We need OpenSSL for the crypto lib to provide us with MD4 and DES */
++
++/* -- WIN32 approved -- */
++#include <stdio.h>
++#include <string.h>
++#include <stdarg.h>
++#include <stdlib.h>
++#include <ctype.h>
++
++#include <openssl/des.h>
++#include <openssl/md4.h>
++#include <openssl/ssl.h>
++
++#if OPENSSL_VERSION_NUMBER < 0x00907001L
++#define DES_key_schedule des_key_schedule
++#define DES_cblock des_cblock
++#define DES_set_odd_parity des_set_odd_parity
++#define DES_set_key des_set_key
++#define DES_ecb_encrypt des_ecb_encrypt
++
++/* This is how things were done in the old days */
++#define DESKEY(x) x
++#define DESKEYARG(x) x
++#else
++/* Modern version */
++#define DESKEYARG(x) *x
++#define DESKEY(x) &x
++#endif
++
++/* Define this to make the type-3 message include the NT response message */
++#define USE_NTRESPONSES 1
++
++/*
++ (*) = A "security buffer" is a triplet consisting of two shorts and one
++ long:
++
++ 1. a 'short' containing the length of the buffer in bytes
++ 2. a 'short' containing the allocated space for the buffer in bytes
++ 3. a 'long' containing the offset to the start of the buffer from the
++ beginning of the NTLM message, in bytes.
++*/
++
++static ntlm ne_input_ntlm(ne_ntlm_context *ctx,
++ const char *responseToken)
++{
++ if(responseToken) {
++ /* We got a type-2 message here:
++
++ Index Description Content
++ 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP"
++ (0x4e544c4d53535000)
++ 8 NTLM Message Type long (0x02000000)
++ 12 Target Name security buffer(*)
++ 20 Flags long
++ 24 Challenge 8 bytes
++ (32) Context (optional) 8 bytes (two consecutive longs)
++ (40) Target Information (optional) security buffer(*)
++ 32 (48) start of data block
++ */
++ unsigned char * buffer = NULL;
++
++ int size = ne_unbase64(responseToken, &buffer);
++
++ ctx->state = NTLMSTATE_TYPE2; /* we got a type-2 */
++
++ if(size >= 48)
++ /* the nonce of interest is index [24 .. 31], 8 bytes */
++ memcpy(ctx->nonce, &buffer[24], 8);
++
++ /* at index decimal 20, there's a 32bit NTLM flag field */
++
++ if (buffer) ne_free(buffer);
++ }
++ else {
++ if(ctx->state >= NTLMSTATE_TYPE1)
++ return NTLM_BAD;
++
++ ctx->state = NTLMSTATE_TYPE1; /* we should sent away a type-1 */
++ }
++ return NTLM_FINE;
++}
++
++/*
++ * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The
++ * key schedule ks is also set.
++ */
++static void setup_des_key(unsigned char *key_56,
++ DES_key_schedule DESKEYARG(ks))
++{
++ DES_cblock key;
++
++ key[0] = key_56[0];
++ key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1);
++ key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2);
++ key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3);
++ key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4);
++ key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5);
++ key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6);
++ key[7] = (key_56[6] << 1) & 0xFF;
++
++ DES_set_odd_parity(&key);
++ DES_set_key(&key, ks);
++}
++
++ /*
++ * takes a 21 byte array and treats it as 3 56-bit DES keys. The
++ * 8 byte plaintext is encrypted with each key and the resulting 24
++ * bytes are stored in the results array.
++ */
++static void calc_resp(unsigned char *keys,
++ unsigned char *plaintext,
++ unsigned char *results)
++{
++ DES_key_schedule ks;
++
++ setup_des_key(keys, DESKEY(ks));
++ DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results,
++ DESKEY(ks), DES_ENCRYPT);
++
++ setup_des_key(keys+7, DESKEY(ks));
++ DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+8),
++ DESKEY(ks), DES_ENCRYPT);
++
++ setup_des_key(keys+14, DESKEY(ks));
++ DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+16),
++ DESKEY(ks), DES_ENCRYPT);
++}
++
++/*
++ * Set up lanmanager and nt hashed passwords
++ */
++static void mkhash(char *password,
++ unsigned char *nonce, /* 8 bytes */
++ unsigned char *lmresp /* must fit 0x18 bytes */
++#ifdef USE_NTRESPONSES
++ , unsigned char *ntresp /* must fit 0x18 bytes */
++#endif
++ )
++{
++ unsigned char lmbuffer[21];
++#ifdef USE_NTRESPONSES
++ unsigned char ntbuffer[21];
++#endif
++ unsigned char *pw;
++ static const unsigned char magic[] = {
++ 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25
++ };
++ int i;
++ int len = strlen(password);
++
++ /* make it fit at least 14 bytes */
++ pw = malloc(len<7?14:len*2);
++ if(!pw)
++ return; /* this will lead to a badly generated package */
++
++ if (len > 14)
++ len = 14;
++
++ for (i=0; i<len; i++)
++ pw[i] = toupper(password[i]);
++
++ for (; i<14; i++)
++ pw[i] = 0;
++
++ {
++ /* create LanManager hashed password */
++ DES_key_schedule ks;
++
++ setup_des_key(pw, DESKEY(ks));
++ DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)lmbuffer,
++ DESKEY(ks), DES_ENCRYPT);
++
++ setup_des_key(pw+7, DESKEY(ks));
++ DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer+8),
++ DESKEY(ks), DES_ENCRYPT);
++
++ memset(lmbuffer+16, 0, 5);
++ }
++ /* create LM responses */
++ calc_resp(lmbuffer, nonce, lmresp);
++
++#ifdef USE_NTRESPONSES
++ {
++ /* create NT hashed password */
++ MD4_CTX MD4;
++
++ len = strlen(password);
++
++ for (i=0; i<len; i++) {
++ pw[2*i] = password[i];
++ pw[2*i+1] = 0;
++ }
++
++ MD4_Init(&MD4);
++ MD4_Update(&MD4, pw, 2*len);
++ MD4_Final(ntbuffer, &MD4);
++
++ memset(ntbuffer+16, 0, 8);
++ }
++
++ calc_resp(ntbuffer, nonce, ntresp);
++#endif
++
++ free(pw);
++}
++
++#define SHORTPAIR(x) ((x) & 0xff), ((x) >> 8)
++#define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8)&0xff), \
++ (((x) >>16)&0xff), ((x)>>24)
++
++/* this is for creating ntlm header output */
++static int ne_output_ntlm(ne_ntlm_context *ctx)
++{
++ const char *domain=""; /* empty */
++ const char *host=""; /* empty */
++ int domlen=strlen(domain);
++ int hostlen = strlen(host);
++ int hostoff; /* host name offset */
++ int domoff; /* domain name offset */
++ int size;
++ unsigned char ntlmbuf[256]; /* enough, unless the host/domain is very long */
++
++ if(!ctx->user || !ctx->passwd)
++ /* no user, no auth */
++ return 0; /* OK */
++
++ switch(ctx->state) {
++ case NTLMSTATE_TYPE1:
++ default: /* for the weird cases we (re)start here */
++ hostoff = 32;
++ domoff = hostoff + hostlen;
++
++ /* Create and send a type-1 message:
++
++ Index Description Content
++ 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP"
++ (0x4e544c4d53535000)
++ 8 NTLM Message Type long (0x01000000)
++ 12 Flags long
++ 16 Supplied Domain security buffer(*)
++ 24 Supplied Workstation security buffer(*)
++ 32 start of data block
++
++ */
++
++ snprintf((char *)ntlmbuf, sizeof(ntlmbuf), "NTLMSSP%c"
++ "\x01%c%c%c" /* 32-bit type = 1 */
++ "%c%c%c%c" /* 32-bit NTLM flag field */
++ "%c%c" /* domain length */
++ "%c%c" /* domain allocated space */
++ "%c%c" /* domain name offset */
++ "%c%c" /* 2 zeroes */
++ "%c%c" /* host length */
++ "%c%c" /* host allocated space */
++ "%c%c" /* host name offset */
++ "%c%c" /* 2 zeroes */
++ "%s" /* host name */
++ "%s", /* domain string */
++ 0, /* trailing zero */
++ 0,0,0, /* part of type-1 long */
++
++ LONGQUARTET(
++ NTLMFLAG_NEGOTIATE_OEM| /* 2 */
++ NTLMFLAG_NEGOTIATE_NTLM_KEY /* 200 */
++ /* equals 0x0202 */
++ ),
++ SHORTPAIR(domlen),
++ SHORTPAIR(domlen),
++ SHORTPAIR(domoff),
++ 0,0,
++ SHORTPAIR(hostlen),
++ SHORTPAIR(hostlen),
++ SHORTPAIR(hostoff),
++ 0,0,
++ host, domain);
++
++ /* initial packet length */
++ size = 32 + hostlen + domlen;
++
++ /* now keeper of the base64 encoded package size */
++ if (ctx->requestToken) ne_free(ctx->requestToken);
++ ctx->requestToken = ne_base64(ntlmbuf, size);
++
++ break;
++
++ case NTLMSTATE_TYPE2:
++ /* We received the type-2 already, create a type-3 message:
++
++ Index Description Content
++ 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP"
++ (0x4e544c4d53535000)
++ 8 NTLM Message Type long (0x03000000)
++ 12 LM/LMv2 Response security buffer(*)
++ 20 NTLM/NTLMv2 Response security buffer(*)
++ 28 Domain Name security buffer(*)
++ 36 User Name security buffer(*)
++ 44 Workstation Name security buffer(*)
++ (52) Session Key (optional) security buffer(*)
++ (60) Flags (optional) long
++ 52 (64) start of data block
++
++ */
++
++ {
++ int lmrespoff;
++ int ntrespoff;
++ int useroff;
++ unsigned char lmresp[0x18]; /* fixed-size */
++#ifdef USE_NTRESPONSES
++ unsigned char ntresp[0x18]; /* fixed-size */
++#endif
++ const char *user;
++ int userlen;
++
++ user = strchr(ctx->user, '\\');
++ if(!user)
++ user = strchr(ctx->user, '/');
++
++ if (user) {
++ domain = ctx->user;
++ domlen = user - domain;
++ user++;
++ }
++ else
++ user = ctx->user;
++ userlen = strlen(user);
++
++ mkhash(ctx->passwd, &ctx->nonce[0], lmresp
++#ifdef USE_NTRESPONSES
++ , ntresp
++#endif
++ );
++
++ domoff = 64; /* always */
++ useroff = domoff + domlen;
++ hostoff = useroff + userlen;
++ lmrespoff = hostoff + hostlen;
++ ntrespoff = lmrespoff + 0x18;
++
++ /* Create the big type-3 message binary blob */
++ size = snprintf((char *)ntlmbuf, sizeof(ntlmbuf),
++ "NTLMSSP%c"
++ "\x03%c%c%c" /* type-3, 32 bits */
++
++ "%c%c%c%c" /* LanManager length + allocated space */
++ "%c%c" /* LanManager offset */
++ "%c%c" /* 2 zeroes */
++
++ "%c%c" /* NT-response length */
++ "%c%c" /* NT-response allocated space */
++ "%c%c" /* NT-response offset */
++ "%c%c" /* 2 zeroes */
++
++ "%c%c" /* domain length */
++ "%c%c" /* domain allocated space */
++ "%c%c" /* domain name offset */
++ "%c%c" /* 2 zeroes */
++
++ "%c%c" /* user length */
++ "%c%c" /* user allocated space */
++ "%c%c" /* user offset */
++ "%c%c" /* 2 zeroes */
++
++ "%c%c" /* host length */
++ "%c%c" /* host allocated space */
++ "%c%c" /* host offset */
++ "%c%c%c%c%c%c" /* 6 zeroes */
++
++ "\xff\xff" /* message length */
++ "%c%c" /* 2 zeroes */
++
++ "\x01\x82" /* flags */
++ "%c%c" /* 2 zeroes */
++
++ /* domain string */
++ /* user string */
++ /* host string */
++ /* LanManager response */
++ /* NT response */
++ ,
++ 0, /* zero termination */
++ 0,0,0, /* type-3 long, the 24 upper bits */
++
++ SHORTPAIR(0x18), /* LanManager response length, twice */
++ SHORTPAIR(0x18),
++ SHORTPAIR(lmrespoff),
++ 0x0, 0x0,
++
++#ifdef USE_NTRESPONSES
++ SHORTPAIR(0x18), /* NT-response length, twice */
++ SHORTPAIR(0x18),
++#else
++ 0x0, 0x0,
++ 0x0, 0x0,
++#endif
++ SHORTPAIR(ntrespoff),
++ 0x0, 0x0,
++
++ SHORTPAIR(domlen),
++ SHORTPAIR(domlen),
++ SHORTPAIR(domoff),
++ 0x0, 0x0,
++
++ SHORTPAIR(userlen),
++ SHORTPAIR(userlen),
++ SHORTPAIR(useroff),
++ 0x0, 0x0,
++
++ SHORTPAIR(hostlen),
++ SHORTPAIR(hostlen),
++ SHORTPAIR(hostoff),
++ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
++
++ 0x0, 0x0,
++
++ 0x0, 0x0);
++
++ /* size is now 64 */
++ size=64;
++ ntlmbuf[62]=ntlmbuf[63]=0;
++
++ /* Make sure that the user and domain strings fit in the target buffer
++ before we copy them there. */
++ if(size + userlen + domlen >= sizeof(ntlmbuf)) {
++ return -1;
++ }
++
++ memcpy(&ntlmbuf[size], domain, domlen);
++ size += domlen;
++
++ memcpy(&ntlmbuf[size], user, userlen);
++ size += userlen;
++
++ /* we append the binary hashes to the end of the blob */
++ if(size < ((int)sizeof(ntlmbuf) - 0x18)) {
++ memcpy(&ntlmbuf[size], lmresp, 0x18);
++ size += 0x18;
++ }
++
++#ifdef USE_NTRESPONSES
++ if(size < ((int)sizeof(ntlmbuf) - 0x18)) {
++ memcpy(&ntlmbuf[size], ntresp, 0x18);
++ size += 0x18;
++ }
++#endif
++
++ ntlmbuf[56] = size & 0xff;
++ ntlmbuf[57] = size >> 8;
++
++ /* convert the binary blob into base64 */
++ ctx->requestToken = ne_base64(ntlmbuf, size);
++
++ ctx->state = NTLMSTATE_TYPE3; /* we sent a type-3 */
++ }
++ break;
++
++ case NTLMSTATE_TYPE3:
++ /* connection is already authenticated,
++ * don't send a header in future requests */
++ if (ctx->requestToken) ne_free(ctx->requestToken);
++ ctx->requestToken = NULL;
++ break;
++ }
++
++ return 0; /* OK */
++}
++
++int ne_ntlm_create_context(ne_ntlm_context **context, const char *userName, const char *password)
++{
++ if (context == NULL) {
++ return -1;
++ } else {
++ ne_ntlm_context *ctx = ne_calloc(sizeof(ne_ntlm_context));
++
++ ctx->state = NTLMSTATE_NONE;
++ ctx->user = ne_strdup(userName);
++ ctx->passwd = ne_strdup(password);
++
++ *context = ctx;
++ return 0;
++ }
++}
++
++int ne_ntlm_destroy_context(ne_ntlm_context *context)
++{
++ if (context != NULL) {
++ if (context->user)
++ ne_free(context->user);
++
++ if (context->passwd)
++ ne_free(context->passwd);
++
++ if (context->requestToken)
++ ne_free(context->requestToken);
++
++ ne_free(context);
++ }
++ return 0;
++}
++
++int ne_ntlm_clear_context(ne_ntlm_context *context)
++{
++ return 0;
++}
++
++int ne_ntlm_authenticate(ne_ntlm_context *context, const char *responseToken)
++{
++ if (context == NULL) {
++ return -1;
++ } else {
++ if (context->state <= NTLMSTATE_TYPE3) {
++ ntlm ntlmstatus = ne_input_ntlm(context, responseToken);
++
++ if (ntlmstatus != NTLM_FINE) {
++ return -1;
++ }
++ }
++ }
++ return ne_output_ntlm(context);
++}
++
++char *ne_ntlm_getRequestToken(ne_ntlm_context *context)
++{
++ if (context == NULL) {
++ return NULL;
++ } else {
++ if (context->requestToken) {
++ char *ret = ne_strdup(context->requestToken);
++ ne_free(context->requestToken);
++ context->requestToken = NULL;
++ return ret;
++ } else {
++ return NULL;
++ }
++ }
++}
++
++#endif /* HAVE_OPENSSL */
++#endif /* HAVE_NTLM */
+--- misc/neon-0.28.2/src/ne_ntlm.h 2009-06-24 12:49:38.000000000 +0200
++++ misc/build/neon-0.28.2/src/ne_ntlm.h 2009-06-24 12:46:45.000000000 +0200
+@@ -1 +1,44 @@
+-dummy
++/*
++ Handling of NTLM Authentication
++ Copyright (C) 2009, Kai Sommerfeld <kso@openoffice.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Library General Public
++ License as published by the Free Software Foundation; either
++ version 2 of the License, or (at your option) any later version.
++
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ MA 02111-1307, USA
++
++*/
++#ifndef NE_NTLM_H
++#define NE_NTLM_H
++
++#include "config.h"
++
++/* PRIVATE TO NEON -- NOT PART OF THE EXTERNAL API. */
++
++#ifdef HAVE_NTLM
++
++typedef struct ne_ntlm_context_s ne_ntlm_context;
++
++int ne_ntlm_create_context(ne_ntlm_context **context, const char *userName, const char *password);
++
++int ne_ntlm_destroy_context(ne_ntlm_context *context);
++
++int ne_ntlm_clear_context(ne_ntlm_context *context);
++
++int ne_ntlm_authenticate(ne_ntlm_context *context, const char *responseToken);
++
++char *ne_ntlm_getRequestToken(ne_ntlm_context *context);
++
++#endif /* HAVE_NTLM */
++
++#endif /* NE_NTLM_H */
+--- misc/neon-0.28.2/src/ne_socket.c 2008-02-28 14:19:19.000000000 +0100
++++ misc/build/neon-0.28.2/src/ne_socket.c 2009-06-24 12:49:13.000000000 +0200
+@@ -60,6 +60,7 @@
+ #include <stddef.h>
+ #ifdef USE_GETADDRINFO
+ #include <ws2tcpip.h>
++#include <Wspiapi.h>
+ #endif
+ #endif
+
--- misc/neon-0.28.2/src/ne_sspi.c 2007-08-10 17:26:08.000000000 +0200
-+++ misc/build/neon-0.28.2/src/ne_sspi.c 2009-01-09 10:31:05.752056400 +0100
++++ misc/build/neon-0.28.2/src/ne_sspi.c 2009-06-24 12:46:45.000000000 +0200
@@ -202,9 +202,48 @@
return -1;
}
@@ -682,37 +1550,26 @@
{
SecBufferDesc outBufferDesc;
SecBuffer outBuffer;
-@@ -552,7 +591,7 @@
- {
- freeBuffer(&outBufferDesc);
- sspiContext->authfinished = 0;
-- NE_DEBUG(NE_DBG_HTTPAUTH,"sspi: failing because starting over from failed try.\n");
-+ NE_DEBUG(NE_DBG_HTTPAUTH,"sspi: fai6 over from failed try.\n");
- return -1;
- }
- sspiContext->authfinished = 0;
-@@ -560,14 +599,26 @@
+@@ -560,14 +599,23 @@
/* Reset any existing context since we are starting over */
resetContext(sspiContext);
+
-+ if (strlen(username) != 0) {
-+ if (acquireCredentialsHandleForUsername
-+ (&sspiContext->credentials, sspiContext->mechanism, username, password) != SEC_E_OK) {
-+ freeBuffer(&outBufferDesc);
-+ NE_DEBUG(NE_DBG_HTTPAUTH,
-+ "sspi: acquireCredentialsHandleForUsername failed.\n");
-+ return -1;
-+ }
-+ } else {
-+ if (acquireCredentialsHandle
-+ (&sspiContext->credentials, sspiContext->mechanism) != SEC_E_OK) {
-+ freeBuffer(&outBufferDesc);
-+ NE_DEBUG(NE_DBG_HTTPAUTH,
-+ "sspi: acquireCredentialsHandle failed.\n");
-+ return -1;
-+ }
-+ }
++ if (strlen(username) != 0) {
++ if (acquireCredentialsHandleForUsername
++ (&sspiContext->credentials, sspiContext->mechanism, username, password) != SEC_E_OK) {
++ freeBuffer(&outBufferDesc);
++ NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: acquireCredentialsHandleForUsername failed.\n");
++ return -1;
++ }
++ } else {
++ if (acquireCredentialsHandle
++ (&sspiContext->credentials, sspiContext->mechanism) != SEC_E_OK) {
++ freeBuffer(&outBufferDesc);
++ NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: acquireCredentialsHandle failed.\n");
++ return -1;
++ }
++ }
- if (acquireCredentialsHandle
- (&sspiContext->credentials, sspiContext->mechanism) != SEC_E_OK) {
@@ -721,12 +1578,11 @@
- "sspi: acquireCredentialsHandle failed.\n");
- return -1;
- }
-+
securityStatus =
initializeSecurityContext(&sspiContext->credentials, NULL,
--- misc/neon-0.28.2/src/ne_sspi.h 2006-02-12 13:05:14.000000000 +0100
-+++ misc/build/neon-0.28.2/src/ne_sspi.h 2008-08-25 14:32:18.000000000 +0200
++++ misc/build/neon-0.28.2/src/ne_sspi.h 2009-06-24 12:46:45.000000000 +0200
@@ -41,7 +41,7 @@
int ne_sspi_clear_context(void *context);
@@ -737,7 +1593,7 @@
#endif /* HAVE_SSPI */
--- misc/neon-0.28.2/src/ne_uri.c 2007-12-05 12:04:47.000000000 +0100
-+++ misc/build/neon-0.28.2/src/ne_uri.c 2009-01-09 10:21:45.201720200 +0100
++++ misc/build/neon-0.28.2/src/ne_uri.c 2009-06-24 12:46:45.000000000 +0200
@@ -42,7 +42,7 @@
#include "ne_alloc.h"
#include "ne_uri.h"
diff --git a/nss/makefile.mk b/nss/makefile.mk
new file mode 100644
index 000000000000..06881d3359d6
--- /dev/null
+++ b/nss/makefile.mk
@@ -0,0 +1,179 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.48 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=.
+
+PRJNAME=nss
+TARGET=nss
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(ENABLE_NSS_MODULE)"!="YES"
+all:
+ @echo "NSS will not be built. ENABLE_NSS_MODULE is '$(ENABLE_NSS_MODULE)'"
+.ENDIF
+
+TARFILE_NAME=nss_3_12_3
+TARFILE_ROOTDIR=mozilla
+PATCH_FILES=nss_3_12_3.patch
+
+.IF "$(debug)" != ""
+.ELSE
+BUILD_OPT=1
+.EXPORT: BUILD_OPT
+.ENDIF
+
+
+.IF "$(GUI)"=="UNX"
+.IF "$(OS)$(COM)"=="LINUXGCC"
+#LDFLAGS:=-Wl,-rpath,'$$$$ORIGIN'
+.EXPORT: LDFLAGS
+
+.IF "$(CPU)"=="X"
+# force 64-bit buildmode
+USE_64:=1
+.EXPORT : USE_64
+.ENDIF # "$(CPU)"=="X"
+.ENDIF # "$(OS)$(COM)"=="LINUXGCC"
+
+
+.IF "$(OS)"=="MACOSX"
+.IF "$(EXTRA_CFLAGS)"!=""
+CPP:=gcc -E $(EXTRA_CFLAGS)
+CXX:=g++ $(EXTRA_CFLAGS)
+CC:=gcc $(EXTRA_CFLAGS)
+.EXPORT : CPP
+.ENDIF # "$(EXTRA_CFLAGS)"!=""
+.ENDIF # "$(OS)"=="MACOSX"
+
+OUT2LIB=dist$/out$/lib$/*$(DLLPOST)
+
+BUILD_DIR=security$/nss
+BUILD_ACTION= $(GNUMAKE) nss_build_all
+
+.ENDIF # "$(GUI)"=="UNX"
+
+
+.IF "$(GUI)"=="WNT"
+
+.IF "$(COM)"=="GCC"
+
+PATCH_FILES+=nss_3_12_3.patch.mingw
+
+moz_build:=$(shell cygpath -p $(MOZILLABUILD))
+PATH!:=$(moz_build)/bin:$(PATH)
+
+nss_CC=$(CC)
+nss_CXX=$(CXX)
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+nss_CC+=-shared-libgcc
+nss_CXX+=-shared-libgcc
+.ENDIF
+
+nss_LIBS=
+.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
+nss_LIBS+=-lstdc++_s
+.ENDIF
+
+
+BUILD_DIR=security$/nss
+BUILD_ACTION=NS_USE_GCC=1 CC="$(nss_CC)" CXX="$(nss_CXX)" OS_LIBS="$(nss_LIBS)" OS_TARGET=WIN95 _WIN32_IE=0x500 PATH=$(PATH) DEFINES=-D_WIN32_IE=0x500 $(GNUMAKE) nss_build_all
+
+OUT2LIB= \
+ dist$/out$/lib$/libnspr4.a \
+ dist$/out$/lib$/libnss3.a \
+ dist$/out$/lib$/libnssdbm3.a \
+ dist$/out$/lib$/libnssutil3.a \
+ dist$/out$/lib$/libplc4.a \
+ dist$/out$/lib$/libplds4.a \
+ dist$/out$/lib$/libsmime3.a \
+ dist$/out$/lib$/libsoftokn3.a \
+ dist$/out$/lib$/libsqlite3.a \
+ dist$/out$/lib$/libssl3.a
+
+.ELSE # "$(COM)"=="GCC"
+MOZ_MSVCVERSION= 9
+.EXPORT : MOZ_MSVCVERSION
+.IF "$(USE_SHELL)"=="4nt"
+PATH!:=$(MOZILLABUILD)/msys/bin;$(MOZILLABUILD)/moztools/bin;$(PATH)
+.ELSE # $(USE_SHELL)"=="4nt"
+moz_build:=$(shell cygpath -p $(MOZILLABUILD))
+PATH!:=$(moz_build)/msys/bin:$(moz_build)/moztools/bin:$(PATH)
+.ENDIF # $(USE_SHELL)"=="4nt"
+.EXPORT : PATH
+
+#Using WINNT will cause at least that nspr4.dll, plc4.dll, plds4.dll
+#become libnspr4.dll, libplc4.dll, libplds4.dll
+#WINNT causes the use of Microsoft fibers (specific to Windows NT and Windows 2000).
+#OS_TARGET= WINNT
+OS_TARGET=WIN95
+.EXPORT : OS_TARGET
+
+# make use of stlport headerfiles
+EXT_USE_STLPORT=TRUE
+
+#To build nss one has to call "make nss_build_all" in
+#mozilla/security/nss
+NSS_BUILD_DIR= $(subst,\,/ $(PWD)/$(MISC)/build/mozilla/security/nss)
+BUILD_ACTION= $(subst,/,$/ $(MOZILLABUILD)/msys/bin/bash) -i \
+ -c "cd $(NSS_BUILD_DIR) && make nss_build_all"
+
+OUT2LIB= \
+ dist$/out$/lib$/nspr4.lib \
+ dist$/out$/lib$/nss3.lib \
+ dist$/out$/lib$/nssdbm3.lib \
+ dist$/out$/lib$/nssutil3.lib \
+ dist$/out$/lib$/plc4.lib \
+ dist$/out$/lib$/plds4.lib \
+ dist$/out$/lib$/smime3.lib \
+ dist$/out$/lib$/softokn3.lib \
+ dist$/out$/lib$/sqlite3.lib \
+ dist$/out$/lib$/ssl3.lib
+
+.ENDIF # "$(COM)"=="GCC"
+
+OUT2BIN=dist$/out$/lib$/*$(DLLPOST)
+.ENDIF # "$(GUI)"=="WNT"
+
+
+OUTDIR2INC=dist$/public$/nss dist$/out$/include
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : set_ext.mk
+.INCLUDE : target.mk
+.INCLUDE : tg_ext.mk
+
+
diff --git a/nss/nss_3_12_3.patch b/nss/nss_3_12_3.patch
new file mode 100644
index 000000000000..de1ff8c41bc8
--- /dev/null
+++ b/nss/nss_3_12_3.patch
@@ -0,0 +1,131 @@
+--- misc/mozilla/nsprpub/config/rules.mk Tue Mar 24 23:49:17 2009
++++ misc/build/mozilla/nsprpub/config/rules.mk Mon Jun 29 15:45:22 2009
+@@ -363,7 +363,11 @@
+ ifdef NS_USE_GCC
+ $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
+ else
+- $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
++ #We remove stl from the paths to avoid that rc.exe finds the stlport of
++ #OOo. stlport includes the system stl which will fail. By removing it,
++ #rc will use the stl from the system if the path is in the INCLUDE
++ #variable.
++ INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
+ endif # GCC
+ @echo $(RES) finished
+ endif
+--- misc/mozilla/nsprpub/configure Fri Dec 5 01:46:50 2008
++++ misc/build/mozilla/nsprpub/configure Mon Jun 29 15:28:52 2009
+@@ -3905,7 +3905,7 @@
+ PR_MD_CSRCS=linux.c
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+ DSO_CFLAGS=-fPIC
+- DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
++ DSO_LDOPTS='-shared -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
+ _OPTIMIZE_FLAGS=-O2
+ _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
+ # combo is not yet good at debugging inlined
+--- misc/mozilla/security/coreconf/Darwin.mk Fri Mar 20 08:19:35 2009
++++ misc/build/mozilla/security/coreconf/Darwin.mk Mon Jun 29 15:28:52 2009
+@@ -38,9 +38,12 @@
+ include $(CORE_DEPTH)/coreconf/UNIX.mk
+
+ DEFAULT_COMPILER = cc
++# CC is taken from environment automatically.
++#CC = cc
++# Use CCC from environment.
++#CCC = c++
++CCC = $(CXX)
+
+-CC = cc
+-CCC = c++
+ RANLIB = ranlib
+
+ ifndef CPU_ARCH
+--- misc/mozilla/security/coreconf/Linux.mk Sat Sep 6 01:17:23 2008
++++ misc/build/mozilla/security/coreconf/Linux.mk Mon Jun 29 15:28:52 2009
+@@ -46,8 +46,11 @@
+ IMPL_STRATEGY = _PTH
+ endif
+
+-CC = gcc
+-CCC = g++
++# CC is taken from environment automatically.
++#CC = gcc
++# Use CCC from environment.
++#CCC = g++
++CCC = $(CXX)
+ RANLIB = ranlib
+
+ DEFAULT_COMPILER = gcc
+@@ -174,7 +177,7 @@
+ ARCH = linux
+
+ DSO_CFLAGS = -fPIC
+-DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,-z,defs
++DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,-z,defs '-Wl,-rpath,$$ORIGIN'
+ DSO_LDFLAGS =
+ LDFLAGS += $(ARCHFLAG)
+
+--- misc/mozilla/security/coreconf/SunOS5.mk Thu Nov 22 05:39:56 2007
++++ misc/build/mozilla/security/coreconf/SunOS5.mk Mon Jun 29 15:28:52 2009
+@@ -89,8 +89,11 @@
+ # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
+ endif
+ else
+- CC = cc
+- CCC = CC
++# CC is taken from environment automatically.
++# CC = cc
++# Use CXX from environment.
++# CCC = CC
++ CCC = $(CXX)
+ ASFLAGS += -Wa,-P
+ OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
+ ifndef BUILD_OPT
+--- misc/mozilla/security/coreconf/arch.mk Wed Mar 11 19:54:24 2009
++++ misc/build/mozilla/security/coreconf/arch.mk Mon Jun 29 15:28:52 2009
+@@ -329,8 +329,14 @@
+ # IMPL_STRATEGY may be defined too.
+ #
+
+-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
++# OBJDIR_NAME is used to build the directory containing the built objects, for
++# example mozilla/dist/Linux2.6_x86_glibc_PTH_DBG.OBJ
++# We need to deliver the contents of that folder into the solver. To make that easier
++# in the makefile we rename this directory to "out".
++#OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
++OBJDIR_NAME = out
+
++
+ ifeq (,$(filter-out WIN%,$(OS_TARGET)))
+ ifndef BUILD_OPT
+ #
+--- misc/mozilla/security/coreconf/rules.mk Wed Jan 21 00:30:57 2009
++++ misc/build/mozilla/security/coreconf/rules.mk Mon Jun 29 15:47:42 2009
+@@ -359,7 +359,11 @@
+ ifdef NS_USE_GCC
+ $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
+ else
+- $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
++ #We remove stl from the paths to avoid that rc.exe finds the stlport of
++ #OOo. stlport includes the system stl which will fail. By removing it,
++ #rc will use the stl from the system if the path is in the INCLUDE
++ #variable.
++ INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
+ endif
+ @echo $(RES) finished
+ endif
+--- misc/mozilla/security/nss/cmd/platlibs.mk Wed Dec 3 00:24:46 2008
++++ misc/build/mozilla/security/nss/cmd/platlibs.mk Mon Jun 29 15:28:52 2009
+@@ -52,9 +52,9 @@
+
+ ifeq ($(OS_ARCH), Linux)
+ ifeq ($(USE_64), 1)
+-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib64:$$ORIGIN/../lib'
++EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN:$$ORIGIN'
+ else
+-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib'
++EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN'
+ endif
+ endif
+
diff --git a/nss/nss_3_12_3.patch.mingw b/nss/nss_3_12_3.patch.mingw
new file mode 100644
index 000000000000..942b44c6997f
--- /dev/null
+++ b/nss/nss_3_12_3.patch.mingw
@@ -0,0 +1,166 @@
+--- misc/mozilla/nsprpub/config/autoconf.mk.in 2007-06-10 01:28:46.000000000 +0900
++++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2009-07-26 19:50:43.845875000 +0900
+@@ -22,6 +22,7 @@
+ RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
+ OBJDIR_NAME = @OBJDIR_NAME@
+ OBJDIR = @OBJDIR@
++LIB_PREFIX = @LIB_PREFIX@
+ OBJ_SUFFIX = @OBJ_SUFFIX@
+ LIB_SUFFIX = @LIB_SUFFIX@
+ DLL_SUFFIX = @DLL_SUFFIX@
+--- misc/mozilla/nsprpub/config/rules.mk 2009-03-25 07:49:17.000000000 +0900
++++ misc/build/mozilla/nsprpub/config/rules.mk 2009-07-26 19:50:44.002125000 +0900
+@@ -113,9 +113,9 @@
+ # other platforms do not.
+ #
+ ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
+-LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
++LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+ SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+-IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
++IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+ SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+ else
+ LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+--- misc/mozilla/nsprpub/configure 2008-12-05 09:46:50.000000000 +0900
++++ misc/build/mozilla/nsprpub/configure 2009-07-26 19:50:45.158375000 +0900
+@@ -2767,6 +2767,7 @@
+ LIB_SUFFIX=a
+ DLL_SUFFIX=so
+ ASM_SUFFIX=s
++LIB_PREFIX=lib
+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
+ PR_MD_ASFILES=
+ PR_MD_CSRCS=
+@@ -4005,6 +4006,7 @@
+ OBJ_SUFFIX=obj
+ LIB_SUFFIX=lib
+ DLL_SUFFIX=dll
++ LIB_PREFIX=
+
+ # Determine compiler version
+ CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
+@@ -6169,6 +6171,7 @@
+ s%@LIB_SUFFIX@%$LIB_SUFFIX%g
+ s%@DLL_SUFFIX@%$DLL_SUFFIX%g
+ s%@ASM_SUFFIX@%$ASM_SUFFIX%g
++s%@LIB_PREFIX@%$LIB_PREFIX%g
+ s%@MKSHLIB@%$MKSHLIB%g
+ s%@DSO_CFLAGS@%$DSO_CFLAGS%g
+ s%@DSO_LDOPTS@%$DSO_LDOPTS%g
+--- misc/mozilla/nsprpub/pr/src/Makefile.in 2008-06-08 05:25:59.000000000 +0900
++++ misc/build/mozilla/nsprpub/pr/src/Makefile.in 2009-07-26 20:57:15.324875000 +0900
+@@ -195,7 +195,7 @@
+
+ ifeq ($(OS_ARCH),WINNT)
+ ifdef NS_USE_GCC
+-OS_LIBS = -ladvapi32 -lwsock32 -lwinmm
++OS_LIBS += -ladvapi32 -lwsock32 -lwinmm
+ else
+ OS_LIBS = advapi32.lib wsock32.lib winmm.lib
+ endif
+--- misc/mozilla/security/coreconf/WIN32.mk 2009-04-01 09:49:48.000000000 +0900
++++ misc/build/mozilla/security/coreconf/WIN32.mk 2009-07-26 19:50:45.252125000 +0900
+@@ -43,8 +43,8 @@
+ DEFAULT_COMPILER = cl
+
+ ifdef NS_USE_GCC
+- CC = gcc
+- CCC = g++
++# CC = gcc
++ CCC = $(CXX)
+ LINK = ld
+ AR = ar
+ AR += cr $@
+--- misc/mozilla/security/coreconf/WIN95.mk 2009-02-14 14:51:10.000000000 +0900
++++ misc/build/mozilla/security/coreconf/WIN95.mk 2009-07-26 19:50:45.377125000 +0900
+@@ -44,4 +44,8 @@
+ DEFINES += -DWIN95
+
+ # WINNT uses the lib prefix, Win95 and WinCE don't
+-NSPR31_LIB_PREFIX = $(NULL)
++ifdef NS_USE_GCC
++ NSPR31_LIB_PREFIX = lib
++else
++ NSPR31_LIB_PREFIX = $(NULL)
++endif
+--- misc/mozilla/security/coreconf/rules.mk 2009-01-21 08:30:57.000000000 +0900
++++ misc/build/mozilla/security/coreconf/rules.mk 2009-07-26 19:50:45.689625000 +0900
+@@ -281,8 +281,12 @@
+ fi
+ endif # MSVC with manifest tool
+ else
++ifeq (,$(filter-out WIN%,$(OS_TARGET)))
++ $(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) -Wl,--start-group $(EXTRA_LIBS) -Wl,--end-group $(EXTRA_SHARED_LIBS) $(OS_LIBS)
++else
+ $(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
+ endif
++endif
+
+ get_objs:
+ @echo $(OBJS)
+--- misc/mozilla/security/nss/Makefile 2008-12-03 08:24:39.000000000 +0900
++++ misc/build/mozilla/security/nss/Makefile 2009-07-26 19:50:45.845875000 +0900
+@@ -108,7 +108,7 @@
+ NSPR_CONFIGURE_OPTS += --enable-debug-rtl
+ endif
+ ifdef NS_USE_GCC
+-NSPR_COMPILERS = CC=gcc CXX=g++
++NSPR_COMPILERS = CC="$(CC)" CXX="$(CXX)"
+ endif
+
+ #
+--- misc/mozilla/security/nss/cmd/crmftest/Makefile 2005-11-14 09:17:21.000000000 +0900
++++ misc/build/mozilla/security/nss/cmd/crmftest/Makefile 2009-07-26 19:50:45.970875000 +0900
+@@ -90,7 +90,7 @@
+ LDDIST = $(DIST)/lib
+
+ ifeq (,$(filter-out WIN%,$(OS_TARGET)))
+-EXTRA_LIBS += $(LDDIST)/sectool.lib
++EXTRA_LIBS += $(LDDIST)/$(LIB_PREFIX)sectool.$(LIB_SUFFIX)
+ endif
+
+ include ../platrules.mk
+--- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2008-11-21 00:44:11.000000000 +0900
++++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-07-26 22:58:48.687625000 +0900
+@@ -112,10 +112,16 @@
+ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
+ else
++ifeq ($(OS_TARGET), WIN95)
++ sh ./sign.sh $(shell cygpath -m -a $(DIST)) \
++ $(shell cygpath -m -a $(OBJDIR)) $(OS_TARGET) \
++ $(shell cygpath -m -a $(NSPR_LIB_DIR)) $(shell cygpath -m -a $<)
++else
+ cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
+ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
+ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
+ endif
++endif
+
+ libs install :: $(CHECKLOC)
+
+--- misc/mozilla/security/nss/lib/freebl/config.mk 2009-02-03 06:57:23.000000000 +0900
++++ misc/build/mozilla/security/nss/lib/freebl/config.mk 2009-07-26 19:50:46.127125000 +0900
+@@ -84,10 +84,6 @@
+ RES = $(OBJDIR)/$(LIBRARY_NAME).res
+ RESNAME = freebl.rc
+
+-ifndef WINCE
+-OS_LIBS += shell32.lib
+-endif
+-
+ ifdef NS_USE_GCC
+ EXTRA_SHARED_LIBS += \
+ -L$(DIST)/lib \
+@@ -96,6 +92,10 @@
+ -lnspr4 \
+ $(NULL)
+ else # ! NS_USE_GCC
++ifndef WINCE
++OS_LIBS += shell32.lib
++endif
++
+ EXTRA_SHARED_LIBS += \
+ $(DIST)/lib/nssutil3.lib \
+ $(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)nspr4.lib \
diff --git a/nss/prj/build.lst b/nss/prj/build.lst
new file mode 100644
index 000000000000..1465b16be200
--- /dev/null
+++ b/nss/prj/build.lst
@@ -0,0 +1,3 @@
+ns nss : solenv stlport NULL
+ns nss nmake - usr1 ns_mkout NULL
+ns nss nmake - all ns_nss NULL
diff --git a/nss/prj/d.lst b/nss/prj/d.lst
new file mode 100644
index 000000000000..891eb7739b1c
--- /dev/null
+++ b/nss/prj/d.lst
@@ -0,0 +1,10 @@
+mkdir: %_DEST%\inc%_EXT%\mozilla\nspr
+mkdir: %_DEST%\inc%_EXT%\mozilla\nspr\obsolete
+mkdir: %_DEST%\inc%_EXT%\mozilla\nss
+
+..\%__SRC%\inc\include\* %_DEST%\inc%_EXT%\mozilla\nspr
+..\%__SRC%\inc\include\obsolete\protypes.h %_DEST%\inc%_EXT%\mozilla\nspr\obsolete\protypes.h
+..\%__SRC%\inc\nss\*.h %_DEST%\inc%_EXT%\mozilla\nss
+..\%__SRC%\lib\* %_DEST%\lib%_EXT%
+..\%__SRC%\bin\* %_DEST%\bin%_EXT%
+
diff --git a/nss/readme.txt b/nss/readme.txt
new file mode 100644
index 000000000000..de23a264c179
--- /dev/null
+++ b/nss/readme.txt
@@ -0,0 +1,56 @@
+Relation between nss, moz, moz_prebuilt
+---------------------------------------
+nss containes the security libraries which are also part of moz. However nss is
+meant to be more current, that is it to be updated more often. This should be
+easier than doing this with moz.
+
+If nss is build depends on an environment variable (ENABLE_NSS_MODULE=YES) which
+is per default set to YES. In this case nss is build before moz. The nss
+libraries/lib files/headers built in moz are then not delivered. Otherwise they
+would overwrite those from nss. That is, the nss libraries build in moz are
+removed from mozruntime.zip (build in moz/solver/bin), they are removed from the
+lib directory (for example moz/unxlngi6.pro/lib), and the nss and nspr headers
+are also removed (inc/nss and inc/nspr). The nss libraries from the nss module
+are then added to mozruntime.zip.
+
+This also applies for moz_prebuilt. Therefore moz and moz_prebuilt must be build
+again after changes have been made to the libraries in the nss module.
+
+Also when moz was updated to use a newer version of mozilla, then one must make
+sure that new files which also belong to nss are not delivered and are removed
+from mozruntime.zip.
+
+Fips 140 and signed libraries
+-------------------------------
+Fips 140 mode is not supported. That is, the *.chk files containing the
+checksums for the cryptographic module are not delivered into solver and will
+not be part of the OOo installation sets.
+
+The *chk files do not match the libraries because we change the rpatch.
+
+libfreebl3
+----------
+Porting to other platforms may require to deliver other variants of
+libfreebl*. The library name varies according to the platform. Changes need to
+be made to
+ooo/moz/extractfiles.mk
+ooo/moz/zipped/makefile.mk
+sun/moz_prebuilt/zipped/makefile.mk
+
+
+See also
+http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html
+
+
+Windows builds of nss
+---------------------
+To build mozilla on windows you'll need the mozilla build tools
+
+Build requirements containing the link to the build tools:
+https://developer.mozilla.org/en/Windows_Build_Prerequisites#ss2.2
+
+The direct link:
+
+http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.3.exe
+
+
diff --git a/python/Python-2.6.1-mingw.patch b/python/Python-2.6.1-mingw.patch
index 63067227c112..26bc4cbd0648 100644
--- a/python/Python-2.6.1-mingw.patch
+++ b/python/Python-2.6.1-mingw.patch
@@ -1,6 +1,6 @@
--- misc/Python-2.6.1/Include/pyport.h 2008-06-11 16:41:16.000000000 +0900
+++ misc/build/Python-2.6.1/Include/pyport.h 2009-03-29 23:28:13.859000000 +0900
-@@ -3,6 +3,26 @@
+@@ -3,6 +3,30 @@
#include "pyconfig.h" /* include for defines */
@@ -9,6 +9,7 @@
+#undef HAVE_OPENPTY
+#undef HAVE_DEV_PTMX
+#undef _POSIX_THREADS
++#undef HAVE_PTHREAD_H
+#define MS_WINDOWS
+#define MS_WIN32
+#define Py_WIN_WIDE_FILENAMES
@@ -18,6 +19,9 @@
+#define NT_THREADS
+#define WITH_THREAD
+#define WINVER 0x0501
++#ifdef socklen_t
++#undef socklen_t
++#endif
+#define HAVE_ADDRINFO
+#define HAVE_GETADDRINFO
+#define HAVE_GETNAMEINFO
diff --git a/python/makefile.mk b/python/makefile.mk
index a84fccb6c9fc..663a5604603d 100644
--- a/python/makefile.mk
+++ b/python/makefile.mk
@@ -95,6 +95,9 @@ BUILD_DIR=
MYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
python_CFLAGS=-mno-cygwin -mthreads
python_LDFLAGS=-mno-cygwin -mthreads
+.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
+python_LDFLAGS+=-shared-libgcc
+.ENDIF
CONFIGURE_ACTION=./configure --prefix=$(MYCWD)/python-inst --enable-shared CC="$(CC:s/guw.exe //)" CXX="$(CXX:s/guw.exe //)" MACHDEP=MINGW32 LN="cp -p" CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
BUILD_ACTION=$(ENV_BUILD) make ; make install
.ELSE
diff --git a/zlib/makefile.mk b/zlib/makefile.mk
index 9b0aafba4e61..c7e1ae8a7b50 100644
--- a/zlib/makefile.mk
+++ b/zlib/makefile.mk
@@ -61,7 +61,8 @@ BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
OUT2INC= \
zlib.h \
zconf.h \
- contrib$/minizip$/unzip.h
+ contrib$/minizip$/unzip.h \
+ contrib$/minizip$/ioapi.h
PATCHED_HEADERS=$(INCCOM)$/patched$/zlib.h
diff --git a/zlib/prj/d.lst b/zlib/prj/d.lst
index d0c944d3a133..b6433510d6c8 100644
--- a/zlib/prj/d.lst
+++ b/zlib/prj/d.lst
@@ -3,6 +3,7 @@ mkdir: %_DEST%\lib%_EXT%\x64
..\%__SRC%\inc\patched\zlib.h %_DEST%\inc%_EXT%\external\zlib\zlib.h
..\%__SRC%\inc\unzip.h %_DEST%\inc%_EXT%\external\zlib\unzip.h
+..\%__SRC%\inc\ioapi.h %_DEST%\inc%_EXT%\external\zlib\ioapi.h
..\%__SRC%\inc\zconf.h %_DEST%\inc%_EXT%\external\zlib\zconf.h
..\%__SRC%\lib\libzlib.a %_DEST%\lib%_EXT%\libzlib.a
diff --git a/zlib/zlib-1.1.4.patch b/zlib/zlib-1.1.4.patch
index 694cd13414b8..34f2fdde44ee 100644
--- a/zlib/zlib-1.1.4.patch
+++ b/zlib/zlib-1.1.4.patch
@@ -1,17 +1,6 @@
---- misc/zlib-1.1.4/contrib/minizip/unzip.h Thu Mar 19 00:15:00 1998
-+++ misc/build/zlib-1.1.4/contrib/minizip/unzip.h Fri Mar 14 10:15:45 2008
-@@ -46,7 +46,7 @@
- #endif
-
- #ifndef _ZLIB_H
--#include "zlib.h"
-+#include "zlib/zlib.h"
- #endif
-
- #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
--- misc/zlib-1.1.4/makefile.mk Fri Mar 14 10:17:06 2008
+++ misc/build/zlib-1.1.4/makefile.mk Fri Mar 14 10:16:56 2008
-@@ -1 +1,77 @@
+@@ -1 +1,79 @@
-dummy
+#*************************************************************************
+#
@@ -52,7 +41,8 @@
+ $(SLO)$/infutil.obj \
+ $(SLO)$/trees.obj \
+ $(SLO)$/zutil.obj \
-+ $(SLO)$/unzip.obj
++ $(SLO)$/unzip.obj \
++ $(SLO)$/ioapi.obj
+
+
+LIB1TARGET=$(SLB)$/$(TARGET).lib
@@ -72,7 +62,8 @@
+ $(SLO_X64)$/infutil.obj \
+ $(SLO_X64)$/trees.obj \
+ $(SLO_X64)$/zutil.obj \
-+ $(SLO_X64)$/unzip.obj
++ $(SLO_X64)$/unzip.obj \
++ $(SLO)$/ioapi.obj
+
+LIB1TARGET_X64=$(SLB_X64)$/$(TARGET).lib
+LIB1OBJFILES_X64=$(SLOFILES_X64)
@@ -174,4 +165,3086 @@
+#endif
#include "zutil.h"
- struct internal_state {int dummy;}; /* for buggy compilers */
+ struct internal_state {int dummy;}; /* for buggy compilers */
+--- misc/zlib-1.1.4/contrib/minizip/unzip.c 1998-06-15 17:34:20.000000000 +0200
++++ misc/build/zlib-1.1.4/contrib/minizip/unzip.c 2009-07-17 10:15:05.156250000 +0200
+@@ -1,9 +1,39 @@
+-/* unzip.c -- IO on .zip files using zlib
+- Version 0.15 beta, Mar 19th, 1998,
++/* unzip.c -- IO for uncompress .zip files using zlib
++ Version 1.01e, February 12th, 2005
++
++ Copyright (C) 1998-2005 Gilles Vollant
+
+ Read unzip.h for more info
+ */
+
++/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
++compatibility with older software. The following is from the original crypt.c. Code
++woven in by Terry Thorsen 1/2003.
++*/
++/*
++ Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
++
++ See the accompanying file LICENSE, version 2000-Apr-09 or later
++ (the contents of which are also included in zip.h) for terms of use.
++ If, for some reason, all these files are missing, the Info-ZIP license
++ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
++*/
++/*
++ crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
++
++ The encryption/decryption parts of this source code (as opposed to the
++ non-echoing password parts) were originally written in Europe. The
++ whole source package can be freely distributed, including from the USA.
++ (Prior to January 2000, re-export from the US was a violation of US law.)
++ */
++
++/*
++ This encryption code is a direct transcription of the algorithm from
++ Roger Schlafly, described by Phil Katz in the file appnote.txt. This
++ file (appnote.txt) is distributed with the PKZIP program (even in the
++ version without encryption capabilities).
++ */
++
+
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -29,10 +59,10 @@
+ /* compile with -Dlocal if your debugger can't find static symbols */
+
+
+-
+-#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
+- !defined(CASESENSITIVITYDEFAULT_NO)
+-#define CASESENSITIVITYDEFAULT_NO
++#ifndef CASESENSITIVITYDEFAULT_NO
++# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
++# define CASESENSITIVITYDEFAULT_NO
++# endif
+ #endif
+
+
+@@ -55,22 +85,10 @@
+ #define SIZEZIPLOCALHEADER (0x1e)
+
+
+-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+-
+-#ifndef SEEK_CUR
+-#define SEEK_CUR 1
+-#endif
+-
+-#ifndef SEEK_END
+-#define SEEK_END 2
+-#endif
+
+-#ifndef SEEK_SET
+-#define SEEK_SET 0
+-#endif
+
+ const char unz_copyright[] =
+- " unzip 0.15 Copyright 1998 Gilles Vollant ";
++ " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
+
+ /* unz_file_info_interntal contain internal info about a file in zipfile*/
+ typedef struct unz_file_info_internal_s
+@@ -83,23 +101,25 @@
+ when reading and decompress it */
+ typedef struct
+ {
+- char *read_buffer; /* internal buffer for compressed data */
+- z_stream stream; /* zLib stream structure for inflate */
++ char *read_buffer; /* internal buffer for compressed data */
++ z_stream stream; /* zLib stream structure for inflate */
+
+- uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
+- uLong stream_initialised; /* flag set if stream structure is initialised*/
++ uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
++ uLong stream_initialised; /* flag set if stream structure is initialised*/
+
+- uLong offset_local_extrafield;/* offset of the local extra field */
+- uInt size_local_extrafield;/* size of the local extra field */
+- uLong pos_local_extrafield; /* position in the local extra field in read*/
+-
+- uLong crc32; /* crc32 of all data uncompressed */
+- uLong crc32_wait; /* crc32 we must obtain after decompress all */
+- uLong rest_read_compressed; /* number of byte to be decompressed */
+- uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
+- FILE* file; /* io structore of the zipfile */
+- uLong compression_method; /* compression method (0==store) */
+- uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
++ uLong offset_local_extrafield;/* offset of the local extra field */
++ uInt size_local_extrafield;/* size of the local extra field */
++ uLong pos_local_extrafield; /* position in the local extra field in read*/
++
++ uLong crc32; /* crc32 of all data uncompressed */
++ uLong crc32_wait; /* crc32 we must obtain after decompress all */
++ uLong rest_read_compressed; /* number of byte to be decompressed */
++ uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
++ zlib_filefunc_def z_filefunc;
++ voidpf filestream; /* io structore of the zipfile */
++ uLong compression_method; /* compression method (0==store) */
++ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
++ int raw;
+ } file_in_zip_read_info_s;
+
+
+@@ -107,25 +127,35 @@
+ */
+ typedef struct
+ {
+- FILE* file; /* io structore of the zipfile */
+- unz_global_info gi; /* public global information */
+- uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+- uLong num_file; /* number of the current file in the zipfile*/
+- uLong pos_in_central_dir; /* pos of the current file in the central dir*/
+- uLong current_file_ok; /* flag about the usability of the current file*/
+- uLong central_pos; /* position of the beginning of the central dir*/
+-
+- uLong size_central_dir; /* size of the central directory */
+- uLong offset_central_dir; /* offset of start of central directory with
+- respect to the starting disk number */
++ zlib_filefunc_def z_filefunc;
++ voidpf filestream; /* io structore of the zipfile */
++ unz_global_info gi; /* public global information */
++ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
++ uLong num_file; /* number of the current file in the zipfile*/
++ uLong pos_in_central_dir; /* pos of the current file in the central dir*/
++ uLong current_file_ok; /* flag about the usability of the current file*/
++ uLong central_pos; /* position of the beginning of the central dir*/
++
++ uLong size_central_dir; /* size of the central directory */
++ uLong offset_central_dir; /* offset of start of central directory with
++ respect to the starting disk number */
+
+- unz_file_info cur_file_info; /* public info about the current file in zip*/
+- unz_file_info_internal cur_file_info_internal; /* private info about it*/
++ unz_file_info cur_file_info; /* public info about the current file in zip*/
++ unz_file_info_internal cur_file_info_internal; /* private info about it*/
+ file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
+- file if we are decompressing it */
++ file if we are decompressing it */
++ int encrypted;
++# ifndef NOUNCRYPT
++ unsigned long keys[3]; /* keys defining the pseudo-random sequence */
++ const unsigned long* pcrc_32_tab;
++# endif
+ } unz_s;
+
+
++#ifndef NOUNCRYPT
++#include "crypt.h"
++#endif
++
+ /* ===========================================================================
+ Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+ for end of file.
+@@ -133,12 +163,18 @@
+ */
+
+
+-local int unzlocal_getByte(fin,pi)
+- FILE *fin;
+- int *pi;
++local int unzlocal_getByte OF((
++ const zlib_filefunc_def* pzlib_filefunc_def,
++ voidpf filestream,
++ int *pi));
++
++local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
++ const zlib_filefunc_def* pzlib_filefunc_def;
++ voidpf filestream;
++ int *pi;
+ {
+ unsigned char c;
+- int err = fread(&c, 1, 1, fin);
++ int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
+ if (err==1)
+ {
+ *pi = (int)c;
+@@ -146,7 +182,7 @@
+ }
+ else
+ {
+- if (ferror(fin))
++ if (ZERROR(*pzlib_filefunc_def,filestream))
+ return UNZ_ERRNO;
+ else
+ return UNZ_EOF;
+@@ -155,23 +191,29 @@
+
+
+ /* ===========================================================================
+- Reads a long in LSB order from the given gz_stream. Sets
++ Reads a long in LSB order from the given gz_stream. Sets
+ */
+-local int unzlocal_getShort (fin,pX)
+- FILE* fin;
++local int unzlocal_getShort OF((
++ const zlib_filefunc_def* pzlib_filefunc_def,
++ voidpf filestream,
++ uLong *pX));
++
++local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
++ const zlib_filefunc_def* pzlib_filefunc_def;
++ voidpf filestream;
+ uLong *pX;
+ {
+ uLong x ;
+ int i;
+ int err;
+
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+-
++
+ if (err==UNZ_OK)
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+-
++
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+@@ -179,29 +221,35 @@
+ return err;
+ }
+
+-local int unzlocal_getLong (fin,pX)
+- FILE* fin;
++local int unzlocal_getLong OF((
++ const zlib_filefunc_def* pzlib_filefunc_def,
++ voidpf filestream,
++ uLong *pX));
++
++local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
++ const zlib_filefunc_def* pzlib_filefunc_def;
++ voidpf filestream;
+ uLong *pX;
+ {
+ uLong x ;
+ int i;
+ int err;
+
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x = (uLong)i;
+-
++
+ if (err==UNZ_OK)
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==UNZ_OK)
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<16;
+
+ if (err==UNZ_OK)
+- err = unzlocal_getByte(fin,&i);
++ err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
+ x += ((uLong)i)<<24;
+-
++
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+@@ -212,26 +260,26 @@
+
+ /* My own strcmpi / strcasecmp */
+ local int strcmpcasenosensitive_internal (fileName1,fileName2)
+- const char* fileName1;
+- const char* fileName2;
++ const char* fileName1;
++ const char* fileName2;
+ {
+- for (;;)
+- {
+- char c1=*(fileName1++);
+- char c2=*(fileName2++);
+- if ((c1>='a') && (c1<='z'))
+- c1 -= 0x20;
+- if ((c2>='a') && (c2<='z'))
+- c2 -= 0x20;
+- if (c1=='\0')
+- return ((c2=='\0') ? 0 : -1);
+- if (c2=='\0')
+- return 1;
+- if (c1<c2)
+- return -1;
+- if (c1>c2)
+- return 1;
+- }
++ for (;;)
++ {
++ char c1=*(fileName1++);
++ char c2=*(fileName2++);
++ if ((c1>='a') && (c1<='z'))
++ c1 -= 0x20;
++ if ((c2>='a') && (c2<='z'))
++ c2 -= 0x20;
++ if (c1=='\0')
++ return ((c2=='\0') ? 0 : -1);
++ if (c2=='\0')
++ return 1;
++ if (c1<c2)
++ return -1;
++ if (c1>c2)
++ return 1;
++ }
+ }
+
+
+@@ -245,7 +293,7 @@
+ #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
+ #endif
+
+-/*
++/*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+@@ -255,203 +303,225 @@
+
+ */
+ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
+- const char* fileName1;
+- const char* fileName2;
+- int iCaseSensitivity;
++ const char* fileName1;
++ const char* fileName2;
++ int iCaseSensitivity;
+ {
+- if (iCaseSensitivity==0)
+- iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
++ if (iCaseSensitivity==0)
++ iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
+
+- if (iCaseSensitivity==1)
+- return strcmp(fileName1,fileName2);
++ if (iCaseSensitivity==1)
++ return strcmp(fileName1,fileName2);
+
+- return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
+-}
++ return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
++}
+
++#ifndef BUFREADCOMMENT
+ #define BUFREADCOMMENT (0x400)
++#endif
+
+ /*
+ Locate the Central directory of a zipfile (at the end, just before
+ the global comment)
+ */
+-local uLong unzlocal_SearchCentralDir(fin)
+- FILE *fin;
++local uLong unzlocal_SearchCentralDir OF((
++ const zlib_filefunc_def* pzlib_filefunc_def,
++ voidpf filestream));
++
++local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
++ const zlib_filefunc_def* pzlib_filefunc_def;
++ voidpf filestream;
+ {
+- unsigned char* buf;
+- uLong uSizeFile;
+- uLong uBackRead;
+- uLong uMaxBack=0xffff; /* maximum size of global comment */
+- uLong uPosFound=0;
+-
+- if (fseek(fin,0,SEEK_END) != 0)
+- return 0;
+-
+-
+- uSizeFile = ftell( fin );
+-
+- if (uMaxBack>uSizeFile)
+- uMaxBack = uSizeFile;
+-
+- buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+- if (buf==NULL)
+- return 0;
+-
+- uBackRead = 4;
+- while (uBackRead<uMaxBack)
+- {
+- uLong uReadSize,uReadPos ;
+- int i;
+- if (uBackRead+BUFREADCOMMENT>uMaxBack)
+- uBackRead = uMaxBack;
+- else
+- uBackRead+=BUFREADCOMMENT;
+- uReadPos = uSizeFile-uBackRead ;
+-
+- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
++ unsigned char* buf;
++ uLong uSizeFile;
++ uLong uBackRead;
++ uLong uMaxBack=0xffff; /* maximum size of global comment */
++ uLong uPosFound=0;
++
++ if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
++ return 0;
++
++
++ uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
++
++ if (uMaxBack>uSizeFile)
++ uMaxBack = uSizeFile;
++
++ buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
++ if (buf==NULL)
++ return 0;
++
++ uBackRead = 4;
++ while (uBackRead<uMaxBack)
++ {
++ uLong uReadSize,uReadPos ;
++ int i;
++ if (uBackRead+BUFREADCOMMENT>uMaxBack)
++ uBackRead = uMaxBack;
++ else
++ uBackRead+=BUFREADCOMMENT;
++ uReadPos = uSizeFile-uBackRead ;
++
++ uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+ (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
+- if (fseek(fin,uReadPos,SEEK_SET)!=0)
+- break;
++ if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
++ break;
+
+- if (fread(buf,(uInt)uReadSize,1,fin)!=1)
+- break;
++ if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
++ break;
+
+- for (i=(int)uReadSize-3; (i--)>0;)
+- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+- ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+- {
+- uPosFound = uReadPos+i;
+- break;
+- }
+-
+- if (uPosFound!=0)
+- break;
+- }
+- TRYFREE(buf);
+- return uPosFound;
++ for (i=(int)uReadSize-3; (i--)>0;)
++ if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
++ ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
++ {
++ uPosFound = uReadPos+i;
++ break;
++ }
++
++ if (uPosFound!=0)
++ break;
++ }
++ TRYFREE(buf);
++ return uPosFound;
+ }
+
+ /*
+ Open a Zip file. path contain the full pathname (by example,
+- on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer
+- "zlib/zlib109.zip".
+- If the zipfile cannot be opened (file don't exist or in not valid), the
+- return value is NULL.
++ on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
++ "zlib/zlib114.zip".
++ If the zipfile cannot be opened (file doesn't exist or in not valid), the
++ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+- of this unzip package.
++ of this unzip package.
+ */
+-extern unzFile ZEXPORT unzOpen (path)
+- const char *path;
+-{
+- unz_s us;
+- unz_s *s;
+- uLong central_pos,uL;
+- FILE * fin ;
+-
+- uLong number_disk; /* number of the current dist, used for
+- spaning ZIP, unsupported, always 0*/
+- uLong number_disk_with_CD; /* number the the disk with central dir, used
+- for spaning ZIP, unsupported, always 0*/
+- uLong number_entry_CD; /* total number of entries in
+- the central dir
+- (same than number_entry on nospan) */
++extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
++ const char *path;
++ zlib_filefunc_def* pzlib_filefunc_def;
++{
++ unz_s us;
++ unz_s *s;
++ uLong central_pos,uL;
++
++ uLong number_disk; /* number of the current dist, used for
++ spaning ZIP, unsupported, always 0*/
++ uLong number_disk_with_CD; /* number the the disk with central dir, used
++ for spaning ZIP, unsupported, always 0*/
++ uLong number_entry_CD; /* total number of entries in
++ the central dir
++ (same than number_entry on nospan) */
+
+- int err=UNZ_OK;
++ int err=UNZ_OK;
+
+ if (unz_copyright[0]!=' ')
+ return NULL;
+
+- fin=fopen(path,"rb");
+- if (fin==NULL)
+- return NULL;
+-
+- central_pos = unzlocal_SearchCentralDir(fin);
+- if (central_pos==0)
+- err=UNZ_ERRNO;
+-
+- if (fseek(fin,central_pos,SEEK_SET)!=0)
+- err=UNZ_ERRNO;
+-
+- /* the signature, already checked */
+- if (unzlocal_getLong(fin,&uL)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* number of this disk */
+- if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* number of the disk with the start of the central directory */
+- if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* total number of entries in the central dir on this disk */
+- if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* total number of entries in the central dir */
+- if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if ((number_entry_CD!=us.gi.number_entry) ||
+- (number_disk_with_CD!=0) ||
+- (number_disk!=0))
+- err=UNZ_BADZIPFILE;
+-
+- /* size of the central directory */
+- if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* offset of start of central directory with respect to the
+- starting disk number */
+- if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- /* zipfile comment length */
+- if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
+- (err==UNZ_OK))
+- err=UNZ_BADZIPFILE;
+-
+- if (err!=UNZ_OK)
+- {
+- fclose(fin);
+- return NULL;
+- }
+-
+- us.file=fin;
+- us.byte_before_the_zipfile = central_pos -
+- (us.offset_central_dir+us.size_central_dir);
+- us.central_pos = central_pos;
++ if (pzlib_filefunc_def==NULL)
++ fill_fopen_filefunc(&us.z_filefunc);
++ else
++ us.z_filefunc = *pzlib_filefunc_def;
++
++ us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
++ path,
++ ZLIB_FILEFUNC_MODE_READ |
++ ZLIB_FILEFUNC_MODE_EXISTING);
++ if (us.filestream==NULL)
++ return NULL;
++
++ central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream);
++ if (central_pos==0)
++ err=UNZ_ERRNO;
++
++ if (ZSEEK(us.z_filefunc, us.filestream,
++ central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
++ err=UNZ_ERRNO;
++
++ /* the signature, already checked */
++ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* number of this disk */
++ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* number of the disk with the start of the central directory */
++ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* total number of entries in the central dir on this disk */
++ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* total number of entries in the central dir */
++ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if ((number_entry_CD!=us.gi.number_entry) ||
++ (number_disk_with_CD!=0) ||
++ (number_disk!=0))
++ err=UNZ_BADZIPFILE;
++
++ /* size of the central directory */
++ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* offset of start of central directory with respect to the
++ starting disk number */
++ if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ /* zipfile comment length */
++ if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
++ (err==UNZ_OK))
++ err=UNZ_BADZIPFILE;
++
++ if (err!=UNZ_OK)
++ {
++ ZCLOSE(us.z_filefunc, us.filestream);
++ return NULL;
++ }
++
++ us.byte_before_the_zipfile = central_pos -
++ (us.offset_central_dir+us.size_central_dir);
++ us.central_pos = central_pos;
+ us.pfile_in_zip_read = NULL;
+-
++ us.encrypted = 0;
+
+- s=(unz_s*)ALLOC(sizeof(unz_s));
+- *s=us;
+- unzGoToFirstFile((unzFile)s);
+- return (unzFile)s;
++
++ s=(unz_s*)ALLOC(sizeof(unz_s));
++ *s=us;
++ unzGoToFirstFile((unzFile)s);
++ return (unzFile)s;
+ }
+
+
++extern unzFile ZEXPORT unzOpen (path)
++ const char *path;
++{
++ return unzOpen2(path, NULL);
++}
++
+ /*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+ extern int ZEXPORT unzClose (file)
+- unzFile file;
++ unzFile file;
+ {
+- unz_s* s;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unz_s* s;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+
+ if (s->pfile_in_zip_read!=NULL)
+ unzCloseCurrentFile(file);
+
+- fclose(s->file);
+- TRYFREE(s);
+- return UNZ_OK;
++ ZCLOSE(s->z_filefunc, s->filestream);
++ TRYFREE(s);
++ return UNZ_OK;
+ }
+
+
+@@ -460,15 +530,15 @@
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
+- unzFile file;
+- unz_global_info *pglobal_info;
++ unzFile file;
++ unz_global_info *pglobal_info;
+ {
+- unz_s* s;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+- *pglobal_info=s->gi;
+- return UNZ_OK;
++ unz_s* s;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ *pglobal_info=s->gi;
++ return UNZ_OK;
+ }
+
+
+@@ -495,14 +565,14 @@
+ */
+ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
+ unz_file_info *pfile_info,
+- unz_file_info_internal
++ unz_file_info_internal
+ *pfile_info_internal,
+ char *szFileName,
+- uLong fileNameBufferSize,
++ uLong fileNameBufferSize,
+ void *extraField,
+- uLong extraFieldBufferSize,
++ uLong extraFieldBufferSize,
+ char *szComment,
+- uLong commentBufferSize));
++ uLong commentBufferSize));
+
+ local int unzlocal_GetCurrentFileInfoInternal (file,
+ pfile_info,
+@@ -510,156 +580,158 @@
+ szFileName, fileNameBufferSize,
+ extraField, extraFieldBufferSize,
+ szComment, commentBufferSize)
+- unzFile file;
+- unz_file_info *pfile_info;
+- unz_file_info_internal *pfile_info_internal;
+- char *szFileName;
+- uLong fileNameBufferSize;
+- void *extraField;
+- uLong extraFieldBufferSize;
+- char *szComment;
+- uLong commentBufferSize;
+-{
+- unz_s* s;
+- unz_file_info file_info;
+- unz_file_info_internal file_info_internal;
+- int err=UNZ_OK;
+- uLong uMagic;
+- long lSeek=0;
+-
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+- if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0)
+- err=UNZ_ERRNO;
+-
+-
+- /* we check the magic */
+- if (err==UNZ_OK)
+- if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+- err=UNZ_ERRNO;
+- else if (uMagic!=0x02014b50)
+- err=UNZ_BADZIPFILE;
+-
+- if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK)
+- err=UNZ_ERRNO;
++ unzFile file;
++ unz_file_info *pfile_info;
++ unz_file_info_internal *pfile_info_internal;
++ char *szFileName;
++ uLong fileNameBufferSize;
++ void *extraField;
++ uLong extraFieldBufferSize;
++ char *szComment;
++ uLong commentBufferSize;
++{
++ unz_s* s;
++ unz_file_info file_info;
++ unz_file_info_internal file_info_internal;
++ int err=UNZ_OK;
++ uLong uMagic;
++ long lSeek=0;
++
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ if (ZSEEK(s->z_filefunc, s->filestream,
++ s->pos_in_central_dir+s->byte_before_the_zipfile,
++ ZLIB_FILEFUNC_SEEK_SET)!=0)
++ err=UNZ_ERRNO;
++
++
++ /* we check the magic */
++ if (err==UNZ_OK)
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
++ err=UNZ_ERRNO;
++ else if (uMagic!=0x02014b50)
++ err=UNZ_BADZIPFILE;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
++ err=UNZ_ERRNO;
+
+- if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK)
+- err=UNZ_ERRNO;
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
++ err=UNZ_ERRNO;
+
+- if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK)
+- err=UNZ_ERRNO;
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
++ err=UNZ_ERRNO;
+
+- if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK)
+- err=UNZ_ERRNO;
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
++ err=UNZ_ERRNO;
+
+ unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
+
+- if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK)
+- err=UNZ_ERRNO;
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ lSeek+=file_info.size_filename;
++ if ((err==UNZ_OK) && (szFileName!=NULL))
++ {
++ uLong uSizeRead ;
++ if (file_info.size_filename<fileNameBufferSize)
++ {
++ *(szFileName+file_info.size_filename)='\0';
++ uSizeRead = file_info.size_filename;
++ }
++ else
++ uSizeRead = fileNameBufferSize;
++
++ if ((file_info.size_filename>0) && (fileNameBufferSize>0))
++ if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
++ err=UNZ_ERRNO;
++ lSeek -= uSizeRead;
++ }
++
++
++ if ((err==UNZ_OK) && (extraField!=NULL))
++ {
++ uLong uSizeRead ;
++ if (file_info.size_file_extra<extraFieldBufferSize)
++ uSizeRead = file_info.size_file_extra;
++ else
++ uSizeRead = extraFieldBufferSize;
++
++ if (lSeek!=0)
++ if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
++ lSeek=0;
++ else
++ err=UNZ_ERRNO;
++ if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
++ if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
++ err=UNZ_ERRNO;
++ lSeek += file_info.size_file_extra - uSizeRead;
++ }
++ else
++ lSeek+=file_info.size_file_extra;
+
+- if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK)
+- err=UNZ_ERRNO;
+
+- if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK)
+- err=UNZ_ERRNO;
++ if ((err==UNZ_OK) && (szComment!=NULL))
++ {
++ uLong uSizeRead ;
++ if (file_info.size_file_comment<commentBufferSize)
++ {
++ *(szComment+file_info.size_file_comment)='\0';
++ uSizeRead = file_info.size_file_comment;
++ }
++ else
++ uSizeRead = commentBufferSize;
+
+- if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- lSeek+=file_info.size_filename;
+- if ((err==UNZ_OK) && (szFileName!=NULL))
+- {
+- uLong uSizeRead ;
+- if (file_info.size_filename<fileNameBufferSize)
+- {
+- *(szFileName+file_info.size_filename)='\0';
+- uSizeRead = file_info.size_filename;
+- }
+- else
+- uSizeRead = fileNameBufferSize;
+-
+- if ((file_info.size_filename>0) && (fileNameBufferSize>0))
+- if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1)
+- err=UNZ_ERRNO;
+- lSeek -= uSizeRead;
+- }
+-
+-
+- if ((err==UNZ_OK) && (extraField!=NULL))
+- {
+- uLong uSizeRead ;
+- if (file_info.size_file_extra<extraFieldBufferSize)
+- uSizeRead = file_info.size_file_extra;
+- else
+- uSizeRead = extraFieldBufferSize;
+-
+- if (lSeek!=0)
+- if (fseek(s->file,lSeek,SEEK_CUR)==0)
+- lSeek=0;
+- else
+- err=UNZ_ERRNO;
+- if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
+- if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
+- err=UNZ_ERRNO;
+- lSeek += file_info.size_file_extra - uSizeRead;
+- }
+- else
+- lSeek+=file_info.size_file_extra;
+-
+-
+- if ((err==UNZ_OK) && (szComment!=NULL))
+- {
+- uLong uSizeRead ;
+- if (file_info.size_file_comment<commentBufferSize)
+- {
+- *(szComment+file_info.size_file_comment)='\0';
+- uSizeRead = file_info.size_file_comment;
+- }
+- else
+- uSizeRead = commentBufferSize;
+-
+- if (lSeek!=0)
+- if (fseek(s->file,lSeek,SEEK_CUR)==0)
+- lSeek=0;
+- else
+- err=UNZ_ERRNO;
+- if ((file_info.size_file_comment>0) && (commentBufferSize>0))
+- if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
+- err=UNZ_ERRNO;
+- lSeek+=file_info.size_file_comment - uSizeRead;
+- }
+- else
+- lSeek+=file_info.size_file_comment;
++ if (lSeek!=0)
++ if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
++ lSeek=0;
++ else
++ err=UNZ_ERRNO;
++ if ((file_info.size_file_comment>0) && (commentBufferSize>0))
++ if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
++ err=UNZ_ERRNO;
++ lSeek+=file_info.size_file_comment - uSizeRead;
++ }
++ else
++ lSeek+=file_info.size_file_comment;
+
+- if ((err==UNZ_OK) && (pfile_info!=NULL))
+- *pfile_info=file_info;
++ if ((err==UNZ_OK) && (pfile_info!=NULL))
++ *pfile_info=file_info;
+
+- if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
+- *pfile_info_internal=file_info_internal;
++ if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
++ *pfile_info_internal=file_info_internal;
+
+- return err;
++ return err;
+ }
+
+
+@@ -670,23 +742,23 @@
+ return UNZ_OK if there is no problem.
+ */
+ extern int ZEXPORT unzGetCurrentFileInfo (file,
+- pfile_info,
+- szFileName, fileNameBufferSize,
+- extraField, extraFieldBufferSize,
+- szComment, commentBufferSize)
+- unzFile file;
+- unz_file_info *pfile_info;
+- char *szFileName;
+- uLong fileNameBufferSize;
+- void *extraField;
+- uLong extraFieldBufferSize;
+- char *szComment;
+- uLong commentBufferSize;
+-{
+- return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
+- szFileName,fileNameBufferSize,
+- extraField,extraFieldBufferSize,
+- szComment,commentBufferSize);
++ pfile_info,
++ szFileName, fileNameBufferSize,
++ extraField, extraFieldBufferSize,
++ szComment, commentBufferSize)
++ unzFile file;
++ unz_file_info *pfile_info;
++ char *szFileName;
++ uLong fileNameBufferSize;
++ void *extraField;
++ uLong extraFieldBufferSize;
++ char *szComment;
++ uLong commentBufferSize;
++{
++ return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
++ szFileName,fileNameBufferSize,
++ extraField,extraFieldBufferSize,
++ szComment,commentBufferSize);
+ }
+
+ /*
+@@ -694,50 +766,50 @@
+ return UNZ_OK if there is no problem
+ */
+ extern int ZEXPORT unzGoToFirstFile (file)
+- unzFile file;
++ unzFile file;
+ {
+- int err=UNZ_OK;
+- unz_s* s;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+- s->pos_in_central_dir=s->offset_central_dir;
+- s->num_file=0;
+- err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+- &s->cur_file_info_internal,
+- NULL,0,NULL,0,NULL,0);
+- s->current_file_ok = (err == UNZ_OK);
+- return err;
++ int err=UNZ_OK;
++ unz_s* s;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ s->pos_in_central_dir=s->offset_central_dir;
++ s->num_file=0;
++ err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
++ &s->cur_file_info_internal,
++ NULL,0,NULL,0,NULL,0);
++ s->current_file_ok = (err == UNZ_OK);
++ return err;
+ }
+
+-
+ /*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+ */
+ extern int ZEXPORT unzGoToNextFile (file)
+- unzFile file;
++ unzFile file;
+ {
+- unz_s* s;
+- int err;
++ unz_s* s;
++ int err;
+
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+- if (!s->current_file_ok)
+- return UNZ_END_OF_LIST_OF_FILE;
+- if (s->num_file+1==s->gi.number_entry)
+- return UNZ_END_OF_LIST_OF_FILE;
+-
+- s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
+- s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
+- s->num_file++;
+- err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+- &s->cur_file_info_internal,
+- NULL,0,NULL,0,NULL,0);
+- s->current_file_ok = (err == UNZ_OK);
+- return err;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ if (!s->current_file_ok)
++ return UNZ_END_OF_LIST_OF_FILE;
++ if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
++ if (s->num_file+1==s->gi.number_entry)
++ return UNZ_END_OF_LIST_OF_FILE;
++
++ s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
++ s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
++ s->num_file++;
++ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
++ &s->cur_file_info_internal,
++ NULL,0,NULL,0,NULL,0);
++ s->current_file_ok = (err == UNZ_OK);
++ return err;
+ }
+
+
+@@ -750,50 +822,130 @@
+ UNZ_END_OF_LIST_OF_FILE if the file is not found
+ */
+ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
+- unzFile file;
+- const char *szFileName;
+- int iCaseSensitivity;
++ unzFile file;
++ const char *szFileName;
++ int iCaseSensitivity;
+ {
+- unz_s* s;
+- int err;
++ unz_s* s;
++ int err;
+
+-
+- uLong num_fileSaved;
+- uLong pos_in_central_dirSaved;
++ /* We remember the 'current' position in the file so that we can jump
++ * back there if we fail.
++ */
++ unz_file_info cur_file_infoSaved;
++ unz_file_info_internal cur_file_info_internalSaved;
++ uLong num_fileSaved;
++ uLong pos_in_central_dirSaved;
+
+
+- if (file==NULL)
+- return UNZ_PARAMERROR;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
+
+ if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
+ return UNZ_PARAMERROR;
+
+- s=(unz_s*)file;
+- if (!s->current_file_ok)
+- return UNZ_END_OF_LIST_OF_FILE;
+-
+- num_fileSaved = s->num_file;
+- pos_in_central_dirSaved = s->pos_in_central_dir;
+-
+- err = unzGoToFirstFile(file);
+-
+- while (err == UNZ_OK)
+- {
+- char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
+- unzGetCurrentFileInfo(file,NULL,
+- szCurrentFileName,sizeof(szCurrentFileName)-1,
+- NULL,0,NULL,0);
+- if (unzStringFileNameCompare(szCurrentFileName,
+- szFileName,iCaseSensitivity)==0)
+- return UNZ_OK;
+- err = unzGoToNextFile(file);
+- }
+-
+- s->num_file = num_fileSaved ;
+- s->pos_in_central_dir = pos_in_central_dirSaved ;
+- return err;
++ s=(unz_s*)file;
++ if (!s->current_file_ok)
++ return UNZ_END_OF_LIST_OF_FILE;
++
++ /* Save the current state */
++ num_fileSaved = s->num_file;
++ pos_in_central_dirSaved = s->pos_in_central_dir;
++ cur_file_infoSaved = s->cur_file_info;
++ cur_file_info_internalSaved = s->cur_file_info_internal;
++
++ err = unzGoToFirstFile(file);
++
++ while (err == UNZ_OK)
++ {
++ char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
++ err = unzGetCurrentFileInfo(file,NULL,
++ szCurrentFileName,sizeof(szCurrentFileName)-1,
++ NULL,0,NULL,0);
++ if (err == UNZ_OK)
++ {
++ if (unzStringFileNameCompare(szCurrentFileName,
++ szFileName,iCaseSensitivity)==0)
++ return UNZ_OK;
++ err = unzGoToNextFile(file);
++ }
++ }
++
++ /* We failed, so restore the state of the 'current file' to where we
++ * were.
++ */
++ s->num_file = num_fileSaved ;
++ s->pos_in_central_dir = pos_in_central_dirSaved ;
++ s->cur_file_info = cur_file_infoSaved;
++ s->cur_file_info_internal = cur_file_info_internalSaved;
++ return err;
++}
++
++
++/*
++///////////////////////////////////////////
++// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
++// I need random access
++//
++// Further optimization could be realized by adding an ability
++// to cache the directory in memory. The goal being a single
++// comprehensive file read to put the file I need in a memory.
++*/
++
++/*
++typedef struct unz_file_pos_s
++{
++ uLong pos_in_zip_directory; // offset in file
++ uLong num_of_file; // # of file
++} unz_file_pos;
++*/
++
++extern int ZEXPORT unzGetFilePos(file, file_pos)
++ unzFile file;
++ unz_file_pos* file_pos;
++{
++ unz_s* s;
++
++ if (file==NULL || file_pos==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ if (!s->current_file_ok)
++ return UNZ_END_OF_LIST_OF_FILE;
++
++ file_pos->pos_in_zip_directory = s->pos_in_central_dir;
++ file_pos->num_of_file = s->num_file;
++
++ return UNZ_OK;
++}
++
++extern int ZEXPORT unzGoToFilePos(file, file_pos)
++ unzFile file;
++ unz_file_pos* file_pos;
++{
++ unz_s* s;
++ int err;
++
++ if (file==NULL || file_pos==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++
++ /* jump to the right spot */
++ s->pos_in_central_dir = file_pos->pos_in_zip_directory;
++ s->num_file = file_pos->num_of_file;
++
++ /* set the current file */
++ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
++ &s->cur_file_info_internal,
++ NULL,0,NULL,0,NULL,0);
++ /* return results */
++ s->current_file_ok = (err == UNZ_OK);
++ return err;
+ }
+
++/*
++// Unzip Helper Functions - should be here?
++///////////////////////////////////////////
++*/
+
+ /*
+ Read the local header of the current zipfile
+@@ -803,185 +955,261 @@
+ (filename and size of extra field data)
+ */
+ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
+- poffset_local_extrafield,
+- psize_local_extrafield)
+- unz_s* s;
+- uInt* piSizeVar;
+- uLong *poffset_local_extrafield;
+- uInt *psize_local_extrafield;
+-{
+- uLong uMagic,uData,uFlags;
+- uLong size_filename;
+- uLong size_extra_field;
+- int err=UNZ_OK;
+-
+- *piSizeVar = 0;
+- *poffset_local_extrafield = 0;
+- *psize_local_extrafield = 0;
+-
+- if (fseek(s->file,s->cur_file_info_internal.offset_curfile +
+- s->byte_before_the_zipfile,SEEK_SET)!=0)
+- return UNZ_ERRNO;
+-
+-
+- if (err==UNZ_OK)
+- if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+- err=UNZ_ERRNO;
+- else if (uMagic!=0x04034b50)
+- err=UNZ_BADZIPFILE;
+-
+- if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+- err=UNZ_ERRNO;
+-/*
+- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
+- err=UNZ_BADZIPFILE;
+-*/
+- if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK)
+- err=UNZ_ERRNO;
+-
+- if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+- err=UNZ_ERRNO;
+- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
+- err=UNZ_BADZIPFILE;
++ poffset_local_extrafield,
++ psize_local_extrafield)
++ unz_s* s;
++ uInt* piSizeVar;
++ uLong *poffset_local_extrafield;
++ uInt *psize_local_extrafield;
++{
++ uLong uMagic,uData,uFlags;
++ uLong size_filename;
++ uLong size_extra_field;
++ int err=UNZ_OK;
++
++ *piSizeVar = 0;
++ *poffset_local_extrafield = 0;
++ *psize_local_extrafield = 0;
++
++ if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
++ s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
++ return UNZ_ERRNO;
++
++
++ if (err==UNZ_OK)
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
++ err=UNZ_ERRNO;
++ else if (uMagic!=0x04034b50)
++ err=UNZ_BADZIPFILE;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
++ err=UNZ_ERRNO;
++/*
++ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
++ err=UNZ_BADZIPFILE;
++*/
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
++ err=UNZ_ERRNO;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
++ err=UNZ_ERRNO;
++ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
++ err=UNZ_BADZIPFILE;
+
+ if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+ err=UNZ_BADZIPFILE;
+
+- if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */
+- err=UNZ_ERRNO;
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
++ err=UNZ_ERRNO;
+
+- if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */
+- err=UNZ_ERRNO;
+- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
+- ((uFlags & 8)==0))
+- err=UNZ_BADZIPFILE;
+-
+- if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */
+- err=UNZ_ERRNO;
+- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
+- ((uFlags & 8)==0))
+- err=UNZ_BADZIPFILE;
+-
+- if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
+- err=UNZ_ERRNO;
+- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
+- ((uFlags & 8)==0))
+- err=UNZ_BADZIPFILE;
+-
+-
+- if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK)
+- err=UNZ_ERRNO;
+- else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
+- err=UNZ_BADZIPFILE;
+-
+- *piSizeVar += (uInt)size_filename;
+-
+- if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK)
+- err=UNZ_ERRNO;
+- *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
+- SIZEZIPLOCALHEADER + size_filename;
+- *psize_local_extrafield = (uInt)size_extra_field;
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
++ err=UNZ_ERRNO;
++ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
++ ((uFlags & 8)==0))
++ err=UNZ_BADZIPFILE;
++
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
++ err=UNZ_ERRNO;
++ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
++ ((uFlags & 8)==0))
++ err=UNZ_BADZIPFILE;
+
+- *piSizeVar += (uInt)size_extra_field;
++ if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
++ err=UNZ_ERRNO;
++ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
++ ((uFlags & 8)==0))
++ err=UNZ_BADZIPFILE;
++
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
++ err=UNZ_ERRNO;
++ else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
++ err=UNZ_BADZIPFILE;
+
+- return err;
++ *piSizeVar += (uInt)size_filename;
++
++ if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
++ err=UNZ_ERRNO;
++ *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
++ SIZEZIPLOCALHEADER + size_filename;
++ *psize_local_extrafield = (uInt)size_extra_field;
++
++ *piSizeVar += (uInt)size_extra_field;
++
++ return err;
+ }
+-
++
+ /*
+ Open for reading data the current file in the zipfile.
+ If there is no error and the file is opened, the return value is UNZ_OK.
+ */
+-extern int ZEXPORT unzOpenCurrentFile (file)
+- unzFile file;
+-{
+- int err=UNZ_OK;
+- int Store;
+- uInt iSizeVar;
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- uLong offset_local_extrafield; /* offset of the local extra field */
+- uInt size_local_extrafield; /* size of the local extra field */
+-
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+- if (!s->current_file_ok)
+- return UNZ_PARAMERROR;
++extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
++ unzFile file;
++ int* method;
++ int* level;
++ int raw;
++ const char* password;
++{
++ int err=UNZ_OK;
++ uInt iSizeVar;
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ uLong offset_local_extrafield; /* offset of the local extra field */
++ uInt size_local_extrafield; /* size of the local extra field */
++# ifndef NOUNCRYPT
++ char source[12];
++# else
++ if (password != NULL)
++ return UNZ_PARAMERROR;
++# endif
++
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ if (!s->current_file_ok)
++ return UNZ_PARAMERROR;
+
+ if (s->pfile_in_zip_read != NULL)
+ unzCloseCurrentFile(file);
+
+- if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
+- &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
+- return UNZ_BADZIPFILE;
+-
+- pfile_in_zip_read_info = (file_in_zip_read_info_s*)
+- ALLOC(sizeof(file_in_zip_read_info_s));
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_INTERNALERROR;
+-
+- pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
+- pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
+- pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
+- pfile_in_zip_read_info->pos_local_extrafield=0;
+-
+- if (pfile_in_zip_read_info->read_buffer==NULL)
+- {
+- TRYFREE(pfile_in_zip_read_info);
+- return UNZ_INTERNALERROR;
+- }
+-
+- pfile_in_zip_read_info->stream_initialised=0;
+-
+- if ((s->cur_file_info.compression_method!=0) &&
++ if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
++ &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
++ return UNZ_BADZIPFILE;
++
++ pfile_in_zip_read_info = (file_in_zip_read_info_s*)
++ ALLOC(sizeof(file_in_zip_read_info_s));
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_INTERNALERROR;
++
++ pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
++ pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
++ pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
++ pfile_in_zip_read_info->pos_local_extrafield=0;
++ pfile_in_zip_read_info->raw=raw;
++
++ if (pfile_in_zip_read_info->read_buffer==NULL)
++ {
++ TRYFREE(pfile_in_zip_read_info);
++ return UNZ_INTERNALERROR;
++ }
++
++ pfile_in_zip_read_info->stream_initialised=0;
++
++ if (method!=NULL)
++ *method = (int)s->cur_file_info.compression_method;
++
++ if (level!=NULL)
++ {
++ *level = 6;
++ switch (s->cur_file_info.flag & 0x06)
++ {
++ case 6 : *level = 1; break;
++ case 4 : *level = 2; break;
++ case 2 : *level = 9; break;
++ }
++ }
++
++ if ((s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+- err=UNZ_BADZIPFILE;
+- Store = s->cur_file_info.compression_method==0;
++ err=UNZ_BADZIPFILE;
+
+- pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
+- pfile_in_zip_read_info->crc32=0;
+- pfile_in_zip_read_info->compression_method =
++ pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
++ pfile_in_zip_read_info->crc32=0;
++ pfile_in_zip_read_info->compression_method =
+ s->cur_file_info.compression_method;
+- pfile_in_zip_read_info->file=s->file;
+- pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
++ pfile_in_zip_read_info->filestream=s->filestream;
++ pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
++ pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
+
+ pfile_in_zip_read_info->stream.total_out = 0;
+
+- if (!Store)
+- {
+- pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+- pfile_in_zip_read_info->stream.zfree = (free_func)0;
+- pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+-
+- err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
+- if (err == Z_OK)
+- pfile_in_zip_read_info->stream_initialised=1;
++ if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
++ (!raw))
++ {
++ pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
++ pfile_in_zip_read_info->stream.zfree = (free_func)0;
++ pfile_in_zip_read_info->stream.opaque = (voidpf)0;
++ pfile_in_zip_read_info->stream.next_in = (voidpf)0;
++ pfile_in_zip_read_info->stream.avail_in = 0;
++
++ err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
++ if (err == Z_OK)
++ pfile_in_zip_read_info->stream_initialised=1;
++ else
++ {
++ TRYFREE(pfile_in_zip_read_info);
++ return err;
++ }
+ /* windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+- * return Z_STREAM_END.
+- * In unzip, i don't wait absolutely Z_STREAM_END because I known the
++ * return Z_STREAM_END.
++ * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+ * size of both compressed and uncompressed data
+ */
+- }
+- pfile_in_zip_read_info->rest_read_compressed =
++ }
++ pfile_in_zip_read_info->rest_read_compressed =
+ s->cur_file_info.compressed_size ;
+- pfile_in_zip_read_info->rest_read_uncompressed =
++ pfile_in_zip_read_info->rest_read_uncompressed =
+ s->cur_file_info.uncompressed_size ;
+
+-
+- pfile_in_zip_read_info->pos_in_zipfile =
+- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+- iSizeVar;
+-
+- pfile_in_zip_read_info->stream.avail_in = (uInt)0;
++
++ pfile_in_zip_read_info->pos_in_zipfile =
++ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
++ iSizeVar;
++
++ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
++
++ s->pfile_in_zip_read = pfile_in_zip_read_info;
++
++# ifndef NOUNCRYPT
++ if (password != NULL)
++ {
++ int i;
++ s->pcrc_32_tab = get_crc_table();
++ init_keys(password,s->keys,s->pcrc_32_tab);
++ if (ZSEEK(s->z_filefunc, s->filestream,
++ s->pfile_in_zip_read->pos_in_zipfile +
++ s->pfile_in_zip_read->byte_before_the_zipfile,
++ SEEK_SET)!=0)
++ return UNZ_INTERNALERROR;
++ if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
++ return UNZ_INTERNALERROR;
++
++ for (i = 0; i<12; i++)
++ zdecode(s->keys,s->pcrc_32_tab,source[i]);
++
++ s->pfile_in_zip_read->pos_in_zipfile+=12;
++ s->encrypted=1;
++ }
++# endif
+
+
+- s->pfile_in_zip_read = pfile_in_zip_read_info;
+ return UNZ_OK;
+ }
+
++extern int ZEXPORT unzOpenCurrentFile (file)
++ unzFile file;
++{
++ return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
++}
++
++extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
++ unzFile file;
++ const char* password;
++{
++ return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
++}
++
++extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
++ unzFile file;
++ int* method;
++ int* level;
++ int raw;
++{
++ return unzOpenCurrentFile3(file, method, level, raw, NULL);
++}
+
+ /*
+ Read bytes from the current file.
+@@ -994,126 +1222,160 @@
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+ */
+ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
+- unzFile file;
+- voidp buf;
+- unsigned len;
+-{
+- int err=UNZ_OK;
+- uInt iRead = 0;
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unzFile file;
++ voidp buf;
++ unsigned len;
++{
++ int err=UNZ_OK;
++ uInt iRead = 0;
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_PARAMERROR;
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
+
+
+- if ((pfile_in_zip_read_info->read_buffer == NULL))
+- return UNZ_END_OF_LIST_OF_FILE;
+- if (len==0)
+- return 0;
+-
+- pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+-
+- pfile_in_zip_read_info->stream.avail_out = (uInt)len;
+-
+- if (len>pfile_in_zip_read_info->rest_read_uncompressed)
+- pfile_in_zip_read_info->stream.avail_out =
+- (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
+-
+- while (pfile_in_zip_read_info->stream.avail_out>0)
+- {
+- if ((pfile_in_zip_read_info->stream.avail_in==0) &&
++ if ((pfile_in_zip_read_info->read_buffer == NULL))
++ return UNZ_END_OF_LIST_OF_FILE;
++ if (len==0)
++ return 0;
++
++ pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
++
++ pfile_in_zip_read_info->stream.avail_out = (uInt)len;
++
++ if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
++ (!(pfile_in_zip_read_info->raw)))
++ pfile_in_zip_read_info->stream.avail_out =
++ (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
++
++ if ((len>pfile_in_zip_read_info->rest_read_compressed+
++ pfile_in_zip_read_info->stream.avail_in) &&
++ (pfile_in_zip_read_info->raw))
++ pfile_in_zip_read_info->stream.avail_out =
++ (uInt)pfile_in_zip_read_info->rest_read_compressed+
++ pfile_in_zip_read_info->stream.avail_in;
++
++ while (pfile_in_zip_read_info->stream.avail_out>0)
++ {
++ if ((pfile_in_zip_read_info->stream.avail_in==0) &&
+ (pfile_in_zip_read_info->rest_read_compressed>0))
+- {
+- uInt uReadThis = UNZ_BUFSIZE;
+- if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
+- uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
+- if (uReadThis == 0)
+- return UNZ_EOF;
+- if (fseek(pfile_in_zip_read_info->file,
+- pfile_in_zip_read_info->pos_in_zipfile +
+- pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
+- return UNZ_ERRNO;
+- if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
+- pfile_in_zip_read_info->file)!=1)
+- return UNZ_ERRNO;
+- pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
+-
+- pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
+-
+- pfile_in_zip_read_info->stream.next_in =
++ {
++ uInt uReadThis = UNZ_BUFSIZE;
++ if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
++ uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
++ if (uReadThis == 0)
++ return UNZ_EOF;
++ if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
++ pfile_in_zip_read_info->filestream,
++ pfile_in_zip_read_info->pos_in_zipfile +
++ pfile_in_zip_read_info->byte_before_the_zipfile,
++ ZLIB_FILEFUNC_SEEK_SET)!=0)
++ return UNZ_ERRNO;
++ if (ZREAD(pfile_in_zip_read_info->z_filefunc,
++ pfile_in_zip_read_info->filestream,
++ pfile_in_zip_read_info->read_buffer,
++ uReadThis)!=uReadThis)
++ return UNZ_ERRNO;
++
++
++# ifndef NOUNCRYPT
++ if(s->encrypted)
++ {
++ uInt i;
++ for(i=0;i<uReadThis;i++)
++ pfile_in_zip_read_info->read_buffer[i] =
++ zdecode(s->keys,s->pcrc_32_tab,
++ pfile_in_zip_read_info->read_buffer[i]);
++ }
++# endif
++
++
++ pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
++
++ pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
++
++ pfile_in_zip_read_info->stream.next_in =
+ (Bytef*)pfile_in_zip_read_info->read_buffer;
+- pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
+- }
++ pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
++ }
++
++ if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
++ {
++ uInt uDoCopy,i ;
++
++ if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
++ (pfile_in_zip_read_info->rest_read_compressed == 0))
++ return (iRead==0) ? UNZ_EOF : iRead;
+
+- if (pfile_in_zip_read_info->compression_method==0)
+- {
+- uInt uDoCopy,i ;
+- if (pfile_in_zip_read_info->stream.avail_out <
++ if (pfile_in_zip_read_info->stream.avail_out <
+ pfile_in_zip_read_info->stream.avail_in)
+- uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
+- else
+- uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
+-
+- for (i=0;i<uDoCopy;i++)
+- *(pfile_in_zip_read_info->stream.next_out+i) =
++ uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
++ else
++ uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
++
++ for (i=0;i<uDoCopy;i++)
++ *(pfile_in_zip_read_info->stream.next_out+i) =
+ *(pfile_in_zip_read_info->stream.next_in+i);
+-
+- pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
+- pfile_in_zip_read_info->stream.next_out,
+- uDoCopy);
+- pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
+- pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
+- pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
+- pfile_in_zip_read_info->stream.next_out += uDoCopy;
+- pfile_in_zip_read_info->stream.next_in += uDoCopy;
++
++ pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
++ pfile_in_zip_read_info->stream.next_out,
++ uDoCopy);
++ pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
++ pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
++ pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
++ pfile_in_zip_read_info->stream.next_out += uDoCopy;
++ pfile_in_zip_read_info->stream.next_in += uDoCopy;
+ pfile_in_zip_read_info->stream.total_out += uDoCopy;
+- iRead += uDoCopy;
+- }
+- else
+- {
+- uLong uTotalOutBefore,uTotalOutAfter;
+- const Bytef *bufBefore;
+- uLong uOutThis;
+- int flush=Z_SYNC_FLUSH;
+-
+- uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+- bufBefore = pfile_in_zip_read_info->stream.next_out;
+-
+- /*
+- if ((pfile_in_zip_read_info->rest_read_uncompressed ==
+- pfile_in_zip_read_info->stream.avail_out) &&
+- (pfile_in_zip_read_info->rest_read_compressed == 0))
+- flush = Z_FINISH;
+- */
+- err=inflate(&pfile_in_zip_read_info->stream,flush);
+-
+- uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+- uOutThis = uTotalOutAfter-uTotalOutBefore;
+-
+- pfile_in_zip_read_info->crc32 =
++ iRead += uDoCopy;
++ }
++ else
++ {
++ uLong uTotalOutBefore,uTotalOutAfter;
++ const Bytef *bufBefore;
++ uLong uOutThis;
++ int flush=Z_SYNC_FLUSH;
++
++ uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
++ bufBefore = pfile_in_zip_read_info->stream.next_out;
++
++ /*
++ if ((pfile_in_zip_read_info->rest_read_uncompressed ==
++ pfile_in_zip_read_info->stream.avail_out) &&
++ (pfile_in_zip_read_info->rest_read_compressed == 0))
++ flush = Z_FINISH;
++ */
++ err=inflate(&pfile_in_zip_read_info->stream,flush);
++
++ if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
++ err = Z_DATA_ERROR;
++
++ uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
++ uOutThis = uTotalOutAfter-uTotalOutBefore;
++
++ pfile_in_zip_read_info->crc32 =
+ crc32(pfile_in_zip_read_info->crc32,bufBefore,
+ (uInt)(uOutThis));
+
+- pfile_in_zip_read_info->rest_read_uncompressed -=
++ pfile_in_zip_read_info->rest_read_uncompressed -=
+ uOutThis;
+
+- iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+-
+- if (err==Z_STREAM_END)
+- return (iRead==0) ? UNZ_EOF : iRead;
+- if (err!=Z_OK)
+- break;
+- }
+- }
+-
+- if (err==Z_OK)
+- return iRead;
+- return err;
++ iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
++
++ if (err==Z_STREAM_END)
++ return (iRead==0) ? UNZ_EOF : iRead;
++ if (err!=Z_OK)
++ break;
++ }
++ }
++
++ if (err==Z_OK)
++ return iRead;
++ return err;
+ }
+
+
+@@ -1121,42 +1383,42 @@
+ Give the current position in uncompressed data
+ */
+ extern z_off_t ZEXPORT unztell (file)
+- unzFile file;
++ unzFile file;
+ {
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_PARAMERROR;
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
+
+- return (z_off_t)pfile_in_zip_read_info->stream.total_out;
++ return (z_off_t)pfile_in_zip_read_info->stream.total_out;
+ }
+
+
+ /*
+- return 1 if the end of file was reached, 0 elsewhere
++ return 1 if the end of file was reached, 0 elsewhere
+ */
+ extern int ZEXPORT unzeof (file)
+- unzFile file;
++ unzFile file;
+ {
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_PARAMERROR;
+-
+- if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+- return 1;
+- else
+- return 0;
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
++
++ if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
++ return 1;
++ else
++ return 0;
+ }
+
+
+@@ -1169,51 +1431,55 @@
+ if buf==NULL, it return the size of the local extra field that can be read
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+- buf.
+- the return value is the number of bytes copied in buf, or (if <0)
+- the error code
++ buf.
++ the return value is the number of bytes copied in buf, or (if <0)
++ the error code
+ */
+ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
+- unzFile file;
+- voidp buf;
+- unsigned len;
+-{
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- uInt read_now;
+- uLong size_to_read;
+-
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unzFile file;
++ voidp buf;
++ unsigned len;
++{
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ uInt read_now;
++ uLong size_to_read;
++
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_PARAMERROR;
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
+
+- size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
+- pfile_in_zip_read_info->pos_local_extrafield);
++ size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
++ pfile_in_zip_read_info->pos_local_extrafield);
+
+- if (buf==NULL)
+- return (int)size_to_read;
+-
+- if (len>size_to_read)
+- read_now = (uInt)size_to_read;
+- else
+- read_now = (uInt)len ;
+-
+- if (read_now==0)
+- return 0;
+-
+- if (fseek(pfile_in_zip_read_info->file,
+- pfile_in_zip_read_info->offset_local_extrafield +
+- pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
+- return UNZ_ERRNO;
++ if (buf==NULL)
++ return (int)size_to_read;
+
+- if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1)
+- return UNZ_ERRNO;
++ if (len>size_to_read)
++ read_now = (uInt)size_to_read;
++ else
++ read_now = (uInt)len ;
++
++ if (read_now==0)
++ return 0;
+
+- return (int)read_now;
++ if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
++ pfile_in_zip_read_info->filestream,
++ pfile_in_zip_read_info->offset_local_extrafield +
++ pfile_in_zip_read_info->pos_local_extrafield,
++ ZLIB_FILEFUNC_SEEK_SET)!=0)
++ return UNZ_ERRNO;
++
++ if (ZREAD(pfile_in_zip_read_info->z_filefunc,
++ pfile_in_zip_read_info->filestream,
++ buf,read_now)!=read_now)
++ return UNZ_ERRNO;
++
++ return (int)read_now;
+ }
+
+ /*
+@@ -1221,39 +1487,40 @@
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+ */
+ extern int ZEXPORT unzCloseCurrentFile (file)
+- unzFile file;
++ unzFile file;
+ {
+- int err=UNZ_OK;
++ int err=UNZ_OK;
+
+- unz_s* s;
+- file_in_zip_read_info_s* pfile_in_zip_read_info;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
++ unz_s* s;
++ file_in_zip_read_info_s* pfile_in_zip_read_info;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+- if (pfile_in_zip_read_info==NULL)
+- return UNZ_PARAMERROR;
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
+
+
+- if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+- {
+- if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
+- err=UNZ_CRCERROR;
+- }
++ if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
++ (!pfile_in_zip_read_info->raw))
++ {
++ if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
++ err=UNZ_CRCERROR;
++ }
+
+
+- TRYFREE(pfile_in_zip_read_info->read_buffer);
+- pfile_in_zip_read_info->read_buffer = NULL;
+- if (pfile_in_zip_read_info->stream_initialised)
+- inflateEnd(&pfile_in_zip_read_info->stream);
++ TRYFREE(pfile_in_zip_read_info->read_buffer);
++ pfile_in_zip_read_info->read_buffer = NULL;
++ if (pfile_in_zip_read_info->stream_initialised)
++ inflateEnd(&pfile_in_zip_read_info->stream);
+
+- pfile_in_zip_read_info->stream_initialised = 0;
+- TRYFREE(pfile_in_zip_read_info);
++ pfile_in_zip_read_info->stream_initialised = 0;
++ TRYFREE(pfile_in_zip_read_info);
+
+ s->pfile_in_zip_read=NULL;
+
+- return err;
++ return err;
+ }
+
+
+@@ -1263,32 +1530,69 @@
+ return the number of byte copied or an error code <0
+ */
+ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
+- unzFile file;
+- char *szComment;
+- uLong uSizeBuf;
+-{
+- int err=UNZ_OK;
+- unz_s* s;
+- uLong uReadThis ;
+- if (file==NULL)
+- return UNZ_PARAMERROR;
+- s=(unz_s*)file;
+-
+- uReadThis = uSizeBuf;
+- if (uReadThis>s->gi.size_comment)
+- uReadThis = s->gi.size_comment;
++ unzFile file;
++ char *szComment;
++ uLong uSizeBuf;
++{
++ int err=UNZ_OK;
++ unz_s* s;
++ uLong uReadThis ;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
+
+- if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0)
+- return UNZ_ERRNO;
++ uReadThis = uSizeBuf;
++ if (uReadThis>s->gi.size_comment)
++ uReadThis = s->gi.size_comment;
+
+- if (uReadThis>0)
++ if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
++ return UNZ_ERRNO;
++
++ if (uReadThis>0)
+ {
+ *szComment='\0';
+- if (fread(szComment,(uInt)uReadThis,1,s->file)!=1)
+- return UNZ_ERRNO;
++ if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
++ return UNZ_ERRNO;
+ }
+
+- if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
+- *(szComment+s->gi.size_comment)='\0';
+- return (int)uReadThis;
++ if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
++ *(szComment+s->gi.size_comment)='\0';
++ return (int)uReadThis;
++}
++
++/* Additions by RX '2004 */
++extern uLong ZEXPORT unzGetOffset (file)
++ unzFile file;
++{
++ unz_s* s;
++
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++ if (!s->current_file_ok)
++ return 0;
++ if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
++ if (s->num_file==s->gi.number_entry)
++ return 0;
++ return s->pos_in_central_dir;
++}
++
++extern int ZEXPORT unzSetOffset (file, pos)
++ unzFile file;
++ uLong pos;
++{
++ unz_s* s;
++ int err;
++
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz_s*)file;
++
++ s->pos_in_central_dir = pos;
++ s->num_file = s->gi.number_entry; /* hack */
++ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
++ &s->cur_file_info_internal,
++ NULL,0,NULL,0,NULL,0);
++ s->current_file_ok = (err == UNZ_OK);
++ return err;
+ }
+--- misc/zlib-1.1.4/contrib/minizip/unzip.h 1998-03-19 00:15:00.000000000 +0100
++++ misc/build/zlib-1.1.4/contrib/minizip/unzip.h 2009-07-17 10:15:15.609375000 +0200
+@@ -1,15 +1,16 @@
+-/* unzip.h -- IO for uncompress .zip files using zlib
+- Version 0.15 beta, Mar 19th, 1998,
++/* unzip.h -- IO for uncompress .zip files using zlib
++ Version 1.01e, February 12th, 2005
+
+- Copyright (C) 1998 Gilles Vollant
++ Copyright (C) 1998-2005 Gilles Vollant
+
+ This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
+ WinZip, InfoZip tools and compatible.
+- Encryption and multi volume ZipFile (span) are not supported.
++
++ Multi volume ZipFile (span) are not supported.
++ Encryption compatible with pkzip 2.04g only supported
+ Old compressions used by old PKZip 1.x are not supported
+
+- THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
+- CAN CHANGE IN FUTURE VERSION !!
++
+ I WAIT FEEDBACK at mail info@winimage.com
+ Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
+
+@@ -33,10 +34,13 @@
+
+
+ */
+-/* for more info about .ZIP format, see
+- ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
++
++/* for more info about .ZIP format, see
++ http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
++ http://www.info-zip.org/pub/infozip/doc/
+ PkWare has also a specification at :
+- ftp://ftp.pkware.com/probdesc.zip */
++ ftp://ftp.pkware.com/probdesc.zip
++*/
+
+ #ifndef _unz_H
+ #define _unz_H
+@@ -46,46 +50,50 @@
+ #endif
+
+ #ifndef _ZLIB_H
+-#include "zlib.h"
++#include "zlib/zlib.h"
++#endif
++
++#ifndef _ZLIBIOAPI_H
++#include "ioapi.h"
+ #endif
+
+ #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+ /* like the STRICT of WIN32, we define a pointer that cannot be converted
+ from (void*) without cast */
+-typedef struct TagunzFile__ { int unused; } unzFile__;
++typedef struct TagunzFile__ { int unused; } unzFile__;
+ typedef unzFile__ *unzFile;
+ #else
+ typedef voidp unzFile;
+ #endif
+
+
+-#define UNZ_OK (0)
+-#define UNZ_END_OF_LIST_OF_FILE (-100)
+-#define UNZ_ERRNO (Z_ERRNO)
+-#define UNZ_EOF (0)
++#define UNZ_OK (0)
++#define UNZ_END_OF_LIST_OF_FILE (-100)
++#define UNZ_ERRNO (Z_ERRNO)
++#define UNZ_EOF (0)
+ #define UNZ_PARAMERROR (-102)
+ #define UNZ_BADZIPFILE (-103)
+ #define UNZ_INTERNALERROR (-104)
+ #define UNZ_CRCERROR (-105)
+
+ /* tm_unz contain date/time info */
+-typedef struct tm_unz_s
++typedef struct tm_unz_s
+ {
+- uInt tm_sec; /* seconds after the minute - [0,59] */
+- uInt tm_min; /* minutes after the hour - [0,59] */
+- uInt tm_hour; /* hours since midnight - [0,23] */
+- uInt tm_mday; /* day of the month - [1,31] */
+- uInt tm_mon; /* months since January - [0,11] */
+- uInt tm_year; /* years - [1980..2044] */
++ uInt tm_sec; /* seconds after the minute - [0,59] */
++ uInt tm_min; /* minutes after the hour - [0,59] */
++ uInt tm_hour; /* hours since midnight - [0,23] */
++ uInt tm_mday; /* day of the month - [1,31] */
++ uInt tm_mon; /* months since January - [0,11] */
++ uInt tm_year; /* years - [1980..2044] */
+ } tm_unz;
+
+ /* unz_global_info structure contain global data about the ZIPfile
+ These data comes from the end of central dir */
+ typedef struct unz_global_info_s
+ {
+- uLong number_entry; /* total number of entries in
+- the central dir on this disk */
+- uLong size_comment; /* size of the global comment of the zipfile */
++ uLong number_entry; /* total number of entries in
++ the central dir on this disk */
++ uLong size_comment; /* size of the global comment of the zipfile */
+ } unz_global_info;
+
+
+@@ -98,8 +106,8 @@
+ uLong compression_method; /* compression method 2 bytes */
+ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
+ uLong crc; /* crc-32 4 bytes */
+- uLong compressed_size; /* compressed size 4 bytes */
+- uLong uncompressed_size; /* uncompressed size 4 bytes */
++ uLong compressed_size; /* compressed size 4 bytes */
++ uLong uncompressed_size; /* uncompressed size 4 bytes */
+ uLong size_filename; /* filename length 2 bytes */
+ uLong size_file_extra; /* extra field length 2 bytes */
+ uLong size_file_comment; /* file comment length 2 bytes */
+@@ -112,27 +120,34 @@
+ } unz_file_info;
+
+ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
+- const char* fileName2,
+- int iCaseSensitivity));
++ const char* fileName2,
++ int iCaseSensitivity));
+ /*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+- or strcasecmp)
++ or strcasecmp)
+ If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+- (like 1 on Unix, 2 on Windows)
++ (like 1 on Unix, 2 on Windows)
+ */
+
+
+ extern unzFile ZEXPORT unzOpen OF((const char *path));
+ /*
+ Open a Zip file. path contain the full pathname (by example,
+- on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
+- "zlib/zlib111.zip".
+- If the zipfile cannot be opened (file don't exist or in not valid), the
+- return value is NULL.
++ on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
++ "zlib/zlib113.zip".
++ If the zipfile cannot be opened (file don't exist or in not valid), the
++ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+- of this unzip package.
++ of this unzip package.
++*/
++
++extern unzFile ZEXPORT unzOpen2 OF((const char *path,
++ zlib_filefunc_def* pzlib_filefunc_def));
++/*
++ Open a Zip file, like unzOpen, but provide a set of file low level API
++ for read/write the zip file (see ioapi.h)
+ */
+
+ extern int ZEXPORT unzClose OF((unzFile file));
+@@ -143,7 +158,7 @@
+ return UNZ_OK if there is no problem. */
+
+ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+- unz_global_info *pglobal_info));
++ unz_global_info *pglobal_info));
+ /*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+@@ -151,8 +166,8 @@
+
+
+ extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
+- char *szComment,
+- uLong uSizeBuf));
++ char *szComment,
++ uLong uSizeBuf));
+ /*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+@@ -176,9 +191,9 @@
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+ */
+
+-extern int ZEXPORT unzLocateFile OF((unzFile file,
+- const char *szFileName,
+- int iCaseSensitivity));
++extern int ZEXPORT unzLocateFile OF((unzFile file,
++ const char *szFileName,
++ int iCaseSensitivity));
+ /*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzStringFileNameCompare
+@@ -189,25 +204,44 @@
+ */
+
+
++/* ****************************************** */
++/* Ryan supplied functions */
++/* unz_file_info contain information about a file in the zipfile */
++typedef struct unz_file_pos_s
++{
++ uLong pos_in_zip_directory; /* offset in zip file directory */
++ uLong num_of_file; /* # of file */
++} unz_file_pos;
++
++extern int ZEXPORT unzGetFilePos(
++ unzFile file,
++ unz_file_pos* file_pos);
++
++extern int ZEXPORT unzGoToFilePos(
++ unzFile file,
++ unz_file_pos* file_pos);
++
++/* ****************************************** */
++
+ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
+- unz_file_info *pfile_info,
+- char *szFileName,
+- uLong fileNameBufferSize,
+- void *extraField,
+- uLong extraFieldBufferSize,
+- char *szComment,
+- uLong commentBufferSize));
++ unz_file_info *pfile_info,
++ char *szFileName,
++ uLong fileNameBufferSize,
++ void *extraField,
++ uLong extraFieldBufferSize,
++ char *szComment,
++ uLong commentBufferSize));
+ /*
+ Get Info about the current file
+ if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+- the current file
++ the current file
+ if szFileName!=NULL, the filemane string will be copied in szFileName
+- (fileNameBufferSize is the size of the buffer)
++ (fileNameBufferSize is the size of the buffer)
+ if extraField!=NULL, the extra field information will be copied in extraField
+- (extraFieldBufferSize is the size of the buffer).
+- This is the Central-header version of the extra field
++ (extraFieldBufferSize is the size of the buffer).
++ This is the Central-header version of the extra field
+ if szComment!=NULL, the comment string of the file will be copied in szComment
+- (commentBufferSize is the size of the buffer)
++ (commentBufferSize is the size of the buffer)
+ */
+
+ /***************************************************************************/
+@@ -221,16 +255,51 @@
+ If there is no error, the return value is UNZ_OK.
+ */
+
++extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
++ const char* password));
++/*
++ Open for reading data the current file in the zipfile.
++ password is a crypting password
++ If there is no error, the return value is UNZ_OK.
++*/
++
++extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
++ int* method,
++ int* level,
++ int raw));
++/*
++ Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
++ if raw==1
++ *method will receive method of compression, *level will receive level of
++ compression
++ note : you can set level parameter as NULL (if you did not want known level,
++ but you CANNOT set method parameter as NULL
++*/
++
++extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
++ int* method,
++ int* level,
++ int raw,
++ const char* password));
++/*
++ Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
++ if raw==1
++ *method will receive method of compression, *level will receive level of
++ compression
++ note : you can set level parameter as NULL (if you did not want known level,
++ but you CANNOT set method parameter as NULL
++*/
++
++
+ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
+ /*
+ Close the file in zip opened with unzOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+ */
+
+-
+-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
+- voidp buf,
+- unsigned len));
++extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
++ voidp buf,
++ unsigned len));
+ /*
+ Read bytes from the current file (opened by unzOpenCurrentFile)
+ buf contain buffer where data must be copied
+@@ -249,12 +318,12 @@
+
+ extern int ZEXPORT unzeof OF((unzFile file));
+ /*
+- return 1 if the end of file was reached, 0 elsewhere
++ return 1 if the end of file was reached, 0 elsewhere
+ */
+
+ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
+- voidp buf,
+- unsigned len));
++ voidp buf,
++ unsigned len));
+ /*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+@@ -263,11 +332,21 @@
+ if buf==NULL, it return the size of the local extra field
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+- buf.
+- the return value is the number of bytes copied in buf, or (if <0)
+- the error code
++ buf.
++ the return value is the number of bytes copied in buf, or (if <0)
++ the error code
+ */
+
++/***************************************************************************/
++
++/* Get the current file offset */
++extern uLong ZEXPORT unzGetOffset (unzFile file);
++
++/* Set the current file offset */
++extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
++
++
++
+ #ifdef __cplusplus
+ }
+ #endif
+ --- misc/zlib-1.1.4/contrib/minizip/crypt.h 2009-07-17 11:13:37.281250000 +0200
++++ misc/build/zlib-1.1.4/contrib/minizip/crypt.h 2009-07-17 10:58:41.843750000 +0200
+@@ -0,0 +1,132 @@
++/* crypt.h -- base code for crypt/uncrypt ZIPfile
++
++
++ Version 1.01e, February 12th, 2005
++
++ Copyright (C) 1998-2005 Gilles Vollant
++
++ This code is a modified version of crypting code in Infozip distribution
++
++ The encryption/decryption parts of this source code (as opposed to the
++ non-echoing password parts) were originally written in Europe. The
++ whole source package can be freely distributed, including from the USA.
++ (Prior to January 2000, re-export from the US was a violation of US law.)
++
++ This encryption code is a direct transcription of the algorithm from
++ Roger Schlafly, described by Phil Katz in the file appnote.txt. This
++ file (appnote.txt) is distributed with the PKZIP program (even in the
++ version without encryption capabilities).
++
++ If you don't need crypting in your application, just define symbols
++ NOCRYPT and NOUNCRYPT.
++
++ This code support the "Traditional PKWARE Encryption".
++
++ The new AES encryption added on Zip format by Winzip (see the page
++ http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
++ Encryption is not supported.
++*/
++
++#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
++
++/***********************************************************************
++ * Return the next byte in the pseudo-random sequence
++ */
++static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
++{
++ unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
++ * unpredictable manner on 16-bit systems; not a problem
++ * with any known compiler so far, though */
++
++ temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
++ return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
++}
++
++/***********************************************************************
++ * Update the encryption keys with the next byte of plain text
++ */
++static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
++{
++ (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
++ (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
++ (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
++ {
++ register int keyshift = (int)((*(pkeys+1)) >> 24);
++ (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
++ }
++ return c;
++}
++
++
++/***********************************************************************
++ * Initialize the encryption keys and the random header according to
++ * the given password.
++ */
++static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
++{
++ *(pkeys+0) = 305419896L;
++ *(pkeys+1) = 591751049L;
++ *(pkeys+2) = 878082192L;
++ while (*passwd != '\0') {
++ update_keys(pkeys,pcrc_32_tab,(int)*passwd);
++ passwd++;
++ }
++}
++
++#define zdecode(pkeys,pcrc_32_tab,c) \
++ (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
++
++#define zencode(pkeys,pcrc_32_tab,c,t) \
++ (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
++
++#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
++
++#define RAND_HEAD_LEN 12
++ /* "last resort" source for second part of crypt seed pattern */
++# ifndef ZCR_SEED2
++# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
++# endif
++
++static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
++ const char *passwd; /* password string */
++ unsigned char *buf; /* where to write header */
++ int bufSize;
++ unsigned long* pkeys;
++ const unsigned long* pcrc_32_tab;
++ unsigned long crcForCrypting;
++{
++ int n; /* index in random header */
++ int t; /* temporary */
++ int c; /* random byte */
++ unsigned char header[RAND_HEAD_LEN-2]; /* random header */
++ static unsigned calls = 0; /* ensure different random header each time */
++
++ if (bufSize<RAND_HEAD_LEN)
++ return 0;
++
++ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
++ * output of rand() to get less predictability, since rand() is
++ * often poorly implemented.
++ */
++ if (++calls == 1)
++ {
++ srand((unsigned)(time(NULL) ^ ZCR_SEED2));
++ }
++ init_keys(passwd, pkeys, pcrc_32_tab);
++ for (n = 0; n < RAND_HEAD_LEN-2; n++)
++ {
++ c = (rand() >> 7) & 0xff;
++ header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
++ }
++ /* Encrypt random header (last two bytes is high word of crc) */
++ init_keys(passwd, pkeys, pcrc_32_tab);
++ for (n = 0; n < RAND_HEAD_LEN-2; n++)
++ {
++ buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
++ }
++ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
++ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
++ return n;
++}
++
++#endif
+--- misc/zlib-1.1.4/contrib/minizip/ioapi.c 2009-07-17 11:13:18.593750000 +0200
++++ misc/build/zlib-1.1.4/contrib/minizip/ioapi.c 2009-07-17 10:58:56.718750000 +0200
+@@ -0,0 +1,177 @@
++/* ioapi.c -- IO base function header for compress/uncompress .zip
++ files using zlib + zip or unzip API
++
++ Version 1.01e, February 12th, 2005
++
++ Copyright (C) 1998-2005 Gilles Vollant
++*/
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include "zlib.h"
++#include "ioapi.h"
++
++
++
++/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
++
++#ifndef SEEK_CUR
++#define SEEK_CUR 1
++#endif
++
++#ifndef SEEK_END
++#define SEEK_END 2
++#endif
++
++#ifndef SEEK_SET
++#define SEEK_SET 0
++#endif
++
++voidpf ZCALLBACK fopen_file_func OF((
++ voidpf opaque,
++ const char* filename,
++ int mode));
++
++uLong ZCALLBACK fread_file_func OF((
++ voidpf opaque,
++ voidpf stream,
++ void* buf,
++ uLong size));
++
++uLong ZCALLBACK fwrite_file_func OF((
++ voidpf opaque,
++ voidpf stream,
++ const void* buf,
++ uLong size));
++
++long ZCALLBACK ftell_file_func OF((
++ voidpf opaque,
++ voidpf stream));
++
++long ZCALLBACK fseek_file_func OF((
++ voidpf opaque,
++ voidpf stream,
++ uLong offset,
++ int origin));
++
++int ZCALLBACK fclose_file_func OF((
++ voidpf opaque,
++ voidpf stream));
++
++int ZCALLBACK ferror_file_func OF((
++ voidpf opaque,
++ voidpf stream));
++
++
++voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
++ voidpf opaque;
++ const char* filename;
++ int mode;
++{
++ FILE* file = NULL;
++ const char* mode_fopen = NULL;
++ if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
++ mode_fopen = "rb";
++ else
++ if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
++ mode_fopen = "r+b";
++ else
++ if (mode & ZLIB_FILEFUNC_MODE_CREATE)
++ mode_fopen = "wb";
++
++ if ((filename!=NULL) && (mode_fopen != NULL))
++ file = fopen(filename, mode_fopen);
++ return file;
++}
++
++
++uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
++ voidpf opaque;
++ voidpf stream;
++ void* buf;
++ uLong size;
++{
++ uLong ret;
++ ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
++ return ret;
++}
++
++
++uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
++ voidpf opaque;
++ voidpf stream;
++ const void* buf;
++ uLong size;
++{
++ uLong ret;
++ ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
++ return ret;
++}
++
++long ZCALLBACK ftell_file_func (opaque, stream)
++ voidpf opaque;
++ voidpf stream;
++{
++ long ret;
++ ret = ftell((FILE *)stream);
++ return ret;
++}
++
++long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
++ voidpf opaque;
++ voidpf stream;
++ uLong offset;
++ int origin;
++{
++ int fseek_origin=0;
++ long ret;
++ switch (origin)
++ {
++ case ZLIB_FILEFUNC_SEEK_CUR :
++ fseek_origin = SEEK_CUR;
++ break;
++ case ZLIB_FILEFUNC_SEEK_END :
++ fseek_origin = SEEK_END;
++ break;
++ case ZLIB_FILEFUNC_SEEK_SET :
++ fseek_origin = SEEK_SET;
++ break;
++ default: return -1;
++ }
++ ret = 0;
++ fseek((FILE *)stream, offset, fseek_origin);
++ return ret;
++}
++
++int ZCALLBACK fclose_file_func (opaque, stream)
++ voidpf opaque;
++ voidpf stream;
++{
++ int ret;
++ ret = fclose((FILE *)stream);
++ return ret;
++}
++
++int ZCALLBACK ferror_file_func (opaque, stream)
++ voidpf opaque;
++ voidpf stream;
++{
++ int ret;
++ ret = ferror((FILE *)stream);
++ return ret;
++}
++
++void fill_fopen_filefunc (pzlib_filefunc_def)
++ zlib_filefunc_def* pzlib_filefunc_def;
++{
++ pzlib_filefunc_def->zopen_file = fopen_file_func;
++ pzlib_filefunc_def->zread_file = fread_file_func;
++ pzlib_filefunc_def->zwrite_file = fwrite_file_func;
++ pzlib_filefunc_def->ztell_file = ftell_file_func;
++ pzlib_filefunc_def->zseek_file = fseek_file_func;
++ pzlib_filefunc_def->zclose_file = fclose_file_func;
++ pzlib_filefunc_def->zerror_file = ferror_file_func;
++ pzlib_filefunc_def->opaque = NULL;
++}
+--- misc/zlib-1.1.4/contrib/minizip/ioapi.h 2009-07-17 11:13:30.109375000 +0200
++++ misc/build/zlib-1.1.4/contrib/minizip/ioapi.h 2009-07-17 10:59:06.375000000 +0200
+@@ -0,0 +1,75 @@
++/* ioapi.h -- IO base function header for compress/uncompress .zip
++ files using zlib + zip or unzip API
++
++ Version 1.01e, February 12th, 2005
++
++ Copyright (C) 1998-2005 Gilles Vollant
++*/
++
++#ifndef _ZLIBIOAPI_H
++#define _ZLIBIOAPI_H
++
++
++#define ZLIB_FILEFUNC_SEEK_CUR (1)
++#define ZLIB_FILEFUNC_SEEK_END (2)
++#define ZLIB_FILEFUNC_SEEK_SET (0)
++
++#define ZLIB_FILEFUNC_MODE_READ (1)
++#define ZLIB_FILEFUNC_MODE_WRITE (2)
++#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
++
++#define ZLIB_FILEFUNC_MODE_EXISTING (4)
++#define ZLIB_FILEFUNC_MODE_CREATE (8)
++
++
++#ifndef ZCALLBACK
++
++#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
++#define ZCALLBACK CALLBACK
++#else
++#define ZCALLBACK
++#endif
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
++typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
++typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
++typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
++typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
++typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
++typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
++
++typedef struct zlib_filefunc_def_s
++{
++ open_file_func zopen_file;
++ read_file_func zread_file;
++ write_file_func zwrite_file;
++ tell_file_func ztell_file;
++ seek_file_func zseek_file;
++ close_file_func zclose_file;
++ testerror_file_func zerror_file;
++ voidpf opaque;
++} zlib_filefunc_def;
++
++
++
++void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
++
++#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
++#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
++#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
++#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
++#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
++#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++