update ooo310-m15
[ooovba.git] / applied_patches / 0206-cws-moz2seamonkey01-moz.diff
bloba959919cfd897ef13bb24246857c5c845769d8ed
1 --- moz/extractfiles.mk (.../tags/DEV300_m41/moz) (revision 268999)
2 +++ moz/extractfiles.mk (.../cws/moz2seamonkey01/moz) (revision 268999)
3 @@ -41,6 +41,7 @@
4 plc4 \
5 plds4 \
6 xpcom \
7 + xpcom_core \
8 xpcom_compat \
9 nss3 \
10 ssl3 \
11 @@ -61,13 +62,7 @@
12 msgbaseutil \
13 ldap50 \
14 prldap50
15 -.IF "$(OS)"=="SOLARIS"
16 -.IF "$(CPU)"=="S"
17 -BIN_RUNTIMELIST+= \
18 - freebl_hybrid_3
19 .ENDIF
20 -.ENDIF #"$(OS)"=="SOLARIS"
21 -.ENDIF
23 COMPONENT_RUNTIMELIST= \
24 addrbook \
25 @@ -101,7 +96,8 @@
26 xpcom_io.xpt \
27 xpcom_xpti.xpt \
28 addrbook.xpt \
29 - mozldap.xpt
30 + mozldap.xpt \
31 + pref.xpt
33 .IF "$(GUI)"=="WNT"
34 COMREGISTRY_FILELIST+= xpcom_thread.xpt
35 @@ -127,6 +123,7 @@
36 libnslber32v50.a \
37 libnsldap32v50.a \
38 libnspr4.a \
39 + libxpcom_core.dll.a \
40 libxpcom.dll.a \
41 libnss3.a \
42 libsmime3.a
43 @@ -137,6 +134,7 @@
44 nslber32v50.lib \
45 nsldap32v50.lib \
46 nspr4.lib \
47 + xpcom_core.lib \
48 xpcom.lib \
49 plc4.lib \
50 plds4.lib \
51 @@ -150,6 +148,7 @@
52 libmozreg_s.a \
53 liblber50.a \
54 libnspr4$(DLLPOST) \
55 + libxpcom_core$(DLLPOST) \
56 libxpcom$(DLLPOST) \
57 libmsgbaseutil$(DLLPOST) \
58 libldap50$(DLLPOST) \
59 @@ -266,8 +265,14 @@
60 .ENDIF
62 # zip runtime files to mozruntime.zip
63 +.IF "$(OS)"=="MACOSX" || "$(OS)"=="LINUX"
64 + cd $(RUNTIME_DIR) && sh ..$/..$/..$/$(MOZ_BIN_DIR)$/run-mozilla.sh .$/regxpcom$(REG_SUBFIX)
65 +.ELSE
66 +.IF "$(OS)"!="WNT"
67 cd $(RUNTIME_DIR) && .$/regxpcom$(REG_SUBFIX)
68 $(COPY) $(RUNTIME_DIR)$/components$/xpti.dat $(RUNTIME_DIR)$/components$/xptitemp.dat
69 +.ENDIF
70 +.ENDIF
71 $(RM) $(RUNTIME_DIR)$/regxpcom$(REG_SUBFIX)
72 cd $(RUNTIME_DIR) && zip -r ..$/..$/bin$/mozruntime.zip *
74 --- moz/makefile.mk (.../tags/DEV300_m41/moz) (revision 268999)
75 +++ moz/makefile.mk (.../cws/moz2seamonkey01/moz) (revision 268999)
76 @@ -41,7 +41,6 @@
77 # --- Files --------------------------------------------------------
78 # ----- pkg-config start -------
79 .INCLUDE .IGNORE : pkgroot.mk
81 .IF "$(PKGCONFIG_ROOT)"!=""
82 PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config
83 PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig
84 @@ -58,32 +57,32 @@
85 .IF "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
86 # hmm... rather gcc specific switches...
87 CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib
88 -LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -LX11
89 +LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/X11R6/lib
90 SYSBASE_X11:=--x-includes=$(SYSBASE)/usr/include/X11 --x-libraries=$(SYSBASE)/usr/X11R6/lib
91 .EXPORT : CFLAGS LDFLAGS
92 .ENDIF # "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
94 # ----- pkg-config end -------
96 -MOZILLA_VERSION*=1.7.5
97 -.IF "$(MOZILLA_VERSION)"=="1.7b"
98 -TARFILE_NAME=mozilla-source-1.7b-source
99 -.ELSE
100 -TARFILE_NAME=mozilla-source-$(MOZILLA_VERSION)
101 -.ENDIF
102 +MOZILLA_VERSION*=1.1.13
103 +TARFILE_NAME=seamonkey-$(MOZILLA_VERSION).source
105 TARFILE_ROOTDIR=mozilla
106 +PATCH_FILE_NAME=seamonkey-source-$(MOZILLA_VERSION).patch
108 -PATCH_FILE_NAME=mozilla-source-$(MOZILLA_VERSION).patch
109 +# This file is needed for the W32 build when BUILD_MOZAB is set
110 +# (currently only vc8/vs2005 is supported when BUILD_MOZAB is set)
111 +MOZTOOLS_ZIPFILE_NAME*=vc8-moztools.zip
113 -# These files are needed for the W32 build when BUILD_MOZAB is set
114 -LIBIDL_VC71_ZIPFILE_NAME*=vc71-libIDL-0.6.8-bin.zip
115 -LIBGLIB_VC71_ZIPFILE_NAME*=vc71-glib-1.2.10-bin.zip
116 -WINTOOLS_ZIPFILE_NAME*=wintools.zip
118 ADDITIONAL_FILES=mailnews$/addrbook$/src$/nsAbMD5sum.cpp
120 CONFIGURE_DIR=
121 -MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
122 +.IF "$(GUIBASE)"!="aqua"
123 +MOZILLA_CONFIGURE_FLAGS += $(SYSBASE_X11)
124 +.ENDIF
126 +MOZILLA_CONFIGURE_FLAGS += --disable-tests \
127 + --enable-application=suite \
128 --enable-ldap \
129 --enable-crypto \
130 --enable-optimize \
131 @@ -95,7 +94,6 @@
132 --disable-debug \
133 --disable-xprint \
134 --disable-postscript \
135 - --disable-freetype2 \
136 --without-system-zlib \
137 --disable-installer \
138 --disable-accessibility \
139 @@ -104,20 +102,40 @@
140 --disable-oji \
141 --disable-profilesharing \
142 --disable-boehm \
143 - --disable-jsloader
144 + --disable-jsloader \
145 + --disable-canvas \
146 + --disable-xft \
147 + --disable-freetype2 \
148 + --disable-gnomeui \
149 + --disable-image-encoders \
150 + --disable-plugins \
151 + --disable-printing \
152 + --enable-extensions="pref"
154 +#.IF "$(GUI)"!="WNT"
155 +#MOZILLA_CONFIGURE_FLAGS += --enable-system-cairo
156 +#.ENDIF
158 #disable profilelocking to share profile with mozilla
159 #disable activex and activex-scripting to remove the dependence of Microsoft_SDK\src\mfc\atlbase.h
160 #disable gnomevfs to remove the needed of gnome develop files
161 #disable others to save build times
163 .IF "$(GUI)"=="UNX"
164 +.IF "$(GUIBASE)"=="aqua"
165 +MACDEVSDK*=/Developer/SDKs/MacOSX10.4u.sdk
166 +MOZILLA_CONFIGURE_FLAGS+= \
167 + --with-macos-sdk=$(MACDEVSDK) \
168 + --disable-glibtest \
169 + --enable-macos-target=10.4 \
170 + --disable-libxul
171 +DEFAULT_MOZILLA_TOOLKIT=mac
172 +.ELSE
173 #We do not need mozilla ui, but libIDL version are decided by default toolkit.
174 #default-toolkit=xlib need libIDL < 0.68
175 #default-toolkit=gtk2 need libIDL > 0.8 (know as libIDL2)
176 -.IF "x$(DEFAULT_MOZILLA_TOOLKIT)"=="x"
177 -DEFAULT_MOZILLA_TOOLKIT=gtk2
178 -.ENDIF
179 +DEFAULT_MOZILLA_TOOLKIT*=gtk2
180 +.ENDIF # "$(GUIBASE)"=="aqua"
181 MOZILLA_CONFIGURE_FLAGS+= --enable-default-toolkit=$(DEFAULT_MOZILLA_TOOLKIT)
182 .ENDIF
184 @@ -145,6 +163,10 @@
185 .IF "$(OS)"=="SOLARIS" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
186 PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
187 .EXPORT: PKG_CONFIG_PATH
188 +MAKE=/usr/sfw/bin/gmake
189 +.EXPORT: MAKE
190 +CFLAGS=-I/usr/sfw/include
191 +.EXPORT: CFLAGS
192 .ENDIF
193 .IF "$(COM)"=="C52" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
194 CFLAGS=-m64
195 @@ -152,7 +174,7 @@
196 .EXPORT: CFLAGS ASFLAGS
197 .ENDIF
199 -MOZDIR=$(MISC)$/build$/mozilla
200 +MOZDIR=$(MISC)$/build$/seamonkey
201 MOZTARGET=$(OS)$(COM)$(CPU)
203 .IF "$(GUI)"=="WNT"
204 @@ -186,33 +208,23 @@
205 .ENDIF
207 # Variables to install/use our own wintools
208 -MOZTOOLSUNPACK:=$(MISC)$/build$/moztoolsunpack
209 -MOZTOOLSINST:=$(MISC)$/build$/moztoolsinst
210 +MOZTOOLS_EXTRACT:=$(MISC)$/build$/moztools
211 .IF "$(USE_SHELL)"!="4nt"
212 -MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztoolsinst
213 +MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztools\vc8-moztools
214 .IF "$(COM)"=="GCC"
215 -PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin
216 +PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin
217 .ELSE
218 -PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
219 +PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
220 .ENDIF
221 -.IF "$(USE_SHELL)"=="tcsh"
222 -SET_MOZ_TOOLS_INSTALL_BAT:=setenv MOZ_TOOLS "$(MOZ_TOOLS_DOS)"
223 -.ELIF "$(USE_SHELL)"=="bash"
224 -SET_MOZ_TOOLS_INSTALL_BAT:=export "MOZ_TOOLS=$(MOZ_TOOLS_DOS)"
225 -.ELSE
226 -SET_MOZ_TOOLS_INSTALL_BAT:=MOZ_TOOLS="$(MOZ_TOOLS_DOS)"; export MOZ_TOOLS
227 -.ENDIF
228 .ELSE # "$(USE_SHELL)"!="4nt"
229 # MOZ_TOOLS must contain an absolute path
230 -MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztoolsinst
231 -PATH!:=$(MOZ_TOOLS_DOS)\vc71\bin;$(MOZ_TOOLS_DOS)\bin;$(PATH)
232 -SET_MOZ_TOOLS_INSTALL_BAT:=set MOZ_TOOLS=$(MOZ_TOOLS_DOS)
233 +MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztools\vc8-moztools
234 +PATH!:=$(MOZ_TOOLS_DOS)\bin;$(PATH)
235 .ENDIF # "$(USE_SHELL)"!="4nt"
237 MOZ_TOOLS:=$(subst,\,/ $(MOZ_TOOLS_DOS))
238 -GLIB_PREFIX:=$(MOZ_TOOLS)/vc71
239 -LIBIDL_PREFIX:=$(MOZ_TOOLS)/vc71
241 -.EXPORT : PATH MOZ_TOOLS GLIB_PREFIX LIBIDL_PREFIX
242 +.EXPORT : PATH MOZ_TOOLS
243 .ENDIF # "$(GUI)"=="WNT"
245 # --- Targets ------------------------------------------------------
246 @@ -227,7 +239,7 @@
247 .INCLUDE : tg_ext.mk
249 .IF "$(GUI)"=="WNT"
250 -NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/wintools.complete
251 +NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/moztools.complete
252 .ENDIF # "$(GUI)"=="WNT"
254 ALLTAR: $(NEEDWINTOOLSFLAGFILE) \
255 @@ -245,29 +257,19 @@
257 # Unpack/setup Windows build tools
258 .IF "$(GUI)"=="WNT"
259 -$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/wintools.complete
260 +$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/moztools.complete
262 -$(MISC)$/build$/wintools.unpack : $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME)
263 - -$(RENAME) $(MOZTOOLSUNPACK) $(MOZTOOLSUNPACK)_removeme
264 - -$(RENAME) $(MOZTOOLSINST) $(MOZTOOLSINST)_removeme
265 - -rm -rf $(MOZTOOLSUNPACK)_removeme $(MOZTOOLSINST)_removeme
266 - @-$(MKDIRHIER) $(MOZTOOLSUNPACK)
267 - unzip $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME) -d $(MOZTOOLSUNPACK)
268 - $(TOUCH) $(MISC)$/build$/wintools.unpack
269 +$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME)
270 + -$(RENAME) $(MOZTOOLS_EXTRACT) $(MOZTOOLS_EXTRACT)_removeme
271 + -rm -rf $(MOZTOOLS_EXTRACT)_removeme
272 + @-$(MKDIRHIER) $(MOZTOOLS_EXTRACT)
273 + unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLS_EXTRACT)
274 +# chmod is also needed for W32-4nt build (when cygwin unzip is used)
275 + -chmod -R +x $(MOZTOOLS_EXTRACT)$/vc8-moztools$/bin
276 + $(TOUCH) $(MISC)$/build$/moztools.unpack
278 -$(MISC)$/build$/wintools.install : $(MISC)$/build$/wintools.unpack
279 - cd $(MOZTOOLSUNPACK)$/buildtools$/windows && $(SET_MOZ_TOOLS_INSTALL_BAT) && cmd /c install.bat
280 - $(TOUCH) $(MISC)$/build$/wintools.install
282 -$(MISC)$/build$/wintools.complete : \
283 - $(MISC)$/build$/wintools.install \
284 - $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) \
285 - $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME)
286 - unzip $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
287 - unzip $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
288 -# chmod is also needed for W32-4nt build (when cygwin unzip is used)
289 - -chmod -R +x $(MOZTOOLSINST)$/vc71$/bin
290 - $(TOUCH) $(MISC)$/build$/wintools.complete
291 +$(MISC)$/build$/moztools.complete : $(MISC)$/build$/moztools.unpack
292 + $(TOUCH) $(MISC)$/build$/moztools.complete
293 .ENDIF # "$(GUI)"=="WNT"
295 zip: \
296 --- moz/seamonkey-source-1.1.13.patch (.../tags/DEV300_m41/moz) (revision 0)
297 +++ moz/seamonkey-source-1.1.13.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
298 @@ -0,0 +1,6880 @@
299 +--- misc/mozilla/build/autoconf/mozconfig-find 2007-02-16 03:19:06.000000000 +0100
300 ++++ misc/build/mozilla/build/autoconf/mozconfig-find 2008-08-19 10:12:04.000000000 +0200
301 +@@ -51,10 +51,7 @@
302 + "$topsrcdir/.mozconfig" \
303 + "$topsrcdir/mozconfig" \
304 + "$topsrcdir/mozconfig.sh" \
305 +- "$topsrcdir/myconfig.sh" \
306 +- "$HOME/.mozconfig" \
307 +- "$HOME/.mozconfig.sh" \
308 +- "$HOME/.mozmyconfig.sh"
309 ++ "$topsrcdir/myconfig.sh"
310 + do
311 + if test -f "$_config"; then
312 + echo "$_config";
313 +--- misc/mozilla/build/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
314 ++++ misc/build/mozilla/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
315 +@@ -1,4 +1,4 @@
316 +-#!/bin/sh
317 ++#!/bin/bash
319 + # Stupid wrapper to avoid win32 dospath/cygdrive issues
320 + # Try not to spawn programs from within this file. If the stuff in here looks royally
321 +@@ -57,12 +57,36 @@
322 + i=-I${mountpoint}/${driveletter}/${pathname}
323 + fi
324 + else
325 +- eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
326 +- if ! test "${leader}" = "${i}"; then
327 +- eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
328 +- eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
329 +- driveletter=${no_mountpoint%%/*}
330 +- i=${leader}${driveletter}:/${pathname}
331 ++ # The original version missed mounted paths, the new version below
332 ++ # doesn't transform /para as this is most likely a parameter.
333 ++ eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
334 ++ if ! test "$notinpath" = "$i"; then
335 ++ # found $mountpoint
336 ++ eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
337 ++ eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
338 ++ driveletter=${withdrive%%/*}
339 ++ i=${notinpath}${driveletter}:/${restpath}
340 ++ else
341 ++ # check for potential path. Precheck using shell methods
342 ++ doconvert=""
343 ++ # Shortcut -X<path> when path does not begin with '/'
344 ++ noswitch=${i#-[a-zA-Z]}
345 ++ if test "$noswitch" != "$i"; then
346 ++ test "${noswitch#/}" != "$noswitch" && doconvert="1"
347 ++ fi
348 ++ # Precheck for possible path. Consider only absolute paths that contain at least
349 ++ # a second / to prevent converting of /abc parameters.
350 ++ test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
351 ++ if test -n "$doconvert"; then
352 ++ # Can be a path. If forking grep would be faster or we could require bash 3
353 ++ # this regexp would be all that's needed to find pathnames that need converting
354 ++ pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
355 ++ eval 'notinpath=${i%'${pathname}'}'
356 ++ if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
357 ++ pathname=`cygpath -am "$pathname"`
358 ++ i=${notinpath}${pathname}
359 ++ fi
360 ++ fi
361 + fi
362 + fi
363 + fi
364 +--- misc/mozilla/config/Makefile.in 2006-12-22 14:50:41.000000000 +0100
365 ++++ misc/build/mozilla/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
366 +@@ -166,7 +166,7 @@
368 + ifdef MOZ_ENABLE_GTK2
369 + GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
370 +- GLIB_LIBS = $(MOZ_GTK2_LIBS)
371 ++ GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
372 + endif
374 + build_number: FORCE
375 +--- misc/mozilla/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
376 ++++ misc/build/mozilla/config/autoconf.mk.in 2008-11-07 16:08:52.937500000 +0100
377 +@@ -543,6 +543,7 @@
378 + MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
379 + MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
380 + MOZ_QUANTIFY = @MOZ_QUANTIFY@
381 ++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
383 + #python options
384 + PYTHON = @MOZ_PYTHON@
385 +--- misc/mozilla/config/config.mk 2008-01-29 20:30:22.000000000 +0100
386 ++++ misc/build/mozilla/config/config.mk 2008-08-14 16:22:21.000000000 +0200
387 +@@ -758,6 +758,23 @@
388 + endif
391 ++# Shared library RUNPATH linker option(s)
393 ++ifeq ($(OS_ARCH),Linux)
394 ++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
395 ++ifdef IS_COMPONENT
396 ++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
397 ++endif # IS_COMPONENT
398 ++endif # Linux
400 ++ifeq ($(OS_ARCH),SunOS)
401 ++EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
402 ++ifdef IS_COMPONENT
403 ++EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
404 ++endif # IS_COMPONENT
405 ++endif # SunOS
408 + # Include any personal overrides the user might think are needed.
410 + -include $(MY_CONFIG)
411 +--- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
412 ++++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100
413 +@@ -529,8 +529,9 @@
414 + ifeq ($(OS_ARCH),WINNT)
415 + ifdef GNU_CC
416 + ifndef IS_COMPONENT
417 +-DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
418 ++DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
419 + endif
420 ++DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
421 + endif
422 + endif
424 +@@ -811,6 +810,12 @@
426 + ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
427 + $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
428 ++ifdef MSMANIFEST_TOOL
429 ++ @if test -f $@.manifest; then \
430 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
431 ++ rm -f $@.manifest; \
432 ++ fi
433 ++endif # MSVC with manifest tool
434 + else
435 + ifeq ($(CPP_PROG_LINK),1)
436 + $(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)
437 +@@ -843,6 +848,12 @@
438 + else
439 + ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
440 + $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
441 ++ifdef MSMANIFEST_TOOL
442 ++ @if test -f $@.manifest; then \
443 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
444 ++ rm -f $@.manifest; \
445 ++ fi
446 ++endif # MSVC with manifest tool
447 + else
448 + $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
449 + endif
450 +@@ -866,6 +877,12 @@
451 + else
452 + ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
453 + $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
454 ++ifdef MSMANIFEST_TOOL
455 ++ @if test -f $@.manifest; then \
456 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
457 ++ rm -f $@.manifest; \
458 ++ fi
459 ++endif # MSVC with manifest tool
460 + else
461 + ifeq ($(CPP_PROG_LINK),1)
462 + $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
463 +@@ -1019,6 +1036,14 @@
464 + endif # SHARED_LIBRARY_LIBS
465 + endif # NO_LD_ARCHIVE_FLAGS
466 + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
467 ++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
468 ++ifdef MSMANIFEST_TOOL
469 ++ @if test -f $@.manifest; then \
470 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
471 ++ rm -f $@.manifest; \
472 ++ fi
473 ++endif # MSVC with manifest tool
474 ++endif # WINNT && !GCC
475 + @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
476 + else # os2 vacpp
477 + $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
478 +@@ -1043,7 +1070,7 @@
479 + if test -d $(@D); then \
480 + echo "Building deps for $<"; \
481 + touch $(_MDDEPFILE) && \
482 +- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
483 ++ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
484 + mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
485 + cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
486 + fi
487 +@@ -1053,7 +1080,7 @@
488 + if test -d $(@D); then \
489 + echo "Building deps for $<"; \
490 + touch $(_MDDEPFILE) && \
491 +- $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
492 ++ $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
493 + mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
494 + cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
495 + fi
496 +@@ -1325,6 +1352,7 @@
498 + $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
499 + $(REPORT_BUILD)
500 ++ echo "PATH=" $(PATH)
501 + $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
502 + @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
503 + then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
504 +@@ -1696,14 +1724,14 @@
505 + define MAKE_DEPS_NOAUTO
506 + set -e ; \
507 + touch $@ && \
508 +- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
509 ++ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
510 + mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
511 + endef
512 + else
513 + define MAKE_DEPS_NOAUTO
514 + set -e ; \
515 + touch $@ && \
516 +- $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
517 ++ $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
518 + mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
519 + endef
520 + endif # WINNT
521 +--- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100
522 ++++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100
523 +@@ -1068,6 +1068,8 @@
524 + GCONF_VERSION=1.2.1
525 + LIBGNOME_VERSION=2.0
527 ++MSMANIFEST_TOOL=
529 + MISSING_X=
530 + for ac_prog in gawk mawk nawk awk
531 + do
532 +@@ -3022,9 +3024,26 @@
533 + _CC_SUITE=7
534 + elif test "$_CC_MAJOR_VERSION" = "14"; then
535 + _CC_SUITE=8
536 ++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
537 + else
538 + { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
539 + fi
541 ++ # bug #249782
542 ++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
543 ++ if test "$_CC_SUITE" -ge "8"; then
544 ++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
545 ++ if test -n "MSMT_TOOL"; then
546 ++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
547 ++ if test -z "MSMANIFEST_TOOL_VERSION"; then
548 ++ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
549 ++ fi
550 ++ MSMANIFEST_TOOL=1
551 ++ unset MSMT_TOOL
552 ++ else
553 ++ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
554 ++ fi
555 ++ fi
557 + # Check linker version
558 + _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
559 +@@ -5726,6 +5745,7 @@
560 + if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
561 + _pwd=`pwd`
562 + CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
563 ++ CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
564 + fi
565 + if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
566 + AS_PERL=1
567 +@@ -6036,7 +6056,7 @@
568 + CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
569 + DLL_SUFFIX=".dylib"
570 + DSO_LDOPTS=''
571 +- STRIP="$STRIP -x -S"
572 ++ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
573 + _PLATFORM_DEFAULT_TOOLKIT='mac'
574 + MOZ_ENABLE_POSTSCRIPT=
575 + TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
576 +@@ -6075,7 +6095,7 @@
577 + ;;
579 + *-freebsd*)
580 +- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
581 ++ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
582 + DLL_SUFFIX=".so.1.0"
583 + DSO_LDOPTS="-shared"
584 + fi
585 +@@ -6718,7 +6738,7 @@
586 + MOZ_USER_DIR="Mozilla"
588 + if test "$MOZTOOLS"; then
589 +- MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
590 ++ MOZ_TOOLS_DIR=`echo $MOZTOOLS`
591 + else
592 + { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
593 + fi
594 +@@ -8614,6 +8634,8 @@
595 + case $target in
596 + *-hpux11.*)
597 + ;;
598 ++*-freebsd*)
599 ++ ;;
600 + *)
601 + echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
602 + echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
603 +@@ -12259,7 +12281,7 @@
604 + gtk2)
605 + MOZ_ENABLE_GTK2=1
606 + MOZ_ENABLE_XREMOTE=1
607 +- MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-}
608 ++ MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-1}
609 + TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
610 + TK_LIBS='$(MOZ_GTK2_LIBS)'
611 + cat >> confdefs.h <<\EOF
612 +@@ -19233,7 +19255,8 @@
613 + MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
615 + if test "$MOZ_X11"; then
616 +- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
617 ++# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
618 ++ MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
619 + fi
620 + if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
621 + MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
622 +@@ -20076,8 +20099,12 @@
623 + WIN_TOP_SRC=`cd $srcdir; pwd -W`
624 + ;;
625 + cygwin*|msvc*|mks*)
626 +- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
627 +- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
628 ++# Don't add the wrapper for the HOST_* versions as they contain an
629 ++# unexpanded $CC and therfore wil get the wrapper below.
630 ++ if test -n "$GNU_CC"; then
631 ++ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
632 ++ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
633 ++ fi
634 + CC="\$(CYGWIN_WRAPPER) $CC"
635 + CXX="\$(CYGWIN_WRAPPER) $CXX"
636 + CPP="\$(CYGWIN_WRAPPER) $CPP"
637 +--- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100
638 ++++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100
639 +@@ -126,6 +126,8 @@
640 + GCONF_VERSION=1.2.1
641 + LIBGNOME_VERSION=2.0
643 ++MSMANIFEST_TOOL=
645 + dnl Set various checks
646 + dnl ========================================================
647 + MISSING_X=
648 +@@ -425,9 +427,26 @@
649 + _CC_SUITE=7
650 + elif test "$_CC_MAJOR_VERSION" = "14"; then
651 + _CC_SUITE=8
652 ++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
653 + else
654 + AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
655 + fi
657 ++ # bug #249782
658 ++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
659 ++ if test "$_CC_SUITE" -ge "8"; then
660 ++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
661 ++ if test -n "MSMT_TOOL"; then
662 ++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
663 ++ if test -z "MSMANIFEST_TOOL_VERSION"; then
664 ++ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
665 ++ fi
666 ++ MSMANIFEST_TOOL=1
667 ++ unset MSMT_TOOL
668 ++ else
669 ++ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
670 ++ fi
671 ++ fi
673 + # Check linker version
674 + _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
675 +@@ -1530,7 +1549,7 @@
676 + CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
677 + DLL_SUFFIX=".dylib"
678 + DSO_LDOPTS=''
679 +- STRIP="$STRIP -x -S"
680 ++ STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
681 + _PLATFORM_DEFAULT_TOOLKIT='mac'
682 + MOZ_ENABLE_POSTSCRIPT=
683 + TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
684 +@@ -1552,7 +1571,7 @@
685 + ;;
687 + *-freebsd*)
688 +- if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
689 ++ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
690 + DLL_SUFFIX=".so.1.0"
691 + DSO_LDOPTS="-shared"
692 + fi
693 +@@ -2749,6 +2768,8 @@
694 + case $target in
695 + *-hpux11.*)
696 + ;;
697 ++*-freebsd*)
698 ++ ;;
699 + *)
700 + AC_CHECK_LIB(c_r, gethostbyname_r)
701 + ;;
702 +@@ -7321,6 +7342,7 @@
703 + AC_SUBST(USE_N32)
704 + AC_SUBST(CC_VERSION)
705 + AC_SUBST(CXX_VERSION)
706 ++AC_SUBST(MSMANIFEST_TOOL)
708 + if test "$USING_HCC"; then
709 + CC='${topsrcdir}/build/hcc'
710 +@@ -7416,8 +7438,12 @@
711 + WIN_TOP_SRC=`cd $srcdir; pwd -W`
712 + ;;
713 + cygwin*|msvc*|mks*)
714 +- HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
715 +- HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
716 ++# Don't add the wrapper for the HOST_* versions as they contain an
717 ++# unexpanded $CC and therfore wil get the wrapper below.
718 ++ if test -n "$GNU_CC"; then
719 ++ HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
720 ++ HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
721 ++ fi
722 + CC="\$(CYGWIN_WRAPPER) $CC"
723 + CXX="\$(CYGWIN_WRAPPER) $CXX"
724 + CPP="\$(CYGWIN_WRAPPER) $CPP"
725 +--- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100
726 ++++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200
727 +@@ -384,7 +384,7 @@
728 + ifdef NS_USE_GCC
729 + LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
730 + LINK_LIB = $(AR) cr $@ $(OBJS)
731 +-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)
732 ++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)
733 + else
734 + DEBUG_LINK_OPT=-DEBUG
735 + ifeq ($(BUILD_OPT), 1)
736 +--- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100
737 ++++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
738 +@@ -70,7 +70,7 @@
740 + ARCH = freebsd
742 +-MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
743 ++MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
745 + ifeq ($(MOZ_OBJFORMAT),elf)
746 + DLL_SUFFIX = so
747 +--- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100
748 ++++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
749 +@@ -25,6 +25,7 @@
750 + LIB_SUFFIX = @LIB_SUFFIX@
751 + LIB_PREFIX = @LIB_PREFIX@
752 + DLL_SUFFIX = @DLL_SUFFIX@
753 ++DLL_PREFIX = @DLL_PREFIX@
754 + ASM_SUFFIX = @ASM_SUFFIX@
755 + PROG_SUFFIX = @PROG_SUFFIX@
756 + MOD_NAME = @NSPR_MODNAME@
757 +--- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
758 ++++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
759 +@@ -1,4 +1,4 @@
760 +-#!/bin/sh
761 ++#!/bin/bash
763 + # Stupid wrapper to avoid win32 dospath/cygdrive issues
764 + # Try not to spawn programs from within this file. If the stuff in here looks royally
765 +--- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100
766 ++++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200
767 +@@ -2738,6 +2738,7 @@
768 + LIB_SUFFIX=a
769 + LIB_PREFIX=lib
770 + DLL_SUFFIX=so
771 ++DLL_PREFIX=lib
772 + ASM_SUFFIX=s
773 + MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
774 + PR_MD_ASFILES=
775 +@@ -3444,7 +3445,7 @@
776 + EOF
778 + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
779 +- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
780 ++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
781 + if test "$MOZ_OBJFORMAT" = "elf"; then
782 + DLL_SUFFIX=so
783 + else
784 +@@ -3811,6 +3812,7 @@
785 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
786 + DSO_CFLAGS=-fPIC
787 + DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
788 ++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
789 + OS_LIBS="$OS_LIBS -lc"
790 + _OPTIMIZE_FLAGS=-O2
791 + _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
792 +@@ -3880,7 +3882,8 @@
793 + CC="$CC -mno-cygwin"
794 + CXX="$CXX -mno-cygwin"
795 + DLL_SUFFIX=dll
796 +- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
797 ++ DLL_PREFIX=
798 ++ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
799 + # Use temp file for windres (bug 213281)
800 + RC="$WINDRES -O coff --use-temp-file"
801 + else
802 +@@ -3897,6 +3900,7 @@
803 + LIB_SUFFIX=lib
804 + LIB_PREFIX=
805 + DLL_SUFFIX=dll
806 ++ DLL_PREFIX=
808 + CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
809 + DLLFLAGS='-OUT:"$@"'
810 +@@ -4293,6 +4297,7 @@
811 + NSINSTALL=nsinstall
812 + LIB_PREFIX=
813 + LIB_SUFFIX=lib
814 ++ DLL_PREFIX=
815 + DLL_SUFFIX=dll
816 + DLLTOOL=''
817 + RC=rc.exe
818 +@@ -4660,6 +4665,7 @@
819 + LD=/usr/ccs/bin/ld
820 + RANLIB=/usr/ccs/bin/ranlib
821 + DSO_LDOPTS='-G -h $(notdir $@)'
822 ++ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
823 + if test -n "$GNU_CC"; then
824 + DSO_CFLAGS=-fPIC
825 + else
826 +@@ -5844,6 +5850,7 @@
827 + s%@LIB_SUFFIX@%$LIB_SUFFIX%g
828 + s%@LIB_PREFIX@%$LIB_PREFIX%g
829 + s%@DLL_SUFFIX@%$DLL_SUFFIX%g
830 ++s%@DLL_PREFIX@%$DLL_PREFIX%g
831 + s%@ASM_SUFFIX@%$ASM_SUFFIX%g
832 + s%@PROG_SUFFIX@%$PROG_SUFFIX%g
833 + s%@MKSHLIB@%$MKSHLIB%g
834 +--- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200
835 ++++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200
836 +@@ -549,6 +549,7 @@
837 + LIB_SUFFIX=a
838 + LIB_PREFIX=lib
839 + DLL_SUFFIX=so
840 ++DLL_PREFIX=lib
841 + ASM_SUFFIX=s
842 + MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
843 + PR_MD_ASFILES=
844 +@@ -1037,7 +1038,7 @@
845 + AC_DEFINE(FREEBSD)
846 + AC_DEFINE(HAVE_BSD_FLOCK)
847 + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
848 +- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
849 ++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
850 + if test "$MOZ_OBJFORMAT" = "elf"; then
851 + DLL_SUFFIX=so
852 + else
853 +@@ -1285,6 +1286,7 @@
854 + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
855 + DSO_CFLAGS=-fPIC
856 + DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
857 ++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
858 + OS_LIBS="$OS_LIBS -lc"
859 + _OPTIMIZE_FLAGS=-O2
860 + _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
861 +@@ -1336,6 +1338,8 @@
862 + CC="$CC -mno-cygwin"
863 + CXX="$CXX -mno-cygwin"
864 + DLL_SUFFIX=dll
865 ++ DLL_SUFFIX=dll
866 ++ DLL_PREFIX=
867 + MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
868 + # Use temp file for windres (bug 213281)
869 + RC="$WINDRES -O coff --use-temp-file"
870 +@@ -1353,6 +1357,7 @@
871 + LIB_SUFFIX=lib
872 + LIB_PREFIX=
873 + DLL_SUFFIX=dll
874 ++ DLL_PREFIX=
876 + CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
877 + DLLFLAGS='-OUT:"$@"'
878 +@@ -1820,6 +1825,7 @@
879 + LD=/usr/ccs/bin/ld
880 + RANLIB=/usr/ccs/bin/ranlib
881 + DSO_LDOPTS='-G -h $(notdir $@)'
882 ++ DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
883 + if test -n "$GNU_CC"; then
884 + DSO_CFLAGS=-fPIC
885 + else
886 +@@ -2410,6 +2416,7 @@
887 + AC_SUBST(LIB_SUFFIX)
888 + AC_SUBST(LIB_PREFIX)
889 + AC_SUBST(DLL_SUFFIX)
890 ++AC_SUBST(DLL_PREFIX)
891 + AC_SUBST(ASM_SUFFIX)
892 + AC_SUBST(PROG_SUFFIX)
893 + AC_SUBST(MKSHLIB)
894 +--- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
895 ++++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100
896 +@@ -85,6 +85,11 @@
898 + ###########################################################################
900 ++ifeq ($(TERM),cygwin)
901 ++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
902 ++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
903 ++endif
905 + all export:: $(INCLUDEDIR) $(GENHEADERS)
906 + $(NSINSTALL) -D $(PRIVATEINCDIR)
907 + $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
908 +--- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100
909 ++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
910 +@@ -109,7 +109,7 @@
911 + HDIR = $(topsrcdir)/ldap/include
913 + LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
914 +-DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
915 ++DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
917 + INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
919 +@@ -320,6 +320,10 @@
920 + -$(RM) $(SO_FILES_TO_REMOVE)
921 + endif
922 + $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
923 ++ if test -f $@.manifest; then \
924 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
925 ++ rm -f $@.manifest; \
926 ++ fi
928 + veryclean:: clean
930 +--- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
931 ++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
932 +@@ -62,7 +62,7 @@
933 + LIBPRLDAP =
934 + endif
935 + DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
936 +- $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
937 ++ $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
939 + INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
941 +--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200
942 ++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200
943 +@@ -41,7 +41,7 @@
944 + HDIR = $(topsrcdir)/ldap/include
946 + LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
947 +-DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
948 ++DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
950 + INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
952 +@@ -76,7 +92,7 @@
954 + # variable definitions for exported symbols
955 + ifeq ($(OS_ARCH), WINNT)
956 +- SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
957 ++ SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
958 + else
959 + SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
960 + endif
961 +--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
962 ++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
963 +@@ -56,7 +56,7 @@
964 + HDIR = $(topsrcdir)/ldap/include
966 + LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
967 +-DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
968 ++DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
970 + INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
972 +--- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100
973 ++++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
974 +@@ -112,14 +112,14 @@
975 + gtkmozembed_internal.h
977 + ifdef MOZ_ENABLE_GTK
978 +-EXTRA_DSO_LDOPTS = \
979 ++EXTRA_DSO_LDOPTS += \
980 + $(MOZ_COMPONENT_LIBS) \
981 + -lgtksuperwin \
982 + $(NULL)
983 + endif
985 + ifdef MOZ_ENABLE_GTK2
986 +-EXTRA_DSO_LDOPTS = \
987 ++EXTRA_DSO_LDOPTS += \
988 + $(MOZ_COMPONENT_LIBS) \
989 + $(NULL)
990 + endif
991 +--- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100
992 ++++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200
993 +@@ -63,10 +63,11 @@
994 + TestGtkEmbedNotebook.cpp \
995 + TestGtkEmbedSocket.cpp \
996 + TestGtkEmbedChild.cpp
997 +-endif
999 + SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
1001 ++endif
1003 + # ENABLE_GNOME=1
1005 + ifdef ENABLE_GNOME
1006 +--- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200
1007 ++++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100
1008 +@@ -68,25 +68,15 @@
1010 + unexport CC CXX
1012 +-ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
1013 +-ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
1014 +-export::
1015 +- rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
1016 +- ln -fs $(srcdir)/src
1017 +- ln -fs $(srcdir)/res
1018 +- ln -fs $(srcdir)/public
1019 +- ln -fs $(srcdir)/Info-*.plist .
1020 +-endif
1022 + libs::
1023 + # Bug 297227: The next line doesn't need to stay around forever, only
1024 + # long enough to clean up existing depend builds from when xcodebuild
1025 + # was being instructed to "install"
1026 + if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
1028 +- $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
1029 +- mkdir -p $(DIST)/package
1030 +- $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
1031 ++# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
1032 ++# mkdir -p $(DIST)/package
1033 ++# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
1035 + clean clobber::
1036 + rm -rf build
1037 +--- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200
1038 ++++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
1039 +@@ -110,7 +110,7 @@
1040 + $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
1041 + $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
1042 + ifndef MINIMO
1043 +- -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
1044 ++ -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
1045 + endif
1046 + ifeq ($(OS_ARCH),WINNT)
1047 + ifeq ($(WINAPP),mfcembed)
1048 +--- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100
1049 ++++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
1050 +@@ -85,7 +85,7 @@
1051 + endif
1054 +-EXTRA_DSO_LDOPTS = \
1055 ++EXTRA_DSO_LDOPTS += \
1056 + $(LIBS_DIR) \
1057 + $(MOZ_JS_LIBS) \
1058 + $(MOZ_COMPONENT_LIBS) \
1059 +--- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100
1060 ++++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200
1061 +@@ -55,5 +55,5 @@
1062 + bin/components/sqlpgsql.xpt \
1063 + bin/components/sqlsqlite.xpt \
1064 + bin/components/sqlmysql.xpt \
1065 +- bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
1066 ++ bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
1067 + bin/chrome/sql.jar
1068 +--- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200
1069 ++++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200
1070 +@@ -76,10 +76,11 @@
1071 + native FT_Sfnt_Tag(FT_Sfnt_Tag);
1072 + native FT_Size(FT_Size);
1074 +-[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
1075 ++[ptr] native FTC_ImageType_p(FTC_ImageType);
1076 + native FTC_Face_Requester(FTC_Face_Requester);
1077 + native FTC_Font(FTC_Font);
1078 +-native FTC_Image_Cache(FTC_Image_Cache);
1079 ++native FTC_FaceID(FTC_FaceID);
1080 ++native FTC_ImageCache(FTC_ImageCache);
1081 + native FTC_Manager(FTC_Manager);
1083 + // #ifdef MOZ_SVG
1084 +@@ -99,7 +100,7 @@
1086 + readonly attribute FT_Library library;
1087 + readonly attribute FTC_Manager FTCacheManager;
1088 +- readonly attribute FTC_Image_Cache ImageCache;
1089 ++ readonly attribute FTC_ImageCache ImageCache;
1091 + void doneFace(in FT_Face face);
1092 + void doneFreeType(in FT_Library lib);
1093 +@@ -115,16 +116,16 @@
1094 + void outlineDecompose(in FT_Outline_p outline,
1095 + in const_FT_Outline_Funcs_p funcs, in voidPtr p);
1096 + void setCharmap(in FT_Face face, in FT_CharMap charmap);
1097 +- void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
1098 ++ void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
1099 + in FT_UInt gindex, out FT_Glyph glyph);
1100 +- void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
1101 +- out FT_Face face, out FT_Size size);
1102 ++ void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
1103 ++ out FT_Face face);
1104 + void managerDone(in FTC_Manager manager);
1105 + void managerNew(in FT_Library lib, in FT_UInt max_faces,
1106 + in FT_UInt max_sizes, in FT_ULong max_bytes,
1107 + in FTC_Face_Requester requester, in FT_Pointer req_data,
1108 + out FTC_Manager manager);
1109 +- void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
1110 ++ void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
1111 + /* #ifdef MOZ_SVG */
1112 + void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
1113 + in FT_Vector_p delta);
1114 +--- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200
1115 ++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
1116 +@@ -111,7 +111,7 @@
1117 + {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
1118 + {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
1119 + {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
1120 +- {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
1121 ++ {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
1122 + {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
1123 + {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
1124 + {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
1125 +@@ -288,7 +288,7 @@
1126 + }
1128 + NS_IMETHODIMP
1129 +-nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
1130 ++nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
1131 + FT_UInt glyphID, FT_Glyph *glyph)
1132 + {
1133 + // call the FreeType2 function via the function pointer
1134 +@@ -297,11 +297,11 @@
1135 + }
1137 + NS_IMETHODIMP
1138 +-nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
1139 +- FT_Face *face, FT_Size *size)
1140 ++nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
1141 ++ FT_Face *face)
1142 + {
1143 + // call the FreeType2 function via the function pointer
1144 +- FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
1145 ++ FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
1146 + return error ? NS_ERROR_FAILURE : NS_OK;
1147 + }
1149 +@@ -326,7 +326,7 @@
1150 + }
1152 + NS_IMETHODIMP
1153 +-nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
1154 ++nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
1155 + {
1156 + // call the FreeType2 function via the function pointer
1157 + FT_Error error = nsFTC_Image_Cache_New(manager, cache);
1158 +@@ -395,7 +395,7 @@
1159 + }
1161 + NS_IMETHODIMP
1162 +-nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
1163 ++nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
1165 + *aCache = mImageCache;
1166 + return NS_OK;
1167 +--- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200
1168 ++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200
1169 +@@ -120,13 +120,13 @@
1170 + typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
1171 + typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
1172 + typedef FT_Error (*FTC_Image_Cache_Lookup_t)
1173 +- (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
1174 +-typedef FT_Error (*FTC_Manager_Lookup_Size_t)
1175 +- (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
1176 ++ (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
1177 ++typedef FT_Error (*FTC_Manager_LookupFace_t)
1178 ++ (FTC_Manager, FTC_FaceID, FT_Face*);
1179 + typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
1180 + typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
1181 + FTC_Face_Requester, FT_Pointer, FTC_Manager*);
1182 +-typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
1183 ++typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
1184 + // #ifdef MOZ_SVG
1185 + typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
1186 + typedef FT_Error (*FT_Get_Kerning_t)
1187 +@@ -181,7 +181,7 @@
1188 + FT_Outline_Decompose_t nsFT_Outline_Decompose;
1189 + FT_Set_Charmap_t nsFT_Set_Charmap;
1190 + FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
1191 +- FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
1192 ++ FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
1193 + FTC_Manager_Done_t nsFTC_Manager_Done;
1194 + FTC_Manager_New_t nsFTC_Manager_New;
1195 + FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
1196 +@@ -229,7 +229,7 @@
1197 + PRLibrary *mSharedLib;
1198 + FT_Library mFreeTypeLibrary;
1199 + FTC_Manager mFTCacheManager;
1200 +- FTC_Image_Cache mImageCache;
1201 ++ FTC_ImageCache mImageCache;
1203 + static nsHashtable *sFontFamilies;
1204 + static nsHashtable *sRange1CharSetNames;
1205 +--- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200
1206 ++++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200
1207 +@@ -211,6 +211,10 @@
1208 + CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
1209 + CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
1211 ++ifeq ($(OS_ARCH), Darwin)
1212 ++EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
1213 ++endif
1215 + ifeq ($(OS_ARCH), SunOS)
1216 + ifndef GNU_CC
1217 + # When using Sun's WorkShop compiler, including
1218 +--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100
1219 ++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200
1220 +@@ -1870,10 +1870,10 @@
1222 + mPixelSize = NSToIntRound(app2dev * mFont->size);
1224 +- mImageDesc.font.face_id = (void*)mEntry;
1225 +- mImageDesc.font.pix_width = mPixelSize;
1226 +- mImageDesc.font.pix_height = mPixelSize;
1227 +- mImageDesc.image_type = 0;
1228 ++ mImageDesc->face_id = (FTC_FaceID)&mEntry;
1229 ++ mImageDesc->width = mPixelSize;
1230 ++ mImageDesc->height = mPixelSize;
1231 ++ mImageDesc->flags = 0;
1233 + nsresult rv;
1234 + mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
1235 +@@ -1907,7 +1907,7 @@
1236 + if (!face)
1237 + return 0;
1239 +- FTC_Image_Cache iCache;
1240 ++ FTC_ImageCache iCache;
1241 + nsresult rv = mFt2->GetImageCache(&iCache);
1242 + if (NS_FAILED(rv)) {
1243 + NS_ERROR("Failed to get Image Cache");
1244 +@@ -1945,8 +1945,8 @@
1246 + FTC_Manager cManager;
1247 + mFt2->GetFTCacheManager(&cManager);
1248 +- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
1249 +- &face, nsnull);
1250 ++ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
1251 ++ &face);
1252 + NS_ASSERTION(rv==0, "failed to get face/size");
1253 + if (rv)
1254 + return nsnull;
1255 +@@ -2392,16 +2392,16 @@
1256 + mEntry->GetFamilyName(fontName);
1257 + mEntry->GetStyleName(styleName);
1259 +- mImageDesc.font.face_id = (void*)mEntry;
1260 ++ mImageDesc->face_id = (FTC_FaceID)&mEntry;
1261 + // TT glyph has no relation to size
1262 +- mImageDesc.font.pix_width = 16;
1263 +- mImageDesc.font.pix_height = 16;
1264 +- mImageDesc.image_type = 0;
1265 ++ mImageDesc->width = 16;
1266 ++ mImageDesc->height = 16;
1267 ++ mImageDesc->flags = 0;
1268 + FT_Face face = nsnull;
1269 + FTC_Manager cManager;
1270 + mFt2->GetFTCacheManager(&cManager);
1271 +- nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
1272 +- &face, nsnull);
1273 ++ nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
1274 ++ &face);
1275 + if (NS_FAILED(rv))
1276 + return;
1278 +--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200
1279 ++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200
1280 +@@ -424,7 +424,7 @@
1281 + nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
1282 + nsCOMPtr<nsIFreeType2> mFt2;
1283 + PRUint16 mPixelSize;
1284 +- FTC_Image_Desc mImageDesc;
1285 ++ FTC_ImageType mImageDesc;
1286 + nsCString mFontNameBase; // the base name of type 1 (sub) fonts
1287 + nscoord mHeight;
1289 +@@ -493,7 +493,7 @@
1290 + protected:
1291 + nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
1292 + nsCOMPtr<nsIFreeType2> mFt2;
1293 +- FTC_Image_Desc mImageDesc;
1294 ++ FTC_ImageType mImageDesc;
1295 + };
1296 + #endif // MOZ_ENABLE_FREETYPE2
1297 + #endif // MOZ_ENABLE_XFT
1298 +--- misc/mozilla/gfx/src/windows/nsDeviceContextWin.cpp 2006-01-29 17:51:00.000000000 +0100
1299 ++++ misc/build/mozilla/gfx/src/windows/nsDeviceContextWin.cpp 2008-08-14 16:22:21.000000000 +0200
1300 +@@ -330,7 +330,11 @@
1301 + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
1302 + else {
1303 + MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
1304 ++#ifdef __MINGW32__
1305 ++ strlen(ptrLogFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
1306 ++#else
1307 + strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
1308 ++#endif
1310 + aFont->name = name;
1312 +@@ -577,7 +581,11 @@
1313 + LOGFONT logFont;
1314 + logFont.lfCharSet = DEFAULT_CHARSET;
1315 + logFont.lfPitchAndFamily = 0;
1316 ++#ifdef __MINGW32__
1317 ++ int outlen = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aFontName.get()), aFontName.Length() + 1,
1318 ++#else
1319 + int outlen = WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
1320 ++#endif
1321 + logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
1323 + // somehow the WideCharToMultiByte failed, let's try the old code
1324 +@@ -894,7 +902,11 @@
1325 + if(acp)
1327 + int outlen = ::WideCharToMultiByte( CP_ACP, 0,
1328 ++#ifdef __MINGW32__
1329 ++ NS_REINTERPRET_CAST(LPCWSTR, PromiseFlatString(aStr).get()), aStr.Length(),
1330 ++#else
1331 + PromiseFlatString(aStr).get(), aStr.Length(),
1332 ++#endif
1333 + acp, acplen, NULL, NULL);
1334 + if ( outlen > 0)
1335 + acp[outlen] = '\0'; // null terminate
1336 +--- misc/mozilla/gfx/src/windows/nsFontMetricsWin.cpp 2007-07-15 16:43:45.000000000 +0200
1337 ++++ misc/build/mozilla/gfx/src/windows/nsFontMetricsWin.cpp 2008-08-14 16:22:21.000000000 +0200
1338 +@@ -1363,7 +1363,11 @@
1339 + PRUnichar fname[LF_FACESIZE];
1340 + fname[0] = 0;
1341 + MultiByteToWideChar(CP_ACP, 0, aFontName,
1342 ++#ifdef __MINGW32__
1343 ++ strlen(aFontName) + 1, NS_REINTERPRET_CAST(LPWSTR, fname), sizeof(fname)/sizeof(fname[0]));
1344 ++#else
1345 + strlen(aFontName) + 1, fname, sizeof(fname)/sizeof(fname[0]));
1346 ++#endif
1347 + name.Assign(NS_LITERAL_CSTRING("encoding.") + NS_ConvertUCS2toUTF8(fname) + NS_LITERAL_CSTRING(".ttf"));
1350 +@@ -2236,7 +2240,11 @@
1352 + // get the final rightBearing and width. Possible kerning is taken into account.
1353 + SIZE size;
1354 ++#ifdef __MIGW32__
1355 ++ ::GetTextExtentPointW(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1356 ++#else
1357 + ::GetTextExtentPointW(aDC, aString, aLength, &size);
1358 ++#endif
1359 + size.cx -= aOverhangCorrection;
1360 + aBoundingMetrics.width = size.cx;
1361 + aBoundingMetrics.rightBearing = size.cx - gm.gmCellIncX + gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
1362 +@@ -2630,7 +2638,11 @@
1363 + PRUnichar name[LF_FACESIZE];
1364 + name[0] = 0;
1365 + MultiByteToWideChar(CP_ACP, 0, logFont->lfFaceName,
1366 ++#ifdef __MINGW32__
1367 ++ strlen(logFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
1368 ++#else
1369 + strlen(logFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
1370 ++#endif
1372 + nsGlobalFont* font = new nsGlobalFont;
1373 + if (!font) {
1374 +@@ -4286,14 +4298,22 @@
1376 + static PRBool
1377 + NS_ExtTextOutW(HDC aDC, nsFontWin* aFont, PRInt32 aX, PRInt32 aY, UINT uOptions,
1378 ++#ifdef __MINGW32__
1379 ++ LPCRECT lprc, const PRUnichar* aString, UINT aLength, INT *lpDx)
1380 ++#else
1381 + LPCRECT lprc, LPCWSTR aString, UINT aLength, INT *lpDx)
1382 ++#endif
1384 + RECT clipRect;
1385 + if (!lpDx && !lprc && aFont->FillClipRect(aX, aY, aLength, uOptions, clipRect)) {
1386 + lprc = &clipRect;
1387 + uOptions |= ETO_CLIPPED;
1389 ++#ifdef __MINGW32__
1390 ++ return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, lpDx);
1391 ++#else
1392 + return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, aString, aLength, lpDx);
1393 ++#endif
1396 + void
1397 +@@ -4359,7 +4379,11 @@
1399 + DEBUG_VERIFY_FONT_HASGLYPH(this, aString, aLength);
1400 + SIZE size;
1401 ++#ifdef __MINGW32__
1402 ++ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1403 ++#else
1404 + ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
1405 ++#endif
1406 + size.cx -= mOverhangCorrection;
1407 + return size.cx;
1409 +@@ -4385,7 +4409,11 @@
1410 + // Clip out the extra underline/strikethru caused by the
1411 + // bug in WIN95.
1412 + SIZE size;
1413 ++#ifdef __MINGW32__
1414 ++ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1415 ++#else
1416 + ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
1417 ++#endif
1418 + size.cx -= mOverhangCorrection;
1419 + RECT clipRect;
1420 + clipRect.top = aY - size.cy;
1421 +@@ -4466,7 +4494,11 @@
1422 + if (!mIsWide)
1423 + ::GetTextExtentPoint32A(aDC, buffer.get(), destLength, &size);
1424 + else
1425 ++#ifdef __MINGW32__
1426 ++ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), destLength / 2, &size);
1427 ++#else
1428 + ::GetTextExtentPoint32W(aDC, (const PRUnichar*) buffer.get(), destLength / 2, &size);
1429 ++#endif
1430 + size.cx -= mOverhangCorrection;
1432 + return size.cx;
1433 +@@ -4649,7 +4681,11 @@
1434 + if (NS_FAILED(rv) || !aLength) return 0;
1436 + SIZE size;
1437 ++#ifdef __MINGW32__
1438 ++ ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), aLength, &size);
1439 ++#else
1440 + ::GetTextExtentPoint32W(aDC, buffer.get(), aLength, &size);
1441 ++#endif
1442 + size.cx -= mOverhangCorrection;
1444 + return size.cx;
1445 +@@ -4828,13 +4864,21 @@
1447 + *aResultLength = 0;
1448 + // Get the number of bytes needed for the conversion
1449 ++#ifdef __MINGW32__
1450 ++ int nb = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
1451 ++#else
1452 + int nb = WideCharToMultiByte(mCodePage, 0, aString, aLength,
1453 ++#endif
1454 + nsnull, 0, nsnull, nsnull);
1456 + if (!nb || !aResult.EnsureElemCapacity(nb)) return;
1457 + char* buf = aResult.get();
1458 + // Convert the Unicode string to ANSI
1459 ++#ifdef __MINGW32__
1460 ++ *aResultLength = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
1461 ++#else
1462 + *aResultLength = WideCharToMultiByte(mCodePage, 0, aString, aLength,
1463 ++#endif
1464 + buf, nb, nsnull, nsnull);
1467 +--- misc/mozilla/gfx/src/windows/nsRenderingContextWin.cpp 2006-06-30 01:18:35.000000000 +0200
1468 ++++ misc/build/mozilla/gfx/src/windows/nsRenderingContextWin.cpp 2008-08-14 16:22:21.000000000 +0200
1469 +@@ -2935,17 +2935,29 @@
1471 + GCP_RESULTSW gcpResult;
1472 + gcpResult.lStructSize = sizeof(GCP_RESULTS);
1473 ++#ifdef __MINGW32__
1474 ++ gcpResult.lpOutString = NS_REINTERPRET_CAST(LPWSTR, outStr); // Output string
1475 ++#else
1476 + gcpResult.lpOutString = outStr; // Output string
1477 ++#endif
1478 + gcpResult.lpOrder = nsnull; // Ordering indices
1479 + gcpResult.lpDx = distanceArray; // Distances between character cells
1480 + gcpResult.lpCaretPos = nsnull; // Caret positions
1481 + gcpResult.lpClass = nsnull; // Character classifications
1482 ++#ifdef __MINGW32__
1483 ++ gcpResult.lpGlyphs = NS_REINTERPRET_CAST(LPWSTR, glyphArray); // Character glyphs
1484 ++#else
1485 + gcpResult.lpGlyphs = glyphArray; // Character glyphs
1486 ++#endif
1487 + gcpResult.nGlyphs = 2; // Array size
1489 + PRUnichar inStr[] = {araAin, one};
1491 ++#ifdef __MINGW32__
1492 ++ if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
1493 ++#else
1494 + if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
1495 ++#endif
1496 + && (inStr[0] == outStr[1]) ) {
1497 + gBidiInfo = GCP_REORDER | GCP_GLYPHSHAPE;
1498 + #ifdef NS_DEBUG
1499 +@@ -2956,7 +2968,11 @@
1500 + const PRUnichar hebAlef = 0x05D0;
1501 + inStr[0] = hebAlef;
1502 + inStr[1] = one;
1503 ++#ifdef __MINGW32__
1504 ++ if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
1505 ++#else
1506 + if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
1507 ++#endif
1508 + && (inStr[0] == outStr[1]) ) {
1509 + gBidiInfo = GCP_REORDER;
1510 + #ifdef NS_DEBUG
1511 +--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200
1512 ++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
1513 +@@ -177,7 +177,7 @@
1514 + FTC_Manager mgr;
1515 + nsresult rv;
1516 + mFt2->GetFTCacheManager(&mgr);
1517 +- rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
1518 ++ rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
1519 + NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
1520 + if (NS_FAILED(rv))
1521 + return nsnull;
1522 +@@ -191,22 +191,15 @@
1523 + PRBool embedded_bimap = PR_FALSE;
1524 + mFaceID = aFaceID;
1525 + mPixelSize = aPixelSize;
1526 +- mImageDesc.font.face_id = (void*)mFaceID;
1527 +- mImageDesc.font.pix_width = aPixelSize;
1528 +- mImageDesc.font.pix_height = aPixelSize;
1529 +- mImageDesc.image_type = 0;
1530 ++ mImageDesc->face_id = (FTC_FaceID)&mFaceID;
1531 ++ mImageDesc->width = aPixelSize;
1532 ++ mImageDesc->height = aPixelSize;
1533 ++ mImageDesc->flags = 0;
1535 + if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
1536 +- mImageDesc.image_type |= ftc_image_mono;
1537 + anti_alias = PR_FALSE;
1540 +- if (nsFreeType2::gFreeType2Autohinted)
1541 +- mImageDesc.image_type |= ftc_image_flag_autohinted;
1543 +- if (nsFreeType2::gFreeType2Unhinted)
1544 +- mImageDesc.image_type |= ftc_image_flag_unhinted;
1546 + PRUint32 num_embedded_bitmaps, i;
1547 + PRInt32* embedded_bitmapheights;
1548 + mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
1549 +@@ -218,7 +211,6 @@
1550 + if (embedded_bitmapheights[i] == aPixelSize) {
1551 + embedded_bimap = PR_TRUE;
1552 + // unhinted must be set for embedded bitmaps to be used
1553 +- mImageDesc.image_type |= ftc_image_flag_unhinted;
1554 + break;
1557 +@@ -312,7 +304,7 @@
1558 + if (!face)
1559 + return NS_ERROR_FAILURE;
1561 +- FTC_Image_Cache icache;
1562 ++ FTC_ImageCache icache;
1563 + mFt2->GetImageCache(&icache);
1564 + if (!icache)
1565 + return NS_ERROR_FAILURE;
1566 +@@ -401,7 +393,7 @@
1567 + if (!face)
1568 + return 0;
1570 +- FTC_Image_Cache icache;
1571 ++ FTC_ImageCache icache;
1572 + mFt2->GetImageCache(&icache);
1573 + if (!icache)
1574 + return 0;
1575 +@@ -723,7 +715,7 @@
1576 + if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
1577 + #endif
1579 +- FTC_Image_Cache icache;
1580 ++ FTC_ImageCache icache;
1581 + mFt2->GetImageCache(&icache);
1582 + if (!icache)
1583 + return 0;
1584 +--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200
1585 ++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200
1586 +@@ -110,7 +110,7 @@
1587 + XImage *GetXImage(PRUint32 width, PRUint32 height);
1588 + nsITrueTypeFontCatalogEntry *mFaceID;
1589 + PRUint16 mPixelSize;
1590 +- FTC_Image_Desc mImageDesc;
1591 ++ FTC_ImageType mImageDesc;
1592 + nsCOMPtr<nsIFreeType2> mFt2;
1593 + };
1595 +--- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100
1596 ++++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200
1597 +@@ -108,7 +108,7 @@
1598 + /* Defines for MMX/SSE2 support. */
1600 + #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
1601 +-#define HAVE_MMX_INTEL_MNEMONICS
1602 ++//#define HAVE_MMX_INTEL_MNEMONICS
1604 + /* SSE2 code appears broken for some cpus (bug 247437) */
1605 + /* #define HAVE_SSE2_INTEL_MNEMONICS */
1606 +--- misc/mozilla/js/src/xpconnect/src/Makefile.in 2006-01-31 02:57:35.000000000 +0100
1607 ++++ misc/build/mozilla/js/src/xpconnect/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
1608 +@@ -163,4 +163,3 @@
1609 + endif
1610 + endif
1611 + endif
1613 +--- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100
1614 ++++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200
1615 +@@ -423,19 +423,19 @@
1616 + return;
1619 +- FTC_Image_Desc imageDesc;
1620 +- imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
1621 ++ FTC_ImageType imageDesc;
1622 ++ imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
1623 + float twipstopixel = GetTwipsToPixels();
1624 + float scale = GetPixelScale();
1625 +- imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1626 +- imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1627 +- imageDesc.image_type |= ftc_image_grays;
1628 ++ imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1629 ++ imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1630 ++ imageDesc->flags |= /* ftc_image_grays */0;
1632 + // get the face
1633 + nsresult rv;
1634 + FTC_Manager mgr;
1635 + nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
1636 +- rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
1637 ++ rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
1638 + NS_ASSERTION(mFace, "failed to get face/size");
1641 +--- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200
1642 ++++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200
1643 +@@ -106,6 +106,7 @@
1644 + nsVCard.cpp \
1645 + nsVCardObj.cpp \
1646 + nsMsgVCardService.cpp \
1647 ++ nsAbMD5sum.cpp \
1648 + nsAbLDIFService.cpp \
1649 + $(NULL)
1651 +@@ -114,7 +115,9 @@
1652 + nsDirPrefs.h \
1653 + nsAbCardProperty.h \
1654 + nsAbMDBCardProperty.h \
1655 +- nsVCardObj.h \
1656 ++ nsVCardObj.h \
1657 ++ nsAbAddressCollecter.h \
1658 ++ nsAbDirectoryQuery.h \
1659 + $(NULL)
1661 + ifeq ($(OS_ARCH),WINNT)
1662 +--- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200
1663 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200
1664 +@@ -43,6 +43,7 @@
1665 + #include "nsIAbBooleanExpression.h"
1666 + #include "nsCOMPtr.h"
1667 + #include "nsString.h"
1668 ++#include "nsAbUtils.h"
1670 + class nsIAbLDAPAttributeMap;
1672 +@@ -74,6 +75,16 @@
1673 + nsIAbBooleanConditionString* condition,
1674 + nsCString& filter,
1675 + int flags);
1676 ++ static void GenerateMultipleFilter(
1677 ++ nsAbBooleanConditionType conditionType,
1678 ++ nsCString& filter,
1679 ++ NS_ConvertUCS2toUTF8 &vUTF8,
1680 ++ CharPtrArrayGuard *pAttrs);
1681 ++ static void GenerateSingleFilter(
1682 ++ nsAbBooleanConditionType conditionType,
1683 ++ nsCString& filter,
1684 ++ NS_ConvertUCS2toUTF8 &vUTF8,
1685 ++ const char *ldapProperty);
1686 + };
1688 + #endif
1689 +--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100
1690 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200
1691 +@@ -126,11 +126,13 @@
1693 + // use mURINoQuery to get a prefName
1694 + nsCAutoString prefName;
1695 +- prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
1696 ++ prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
1698 + // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
1699 + nsXPIDLCString URI;
1700 +- rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
1701 ++ nsCAutoString uriPrefName;
1702 ++ uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
1703 ++ rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
1704 + if (NS_FAILED(rv))
1706 + /*
1707 +@@ -154,6 +156,27 @@
1708 + nsCAutoString tempLDAPURL(mURINoQuery);
1709 + tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
1710 + rv = mURL->SetSpec(tempLDAPURL);
1711 ++ NS_ENSURE_SUCCESS(rv,rv);
1713 ++ nsCAutoString aHost;
1714 ++ mURL->GetHost(aHost);
1715 ++ aHost.ReplaceChar('.','_');
1716 ++ prefName = nsDependentCString("ldap_2.servers.") + aHost;
1717 ++ PRBool useSSL=0;
1718 ++ rv = prefs->GetBoolPref(
1719 ++ PromiseFlatCString(prefName
1720 ++ + NS_LITERAL_CSTRING(".UseSSL")).get(),
1721 ++ &useSSL
1722 ++ );
1724 ++ // If use SSL,ldap url will look like this ldaps://host:port/.....
1725 ++ if (!NS_FAILED(rv) && useSSL)
1726 ++ {
1727 ++ tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
1728 ++ rv = mURL->SetSpec(tempLDAPURL);
1729 ++ }
1730 ++ //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
1731 ++ rv = 0;
1733 + else
1735 +@@ -164,24 +187,29 @@
1736 + // get the login information, if there is any
1737 + //
1738 + rv = prefs->GetCharPref(
1739 +- PromiseFlatCString(
1740 +- Substring(mURINoQuery, kLDAPDirectoryRootLen,
1741 +- mURINoQuery.Length() - kLDAPDirectoryRootLen)
1742 ++ PromiseFlatCString(prefName
1743 + + NS_LITERAL_CSTRING(".auth.dn")).get(),
1744 + getter_Copies(mLogin));
1745 + if (NS_FAILED(rv)) {
1746 + mLogin.Truncate(); // zero out mLogin
1749 ++ // get the password information, if there is any
1750 ++ //
1751 ++ rv = prefs->GetCharPref(
1752 ++ PromiseFlatCString(prefName
1753 ++ + NS_LITERAL_CSTRING(".auth.pwd")).get(),
1754 ++ getter_Copies(mPassword));
1755 ++ if (NS_FAILED(rv)) {
1756 ++ mPassword.Truncate(); // zero out mLogin
1757 ++ }
1758 + // get the protocol version, if there is any. using a string pref
1759 + // here instead of an int, as protocol versions sometimes have names like
1760 + // "4bis".
1761 + //
1762 + nsXPIDLCString protocolVersion;
1763 + rv = prefs->GetCharPref(
1764 +- PromiseFlatCString(
1765 +- Substring(mURINoQuery, kLDAPDirectoryRootLen,
1766 +- mURINoQuery.Length() - kLDAPDirectoryRootLen)
1767 ++ PromiseFlatCString(prefName
1768 + + NS_LITERAL_CSTRING(".protocolVersion")).get(),
1769 + getter_Copies(protocolVersion));
1771 +--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100
1772 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200
1773 +@@ -74,7 +74,7 @@
1774 + PRInt32 resultLimit = -1,
1775 + PRInt32 timeOut = 0);
1776 + virtual ~nsAbQueryLDAPMessageListener ();
1778 ++ void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
1779 + protected:
1780 + nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
1781 + nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
1782 +@@ -108,6 +108,8 @@
1783 + PRBool mCanceled;
1784 + PRBool mWaitingForPrevQueryToFinish;
1786 ++ nsAutoString m_sPassword;
1788 + nsCOMPtr<nsILDAPOperation> mSearchOperation;
1790 + PRLock* mLock;
1791 +@@ -272,7 +274,7 @@
1793 + // If mLogin is set, we're expected to use it to get a password.
1794 + //
1795 +- if (!mDirectoryQuery->mLogin.IsEmpty()) {
1796 ++ if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
1797 + // XXX hack until nsUTF8AutoString exists
1798 + #define nsUTF8AutoString nsCAutoString
1799 + nsUTF8AutoString spec;
1800 +@@ -415,10 +417,13 @@
1801 + rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
1802 + NS_ENSURE_SUCCESS(rv, rv);
1804 +- // Bind
1805 +- rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1807 ++ // Bind
1808 ++ if (m_sPassword.Length())
1809 ++ rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
1810 ++ else
1811 ++ rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1812 + NS_ENSURE_SUCCESS(rv, rv);
1814 + return rv;
1817 +@@ -707,7 +712,7 @@
1818 + rv = getLdapReturnAttributes (arguments, returnAttributes);
1819 + NS_ENSURE_SUCCESS(rv, rv);
1823 + // Get the filter
1824 + nsCOMPtr<nsISupports> supportsExpression;
1825 + rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
1826 +@@ -828,6 +833,10 @@
1827 + if (msgListener)
1829 + msgListener->mUrl = url;
1830 ++ msgListener->mQueryListener = listener;
1831 ++ msgListener->mResultLimit = resultLimit;
1832 ++ msgListener->mTimeOut = timeOut;
1833 ++ msgListener->mQueryArguments = arguments;
1834 + return msgListener->DoSearch();
1837 +@@ -845,6 +854,11 @@
1838 + timeOut);
1839 + if (_messageListener == NULL)
1840 + return NS_ERROR_OUT_OF_MEMORY;
1842 ++ nsAutoString wPassword;
1843 ++ wPassword.AssignWithConversion(mPassword.get());
1844 ++ _messageListener->SetPassword(wPassword);
1846 + mListener = _messageListener;
1847 + *_retval = 1;
1849 +--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200
1850 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200
1851 +@@ -72,6 +72,7 @@
1852 + friend class nsAbQueryLDAPMessageListener;
1853 + nsresult Initiate ();
1854 + nsXPIDLCString mLogin; // authenticate to the LDAP server as...
1855 ++ nsXPIDLCString mPassword; // password to the LDAP server as...
1856 + nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
1857 + PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
1859 +--- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200
1860 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200
1861 +@@ -1 +1,633 @@
1862 +-dummy
1863 ++/*
1864 ++ * The contents of this file are subject to the Mozilla Public
1865 ++ * License Version 1.1 (the "License"); you may not use this file
1866 ++ * except in compliance with the License. You may obtain a copy of
1867 ++ * the License at http://www.mozilla.org/MPL/
1868 ++ *
1869 ++ * Software distributed under the License is distributed on an "AS
1870 ++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1871 ++ * implied. See the License for the specific language governing
1872 ++ * rights and limitations under the License.
1873 ++ *
1874 ++ * The Original Code is the Netscape security libraries.
1875 ++ *
1876 ++ * The Initial Developer of the Original Code is Netscape
1877 ++ * Communications Corporation. Portions created by Netscape are
1878 ++ * Copyright (C) 1994-2000 Netscape Communications Corporation. All
1879 ++ * Rights Reserved.
1880 ++ *
1881 ++ * Contributor(s):
1882 ++ *
1883 ++ * Alternatively, the contents of this file may be used under the
1884 ++ * terms of the GNU General Public License Version 2 or later (the
1885 ++ * "GPL"), in which case the provisions of the GPL are applicable
1886 ++ * instead of those above. If you wish to allow use of your
1887 ++ * version of this file only under the terms of the GPL and not to
1888 ++ * allow others to use your version of this file under the MPL,
1889 ++ * indicate your decision by deleting the provisions above and
1890 ++ * replace them with the notice and other provisions required by
1891 ++ * the GPL. If you do not delete the provisions above, a recipient
1892 ++ * may use your version of this file under either the MPL or the
1893 ++ * GPL.
1894 ++ */
1895 ++#include <stdio.h>
1896 ++#include <stdlib.h>
1898 ++#include "prerr.h"
1900 ++#include "prtypes.h"
1901 ++#include "prlong.h"
1902 ++#include "plstr.h"
1903 ++#include "nsMemory.h"
1905 ++#define MD5_HASH_LEN 16
1906 ++#define MD5_BUFFER_SIZE 64
1907 ++#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
1909 ++#define CV0_1 0x67452301
1910 ++#define CV0_2 0xefcdab89
1911 ++#define CV0_3 0x98badcfe
1912 ++#define CV0_4 0x10325476
1914 ++#define T1_0 0xd76aa478
1915 ++#define T1_1 0xe8c7b756
1916 ++#define T1_2 0x242070db
1917 ++#define T1_3 0xc1bdceee
1918 ++#define T1_4 0xf57c0faf
1919 ++#define T1_5 0x4787c62a
1920 ++#define T1_6 0xa8304613
1921 ++#define T1_7 0xfd469501
1922 ++#define T1_8 0x698098d8
1923 ++#define T1_9 0x8b44f7af
1924 ++#define T1_10 0xffff5bb1
1925 ++#define T1_11 0x895cd7be
1926 ++#define T1_12 0x6b901122
1927 ++#define T1_13 0xfd987193
1928 ++#define T1_14 0xa679438e
1929 ++#define T1_15 0x49b40821
1931 ++#define T2_0 0xf61e2562
1932 ++#define T2_1 0xc040b340
1933 ++#define T2_2 0x265e5a51
1934 ++#define T2_3 0xe9b6c7aa
1935 ++#define T2_4 0xd62f105d
1936 ++#define T2_5 0x02441453
1937 ++#define T2_6 0xd8a1e681
1938 ++#define T2_7 0xe7d3fbc8
1939 ++#define T2_8 0x21e1cde6
1940 ++#define T2_9 0xc33707d6
1941 ++#define T2_10 0xf4d50d87
1942 ++#define T2_11 0x455a14ed
1943 ++#define T2_12 0xa9e3e905
1944 ++#define T2_13 0xfcefa3f8
1945 ++#define T2_14 0x676f02d9
1946 ++#define T2_15 0x8d2a4c8a
1948 ++#define T3_0 0xfffa3942
1949 ++#define T3_1 0x8771f681
1950 ++#define T3_2 0x6d9d6122
1951 ++#define T3_3 0xfde5380c
1952 ++#define T3_4 0xa4beea44
1953 ++#define T3_5 0x4bdecfa9
1954 ++#define T3_6 0xf6bb4b60
1955 ++#define T3_7 0xbebfbc70
1956 ++#define T3_8 0x289b7ec6
1957 ++#define T3_9 0xeaa127fa
1958 ++#define T3_10 0xd4ef3085
1959 ++#define T3_11 0x04881d05
1960 ++#define T3_12 0xd9d4d039
1961 ++#define T3_13 0xe6db99e5
1962 ++#define T3_14 0x1fa27cf8
1963 ++#define T3_15 0xc4ac5665
1965 ++#define T4_0 0xf4292244
1966 ++#define T4_1 0x432aff97
1967 ++#define T4_2 0xab9423a7
1968 ++#define T4_3 0xfc93a039
1969 ++#define T4_4 0x655b59c3
1970 ++#define T4_5 0x8f0ccc92
1971 ++#define T4_6 0xffeff47d
1972 ++#define T4_7 0x85845dd1
1973 ++#define T4_8 0x6fa87e4f
1974 ++#define T4_9 0xfe2ce6e0
1975 ++#define T4_10 0xa3014314
1976 ++#define T4_11 0x4e0811a1
1977 ++#define T4_12 0xf7537e82
1978 ++#define T4_13 0xbd3af235
1979 ++#define T4_14 0x2ad7d2bb
1980 ++#define T4_15 0xeb86d391
1982 ++#define R1B0 0
1983 ++#define R1B1 1
1984 ++#define R1B2 2
1985 ++#define R1B3 3
1986 ++#define R1B4 4
1987 ++#define R1B5 5
1988 ++#define R1B6 6
1989 ++#define R1B7 7
1990 ++#define R1B8 8
1991 ++#define R1B9 9
1992 ++#define R1B10 10
1993 ++#define R1B11 11
1994 ++#define R1B12 12
1995 ++#define R1B13 13
1996 ++#define R1B14 14
1997 ++#define R1B15 15
1999 ++#define R2B0 1
2000 ++#define R2B1 6
2001 ++#define R2B2 11
2002 ++#define R2B3 0
2003 ++#define R2B4 5
2004 ++#define R2B5 10
2005 ++#define R2B6 15
2006 ++#define R2B7 4
2007 ++#define R2B8 9
2008 ++#define R2B9 14
2009 ++#define R2B10 3
2010 ++#define R2B11 8
2011 ++#define R2B12 13
2012 ++#define R2B13 2
2013 ++#define R2B14 7
2014 ++#define R2B15 12
2016 ++#define R3B0 5
2017 ++#define R3B1 8
2018 ++#define R3B2 11
2019 ++#define R3B3 14
2020 ++#define R3B4 1
2021 ++#define R3B5 4
2022 ++#define R3B6 7
2023 ++#define R3B7 10
2024 ++#define R3B8 13
2025 ++#define R3B9 0
2026 ++#define R3B10 3
2027 ++#define R3B11 6
2028 ++#define R3B12 9
2029 ++#define R3B13 12
2030 ++#define R3B14 15
2031 ++#define R3B15 2
2033 ++#define R4B0 0
2034 ++#define R4B1 7
2035 ++#define R4B2 14
2036 ++#define R4B3 5
2037 ++#define R4B4 12
2038 ++#define R4B5 3
2039 ++#define R4B6 10
2040 ++#define R4B7 1
2041 ++#define R4B8 8
2042 ++#define R4B9 15
2043 ++#define R4B10 6
2044 ++#define R4B11 13
2045 ++#define R4B12 4
2046 ++#define R4B13 11
2047 ++#define R4B14 2
2048 ++#define R4B15 9
2050 ++#define S1_0 7
2051 ++#define S1_1 12
2052 ++#define S1_2 17
2053 ++#define S1_3 22
2055 ++#define S2_0 5
2056 ++#define S2_1 9
2057 ++#define S2_2 14
2058 ++#define S2_3 20
2060 ++#define S3_0 4
2061 ++#define S3_1 11
2062 ++#define S3_2 16
2063 ++#define S3_3 23
2065 ++#define S4_0 6
2066 ++#define S4_1 10
2067 ++#define S4_2 15
2068 ++#define S4_3 21
2070 ++struct MD5ContextStr {
2071 ++ PRUint32 lsbInput;
2072 ++ PRUint32 msbInput;
2073 ++ PRUint32 cv[4];
2074 ++ union {
2075 ++ PRUint8 b[64];
2076 ++ PRUint32 w[16];
2077 ++ } u;
2078 ++};
2079 ++typedef struct MD5ContextStr MD5Context;
2081 ++#define inBuf u.b
2083 ++int MD5_Hash(unsigned char *dest, const char *src);
2084 ++int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
2085 ++MD5Context * MD5_NewContext(void);
2086 ++void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
2087 ++void MD5_Begin(MD5Context *cx);
2088 ++static void md5_compress(MD5Context *cx);
2089 ++void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
2090 ++void MD5_End(MD5Context *cx, unsigned char *digest,
2091 ++ unsigned int *digestLen, unsigned int maxDigestLen);
2092 ++unsigned int MD5_FlattenSize(MD5Context *cx);
2093 ++int MD5_Flatten(MD5Context *cx, unsigned char *space);
2094 ++MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
2095 ++void MD5_TraceState(MD5Context *cx);
2097 ++int
2098 ++MD5_Hash(unsigned char *dest, const char *src)
2100 ++ return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
2103 ++int
2104 ++MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
2106 ++ unsigned int len;
2107 ++ MD5Context *cx = MD5_NewContext();
2108 ++ if (cx == NULL) {
2109 ++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
2110 ++ return -1;
2111 ++ }
2112 ++ MD5_Begin(cx);
2113 ++ MD5_Update(cx, src, src_length);
2114 ++ MD5_End(cx, dest, &len, MD5_HASH_LEN);
2115 ++ MD5_DestroyContext(cx, PR_TRUE);
2116 ++ return 0;
2119 ++MD5Context *
2120 ++MD5_NewContext(void)
2122 ++ MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
2123 ++ if (cx == NULL) {
2124 ++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
2125 ++ return NULL;
2126 ++ }
2127 ++ return cx;
2130 ++void
2131 ++MD5_DestroyContext(MD5Context *cx, PRBool freeit)
2133 ++ if (freeit) {
2134 ++ free(cx);
2135 ++ }
2138 ++void
2139 ++MD5_Begin(MD5Context *cx)
2141 ++ cx->lsbInput = 0;
2142 ++ cx->msbInput = 0;
2143 ++ memset(cx->inBuf, 0, sizeof(cx->inBuf));
2144 ++ cx->cv[0] = CV0_1;
2145 ++ cx->cv[1] = CV0_2;
2146 ++ cx->cv[2] = CV0_3;
2147 ++ cx->cv[3] = CV0_4;
2150 ++#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
2152 ++#define MASK 0x00ff00ff
2153 ++#ifdef IS_LITTLE_ENDIAN
2154 ++#define lendian(i32) \
2155 ++ (i32)
2156 ++#else
2157 ++#define lendian(i32) \
2158 ++ (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
2159 ++#endif
2161 ++#if defined(SOLARIS) || defined(HPUX)
2162 ++#define addto64(sumhigh, sumlow, addend) \
2163 ++ sumlow += addend; sumhigh += (sumlow < addend);
2164 ++#else
2165 ++#define addto64(sumhigh, sumlow, addend) \
2166 ++ sumlow += addend; if (sumlow < addend) ++sumhigh;
2167 ++#endif
2169 ++#define F(X, Y, Z) \
2170 ++ ((X & Y) | ((~X) & Z))
2172 ++#define G(X, Y, Z) \
2173 ++ ((X & Z) | (Y & (~Z)))
2175 ++#define H(X, Y, Z) \
2176 ++ (X ^ Y ^ Z)
2178 ++#define I(X, Y, Z) \
2179 ++ (Y ^ (X | (~Z)))
2181 ++#define FF(a, b, c, d, bufint, s, ti) \
2182 ++ a = b + cls(a + F(b, c, d) + bufint + ti, s)
2184 ++#define GG(a, b, c, d, bufint, s, ti) \
2185 ++ a = b + cls(a + G(b, c, d) + bufint + ti, s)
2187 ++#define HH(a, b, c, d, bufint, s, ti) \
2188 ++ a = b + cls(a + H(b, c, d) + bufint + ti, s)
2190 ++#define II(a, b, c, d, bufint, s, ti) \
2191 ++ a = b + cls(a + I(b, c, d) + bufint + ti, s)
2193 ++static void
2194 ++md5_compress(MD5Context *cx)
2196 ++ PRUint32 a, b, c, d;
2197 ++ PRUint32 tmp;
2198 ++ a = cx->cv[0];
2199 ++ b = cx->cv[1];
2200 ++ c = cx->cv[2];
2201 ++ d = cx->cv[3];
2202 ++#ifndef IS_LITTLE_ENDIAN
2203 ++ cx->u.w[0] = lendian(cx->u.w[0]);
2204 ++ cx->u.w[1] = lendian(cx->u.w[1]);
2205 ++ cx->u.w[2] = lendian(cx->u.w[2]);
2206 ++ cx->u.w[3] = lendian(cx->u.w[3]);
2207 ++ cx->u.w[4] = lendian(cx->u.w[4]);
2208 ++ cx->u.w[5] = lendian(cx->u.w[5]);
2209 ++ cx->u.w[6] = lendian(cx->u.w[6]);
2210 ++ cx->u.w[7] = lendian(cx->u.w[7]);
2211 ++ cx->u.w[8] = lendian(cx->u.w[8]);
2212 ++ cx->u.w[9] = lendian(cx->u.w[9]);
2213 ++ cx->u.w[10] = lendian(cx->u.w[10]);
2214 ++ cx->u.w[11] = lendian(cx->u.w[11]);
2215 ++ cx->u.w[12] = lendian(cx->u.w[12]);
2216 ++ cx->u.w[13] = lendian(cx->u.w[13]);
2217 ++ cx->u.w[14] = lendian(cx->u.w[14]);
2218 ++ cx->u.w[15] = lendian(cx->u.w[15]);
2219 ++#endif
2220 ++ FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
2221 ++ FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
2222 ++ FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
2223 ++ FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
2224 ++ FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
2225 ++ FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
2226 ++ FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
2227 ++ FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
2228 ++ FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
2229 ++ FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
2230 ++ FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
2231 ++ FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
2232 ++ FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
2233 ++ FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
2234 ++ FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
2235 ++ FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
2236 ++ GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
2237 ++ GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
2238 ++ GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
2239 ++ GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
2240 ++ GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
2241 ++ GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
2242 ++ GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
2243 ++ GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
2244 ++ GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
2245 ++ GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
2246 ++ GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
2247 ++ GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
2248 ++ GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
2249 ++ GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
2250 ++ GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
2251 ++ GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
2252 ++ HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
2253 ++ HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
2254 ++ HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
2255 ++ HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
2256 ++ HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
2257 ++ HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
2258 ++ HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
2259 ++ HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
2260 ++ HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
2261 ++ HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
2262 ++ HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
2263 ++ HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
2264 ++ HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
2265 ++ HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
2266 ++ HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
2267 ++ HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
2268 ++ II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
2269 ++ II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
2270 ++ II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
2271 ++ II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
2272 ++ II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
2273 ++ II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
2274 ++ II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
2275 ++ II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
2276 ++ II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
2277 ++ II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
2278 ++ II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
2279 ++ II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
2280 ++ II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
2281 ++ II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
2282 ++ II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
2283 ++ II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
2284 ++ cx->cv[0] += a;
2285 ++ cx->cv[1] += b;
2286 ++ cx->cv[2] += c;
2287 ++ cx->cv[3] += d;
2290 ++void
2291 ++MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
2293 ++ PRUint32 bytesToConsume;
2294 ++ PRUint32 inBufIndex = cx->lsbInput & 63;
2296 ++ /* Add the number of input bytes to the 64-bit input counter. */
2297 ++ addto64(cx->msbInput, cx->lsbInput, inputLen);
2298 ++ if (inBufIndex) {
2299 ++ /* There is already data in the buffer. Fill with input. */
2300 ++ bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
2301 ++ memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
2302 ++ if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
2303 ++ /* The buffer is filled. Run the compression function. */
2304 ++ md5_compress(cx);
2305 ++ /* Remaining input. */
2306 ++ inputLen -= bytesToConsume;
2307 ++ input += bytesToConsume;
2308 ++ }
2310 ++ /* Iterate over 64-byte chunks of the message. */
2311 ++ while (inputLen >= MD5_BUFFER_SIZE) {
2312 ++ memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
2313 ++ md5_compress(cx);
2314 ++ inputLen -= MD5_BUFFER_SIZE;
2315 ++ input += MD5_BUFFER_SIZE;
2316 ++ }
2318 ++ /* Tail of message (message bytes mod 64). */
2319 ++ if (inputLen)
2320 ++ memcpy(cx->inBuf, input, inputLen);
2323 ++static const unsigned char padbytes[] = {
2324 ++ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2325 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2326 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2327 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2328 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2329 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2330 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2331 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2332 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2333 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2334 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2335 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2336 ++};
2338 ++void
2339 ++MD5_End(MD5Context *cx, unsigned char *digest,
2340 ++ unsigned int *digestLen, unsigned int maxDigestLen)
2342 ++#ifndef IS_LITTLE_ENDIAN
2343 ++ PRUint32 tmp;
2344 ++#endif
2345 ++ PRUint32 lowInput, highInput;
2346 ++ PRUint32 inBufIndex = cx->lsbInput & 63;
2348 ++ if (maxDigestLen < MD5_HASH_LEN) {
2349 ++// PORT_SetError(SEC_ERROR_INVALID_ARGS);
2350 ++ return;
2351 ++ }
2353 ++ /* Copy out the length of bits input before padding. */
2354 ++ lowInput = cx->lsbInput;
2355 ++ highInput = (cx->msbInput << 3) | (lowInput >> 29);
2356 ++ lowInput <<= 3;
2358 ++ if (inBufIndex < MD5_END_BUFFER) {
2359 ++ MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
2360 ++ } else {
2361 ++ MD5_Update(cx, padbytes,
2362 ++ MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
2363 ++ }
2365 ++ /* Store the number of bytes input (before padding) in final 64 bits. */
2366 ++ cx->u.w[14] = lendian(lowInput);
2367 ++ cx->u.w[15] = lendian(highInput);
2369 ++ /* Final call to compress. */
2370 ++ md5_compress(cx);
2372 ++ /* Copy the resulting values out of the chain variables into return buf. */
2373 ++ *digestLen = MD5_HASH_LEN;
2374 ++#ifndef IS_LITTLE_ENDIAN
2375 ++ cx->cv[0] = lendian(cx->cv[0]);
2376 ++ cx->cv[1] = lendian(cx->cv[1]);
2377 ++ cx->cv[2] = lendian(cx->cv[2]);
2378 ++ cx->cv[3] = lendian(cx->cv[3]);
2379 ++#endif
2380 ++ memcpy(digest, cx->cv, MD5_HASH_LEN);
2383 ++unsigned int
2384 ++MD5_FlattenSize(MD5Context *cx)
2386 ++ return sizeof(*cx);
2389 ++int
2390 ++MD5_Flatten(MD5Context *cx, unsigned char *space)
2392 ++ memcpy(space, cx, sizeof(*cx));
2393 ++ return 0;
2396 ++MD5Context *
2397 ++MD5_Resurrect(unsigned char *space, void *arg)
2399 ++ MD5Context *cx = MD5_NewContext();
2400 ++ if (cx)
2401 ++ memcpy(cx, space, sizeof(*cx));
2402 ++ return cx;
2405 ++void
2406 ++MD5_TraceState(MD5Context *cx)
2408 ++// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
2411 ++int
2412 ++md5_stream (FILE *stream, unsigned char *dest)
2414 ++ /* Important: BLOCKSIZE must be a multiple of 64. */
2415 ++#define BLOCKSIZE 4096
2416 ++ unsigned int len;
2417 ++ MD5Context *cx = MD5_NewContext();
2418 ++ if (cx == NULL) {
2419 ++// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
2420 ++ return -1;
2421 ++ }
2423 ++ unsigned char buffer[BLOCKSIZE + 72];
2424 ++ size_t sum;
2426 ++ /* Initialize the computation context. */
2427 ++ MD5_Begin(cx);
2429 ++ /* Iterate over full file contents. */
2430 ++ while (1)
2431 ++ {
2432 ++ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
2433 ++ computation function processes the whole buffer so that with the
2434 ++ next round of the loop another block can be read. */
2435 ++ size_t n;
2436 ++ sum = 0;
2438 ++ /* Read block. Take care for partial reads. */
2439 ++ do
2440 ++ {
2441 ++ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
2443 ++ sum += n;
2444 ++ }
2445 ++ while (sum < BLOCKSIZE && n != 0);
2446 ++ if (n == 0 && ferror (stream))
2447 ++ return 1;
2449 ++ /* If end of file is reached, end the loop. */
2450 ++ if (n == 0)
2451 ++ break;
2453 ++ /* Process buffer with BLOCKSIZE bytes. Note that
2454 ++ BLOCKSIZE % 64 == 0
2455 ++ */
2456 ++ MD5_Update(cx, buffer, BLOCKSIZE);
2457 ++ }
2459 ++ /* Add the last bytes if necessary. */
2460 ++ if (sum > 0)
2461 ++ MD5_Update(cx, buffer, sum);
2463 ++ MD5_End(cx, dest, &len, MD5_HASH_LEN);
2464 ++ MD5_DestroyContext(cx, PR_TRUE);
2465 ++ return len;
2469 ++int getMD5sum(const char * fileName,char * sum)
2471 ++ unsigned char bin_sum[16];
2472 ++ int len=0;
2473 ++ if (fileName)
2474 ++ {
2475 ++ FILE *fp=fopen(fileName,"rb");
2476 ++ if (fp)
2477 ++ {
2478 ++ len=md5_stream(fp,bin_sum);
2479 ++ memset(sum,0,33);
2480 ++ for (int i = 0; i < len; ++i)
2481 ++ sprintf (sum,"%s%02x",sum, bin_sum[i]);
2482 ++ fclose(fp);
2483 ++ return 0;
2484 ++ }
2485 ++ }
2486 ++ return 1;
2489 ++int testMD5sum(const char * fileName,char * sum)
2491 ++ char newSum[33]="";
2492 ++ if (getMD5sum(fileName,newSum))
2493 ++ return 1;
2494 ++ return strcmp(newSum,sum);
2496 +--- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100
2497 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200
2498 +@@ -273,8 +273,7 @@
2499 + if (mCardDatabase)
2501 + mCardDatabase->EditCard(this, PR_TRUE);
2502 +- mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2503 +- return NS_OK;
2504 ++ return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2506 + else
2507 + return NS_ERROR_FAILURE;
2508 +--- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100
2509 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2510 +@@ -561,7 +561,7 @@
2514 +- mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2515 ++ rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2517 + return rv;
2519 +@@ -707,6 +707,7 @@
2520 + return NS_ERROR_NOT_IMPLEMENTED;
2522 + nsresult rv = NS_OK;
2524 + if (!mDatabase)
2525 + rv = GetAbDatabase();
2527 +@@ -736,10 +737,11 @@
2528 + mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
2529 + else
2530 + mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
2531 +- mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2532 ++ rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2534 ++ NS_ENSURE_SUCCESS(rv, rv);
2535 + NS_IF_ADDREF(*addedCard = newCard);
2536 +- return NS_OK;
2537 ++ return rv;
2540 + NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
2541 +--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200
2542 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200
2543 +@@ -94,6 +94,7 @@
2545 + index_DisplayName = 0,
2546 + index_EmailAddress,
2547 ++ index_SecondEmailAddress,
2548 + index_FirstName,
2549 + index_LastName,
2550 + index_NickName,
2551 +@@ -121,32 +122,34 @@
2553 + static const ULONG OutlookCardMAPIProps [] =
2555 +- PR_DISPLAY_NAME_W,
2556 +- PR_EMAIL_ADDRESS_W,
2557 +- PR_GIVEN_NAME_W,
2558 +- PR_SURNAME_W,
2559 +- PR_NICKNAME_W,
2560 +- PR_BUSINESS_TELEPHONE_NUMBER_W,
2561 +- PR_HOME_TELEPHONE_NUMBER_W,
2562 +- PR_BUSINESS_FAX_NUMBER_W,
2563 +- PR_PAGER_TELEPHONE_NUMBER_W,
2564 +- PR_MOBILE_TELEPHONE_NUMBER_W,
2565 +- PR_HOME_ADDRESS_CITY_W,
2566 +- PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
2567 +- PR_HOME_ADDRESS_POSTAL_CODE_W,
2568 +- PR_HOME_ADDRESS_COUNTRY_W,
2569 +- PR_BUSINESS_ADDRESS_CITY_W,
2570 +- PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
2571 +- PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
2572 +- PR_BUSINESS_ADDRESS_COUNTRY_W,
2573 +- PR_TITLE_W,
2574 +- PR_DEPARTMENT_NAME_W,
2575 +- PR_COMPANY_NAME_W,
2576 +- PR_BUSINESS_HOME_PAGE_W,
2577 +- PR_PERSONAL_HOME_PAGE_W,
2578 +- PR_COMMENT_W
2579 ++ PR_DISPLAY_NAME_A,//0x8035001E
2580 ++ PR_EMAIL_ADDRESS_A,//0x8034001E
2581 ++ PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
2582 ++ PR_GIVEN_NAME_A,
2583 ++ PR_SURNAME_A,
2584 ++ PR_NICKNAME_A,
2585 ++ PR_BUSINESS_TELEPHONE_NUMBER_A,
2586 ++ PR_HOME_TELEPHONE_NUMBER_A,
2587 ++ PR_BUSINESS_FAX_NUMBER_A,
2588 ++ PR_PAGER_TELEPHONE_NUMBER_A,
2589 ++ PR_MOBILE_TELEPHONE_NUMBER_A,
2590 ++ PR_HOME_ADDRESS_CITY_A,
2591 ++ PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
2592 ++ PR_HOME_ADDRESS_POSTAL_CODE_A,
2593 ++ PR_HOME_ADDRESS_COUNTRY_A,
2594 ++ PR_BUSINESS_ADDRESS_CITY_A,
2595 ++ PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
2596 ++ PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
2597 ++ PR_BUSINESS_ADDRESS_COUNTRY_A,
2598 ++ PR_TITLE_A,
2599 ++ PR_DEPARTMENT_NAME_A,
2600 ++ PR_COMPANY_NAME_A,
2601 ++ PR_BUSINESS_HOME_PAGE_A,
2602 ++ PR_PERSONAL_HOME_PAGE_A,
2603 ++ PR_COMMENT_A
2604 + } ;
2607 + nsresult nsAbOutlookCard::Init(const char *aUri)
2609 + nsresult retCode = nsRDFResource::Init(aUri) ;
2610 +@@ -173,6 +176,7 @@
2611 + SetDisplayName(unichars [index_DisplayName]->get()) ;
2612 + SetNickName(unichars [index_NickName]->get()) ;
2613 + SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
2614 ++ SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
2615 + SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
2616 + SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
2617 + SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
2618 +@@ -207,12 +211,12 @@
2619 + nsAutoString unichar ;
2620 + nsAutoString unicharBis ;
2622 +- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
2623 ++ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
2624 + splitString(unichar, unicharBis) ;
2625 + SetHomeAddress(unichar.get()) ;
2626 + SetHomeAddress2(unicharBis.get()) ;
2628 +- if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
2629 ++ if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
2630 + splitString(unichar, unicharBis) ;
2631 + SetWorkAddress(unichar.get()) ;
2632 + SetWorkAddress2(unicharBis.get()) ;
2633 +@@ -290,6 +294,7 @@
2634 + SetDisplayName(properties [index_DisplayName]) ;
2635 + GetNickName(getter_Copies(properties [index_NickName])) ;
2636 + GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
2637 ++ GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
2638 + GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
2639 + GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
2640 + GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
2641 +@@ -309,9 +314,16 @@
2642 + GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
2643 + GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
2644 + GetNotes(getter_Copies(properties [index_Comments])) ;
2645 +- if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
2646 +- index_LastProp, properties)) {
2647 +- PRINTF(("Cannot set general properties.\n")) ;
2649 ++ int i=0;
2650 ++ for (i=0;i<index_LastProp;i++)
2651 ++ {
2652 ++ if (!mapiAddBook->SetPropertyUString(*mMapiData,
2653 ++ OutlookCardMAPIProps[i],
2654 ++ properties[i]))
2655 ++ {
2656 ++ PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
2657 ++ }
2659 + delete [] properties ;
2660 + nsXPIDLString unichar ;
2661 +--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200
2662 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200
2663 +@@ -124,8 +124,8 @@
2664 + nsCAutoString uri ;
2665 + nsCOMPtr<nsIRDFResource> resource ;
2667 +- for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
2668 +- folders.mEntries [i].ToString(entryId) ;
2669 ++ for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
2670 ++ folders[i].ToString(entryId) ;
2671 + buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
2672 + uri.Append(entryId) ;
2674 +--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100
2675 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2676 +@@ -126,7 +126,7 @@
2677 + PRINTF(("Cannot get type.\n")) ;
2678 + return NS_ERROR_FAILURE ;
2680 +- if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
2681 ++ if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
2682 + PRINTF(("Cannot get name.\n")) ;
2683 + return NS_ERROR_FAILURE ;
2685 +@@ -163,45 +163,85 @@
2686 + return retCode;
2689 ++nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2690 ++ PRBool aSearchForOld, PRBool& aIsNewCard)
2691 ++{
2692 ++ nsresult retCode = NS_OK ;
2693 ++ if (aSearchForOld) {
2694 ++ nsCStringKey key(uriName) ;
2695 ++ nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
2697 ++ if (existingCard) {
2698 ++ nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
2700 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2701 ++ NS_IF_ADDREF(*aNewCard = card) ;
2702 ++ aIsNewCard = PR_FALSE ;
2703 ++ return retCode ;
2704 ++ }
2705 ++ }
2706 ++ aIsNewCard = PR_TRUE ;
2707 ++ nsCOMPtr<nsIRDFResource> resource ;
2709 ++ nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2710 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2711 ++ resource = do_QueryInterface(childCard, &retCode) ;
2712 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2713 ++ retCode = resource->Init(uriName.get()) ;
2714 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2715 ++ NS_IF_ADDREF(*aNewCard = childCard);
2716 ++ return retCode ;
2719 + NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
2721 + if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2722 + *aCards = nsnull ;
2723 + nsCOMPtr<nsISupportsArray> cardList ;
2724 ++ nsCStringArray uriList ;
2725 ++ nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2726 + nsresult retCode ;
2728 +- mCardList.Reset() ;
2729 + if (mIsQueryURI) {
2730 + retCode = StartSearch() ;
2731 +- NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2733 + else {
2734 +- retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
2735 ++ retCode = GetChildCards(uriList, nsnull) ;
2737 ++ NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2738 + if (NS_SUCCEEDED(retCode)) {
2739 + // Fill the results array and update the card list
2740 + // Also update the address list and notify any changes.
2741 + PRUint32 nbCards = 0 ;
2742 +- nsCOMPtr<nsISupports> element ;
2743 ++ nsCAutoString uriName;
2744 ++ nsCOMPtr <nsIAbCard> childCard;
2745 ++ PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
2747 ++ nbCards = uriList.Count();
2748 ++ NS_NewISupportsArray(getter_AddRefs(m_AddressList));
2750 +- cardList->Enumerate(aCards) ;
2751 +- cardList->Count(&nbCards) ;
2752 + for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
2753 +- cardList->GetElementAt(i, getter_AddRefs(element)) ;
2754 +- nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
2755 +- nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
2756 ++ PRBool isNewCard = PR_FALSE ;
2758 +- if (!oldElement) {
2759 ++ uriList.CStringAt(i,uriName);
2760 ++ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
2761 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2762 ++ cardList->AppendElement(childCard);
2764 ++ if (isNewCard) {
2765 + // We are dealing with a new element (probably directly
2766 + // added from Outlook), we may need to sync m_AddressList
2767 +- mCardList.Put(&newKey, element) ;
2768 +- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2769 ++ nsCStringKey newKey(uriName) ;
2771 ++ mCardList.Put(&newKey, childCard) ;
2772 ++ nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
2774 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2775 + PRBool isMailList = PR_FALSE ;
2777 + retCode = card->GetIsMailList(&isMailList) ;
2778 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2780 + if (isMailList) {
2781 + // We can have mailing lists only in folder,
2782 + // we must add the directory to m_AddressList
2783 +@@ -224,18 +264,33 @@
2784 + NotifyItemAddition(card) ;
2787 +- else {
2788 +- NS_ASSERTION(oldElement == element, "Different card stored") ;
2791 ++ return cardList->Enumerate(aCards) ;
2794 ++static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
2795 ++ nsresult retCode = NS_OK ;
2796 ++ nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
2798 ++ // Receiving a non-RDF card is accepted
2799 ++ if (NS_FAILED(retCode)) { return NS_OK ; }
2800 ++ nsXPIDLCString uri ;
2802 ++ retCode = resource->GetValue(getter_Copies(uri)) ;
2803 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2804 ++ aUri = uri.get() ;
2805 + return retCode ;
2808 + NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
2810 + if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
2811 +- nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
2812 ++ *aHasCard = PR_FALSE ;
2813 ++ nsCString uri ;
2815 ++ ExtractUriFromCard(aCard, uri) ;
2816 ++ nsCStringKey key(uri) ;
2818 + *aHasCard = mCardList.Exists(&key) ;
2819 + return NS_OK ;
2820 +@@ -317,7 +372,10 @@
2821 + PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
2823 + else {
2824 +- nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
2825 ++ nsCString uri ;
2827 ++ ExtractUriFromCard(card, uri) ;
2828 ++ nsCStringKey key(uri) ;
2830 + mCardList.Remove(&key) ;
2831 + if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
2832 +@@ -386,7 +444,10 @@
2834 + retCode = CreateCard(aData, addedCard) ;
2835 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2836 +- nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
2837 ++ nsCString uri ;
2839 ++ ExtractUriFromCard(*addedCard, uri) ;
2840 ++ nsCStringKey newKey(uri) ;
2842 + mCardList.Put(&newKey, *addedCard) ;
2843 + if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
2844 +@@ -457,7 +518,7 @@
2845 + if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2846 + retCode = GetDirName(getter_Copies(name)) ;
2847 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2848 +- if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
2849 ++ if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
2850 + return NS_ERROR_FAILURE ;
2852 + retCode = CommitAddressList() ;
2853 +@@ -518,6 +579,7 @@
2854 + {"DisplayName", PR_DISPLAY_NAME_A},
2855 + {"NickName", PR_NICKNAME_A},
2856 + {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
2857 ++ {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
2858 + {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
2859 + {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
2860 + {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
2861 +@@ -1027,7 +1089,10 @@
2863 + nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
2865 +- nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
2866 ++ nsCString uri ;
2868 ++ ExtractUriFromCard(aCard, uri) ;
2869 ++ nsCStringKey newKey(uri) ;
2870 + nsresult retCode = NS_OK ;
2872 + mCardList.Put(&newKey, aCard) ;
2873 +@@ -1051,14 +1116,14 @@
2874 + retCode = BuildRestriction(aArguments, arguments) ;
2875 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2876 + nsCOMPtr<nsISupportsArray> resultsArray ;
2877 ++ nsCStringArray uriArray ;
2878 + PRUint32 nbResults = 0 ;
2880 +- retCode = GetChildCards(getter_AddRefs(resultsArray),
2881 ++ retCode = GetChildCards(uriArray,
2882 + arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
2883 + DestroyRestriction(arguments) ;
2884 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2885 +- retCode = resultsArray->Count(&nbResults) ;
2886 +- NS_ENSURE_SUCCESS(retCode, retCode) ;
2887 ++ nbResults = uriArray.Count() ;
2888 + nsCOMPtr<nsIAbDirectoryQueryResult> result ;
2889 + nsAbDirectoryQueryResult *newResult = nsnull ;
2891 +@@ -1066,15 +1131,18 @@
2892 + nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
2894 + PRUint32 i = 0 ;
2895 +- nsCOMPtr<nsISupports> element ;
2896 + nsCOMPtr<nsISupportsArray> propertyValues ;
2898 ++ nsCAutoString uriName;
2899 ++ nsCOMPtr <nsIAbCard> card;
2901 + for (i = 0 ; i < nbResults ; ++ i) {
2902 +- retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
2903 +- NS_ENSURE_SUCCESS(retCode, retCode) ;
2904 +- nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2905 ++ PRBool isNewCard = PR_FALSE ;
2907 ++ uriArray.CStringAt(i,uriName);
2908 ++ retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
2909 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2911 + FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
2912 + newResult = new nsAbDirectoryQueryResult(0, aArguments,
2913 + nsIAbDirectoryQueryResult::queryResultMatch,
2914 +@@ -1099,13 +1167,43 @@
2915 + if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2916 + *aCards = nsnull ;
2917 + nsresult retCode = NS_OK ;
2918 +- nsCOMPtr<nsISupportsArray> cards ;
2920 ++ nsCOMPtr<nsISupportsArray> cards;
2921 ++ retCode = NS_NewISupportsArray(getter_AddRefs(cards));
2922 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2924 ++ nsCStringArray uriList;
2925 ++ retCode = GetChildCards(uriList,aRestriction);
2926 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2928 ++ nsCAutoString uriName;
2929 ++ nsCOMPtr <nsIAbCard> childCard;
2930 ++ PRUint32 nbURIs = 0 ;
2931 ++ nbURIs = uriList.Count();
2932 ++ PRUint32 i = 0 ;
2934 ++ for (i = 0 ; i < nbURIs ; ++ i) {
2935 ++ PRBool isNewCard = PR_FALSE ;
2937 ++ uriList.CStringAt(i,uriName);
2938 ++ retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
2939 ++ NS_ENSURE_SUCCESS(retCode, retCode) ;
2940 ++ cards->AppendElement(childCard);
2941 ++ }
2943 ++ NS_IF_ADDREF(*aCards = cards);
2944 ++ return retCode ;
2947 ++nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
2948 ++ void *aRestriction)
2950 ++ nsresult retCode = NS_OK ;
2951 + nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2952 + nsMapiEntryArray cardEntries ;
2953 + LPSRestriction restriction = (LPSRestriction) aRestriction ;
2955 + if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2956 +- retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
2957 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2958 + if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
2959 + PRINTF(("Cannot get cards.\n")) ;
2960 +@@ -1114,22 +1212,14 @@
2961 + nsCAutoString entryId ;
2962 + nsCAutoString uriName ;
2963 + nsCOMPtr<nsIRDFResource> resource ;
2964 +- nsCOMPtr <nsIAbCard> childCard;
2966 +- for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
2967 +- cardEntries.mEntries [card].ToString(entryId) ;
2968 ++ aURI.Clear();
2970 ++ for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
2971 ++ cardEntries [card].ToString(entryId) ;
2972 + buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
2973 + uriName.Append(entryId) ;
2974 +- childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2975 +- NS_ENSURE_SUCCESS(retCode, retCode) ;
2976 +- resource = do_QueryInterface(childCard, &retCode) ;
2977 +- NS_ENSURE_SUCCESS(retCode, retCode) ;
2978 +- retCode = resource->Init(uriName.get()) ;
2979 +- NS_ENSURE_SUCCESS(retCode, retCode) ;
2980 +- cards->AppendElement(childCard) ;
2981 ++ aURI.AppendCString(uriName);
2983 +- *aCards = cards ;
2984 +- NS_ADDREF(*aCards) ;
2985 + return retCode ;
2988 +@@ -1153,8 +1243,8 @@
2989 + nsCAutoString uriName ;
2990 + nsCOMPtr <nsIRDFResource> resource ;
2992 +- for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
2993 +- nodeEntries.mEntries [node].ToString(entryId) ;
2994 ++ for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
2995 ++ nodeEntries [node].ToString(entryId) ;
2996 + buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
2997 + uriName.Append(entryId) ;
2998 + retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
2999 +@@ -1275,7 +1365,7 @@
3000 + // In the case of a mailing list, we cannot directly create a new card,
3001 + // we have to create a temporary one in a real folder (to be able to use
3002 + // templates) and then copy it to the mailing list.
3003 +- if (m_IsMailList) {
3004 ++ if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
3005 + nsMapiEntry parentEntry ;
3006 + nsMapiEntry temporaryEntry ;
3008 +--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200
3009 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200
3010 +@@ -46,6 +46,7 @@
3011 + #include "nsHashtable.h"
3013 + #include "nsISupportsArray.h"
3014 ++#include "nsVoidArray.h"
3016 + struct nsMapiEntry ;
3018 +@@ -92,6 +93,8 @@
3019 + protected:
3020 + // Retrieve hierarchy as cards, with an optional restriction
3021 + nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
3022 ++ // Retrieve hierarchy as URIs, with an optional restriction
3023 ++ nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
3024 + // Retrieve hierarchy as directories
3025 + nsresult GetChildNodes(nsISupportsArray **aNodes) ;
3026 + // Create a new card
3027 +@@ -103,6 +106,9 @@
3028 + nsresult CommitAddressList(void) ;
3029 + // Read MAPI repository
3030 + nsresult UpdateAddressList(void) ;
3031 ++ // Search for an existing card or build a new one
3032 ++ nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
3033 ++ PRBool aSearchForOld, PRBool& aIsNewCard) ;
3035 + nsMapiEntry *mMapiData ;
3036 + // Container for the query threads
3037 +--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200
3038 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200
3039 +@@ -42,6 +42,9 @@
3040 + #define USES_IID_IABContainer
3041 + #define USES_IID_IMAPITable
3042 + #define USES_IID_IDistList
3043 ++#define USES_IID_IMsgStore
3044 ++#define USES_IID_IMessage
3045 ++#define USES_IID_IMAPIFolder
3047 + #include "nsAbWinHelper.h"
3048 + #include "nsMapiAddressBook.h"
3049 +@@ -59,19 +62,6 @@
3051 + #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
3053 +-// Small utility to ensure release of all MAPI interfaces
3054 +-template <class tInterface> struct nsMapiInterfaceWrapper
3056 +- tInterface mInterface ;
3058 +- nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
3059 +- ~nsMapiInterfaceWrapper(void) {
3060 +- if (mInterface != NULL) { mInterface->Release() ; }
3061 +- }
3062 +- operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
3063 +- tInterface operator -> (void) const { return mInterface ; }
3064 +- operator tInterface *(void) { return &mInterface ; }
3065 +-} ;
3067 + static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
3069 +@@ -249,24 +239,28 @@
3070 + MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
3072 + nsMapiEntryArray::nsMapiEntryArray(void)
3073 +-: mEntries(NULL), mNbEntries(0)
3075 + MOZ_COUNT_CTOR(nsMapiEntryArray) ;
3078 + nsMapiEntryArray::~nsMapiEntryArray(void)
3080 +- if (mEntries) { delete [] mEntries ; }
3081 ++ CleanUp();
3082 + MOZ_COUNT_DTOR(nsMapiEntryArray) ;
3085 ++void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
3087 ++ m_array.AppendElement(aEntries);
3089 + void nsMapiEntryArray::CleanUp(void)
3091 +- if (mEntries != NULL) {
3092 +- delete [] mEntries ;
3093 +- mEntries = NULL ;
3094 +- mNbEntries = 0 ;
3095 ++ nsMapiEntry *pEntries;
3096 ++ for (int i = 0; i < m_array.Count(); i++)
3097 ++ {
3098 ++ pEntries = (nsMapiEntry *)m_array.ElementAt( i);
3099 ++ delete pEntries;
3101 ++ m_array.Clear();
3104 + MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
3105 +@@ -280,100 +274,55 @@
3106 + // same protection (MAPI is supposed to be thread-safe).
3107 + PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
3109 ++int nsAbWinHelper::m_clients = 0;
3111 ++PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
3112 ++int nsAbWinHelper::m_uniBuffLen = 0;
3113 ++char * nsAbWinHelper::m_pCStrBuff = NULL;
3114 ++int nsAbWinHelper::m_cstrBuffLen = 0;
3116 + nsAbWinHelper::nsAbWinHelper(void)
3117 +-: mAddressBook(NULL), mLastError(S_OK)
3118 ++:mLastError(S_OK)
3120 + MOZ_COUNT_CTOR(nsAbWinHelper) ;
3121 ++ m_clients++;
3124 + nsAbWinHelper::~nsAbWinHelper(void)
3126 + MOZ_COUNT_DTOR(nsAbWinHelper) ;
3129 +-BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
3130 ++ m_clients--;
3131 ++ if (!m_clients)
3133 +- aFolders.CleanUp() ;
3134 +- nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
3135 +- nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
3136 +- ULONG objType = 0 ;
3137 +- ULONG rowCount = 0 ;
3138 +- SRestriction restriction ;
3139 +- SPropTagArray folderColumns ;
3141 +- mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
3142 +- rootFolder) ;
3143 +- if (HR_FAILED(mLastError)) {
3144 +- PRINTF(("Cannot open root %08x.\n", mLastError)) ;
3145 +- return FALSE ;
3146 ++ delete [] m_pUniBuff;
3147 ++ m_pUniBuff = NULL;
3148 ++ m_uniBuffLen = 0;
3149 ++ delete [] m_pCStrBuff;
3150 ++ m_pCStrBuff = NULL;
3151 ++ m_cstrBuffLen = 0;
3153 +- mLastError = rootFolder->GetHierarchyTable(0, folders) ;
3154 +- if (HR_FAILED(mLastError)) {
3155 +- PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
3156 +- return FALSE ;
3158 +- // We only take into account modifiable containers,
3159 +- // otherwise, we end up with all the directory services...
3160 +- restriction.rt = RES_BITMASK ;
3161 +- restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
3162 +- restriction.res.resBitMask.relBMR = BMR_NEZ ;
3163 +- restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
3164 +- mLastError = folders->Restrict(&restriction, 0) ;
3165 +- if (HR_FAILED(mLastError)) {
3166 +- PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
3167 +- }
3168 +- folderColumns.cValues = 1 ;
3169 +- folderColumns.aulPropTag [0] = PR_ENTRYID ;
3170 +- mLastError = folders->SetColumns(&folderColumns, 0) ;
3171 +- if (HR_FAILED(mLastError)) {
3172 +- PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
3173 +- return FALSE ;
3174 +- }
3175 +- mLastError = folders->GetRowCount(0, &rowCount) ;
3176 +- if (HR_SUCCEEDED(mLastError)) {
3177 +- aFolders.mEntries = new nsMapiEntry [rowCount] ;
3178 +- aFolders.mNbEntries = 0 ;
3179 +- do {
3180 +- LPSRowSet rowSet = NULL ;
3182 +- rowCount = 0 ;
3183 +- mLastError = folders->QueryRows(1, 0, &rowSet) ;
3184 +- if (HR_SUCCEEDED(mLastError)) {
3185 +- rowCount = rowSet->cRows ;
3186 +- if (rowCount > 0) {
3187 +- nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
3188 +- SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
3190 +- current.Assign(currentValue.Value.bin.cb,
3191 +- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
3192 +- }
3193 +- MyFreeProws(rowSet) ;
3194 +- }
3195 +- else {
3196 +- PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
3197 +- }
3198 +- } while (rowCount > 0) ;
3199 +- }
3200 +- return HR_SUCCEEDED(mLastError) ;
3204 + BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3205 + nsMapiEntryArray& aCards)
3207 + aCards.CleanUp() ;
3208 +- return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
3209 ++ return GetContents(aParent, aRestriction, &aCards, 0) ;
3212 + BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
3213 + {
3214 + aNodes.CleanUp() ;
3215 +- return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
3216 ++ return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
3219 + BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
3221 +- aNbCards = 0 ;
3222 +- return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
3223 ++ nsMapiEntryArray aCards;
3224 ++ BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
3225 ++ aNbCards=aCards.GetSize();
3226 ++ return ret;
3229 + BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
3230 +@@ -390,7 +339,7 @@
3231 + aName = values->Value.lpszA ;
3233 + else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
3234 +- aName.AssignWithConversion(values->Value.lpszW) ;
3235 ++ UnicodeToCStr(values->Value.lpszW,aName) ;
3238 + FreeBuffer(values) ;
3239 +@@ -410,7 +359,7 @@
3240 + aName = values->Value.lpszW ;
3242 + else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
3243 +- aName.AssignWithConversion(values->Value.lpszA) ;
3244 ++ CStrToUnicode(values->Value.lpszA,aName) ;
3247 + FreeBuffer(values) ;
3248 +@@ -431,16 +380,22 @@
3249 + ULONG i = 0 ;
3251 + for (i = 0 ; i < valueCount ; ++ i) {
3252 +- if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
3253 ++ if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
3254 + if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
3255 + nsAutoString temp ;
3257 +- temp.AssignWithConversion (values [i].Value.lpszA) ;
3258 ++ CStrToUnicode(values [i].Value.lpszA,temp) ;
3259 + aNames.AppendString(temp) ;
3261 + else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
3262 + aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
3264 ++ else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
3265 ++ nsAutoString temp ;
3267 ++ CStrToUnicode (values [i].Value.lpszA,temp) ;
3268 ++ aNames.AppendString(temp) ;
3269 ++ }
3270 + else {
3271 + aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
3273 +@@ -466,7 +421,6 @@
3274 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
3275 + if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
3276 + SYSTEMTIME readableTime ;
3278 + if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
3279 + aYear = readableTime.wYear ;
3280 + aMonth = readableTime.wMonth ;
3281 +@@ -518,7 +472,7 @@
3282 + nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
3283 + ULONG objType = 0 ;
3285 +- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3286 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3287 + &IID_IMAPIContainer, 0, &objType,
3288 + container) ;
3289 + if (HR_FAILED(mLastError)) {
3290 +@@ -537,7 +491,7 @@
3291 + SBinary entry ;
3292 + SBinaryArray entryArray ;
3294 +- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3295 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3296 + &IID_IABContainer, MAPI_MODIFY, &objType,
3297 + container) ;
3298 + if (HR_FAILED(mLastError)) {
3299 +@@ -567,14 +521,15 @@
3300 + value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
3302 + else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
3303 +- alternativeValue.AssignWithConversion(aValue) ;
3304 ++ UnicodeToCStr(aValue,alternativeValue) ;
3305 + value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
3307 + else {
3308 + PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
3309 + return TRUE ;
3311 +- return SetMAPIProperties(aObject, 1, &value) ;
3312 ++ LPSPropValue values=&value;
3313 ++ return SetMAPIProperties(aObject, 1, values) ;
3316 + BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3317 +@@ -595,7 +550,7 @@
3318 + values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
3320 + else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
3321 +- alternativeValue.AssignWithConversion(aValues [i].get()) ;
3322 ++ UnicodeToCStr(aValues [i].get(),alternativeValue) ;
3323 + char *av = nsCRT::strdup(alternativeValue.get()) ;
3324 + if (!av) {
3325 + retCode = FALSE ;
3326 +@@ -633,7 +588,8 @@
3327 + readableTime.wSecond = 0 ;
3328 + readableTime.wMilliseconds = 0 ;
3329 + if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
3330 +- return SetMAPIProperties(aObject, 1, &value) ;
3331 ++ LPSPropValue values=&value;
3332 ++ return SetMAPIProperties(aObject, 1, values) ;
3334 + return TRUE ;
3336 +@@ -645,7 +601,7 @@
3337 + nsMapiInterfaceWrapper<LPABCONT> container ;
3338 + ULONG objType = 0 ;
3340 +- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3341 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
3342 + &IID_IABContainer, MAPI_MODIFY, &objType,
3343 + container) ;
3344 + if (HR_FAILED(mLastError)) {
3345 +@@ -708,7 +664,7 @@
3346 + nsMapiInterfaceWrapper<LPABCONT> container ;
3347 + ULONG objType = 0 ;
3349 +- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3350 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
3351 + &IID_IABContainer, MAPI_MODIFY, &objType,
3352 + container) ;
3353 + if (HR_FAILED(mLastError)) {
3354 +@@ -773,7 +729,7 @@
3355 + nsMapiInterfaceWrapper<LPABCONT> container ;
3356 + ULONG objType = 0 ;
3358 +- mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3359 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3360 + &IID_IABContainer, MAPI_MODIFY, &objType,
3361 + container) ;
3362 + if (HR_FAILED(mLastError)) {
3363 +@@ -810,194 +766,77 @@
3364 + return TRUE ;
3367 +-BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
3369 +- LPENTRYID entryId = NULL ;
3370 +- ULONG byteCount = 0 ;
3372 +- mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
3373 +- if (HR_FAILED(mLastError)) {
3374 +- PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
3375 +- return FALSE ;
3376 +- }
3377 +- aContainer.Assign(byteCount, entryId) ;
3378 +- FreeBuffer(entryId) ;
3379 +- return TRUE ;
3382 +-enum
3384 +- ContentsColumnEntryId = 0,
3385 +- ContentsColumnObjectType,
3386 +- ContentsColumnsSize
3387 +-} ;
3389 +-static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3391 +- ContentsColumnsSize,
3392 +- {
3393 +- PR_ENTRYID,
3394 +- PR_OBJECT_TYPE
3395 +- }
3396 +-} ;
3398 +-BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3399 +- nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
3400 ++void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3402 +- if (aList != NULL) { *aList = NULL ; }
3403 +- aNbElements = 0 ;
3404 +- nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
3405 +- nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
3406 +- ULONG objType = 0 ;
3407 +- ULONG rowCount = 0 ;
3408 ++ if (aRowset == NULL) { return ; }
3409 ++ ULONG i = 0 ;
3411 +- mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3412 +- &IID_IMAPIContainer, 0, &objType,
3413 +- parent) ;
3414 +- if (HR_FAILED(mLastError)) {
3415 +- PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
3416 +- return FALSE ;
3417 +- }
3418 +- // Here, flags for WAB and MAPI could be different, so this works
3419 +- // only as long as we don't want to use any flag in GetContentsTable
3420 +- mLastError = parent->GetContentsTable(0, contents) ;
3421 +- if (HR_FAILED(mLastError)) {
3422 +- PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
3423 +- return FALSE ;
3424 ++ for (i = 0 ; i < aRowset->cRows ; ++ i) {
3425 ++ FreeBuffer(aRowset->aRow [i].lpProps) ;
3427 +- if (aRestriction != NULL) {
3428 +- mLastError = contents->Restrict(aRestriction, 0) ;
3429 +- if (HR_FAILED(mLastError)) {
3430 +- PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
3431 +- return FALSE ;
3432 +- }
3433 +- }
3434 +- mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
3435 +- if (HR_FAILED(mLastError)) {
3436 +- PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
3437 +- return FALSE ;
3438 +- }
3439 +- mLastError = contents->GetRowCount(0, &rowCount) ;
3440 +- if (HR_FAILED(mLastError)) {
3441 +- PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
3442 +- return FALSE ;
3443 +- }
3444 +- if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
3445 +- aNbElements = 0 ;
3446 +- do {
3447 +- LPSRowSet rowSet = NULL ;
3449 +- rowCount = 0 ;
3450 +- mLastError = contents->QueryRows(1, 0, &rowSet) ;
3451 +- if (HR_FAILED(mLastError)) {
3452 +- PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
3453 +- return FALSE ;
3454 +- }
3455 +- rowCount = rowSet->cRows ;
3456 +- if (rowCount > 0 &&
3457 +- (aMapiType == 0 ||
3458 +- rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
3459 +- if (aList != NULL) {
3460 +- nsMapiEntry& current = (*aList) [aNbElements] ;
3461 +- SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
3463 +- current.Assign(currentValue.Value.bin.cb,
3464 +- NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
3465 ++ FreeBuffer(aRowset) ;
3466 ++ }
3467 ++void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
3469 ++ result.Truncate( 0);
3470 ++ int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
3471 ++ if (wLen >= m_uniBuffLen)
3472 ++ {
3473 ++ delete [] m_pUniBuff;
3474 ++ m_pUniBuff = new PRUnichar[wLen + 64];
3475 ++ m_uniBuffLen = wLen + 64;
3477 +- ++ aNbElements ;
3478 ++ if (wLen)
3479 ++ {
3480 ++ MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
3481 ++ result = m_pUniBuff;
3483 +- MyFreeProws(rowSet) ;
3484 +- } while (rowCount > 0) ;
3485 +- return TRUE ;
3488 +-BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3489 +- ULONG aNbProperties, LPSPropValue& aValue,
3490 +- ULONG& aValueCount)
3491 ++void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
3493 +- nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3494 +- ULONG objType = 0 ;
3495 +- LPSPropTagArray properties = NULL ;
3496 +- ULONG i = 0 ;
3498 +- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3499 +- &IID_IMAPIProp, 0, &objType,
3500 +- object) ;
3501 +- if (HR_FAILED(mLastError)) {
3502 +- PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3503 +- return FALSE ;
3504 ++ result.Truncate( 0);
3505 ++ int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
3506 ++ if (cLen >= m_cstrBuffLen) {
3507 ++ if (m_pCStrBuff)
3508 ++ delete [] m_pCStrBuff;
3509 ++ m_pCStrBuff = new char[cLen + 64];
3510 ++ m_cstrBuffLen = cLen + 64;
3512 +- AllocateBuffer(CbNewSPropTagArray(aNbProperties),
3513 +- NS_REINTERPRET_CAST(void **, &properties)) ;
3514 +- properties->cValues = aNbProperties ;
3515 +- for (i = 0 ; i < aNbProperties ; ++ i) {
3516 +- properties->aulPropTag [i] = aPropertyTags [i] ;
3517 +- }
3518 +- mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
3519 +- FreeBuffer(properties) ;
3520 +- if (HR_FAILED(mLastError)) {
3521 +- PRINTF(("Cannot get props %08x.\n", mLastError)) ;
3522 ++ if (cLen) {
3523 ++ WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
3524 ++ result = m_pCStrBuff;
3526 +- return HR_SUCCEEDED(mLastError) ;
3529 +-BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3530 +- const LPSPropValue& aValues)
3532 +- nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3533 +- ULONG objType = 0 ;
3534 +- LPSPropProblemArray problems = NULL ;
3535 ++static nsAbWinHelper *getOutlookAddressBook(void) {
3536 ++ static nsMapiAddressBook *addressBook = NULL ;
3538 +- mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3539 +- &IID_IMAPIProp, MAPI_MODIFY, &objType,
3540 +- object) ;
3541 +- if (HR_FAILED(mLastError)) {
3542 +- PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3543 +- return FALSE ;
3544 +- }
3545 +- mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
3546 +- if (HR_FAILED(mLastError)) {
3547 +- PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
3548 +- return FALSE ;
3549 +- }
3550 +- if (problems != NULL) {
3551 +- for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
3552 +- PRINTF(("Problem %d: index %d code %08x.\n", i,
3553 +- problems->aProblem [i].ulIndex,
3554 +- problems->aProblem [i].scode)) ;
3555 +- }
3556 +- }
3557 +- mLastError = object->SaveChanges(0) ;
3558 +- if (HR_FAILED(mLastError)) {
3559 +- PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
3560 +- }
3561 +- return HR_SUCCEEDED(mLastError) ;
3562 ++ if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
3563 ++ return addressBook ;
3566 +-void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3568 +- if (aRowset == NULL) { return ; }
3569 +- ULONG i = 0 ;
3570 ++static nsAbWinHelper *getOutlookExpAddressBook(void) {
3571 ++ static nsWabAddressBook *addressBook = NULL ;
3573 +- for (i = 0 ; i < aRowset->cRows ; ++ i) {
3574 +- FreeBuffer(aRowset->aRow [i].lpProps) ;
3575 +- }
3576 +- FreeBuffer(aRowset) ;
3577 ++ if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
3578 ++ return addressBook ;
3581 + nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
3582 + : mHelper(NULL)
3584 + switch(aType) {
3585 +- case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
3586 +- case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
3587 ++ case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
3588 ++ case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
3589 + default: break ;
3593 + nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
3595 +- delete mHelper ;
3598 + const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
3599 +--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200
3600 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200
3601 +@@ -45,6 +45,24 @@
3602 + #include "nsVoidArray.h"
3603 + #include "nsXPIDLString.h"
3605 ++#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
3606 ++#define PR_SCREEN_NAME_A 0x805B001E
3609 ++// Small utility to ensure release of all MAPI interfaces
3610 ++template <class tInterface> struct nsMapiInterfaceWrapper
3612 ++ tInterface mInterface ;
3614 ++ nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
3615 ++ ~nsMapiInterfaceWrapper(void) {
3616 ++ if (mInterface ) { mInterface->Release() ; }
3617 ++ }
3618 ++ operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
3619 ++ tInterface operator -> (void) const { return mInterface ; }
3620 ++ operator tInterface *(void) { return &mInterface ; }
3621 ++} ;
3623 + struct nsMapiEntry
3625 + ULONG mByteCount ;
3626 +@@ -62,14 +80,28 @@
3628 + struct nsMapiEntryArray
3630 +- nsMapiEntry *mEntries ;
3631 +- ULONG mNbEntries ;
3633 + nsMapiEntryArray(void) ;
3634 + ~nsMapiEntryArray(void) ;
3636 +- const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
3637 ++ void AddItem(nsMapiEntry * aEntries);
3638 ++ void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
3639 ++ {
3640 ++ nsMapiEntry * aEntries=new nsMapiEntry();
3641 ++ aEntries->Assign(mByteCount,mEntryId);
3642 ++ AddItem(aEntries);
3643 ++ }
3645 ++ ULONG GetSize( void) { return( m_array.Count());}
3646 ++ nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
3647 ++ nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
3648 + void CleanUp(void) ;
3649 ++ void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
3650 ++ void Remove(int index){ m_array.RemoveElementAt(index); }
3651 ++ ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
3652 ++private:
3653 ++ nsVoidArray m_array;
3655 + } ;
3657 + class nsAbWinHelper
3658 +@@ -79,7 +111,7 @@
3659 + virtual ~nsAbWinHelper(void) ;
3661 + // Get the top address books
3662 +- BOOL GetFolders(nsMapiEntryArray& aFolders) ;
3663 ++ virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
3664 + // Get a list of entries for cards/mailing lists in a folder/mailing list
3665 + BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3666 + nsMapiEntryArray& aCards) ;
3667 +@@ -97,18 +129,14 @@
3668 + BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3669 + ULONG aNbProperties, nsStringArray& aValues) ;
3670 + // Get the value of a MAPI property of type SYSTIME
3671 +- BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3672 ++ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3673 + WORD& aYear, WORD& aMonth, WORD& aDay) ;
3674 +- // Get the value of a MAPI property of type LONG
3675 +- BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3676 + // Get the value of a MAPI property of type BIN
3677 + BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
3678 + // Tests if a container contains an entry
3679 + BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3680 +- // Delete an entry in the address book
3681 +- BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3682 + // Set the value of a MAPI property of type string in unicode
3683 +- BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3684 ++ virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3685 + const PRUnichar *aValue) ;
3686 + // Same as previous, but with a bunch of properties in one call
3687 + BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3688 +@@ -117,32 +145,44 @@
3689 + BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3690 + WORD aYear, WORD aMonth, WORD aDay) ;
3691 + // Create entry in the address book
3692 +- BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3693 ++ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3694 ++ // Delete an entry in the address book
3695 ++ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3696 + // Create a distribution list in the address book
3697 +- BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3698 ++ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3699 + // Copy an existing entry in the address book
3700 +- BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3701 ++ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3702 + // Get a default address book container
3703 +- BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
3704 ++ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
3705 + // Is the helper correctly initialised?
3706 +- BOOL IsOK(void) const { return mAddressBook != NULL ; }
3707 ++ virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
3709 ++ // Get the value of a MAPI property of type LONG
3710 ++ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3712 + protected:
3713 + HRESULT mLastError ;
3714 +- LPADRBOOK mAddressBook ;
3715 + static PRUint32 mEntryCounter ;
3716 + static PRLock *mMutex ;
3718 ++ virtual HRESULT OpenEntry(ULONG cbEntryID,
3719 ++ LPENTRYID lpEntryID,
3720 ++ LPCIID lpInterface,
3721 ++ ULONG ulFlags,
3722 ++ ULONG FAR * lpulObjType,
3723 ++ LPUNKNOWN FAR * lppUnk
3724 ++ ) = 0;
3726 + // Retrieve the contents of a container, with an optional restriction
3727 +- BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3728 +- nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
3729 ++ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3730 ++ nsMapiEntryArray *aList, ULONG aMapiType) =0;
3731 + // Retrieve the values of a set of properties on a MAPI object
3732 +- BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3733 ++ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3734 + ULONG aNbProperties,
3735 +- LPSPropValue& aValues, ULONG& aValueCount) ;
3736 ++ LPSPropValue& aValues, ULONG& aValueCount) =0;
3737 + // Set the values of a set of properties on a MAPI object
3738 +- BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3739 +- const LPSPropValue& aValues) ;
3740 ++ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3741 ++ LPSPropValue& aValues) =0;
3742 + // Clean-up a rowset returned by QueryRows
3743 + void MyFreeProws(LPSRowSet aSet) ;
3744 + // Allocation of a buffer for transmission to interfaces
3745 +@@ -150,7 +190,16 @@
3746 + // Destruction of a buffer provided by the interfaces
3747 + virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
3749 ++ static void CStrToUnicode( const char *pStr, nsString& result);
3750 ++ static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
3752 + private:
3753 ++ static int m_clients;
3754 ++ static PRUnichar * m_pUniBuff;
3755 ++ static int m_uniBuffLen;
3756 ++ static char * m_pCStrBuff;
3757 ++ static int m_cstrBuffLen;
3759 + } ;
3761 + enum nsAbWinType
3762 +@@ -168,6 +217,7 @@
3764 + nsAbWinHelper *operator ->(void) { return mHelper ; }
3766 ++ static void FreeWinAbLibrarys();
3767 + private:
3768 + nsAbWinHelper *mHelper ;
3769 + } ;
3770 +--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100
3771 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200
3772 +@@ -100,6 +100,9 @@
3774 + static const char kMailListAddressFormat[] = "Address%d";
3776 ++extern int getMD5sum(const char * fileName,char * sum);
3777 ++extern int testMD5sum(const char * fileName,char * sum);
3779 + static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
3781 + nsAddrDatabase::nsAddrDatabase()
3782 +@@ -171,6 +174,7 @@
3783 + m_LastRecordKey(0),
3784 + m_dbDirectory(nsnull)
3786 ++ memset(m_dbMd5Sum,0,33);
3789 + nsAddrDatabase::~nsAddrDatabase()
3790 +@@ -790,7 +794,11 @@
3791 + if (NS_FAILED(ret))
3792 + ret = NS_ERROR_FILE_ACCESS_DENIED;
3796 ++ ret = getMD5sum(nativeFileName,m_dbMd5Sum);
3797 ++ if (ret == 1)
3798 ++ ret = NS_ERROR_FAILURE;
3800 + nsCRT::free(nativeFileName);
3802 + if (NS_SUCCEEDED(ret) && thumb)
3803 +@@ -883,6 +891,17 @@
3805 + nsresult err = NS_OK;
3806 + nsIMdbThumb *commitThumb = nsnull;
3808 ++ const char *pFilename = m_dbName.GetCString(); /* do not free */
3809 ++ char *nativeFileName = nsCRT::strdup(pFilename);
3810 ++#if defined(XP_PC) || defined(XP_MAC)
3811 ++ UnixToNative(nativeFileName);
3812 ++#endif
3813 ++ if (testMD5sum(nativeFileName,m_dbMd5Sum))
3814 ++ {
3815 ++ nsCRT::free(nativeFileName);
3816 ++ return NS_ERROR_FILE_ACCESS_DENIED;
3817 ++ }
3819 + if (commitType == nsAddrDBCommitType::kLargeCommit ||
3820 + commitType == nsAddrDBCommitType::kSessionCommit)
3821 +@@ -936,6 +955,10 @@
3822 + // ### do something with error, but clear it now because mork errors out on commits.
3823 + if (m_mdbEnv)
3824 + m_mdbEnv->ClearErrors();
3825 ++ if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
3826 ++ err = NS_ERROR_FAILURE;
3827 ++ nsCRT::free(nativeFileName);
3829 + return err;
3832 +--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100
3833 ++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200
3834 +@@ -394,6 +394,7 @@
3835 + nsIMdbTable *m_mdbPabTable;
3836 + nsIMdbTable *m_mdbDeletedCardsTable;
3837 + nsFileSpec m_dbName;
3838 ++ char m_dbMd5Sum[33];
3839 + PRBool m_mdbTokensInitialized;
3840 + nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
3842 +--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
3843 ++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
3844 +@@ -40,6 +40,22 @@
3846 + #include "prlog.h"
3848 ++static char * stristr(const char *big, const char *little)
3850 ++ PRUint32 len;
3852 ++ if (!big || !little || !*big || !*little)
3853 ++ return 0;
3854 ++ len = strlen(little);
3856 ++ for( ; *big; big++ )
3857 ++ if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
3858 ++ return (char *)big;
3860 ++ return (char *)0;
3864 + #ifdef PR_LOGGING
3865 + static PRLogModuleInfo* gMapiAddressBookLog
3866 + = PR_NewLogModule("nsMapiAddressBookLog");
3867 +@@ -47,6 +63,60 @@
3869 + #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
3871 ++#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
3872 ++#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
3873 ++#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
3874 ++#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
3875 ++#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
3876 ++#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
3877 ++#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
3879 ++static const TagMap TagMaps[]={
3880 ++ {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
3881 ++ {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
3882 ++ {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
3883 ++ {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
3885 ++enum {
3886 ++ ieidPR_ENTRYID = 0,
3887 ++ ieidPR_OBJECT_TYPE,
3888 ++ ieidPR_DISPLAY_NAME,
3889 ++ ieidPR_MESSAGE_CLASS,
3890 ++ ieidPR_STORE_ENTRYID,
3891 ++ ieidPR_MESSAGE_RECIPIENTS,
3892 ++ ieidMax
3893 ++};
3895 ++static const SizedSPropTagArray(ieidMax, ptaEid)=
3897 ++ ieidMax,
3898 ++ {
3899 ++ PR_ENTRYID,
3900 ++ PR_OBJECT_TYPE,
3901 ++ PR_DISPLAY_NAME,
3902 ++ PR_MESSAGE_CLASS,
3903 ++ PR_STORE_ENTRYID,
3904 ++ PR_MESSAGE_RECIPIENTS
3905 ++ }
3906 ++};
3908 ++enum
3910 ++ ContentsColumnEntryId = 0,
3911 ++ ContentsColumnObjectType,
3912 ++ ContentsColumnMessageClass,
3913 ++ ContentsColumnsSize
3914 ++} ;
3916 ++static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3918 ++ ContentsColumnsSize,
3919 ++ {
3920 ++ PR_ENTRYID,
3921 ++ PR_OBJECT_TYPE,
3922 ++ PR_MESSAGE_CLASS
3923 ++ }
3924 ++} ;
3926 + HMODULE nsMapiAddressBook::mLibrary = NULL ;
3927 + PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
3928 +@@ -59,7 +129,7 @@
3929 + BOOL nsMapiAddressBook::mInitialized = FALSE ;
3930 + BOOL nsMapiAddressBook::mLogonDone = FALSE ;
3931 + LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
3932 +-LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
3933 ++#define MAPI_NO_COINIT 8
3935 + BOOL nsMapiAddressBook::LoadMapiLibrary(void)
3937 +@@ -91,7 +161,7 @@
3938 + mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
3939 + GetProcAddress(mLibrary, "MAPILogonEx")) ;
3940 + if (!mMAPILogonEx) { return FALSE ; }
3941 +- MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
3942 ++ MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
3943 + HRESULT retCode = mMAPIInitialize(&mapiInit) ;
3945 + if (HR_FAILED(retCode)) {
3946 +@@ -105,22 +175,19 @@
3947 + MAPI_NEW_SESSION,
3948 + &mRootSession) ;
3949 + if (HR_FAILED(retCode)) {
3950 +- PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
3951 ++ PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
3952 ++ return FALSE ;
3954 + mLogonDone = TRUE ;
3955 +- retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
3956 +- if (HR_FAILED(retCode)) {
3957 +- PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
3958 +- }
3960 + return HR_SUCCEEDED(retCode) ;
3963 + void nsMapiAddressBook::FreeMapiLibrary(void)
3965 + if (mLibrary) {
3966 +- if (-- mLibUsage == 0) {
3967 ++ if (--mLibUsage < 0) {
3969 +- if (mRootBook) { mRootBook->Release() ; }
3970 + if (mRootSession) {
3971 + if (mLogonDone) {
3972 + mRootSession->Logoff(NULL, 0, 0) ;
3973 +@@ -134,6 +201,7 @@
3975 + }
3976 + FreeLibrary(mLibrary) ;
3977 ++ mRootSession = NULL;
3978 + mLibrary = NULL ;
3981 +@@ -145,7 +213,6 @@
3982 + : nsAbWinHelper()
3984 + BOOL result = Initialize() ;
3986 + NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
3987 + MOZ_COUNT_CTOR(nsMapiAddressBook) ;
3989 +@@ -153,22 +220,882 @@
3990 + nsMapiAddressBook::~nsMapiAddressBook(void)
3992 + nsAutoLock guard(mMutex) ;
3994 ++ CleanUpMDB();
3995 + FreeMapiLibrary() ;
3996 + MOZ_COUNT_DTOR(nsMapiAddressBook) ;
3999 ++LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
4001 ++ if (!pProp)
4002 ++ return( NULL);
4004 ++ int sz = CbNewSPropTagArray( 1);
4005 ++ SPropTagArray *pTag = (SPropTagArray *) new char[sz];
4006 ++ pTag->cValues = 1;
4007 ++ pTag->aulPropTag[0] = tag;
4008 ++ LPSPropValue lpProp = NULL;
4009 ++ ULONG cValues = 0;
4010 ++ HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
4011 ++ delete pTag;
4012 ++ if (HR_FAILED( hr) || (cValues != 1)) {
4013 ++ if (lpProp)
4014 ++ mMAPIFreeBuffer( lpProp);
4015 ++ return( NULL);
4016 ++ }
4017 ++ else {
4018 ++ if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
4019 ++ if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
4020 ++ mMAPIFreeBuffer( lpProp);
4021 ++ lpProp = NULL;
4022 ++ }
4023 ++ }
4024 ++ }
4026 ++ return( lpProp);
4028 ++BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
4030 ++ if (!pVal)
4031 ++ return( FALSE);
4033 ++ BOOL bResult = TRUE;
4034 ++ switch (PROP_TYPE(pVal->ulPropTag))
4035 ++ {
4036 ++ case PT_BINARY:
4037 ++ cbEntryId = pVal->Value.bin.cb;
4038 ++ mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
4039 ++ memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
4040 ++ break;
4042 ++ default:
4043 ++ PRINTF(( "EntryId not in BINARY prop value\n"));
4044 ++ bResult = FALSE;
4045 ++ break;
4046 ++ }
4048 ++ if (pVal && delVal)
4049 ++ mMAPIFreeBuffer( pVal);
4051 ++ return( bResult);
4054 ++BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
4056 ++ LPMDB lpMsgStore;
4057 ++ ULONG objType=0;
4058 ++ HRESULT hr;
4060 ++ if (oType == MAPI_MESSAGE)
4061 ++ return FALSE;
4062 ++ if (oType == MAPI_STORE)
4063 ++ {
4064 ++ hr=mRootSession->OpenEntry(
4065 ++ cb,
4066 ++ pEntry,
4067 ++ &IID_IMsgStore,
4068 ++ MAPI_BEST_ACCESS,
4069 ++ &objType,
4070 ++ (IUnknown**)&lpMsgStore);
4071 ++ if (FAILED(hr))
4072 ++ return FALSE ;
4073 ++ //Add MDB to a list to make it can be released when class destroyed.
4074 ++ //We must leave it openned or else we can't open address store in it.
4075 ++ AddToMDBArray(lpMsgStore);
4077 ++ LPSPropValue pVal;
4078 ++ pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
4081 ++ if (pVal) {
4082 ++ ULONG cbEntry;
4083 ++ LPENTRYID pEntry;
4084 ++ nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
4086 ++ if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
4087 ++ // Open up the folder!
4088 ++ BOOL bResult = TRUE;
4089 ++ bResult = lpMsgStore->OpenEntry(
4090 ++ cbEntry,
4091 ++ pEntry,
4092 ++ NULL,
4093 ++ MAPI_BEST_ACCESS,
4094 ++ &objType,
4095 ++ lpSubTree);
4096 ++ mMAPIFreeBuffer( pEntry);
4097 ++ if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
4098 ++ // Iterate the subtree with the results going into the folder list
4099 ++ bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
4100 ++ }
4101 ++ else {
4102 ++ PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
4103 ++ }
4104 ++ }
4105 ++ else {
4106 ++ PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
4107 ++ }
4108 ++ }
4109 ++ else {
4110 ++ PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
4111 ++ }
4112 ++ }
4113 ++ else
4114 ++ {
4115 ++ PRINTF(("Type:%d\n",oType));
4116 ++ }
4118 ++ return TRUE ;
4121 ++BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
4123 ++ // flags can be CONVENIENT_DEPTH or 0
4124 ++ // CONVENIENT_DEPTH will return all depths I believe instead
4125 ++ // of just children
4126 ++ HRESULT hr;
4127 ++ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
4128 ++ hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
4129 ++ if (HR_FAILED(hr)) {
4130 ++ PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
4131 ++ return( FALSE);
4134 ++ ULONG rowCount;
4135 ++ hr = lpTable->GetRowCount( 0, &rowCount);
4136 ++ if (!rowCount) {
4137 ++ return( TRUE);
4138 ++ }
4140 ++ hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
4141 ++ if (HR_FAILED(hr)) {
4142 ++ PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
4143 ++ return( FALSE);
4144 ++ }
4146 ++ hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
4147 ++ if (HR_FAILED(hr)) {
4148 ++ PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
4149 ++ return( FALSE);
4150 ++ }
4152 ++ int cNumRows = 0;
4153 ++ LPSRowSet lpRow;
4154 ++ BOOL keepGoing = TRUE;
4155 ++ BOOL bResult = TRUE;
4156 ++ do {
4158 ++ lpRow = NULL;
4159 ++ hr = lpTable->QueryRows( 1, 0, &lpRow);
4161 ++ if (HR_FAILED(hr))
4163 ++ PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
4164 ++ bResult = FALSE;
4165 ++ break;
4166 ++ }
4168 ++ if (lpRow){
4169 ++ cNumRows = lpRow->cRows;
4171 ++ if (cNumRows) {
4172 ++ LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
4173 ++ ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
4174 ++ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
4176 ++ keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
4178 ++ }
4179 ++ MyFreeProws(lpRow);
4180 ++ }
4182 ++ } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
4185 ++ if (bResult && !keepGoing)
4186 ++ bResult = FALSE;
4188 ++ return( bResult);
4190 ++BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
4192 ++ ULONG objType=0;
4193 ++ if (oType == MAPI_FOLDER)
4194 ++ {
4195 ++ nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
4196 ++ if (!mRootSession->OpenEntry(
4197 ++ cb,
4198 ++ pEntry,
4199 ++ 0,
4200 ++ MAPI_BEST_ACCESS,
4201 ++ &objType,
4202 ++ pFolder))
4203 ++ {
4204 ++ LPSPropValue pVal;
4207 ++ pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
4208 ++ if (pVal)
4209 ++ {
4210 ++ if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
4211 ++ {
4212 ++ SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
4214 ++ aFolders.AddItem(currentValue->Value.bin.cb,
4215 ++ NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
4217 ++ }
4218 ++ }
4219 ++ }
4220 ++ }
4221 ++ else
4222 ++ {
4223 ++ PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
4224 ++ }
4226 ++ return( TRUE);
4230 ++BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
4232 ++ aFolders.CleanUp() ;
4233 ++ nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
4234 ++ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
4235 ++ ULONG objType = 0 ;
4236 ++ ULONG rowCount = 0 ;
4238 ++ nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
4240 ++ mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
4241 ++ if (HR_FAILED(mLastError)) {
4242 ++ PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
4243 ++ return mLastError;
4244 ++ }
4246 ++ mLastError = lpTable->GetRowCount( 0, &rowCount);
4248 ++ mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
4249 ++ if (FAILED(mLastError))
4250 ++ return( mLastError);
4251 ++ mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
4252 ++ if (FAILED(mLastError))
4253 ++ return mLastError;
4255 ++ int cNumRows = 0;
4256 ++ LPSRowSet lpRow;
4257 ++ BOOL keepGoing = TRUE;
4258 ++ BOOL bResult = TRUE;
4259 ++ do {
4261 ++ lpRow = NULL;
4262 ++ mLastError = lpTable->QueryRows( 1, 0, &lpRow);
4264 ++ if (HR_FAILED(mLastError)){
4265 ++ bResult = FALSE;
4266 ++ break;
4267 ++ }
4269 ++ if (lpRow){
4270 ++ cNumRows = lpRow->cRows;
4272 ++ if (cNumRows) {
4273 ++ LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
4274 ++ ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
4275 ++ ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
4278 ++ keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
4279 ++ }
4280 ++ MyFreeProws( lpRow);
4281 ++ }
4283 ++ } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
4286 ++ return HR_SUCCEEDED(mLastError) ;
4288 ++BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
4290 ++ ULONG conditionType = 0 ;
4291 ++ ULONG ulResIndex;
4292 ++ if (!aRestriction)
4293 ++ return FALSE;
4294 ++ for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
4295 ++ {
4296 ++ conditionType = aRestriction[ulResIndex].rt;
4297 ++ switch (conditionType)
4298 ++ {
4299 ++ case RES_EXIST :
4300 ++ aRestriction[ulResIndex].res.resExist.ulPropTag =
4301 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
4302 ++ break ;
4303 ++ case RES_BITMASK :
4304 ++ aRestriction[ulResIndex].res.resBitMask.ulPropTag =
4305 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
4306 ++ break ;
4307 ++ case RES_CONTENT :
4308 ++ aRestriction[ulResIndex].res.resContent.ulPropTag =
4309 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
4310 ++ aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
4311 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
4312 ++ break ;
4313 ++ case RES_PROPERTY :
4314 ++ aRestriction[ulResIndex].res.resProperty.ulPropTag =
4315 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
4316 ++ aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
4317 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
4318 ++ break ;
4319 ++ case RES_SIZE :
4320 ++ aRestriction[ulResIndex].res.resSize.ulPropTag =
4321 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
4322 ++ break ;
4323 ++ case RES_COMPAREPROPS :
4324 ++ aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
4325 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
4326 ++ aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
4327 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
4328 ++ break ;
4329 ++ case RES_NOT :
4330 ++ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
4331 ++ break;
4332 ++ case RES_AND :
4333 ++ CorrectRestriction(aMapiProp,
4334 ++ aRestriction[ulResIndex].res.resAnd.cRes,
4335 ++ aRestriction[ulResIndex].res.resAnd.lpRes);
4336 ++ break;
4337 ++ case RES_OR :
4338 ++ CorrectRestriction(aMapiProp,
4339 ++ aRestriction[ulResIndex].res.resOr.cRes,
4340 ++ aRestriction[ulResIndex].res.resOr.lpRes);
4341 ++ break;
4343 ++ case RES_COMMENT :
4344 ++ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
4345 ++ aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
4346 ++ GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
4347 ++ break;
4348 ++ case RES_SUBRESTRICTION :
4349 ++ CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
4350 ++ break;
4351 ++ default:
4352 ++ return FALSE;
4353 ++ }
4354 ++ }
4355 ++ return TRUE;
4357 ++BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
4359 ++ if (!aRestriction)
4360 ++ return FALSE;
4362 ++ ULONG conditionType = 0 ;
4364 ++ nsMapiEntryArray listOut;
4365 ++ ULONG listindex=0;
4367 ++ nsMapiEntryArray listDel;
4368 ++ ULONG delindex=0;
4370 ++ ULONG listsize;
4371 ++ ULONG resCount = 0;
4372 ++ ULONG resIndex = 0;
4374 ++ listsize = aList->GetSize();
4375 ++ conditionType = aRestriction->rt;
4376 ++ switch (conditionType)
4377 ++ {
4378 ++ case RES_EXIST :
4379 ++ case RES_BITMASK :
4380 ++ case RES_CONTENT :
4381 ++ case RES_PROPERTY :
4382 ++ case RES_SIZE :
4383 ++ case RES_COMPAREPROPS :
4384 ++ case RES_COMMENT :
4385 ++ case RES_SUBRESTRICTION :
4386 ++ {
4387 ++ while(listindex < aList->GetSize())
4388 ++ {
4389 ++ if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
4390 ++ aList->Remove(listindex);
4391 ++ else
4392 ++ listindex++;
4393 ++ }
4394 ++ }
4395 ++ break;
4396 ++ case RES_NOT :
4397 ++ aRestriction->res.resNot.ulReserved = 1;
4398 ++ case RES_AND :
4399 ++ case RES_OR :
4400 ++ {
4401 ++ if (conditionType == RES_OR)
4402 ++ {
4403 ++ for(listindex=0;listindex<aList->GetSize();listindex++)
4404 ++ {
4405 ++ listDel.AddItem(aList->ElementAt(listindex));
4406 ++ }
4407 ++ }
4409 ++ resCount = aRestriction->res.resAnd.cRes;
4410 ++ //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
4411 ++ //use the same struct
4412 ++ for (resIndex = 0;resIndex < resCount;resIndex++)
4413 ++ {
4414 ++ //can't call listOut.CleanUp() here
4415 ++ //because it will destroy all Element too
4416 ++ while(listOut.GetSize())
4417 ++ {
4418 ++ listOut.Remove(0);
4419 ++ }
4421 ++ for(listindex=0;listindex<aList->GetSize();listindex++)
4422 ++ {
4423 ++ listOut.AddItem(aList->ElementAt(listindex));
4424 ++ }
4426 ++ Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
4427 ++ if (conditionType == RES_NOT)
4428 ++ {
4429 ++ for(listindex=0;listindex<listOut.GetSize();listindex++)
4430 ++ {
4431 ++ aList->Remove(listOut.ElementAt(listindex));
4432 ++ }
4433 ++ }
4434 ++ else if (conditionType == RES_AND )
4435 ++ {
4436 ++ for(listindex=0;listindex<listOut.GetSize();listindex++)
4437 ++ {
4438 ++ if (!aList->IndexOf(listOut.ElementAt(listindex)))
4439 ++ {
4440 ++ aList->Remove(listOut.ElementAt(listindex));
4441 ++ }
4442 ++ }
4443 ++ }
4444 ++ else if (conditionType == RES_OR )
4445 ++ {
4446 ++ for(listindex=0;listindex<listOut.GetSize();listindex++)
4447 ++ {
4448 ++ listDel.Remove(listOut.ElementAt(listindex));
4449 ++ }
4450 ++ if (listDel.GetSize() == 0)
4451 ++ {
4452 ++ break;
4453 ++ }
4454 ++ }
4455 ++ }
4456 ++ if (conditionType == RES_OR)
4457 ++ {
4458 ++ for(listindex=0;listindex<listDel.GetSize();listindex++)
4459 ++ {
4460 ++ aList->Remove(listDel.ElementAt(listindex));
4461 ++ }
4462 ++ }
4463 ++ }
4465 ++ }
4466 ++ while(listDel.GetSize())
4467 ++ {
4468 ++ listDel.Remove(0);
4469 ++ }
4470 ++ while(listOut.GetSize())
4471 ++ {
4472 ++ listOut.Remove(0);
4473 ++ }
4476 ++ return TRUE;
4479 ++BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
4481 ++ LPMAPIPROP object ;
4482 ++ ULONG objType = 0 ;
4483 ++ LPSPropValue realValue = NULL ;
4484 ++ LPSPropValue resValue = NULL ;
4485 ++ ULONG valueCount = 0 ;
4487 ++ mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
4488 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4489 ++ (IUnknown **)&object) ;
4491 ++ if (HR_FAILED(mLastError)) {
4492 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4493 ++ return FALSE ;
4494 ++ }
4496 ++ ULONG conditionType = 0 ;
4497 ++ conditionType = aRestriction->rt;
4499 ++ switch (conditionType)
4500 ++ {
4501 ++ case RES_EXIST :
4502 ++ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
4503 ++ return FALSE;
4504 ++ resValue = NULL;
4505 ++ break ;
4506 ++ case RES_CONTENT :
4507 ++ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
4508 ++ return FALSE;
4509 ++ resValue = aRestriction->res.resContent.lpProp;
4510 ++ break ;
4511 ++ case RES_PROPERTY :
4512 ++ if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
4513 ++ return FALSE;
4514 ++ resValue = aRestriction->res.resProperty.lpProp;
4515 ++ break ;
4516 ++ case RES_BITMASK :
4517 ++ return FALSE; //not support
4518 ++ break ;
4519 ++ case RES_SIZE :
4520 ++ return FALSE;//not been used now
4521 ++ break ;
4522 ++ case RES_COMPAREPROPS :
4523 ++ return FALSE;//not been used now
4524 ++ break ;
4525 ++ case RES_NOT :
4526 ++ return FALSE;//not need care here
4527 ++ break;
4528 ++ case RES_AND :
4529 ++ return FALSE;//not need care here
4530 ++ break;
4531 ++ case RES_OR :
4532 ++ return FALSE;//not need care here
4533 ++ break;
4534 ++ case RES_COMMENT :
4535 ++ return TRUE;//comment
4536 ++ break;
4537 ++ case RES_SUBRESTRICTION :
4538 ++ return FALSE;//not been used now
4539 ++ break ;
4541 ++ return AtomyFilter(aRestriction,realValue,resValue);
4545 ++BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
4547 ++ ULONG conditionType = 0 ;
4548 ++ conditionType = aRestriction->rt;
4550 ++ BOOL bTagEq=(aRealValue &&
4551 ++ PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
4552 ++ aFilterValue;
4553 ++ // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
4554 ++ switch (conditionType)
4555 ++ {
4556 ++ case RES_EXIST :
4557 ++ return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
4558 ++ break ;
4559 ++ case RES_CONTENT :
4560 ++ if (bTagEq)
4561 ++ {
4562 ++ switch(aRestriction->res.resContent.ulFuzzyLevel)
4563 ++ {
4564 ++ case FL_FULLSTRING :
4565 ++ return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
4566 ++ break;
4567 ++ case FL_PREFIX :
4568 ++ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
4569 ++ break;
4570 ++ case FL_SUBSTRING :
4571 ++ default:
4572 ++ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4573 ++ break;
4574 ++ }
4575 ++ }
4576 ++ return FALSE;
4577 ++ break ;
4578 ++ case RES_PROPERTY :
4579 ++ if (bTagEq)
4580 ++ {
4581 ++ switch(aRestriction->res.resProperty.relop)
4582 ++ {
4583 ++ case RELOP_GE :
4584 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
4585 ++ break;
4586 ++ case RELOP_GT :
4587 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
4588 ++ break;
4589 ++ case RELOP_LE :
4590 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
4591 ++ break;
4592 ++ case RELOP_LT :
4593 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
4594 ++ break;
4595 ++ case RELOP_EQ :
4596 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
4597 ++ break;
4598 ++ case RELOP_NE :
4599 ++ return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
4600 ++ break;
4601 ++ case RELOP_RE :
4602 ++ default:
4603 ++ return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4604 ++ break;
4606 ++ }
4607 ++ }
4608 ++ return FALSE;
4609 ++ break ;
4610 ++ case RES_BITMASK :
4611 ++ return FALSE; //not support
4612 ++ break ;
4613 ++ case RES_SIZE :
4614 ++ return FALSE;//not been used now
4615 ++ break ;
4616 ++ case RES_COMPAREPROPS :
4617 ++ return FALSE;//not been used now
4618 ++ break ;
4619 ++ case RES_NOT :
4620 ++ return FALSE;//not need care here
4621 ++ break;
4622 ++ case RES_AND :
4623 ++ return FALSE;//not need care here
4624 ++ break;
4625 ++ case RES_OR :
4626 ++ return FALSE;//not need care here
4627 ++ break;
4628 ++ case RES_COMMENT :
4629 ++ return TRUE;//comment
4630 ++ break;
4631 ++ case RES_SUBRESTRICTION :
4632 ++ return FALSE;//not been used now
4633 ++ break ;
4634 ++ }
4635 ++ return TRUE;
4638 ++BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
4639 ++ nsMapiEntryArray *aList, ULONG aMapiType)
4641 ++ if (aList)
4642 ++ aList->CleanUp();
4644 ++ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
4645 ++ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
4646 ++ ULONG objType = 0 ;
4647 ++ ULONG rowCount = 0 ;
4650 ++ nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
4651 ++ nsCString cs;
4652 ++ aParent.ToString(cs);
4654 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4655 ++ 0, MAPI_BEST_ACCESS, &objType, pFolder);
4656 ++ if (HR_FAILED(mLastError))
4657 ++ {
4658 ++ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4659 ++ return FALSE;
4660 ++ }
4663 ++ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
4664 ++ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4665 ++ {
4666 ++ HRESULT hr;
4667 ++ LPSPropValue aValue = NULL ;
4668 ++ ULONG aValueCount = 0 ;
4670 ++ LPSPropTagArray properties = NULL ;
4671 ++ mMAPIAllocateBuffer(CbNewSPropTagArray(1),
4672 ++ (void **)&properties);
4673 ++ properties->cValues = 1;
4674 ++ properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
4675 ++ hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
4677 ++ SBinaryArray *sa=&aValue->Value.MVbin;
4679 ++ LPENTRYID lpEID;
4680 ++ ULONG cbEID;
4682 ++ ULONG idx;
4683 ++ nsMapiEntry testEntry;
4684 ++ nsCString sClass;
4685 ++ for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
4686 ++ {
4687 ++ lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
4688 ++ cbEID = sa->lpbin[idx].cb;
4689 ++ testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
4691 ++ if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
4692 ++ {
4693 ++ aList->AddItem(cbEID,lpEID);
4694 ++ }
4695 ++ }
4696 ++ Filter(aRestriction,aList);
4697 ++ }
4698 ++ else
4699 ++ {
4700 ++ if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
4701 ++ return FALSE;
4702 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4703 ++ &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
4704 ++ parent) ;
4705 ++ if (HR_FAILED(mLastError)) {
4706 ++ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
4707 ++ return FALSE ;
4708 ++ }
4710 ++ mLastError = parent->GetContentsTable(0, contents) ;
4711 ++ if (HR_FAILED(mLastError)) {
4712 ++ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
4713 ++ return FALSE;
4714 ++ }
4715 ++ if (aRestriction) {
4716 ++ mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
4717 ++ if (HR_FAILED(mLastError)) {
4718 ++ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
4719 ++ return FALSE ;
4720 ++ }
4721 ++ }
4722 ++ mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
4723 ++ if (HR_FAILED(mLastError)) {
4724 ++ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
4725 ++ return FALSE ;
4726 ++ }
4727 ++ mLastError = contents->GetRowCount(0, &rowCount) ;
4728 ++ if (HR_FAILED(mLastError)) {
4729 ++ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
4730 ++ return FALSE ;
4731 ++ }
4732 ++ do {
4733 ++ LPSRowSet rowSet = NULL ;
4735 ++ rowCount = 0 ;
4736 ++ mLastError = contents->QueryRows(1, 0, &rowSet) ;
4737 ++ if (HR_FAILED(mLastError)) {
4738 ++ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
4739 ++ return FALSE ;
4740 ++ }
4741 ++ rowCount = rowSet->cRows ;
4742 ++ if (rowCount > 0 && aList)
4743 ++ {
4744 ++ if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
4745 ++ {
4746 ++ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4747 ++ aList->AddItem(currentValue.Value.bin.cb,
4748 ++ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4749 ++ }
4750 ++ else if (aMapiType == MAPI_DISTLIST)
4751 ++ {
4752 ++ if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
4753 ++ {
4754 ++ SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4755 ++ aList->AddItem(currentValue.Value.bin.cb,
4756 ++ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4758 ++ }
4761 ++ }
4762 ++ MyFreeProws(rowSet) ;
4763 ++ } while (rowCount > 0) ;
4764 ++ }
4767 ++ return TRUE ;
4770 ++BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
4771 ++ ULONG aNbProperties, LPSPropValue& aValue,
4772 ++ ULONG& aValueCount)
4774 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4775 ++ ULONG objType = 0 ;
4776 ++ LPSPropTagArray properties = NULL ;
4777 ++ ULONG i = 0 ;
4779 ++ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
4780 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4781 ++ object) ;
4783 ++ if (HR_FAILED(mLastError)) {
4784 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4785 ++ return FALSE ;
4786 ++ }
4787 ++ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
4788 ++ NS_REINTERPRET_CAST(void **, &properties));
4789 ++ properties->cValues = aNbProperties ;
4790 ++ for (i = 0 ; i < aNbProperties ; ++ i)
4791 ++ {
4792 ++ properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
4793 ++ }
4794 ++ mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
4795 ++ FreeBuffer(properties) ;
4797 ++ if (HR_FAILED(mLastError)) {
4798 ++ PRINTF(("Error get props %08x.\n", mLastError)) ;
4799 ++ }
4800 ++ return HR_SUCCEEDED(mLastError);
4803 ++BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
4804 ++ LPSPropValue& aValues)
4806 ++ nsMapiInterfaceWrapper<LPMESSAGE> object;
4807 ++ ULONG objType = 0 ;
4808 ++ LPSPropProblemArray problems = NULL ;
4809 ++ ULONG i = 0 ;
4811 ++ LPMDB lpMsgStore=GetMsgStore(aObject);
4813 ++ if (!lpMsgStore)
4814 ++ {
4815 ++ return FALSE;
4816 ++ }
4817 ++ mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
4818 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
4819 ++ object) ;
4820 ++ lpMsgStore->Release();
4822 ++ if (HR_FAILED(mLastError)) {
4823 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4824 ++ return FALSE ;
4825 ++ }
4826 ++ for (i = 0 ; i < aNbProperties ; ++ i)
4827 ++ {
4828 ++ aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
4829 ++ }
4830 ++ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
4831 ++ if (HR_FAILED(mLastError)) {
4832 ++ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
4833 ++ return FALSE ;
4834 ++ }
4835 ++ if (problems) {
4836 ++ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
4837 ++ PRINTF(("Problem %d: index %d code %08x.\n", i,
4838 ++ problems->aProblem [i].ulIndex,
4839 ++ problems->aProblem [i].scode)) ;
4840 ++ }
4841 ++ }
4842 ++ mLastError = object->SaveChanges(0) ;
4843 ++ if (MAPI_E_OBJECT_CHANGED == mLastError)
4844 ++ {
4845 ++ mLastError = object->SaveChanges(FORCE_SAVE ) ;
4846 ++ }
4847 ++ return HR_SUCCEEDED(mLastError) ;
4850 ++BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
4852 ++ return FALSE ;
4855 ++BOOL nsMapiAddressBook::IsOK(void)
4857 ++ return mRootSession && mLibUsage;
4860 + BOOL nsMapiAddressBook::Initialize(void)
4862 +- if (mAddressBook) { return TRUE ; }
4864 + nsAutoLock guard(mMutex) ;
4866 + if (!LoadMapiLibrary()) {
4867 + PRINTF(("Cannot load library.\n")) ;
4868 + return FALSE ;
4870 +- mAddressBook = mRootBook ;
4871 +- return TRUE ;
4872 ++ return TRUE;
4875 + void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
4876 +@@ -181,7 +1108,803 @@
4877 + mMAPIFreeBuffer(aBuffer) ;
4880 ++ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
4882 ++ static GUID emailGUID =
4883 ++ {
4884 ++ 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
4885 ++ };
4888 ++ MAPINAMEID mapiNameID;
4889 ++ mapiNameID.lpguid = &emailGUID;
4890 ++ mapiNameID.ulKind = MNID_ID;
4891 ++ mapiNameID.Kind.lID = nameID;
4893 ++ LPMAPINAMEID lpMapiNames = &mapiNameID;
4894 ++ LPSPropTagArray lpMailTagArray = NULL;
4896 ++ HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
4897 ++ if (result == S_OK)
4898 ++ {
4899 ++ ULONG lTag = lpMailTagArray->aulPropTag[0];
4900 ++ mMAPIFreeBuffer(lpMailTagArray);
4901 ++ return lTag;
4902 ++ }
4903 ++ return 0L;
4905 ++ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
4907 ++ LPSPropValue addr;
4908 ++ ULONG upRealTag=aPropertyTag;
4909 ++ ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
4911 ++ for(int i=0; i<lSize; i++)
4912 ++ {
4913 ++ if (TagMaps[i].AddressTag == aPropertyTag)
4914 ++ {
4916 ++ ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
4917 ++ if (aTest)
4918 ++ {
4919 ++ if (PR_DISPLAY_NAME_A == aPropertyTag)
4920 ++ {
4921 ++ //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
4922 ++ LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
4923 ++ if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
4924 ++ {
4925 ++ if (kPriEmailColumn)
4926 ++ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4927 ++ }
4928 ++ else
4929 ++ {
4930 ++ FreeBuffer(msgClass);
4931 ++ upRealTag = aPropertyTag;
4932 ++ }
4933 ++ }
4934 ++ else //PR_DISPLAY_NAME_A == aPropertyTag
4935 ++ {
4936 ++ addr=GetMapiProperty(lpProp,aPropertyTag);
4937 ++ if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
4938 ++ addr->Value.l == MAPI_E_NOT_FOUND)
4939 ++ {
4940 ++ if (kPriEmailColumn)
4941 ++ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4942 ++ }
4943 ++ }
4944 ++ }
4945 ++ else //aTest
4946 ++ {
4947 ++ if (kPriEmailColumn)
4948 ++ upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4949 ++ }
4951 ++ break; //we find it,exit
4952 ++ }
4953 ++ }
4955 ++ return upRealTag;
4958 ++BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
4959 ++ ULONG aPropertyTag,
4960 ++ ULONG& aValue)
4962 ++ aValue = 0 ;
4963 ++ LPSPropValue values = NULL ;
4964 ++ ULONG valueCount = 0 ;
4966 ++ if (PR_OBJECT_TYPE == aPropertyTag)
4967 ++ {
4968 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
4969 ++ ULONG objType=0;
4970 ++ mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
4971 ++ NULL,MAPI_BEST_ACCESS,&objType, pFolder);
4972 ++ if (HR_FAILED(mLastError))
4973 ++ {
4974 ++ PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4975 ++ return FALSE;
4976 ++ }
4977 ++ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
4978 ++ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4979 ++ {
4980 ++ FreeBuffer(msgClass);
4981 ++ aValue = MAPI_DISTLIST;
4982 ++ return TRUE;
4983 ++ }
4984 ++ }
4986 ++ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4987 ++ return FALSE ;
4989 ++ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
4990 ++ aValue = values->Value.ul ;
4991 ++ }
4992 ++ FreeBuffer(values) ;
4993 ++ return TRUE ;
4996 ++BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
4997 ++ WORD& aYear, WORD& aMonth, WORD& aDay)
4999 ++ aYear = 0;
5000 ++ aMonth = 0;
5001 ++ aDay = 0;
5002 ++ LPSPropValue values = NULL ;
5003 ++ ULONG valueCount = 0 ;
5005 ++ if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
5006 ++ return FALSE ;
5008 ++ if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
5009 ++ SYSTEMTIME readableTime ;
5010 ++ FILETIME localTime ;
5011 ++ FileTimeToLocalFileTime(&values->Value.ft,&localTime);
5012 ++ if (FileTimeToSystemTime(&localTime, &readableTime)) {
5013 ++ aYear = readableTime.wYear ;
5014 ++ aMonth = readableTime.wMonth ;
5015 ++ aDay = readableTime.wDay ;
5016 ++ }
5017 ++ }
5018 ++ FreeBuffer(values) ;
5019 ++ return TRUE ;
5022 ++HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
5023 ++ LPENTRYID lpEntryID,
5024 ++ LPCIID lpInterface,
5025 ++ ULONG ulFlags,
5026 ++ ULONG FAR * lpulObjType,
5027 ++ LPUNKNOWN FAR * lppUnk
5028 ++ )
5031 ++ int err;
5032 ++ HRESULT rv;
5033 ++ __try
5034 ++ {
5035 ++ rv=mRootSession->OpenEntry(cbEntryID,
5036 ++ lpEntryID,
5037 ++ lpInterface,
5038 ++ ulFlags ,
5039 ++ lpulObjType,
5040 ++ lppUnk
5041 ++ );
5042 ++ }__except(err)
5043 ++ {
5044 ++ return (-1);
5045 ++ }
5047 ++ if (HR_FAILED(rv) && !m_MDBArray.Count())
5048 ++ {
5049 ++ //There are no openned Message store,so we have to open them all
5050 ++ nsMapiEntryArray aFolders;
5051 ++ if (GetFolders(aFolders))
5052 ++ {
5053 ++ __try
5054 ++ {
5055 ++ rv=mRootSession->OpenEntry(cbEntryID,
5056 ++ lpEntryID,
5057 ++ lpInterface,
5058 ++ ulFlags ,
5059 ++ lpulObjType,
5060 ++ lppUnk
5061 ++ );
5062 ++ }__except(err)
5063 ++ {
5064 ++ return (-1);
5065 ++ }
5066 ++ }
5067 ++ }
5068 ++ return rv;
5072 ++BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
5074 ++ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
5075 ++ ULONG objType = 0 ;
5077 ++ nsMapiEntry parentEntry;
5078 ++ if (!GetEntryParent(aDistlist,parentEntry))
5079 ++ return FALSE;
5081 ++ LPMDB lpMsgStore=GetMsgStore(parentEntry);
5083 ++ if (!lpMsgStore)
5084 ++ return FALSE;
5085 ++ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
5086 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5087 ++ container) ;
5088 ++ lpMsgStore->Release();
5090 ++ if (HR_FAILED(mLastError))
5091 ++ return FALSE ;
5094 ++ /*
5095 ++ When add mail address to distlist,Mapi need update 2 tag.
5096 ++ */
5097 ++ //update OUTLOOK_EMAIL_LIST1
5098 ++ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
5099 ++ SBinaryArray oldChilds;
5100 ++ LPSBinary bins=NULL;
5101 ++ SBinaryArray newChilds;
5102 ++ LPSPropValue oldChildValue = NULL ;
5103 ++ ULONG valueCount = 0 ;
5105 ++ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
5106 ++ {
5107 ++ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
5108 ++ return FALSE;
5109 ++ }
5111 ++ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
5112 ++ {
5113 ++ oldChilds = oldChildValue->Value.MVbin;
5114 ++ newChilds.cValues=oldChilds.cValues + 1;
5115 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5116 ++ newChilds.lpbin = bins;
5117 ++ for (ULONG i=0;i<oldChilds.cValues;i++)
5118 ++ {
5119 ++ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
5120 ++ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
5121 ++ }
5122 ++ }
5123 ++ else
5124 ++ {
5125 ++ newChilds.cValues = 1;
5126 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5127 ++ newChilds.lpbin = bins;
5128 ++ }
5130 ++ nsMapiEntry orgEntryID;
5131 ++ if (!GetPropertyBin(aNewEntry,
5132 ++ GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
5133 ++ orgEntryID))
5134 ++ {
5135 ++ return FALSE;
5136 ++ }
5137 ++ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
5138 ++ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
5140 ++ SPropValue childs;
5141 ++ childs.ulPropTag = listTag;
5142 ++ childs.Value.MVbin = newChilds;
5144 ++ LPSPropProblemArray problems = NULL ;
5145 ++ mLastError = container->SetProps(1, &childs, &problems) ;
5146 ++ if (HR_FAILED(mLastError)) {
5147 ++ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5148 ++ return FALSE ;
5149 ++ }
5151 ++ //update OUTLOOK_EMAIL_LIST2
5152 ++ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
5153 ++ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
5154 ++ {
5155 ++ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
5156 ++ return FALSE;
5157 ++ }
5159 ++ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
5160 ++ {
5161 ++ oldChilds = oldChildValue->Value.MVbin;
5162 ++ newChilds.cValues=oldChilds.cValues + 1;
5163 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5164 ++ newChilds.lpbin = bins;
5165 ++ for (ULONG i=0;i<oldChilds.cValues;i++)
5166 ++ {
5167 ++ newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
5168 ++ newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
5169 ++ }
5170 ++ }
5171 ++ else
5172 ++ {
5173 ++ newChilds.cValues = 1;
5174 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5175 ++ newChilds.lpbin = bins;
5176 ++ }
5178 ++ /*
5179 ++ Need more work here.
5180 ++ There are two kind of mail address in outlook DistList.
5181 ++ One is sample,not include in parent folder.
5182 ++ The other is a link to a unattached address in parents folders.
5183 ++ Currently we can only add first kind of address to a outlook distlist.
5184 ++ */
5186 ++ newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
5187 ++ newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
5189 ++ childs.ulPropTag = listTag;
5190 ++ childs.Value.MVbin = newChilds;
5192 ++ mLastError = container->SetProps(1, &childs, &problems) ;
5193 ++ if (HR_FAILED(mLastError))
5194 ++ {
5195 ++ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5196 ++ return FALSE ;
5197 ++ }
5199 ++ mMAPIFreeBuffer(bins);
5201 ++ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
5202 ++ if (HR_FAILED(mLastError)) {
5203 ++ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5204 ++ return FALSE ;
5205 ++ }
5207 ++ return TRUE ;
5209 ++BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
5211 ++ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
5212 ++ ULONG objType = 0 ;
5214 ++ nsMapiEntry parentEntry;
5215 ++ if (!GetEntryParent(aDistlist,parentEntry))
5216 ++ return FALSE;
5218 ++ LPMDB lpMsgStore=GetMsgStore(parentEntry);
5219 ++ if (!lpMsgStore)
5220 ++ return FALSE;
5222 ++ mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
5223 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5224 ++ container) ;
5225 ++ lpMsgStore->Release();
5227 ++ if (HR_FAILED(mLastError))
5228 ++ return FALSE ;
5229 ++ /*
5230 ++ When delete mail address from distlist,Mapi need update 2 tag.
5231 ++ */
5232 ++ //update OUTLOOK_EMAIL_LIST1
5233 ++ ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
5235 ++ SBinaryArray oldChilds;
5236 ++ LPSBinary bins=NULL;
5237 ++ SBinaryArray newChilds;
5238 ++ LPSPropValue oldChildValue = NULL ;
5239 ++ ULONG valueCount = 0 ;
5241 ++ newChilds.lpbin=NULL;
5243 ++ ULONG lDeleteEntry=0;
5244 ++ ULONG newIndex=0;
5245 ++ ULONG oldIndex=0;
5246 ++ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
5247 ++ {
5248 ++ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
5249 ++ return FALSE;
5250 ++ }
5252 ++ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
5253 ++ {
5254 ++ oldChilds = oldChildValue->Value.MVbin;
5255 ++ newChilds.cValues=oldChilds.cValues - 1;
5256 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5257 ++ newChilds.lpbin = bins;
5258 ++ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
5259 ++ {
5260 ++ if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
5261 ++ !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
5262 ++ (void*)(aNewEntry.mEntryId->ab),
5263 ++ oldChilds.lpbin[oldIndex].cb-4))
5264 ++ {
5265 ++ lDeleteEntry=oldIndex;
5266 ++ }
5267 ++ else
5268 ++ {
5269 ++ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
5270 ++ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
5271 ++ newIndex++;
5272 ++ }
5273 ++ }
5274 ++ }
5275 ++ else
5276 ++ return FALSE;
5279 ++ SPropValue childs;
5280 ++ LPSPropProblemArray problems = NULL ;
5282 ++ if (newChilds.cValues == 0)
5283 ++ {
5284 ++ SPropTagArray delTags;
5285 ++ delTags.cValues = 1;
5286 ++ delTags.aulPropTag[0] = listTag;
5288 ++ mLastError = container->DeleteProps(&delTags, &problems) ;
5289 ++ }
5290 ++ else
5291 ++ {
5292 ++ childs.ulPropTag = listTag;
5293 ++ childs.Value.MVbin = newChilds;
5294 ++ mLastError = container->SetProps(1, &childs, &problems) ;
5295 ++ }
5297 ++ if (HR_FAILED(mLastError)) {
5298 ++ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5299 ++ return FALSE ;
5300 ++ }
5302 ++ //update OUTLOOK_EMAIL_LIST2
5303 ++ listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
5304 ++ if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
5305 ++ {
5306 ++ PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
5307 ++ return FALSE;
5308 ++ }
5310 ++ newIndex=0;
5311 ++ if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
5312 ++ {
5313 ++ oldChilds = oldChildValue->Value.MVbin;
5314 ++ newChilds.cValues=oldChilds.cValues - 1;
5315 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5316 ++ newChilds.lpbin = bins;
5317 ++ for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
5318 ++ {
5319 ++ if (oldIndex != lDeleteEntry)
5320 ++ {
5321 ++ newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
5322 ++ newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
5323 ++ newIndex++;
5324 ++ }
5325 ++ }
5326 ++ }
5327 ++ else
5328 ++ {
5329 ++ newChilds.cValues = 1;
5330 ++ mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5331 ++ newChilds.lpbin = bins;
5332 ++ }
5336 ++ if (newChilds.cValues == 0)
5337 ++ {
5338 ++ SPropTagArray delTags;
5339 ++ delTags.cValues = 1;
5340 ++ delTags.aulPropTag[0] = listTag;
5342 ++ mLastError = container->DeleteProps(&delTags, &problems) ;
5343 ++ }
5344 ++ else
5345 ++ {
5346 ++ childs.ulPropTag = listTag;
5347 ++ childs.Value.MVbin = newChilds;
5348 ++ mLastError = container->SetProps(1, &childs, &problems) ;
5349 ++ }
5350 ++ if (HR_FAILED(mLastError)) {
5351 ++ PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5352 ++ return FALSE ;
5353 ++ }
5355 ++ mMAPIFreeBuffer(bins);
5357 ++ mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
5358 ++ if (HR_FAILED(mLastError)) {
5359 ++ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5360 ++ return FALSE ;
5361 ++ }
5363 ++ return TRUE ;
5366 ++BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
5368 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5369 ++ ULONG objType = 0 ;
5370 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5371 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5372 ++ (IUnknown **)&object) ;
5374 ++ if (HR_FAILED(mLastError)) {
5375 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5376 ++ return FALSE ;
5377 ++ }
5378 ++ SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
5380 ++ if (parentID->Value.l == MAPI_E_NOT_FOUND)
5381 ++ return FALSE;
5382 ++ aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
5383 ++ return TRUE;
5385 ++BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
5387 ++ nsMapiInterfaceWrapper<LPMAPIPROP> container ;
5388 ++ ULONG objType = 0 ;
5390 ++ nsMapiEntry parentEntry;
5391 ++ if (!GetEntryParent(aDistlist,parentEntry))
5392 ++ {
5393 ++ return FALSE;
5394 ++ }
5395 ++ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5396 ++ if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
5397 ++ return FALSE;
5399 ++ return AddEntryToList(aDistlist,aNewEntry);
5402 ++BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
5404 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5405 ++ ULONG objType = 0 ;
5407 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object;
5408 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5409 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5410 ++ object) ;
5412 ++ if (HR_FAILED(mLastError)) {
5413 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5414 ++ return NULL ;
5415 ++ }
5416 ++ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5418 ++ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5419 ++ return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
5421 ++ LPMDB lpMsgStore=GetMsgStore(aParent);
5423 ++ if (!lpMsgStore)
5424 ++ return FALSE;
5426 ++ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
5427 ++ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5428 ++ container) ;
5429 ++ lpMsgStore->Release();
5431 ++ if (HR_FAILED(mLastError))
5432 ++ return FALSE;
5434 ++ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5436 ++ mLastError = container->CreateMessage(&IID_IMessage,
5437 ++ 0,
5438 ++ newEntry) ;
5439 ++ if (HR_FAILED(mLastError)) {
5440 ++ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5441 ++ return FALSE ;
5442 ++ }
5443 ++ SPropValue messageclass ;
5444 ++ LPSPropProblemArray problems = NULL ;
5445 ++ nsCString tempName ;
5447 ++ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5448 ++ tempName.Assign("IPM.Contact") ;
5449 ++ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5450 ++ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5451 ++ if (HR_FAILED(mLastError)) {
5452 ++ PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
5453 ++ return FALSE ;
5454 ++ }
5455 ++ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5456 ++ if (HR_FAILED(mLastError)) {
5457 ++ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5458 ++ return FALSE ;
5459 ++ }
5461 ++ SPropTagArray property ;
5462 ++ LPSPropValue value = NULL ;
5463 ++ ULONG valueCount = 0 ;
5465 ++ property.cValues = 1 ;
5466 ++ property.aulPropTag [0] = PR_ENTRYID ;
5467 ++ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5468 ++ if (HR_FAILED(mLastError) || valueCount != 1) {
5469 ++ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5470 ++ return FALSE ;
5471 ++ }
5472 ++ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5473 ++ FreeBuffer(value) ;
5474 ++ return TRUE ;
5477 ++BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
5479 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5480 ++ ULONG objType = 0 ;
5482 ++ LPMDB lpMsgStore=GetMsgStore(aParent);
5483 ++ if (!lpMsgStore)
5484 ++ return FALSE;
5485 ++ mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
5486 ++ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5487 ++ container) ;
5488 ++ lpMsgStore->Release();
5490 ++ if (HR_FAILED(mLastError)) {
5491 ++ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5492 ++ return FALSE ;
5493 ++ }
5495 ++ nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5496 ++ mLastError = container->CreateMessage(&IID_IMAPIProp,
5497 ++ 0,
5498 ++ newEntry) ;
5499 ++ if (HR_FAILED(mLastError)) {
5500 ++ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5501 ++ return FALSE ;
5502 ++ }
5503 ++ SPropValue messageclass ;
5504 ++ LPSPropProblemArray problems = NULL ;
5505 ++ nsCString tempName ;
5507 ++ messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5508 ++ tempName.Assign("IPM.DistList") ;
5509 ++ messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5510 ++ mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5511 ++ if (HR_FAILED(mLastError)) {
5512 ++ PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
5513 ++ return FALSE ;
5514 ++ }
5515 ++ mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5516 ++ if (HR_FAILED(mLastError)) {
5517 ++ PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5518 ++ return FALSE ;
5519 ++ }
5521 ++ ULONG valueCount = 0 ;
5522 ++ SPropTagArray property ;
5523 ++ LPSPropValue value = NULL ;
5525 ++ property.cValues = 1 ;
5526 ++ property.aulPropTag [0] = PR_ENTRYID ;
5527 ++ mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5528 ++ if (HR_FAILED(mLastError) || valueCount != 1) {
5529 ++ PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5530 ++ return FALSE ;
5531 ++ }
5532 ++ aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5534 ++ FreeBuffer(value) ;
5535 ++ return TRUE ;
5539 ++BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
5540 ++ nsMapiEntry& aTarget)
5542 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5543 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
5544 ++ ULONG objType = 0 ;
5545 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object;
5546 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5547 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5548 ++ object) ;
5550 ++ if (HR_FAILED(mLastError)) {
5551 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5552 ++ return FALSE ;
5553 ++ }
5554 ++ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5556 ++ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5557 ++ {
5558 ++ //Add Entry To DistList
5559 ++ if (!AddEntryToList(aContainer,aSource))
5560 ++ return FALSE;
5561 ++ aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
5562 ++ return TRUE;
5563 ++ }
5565 ++ SBinary entry ;
5566 ++ SBinaryArray entryArray ;
5568 ++ entry.cb = aSource.mByteCount ;
5569 ++ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
5570 ++ entryArray.cValues = 1 ;
5571 ++ entryArray.lpbin = &entry ;
5573 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5574 ++ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5575 ++ container) ;
5576 ++ if (HR_FAILED(mLastError)) {
5577 ++ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5578 ++ return FALSE ;
5579 ++ }
5581 ++ mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
5582 ++ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5583 ++ targetFolder) ;
5584 ++ if (HR_FAILED(mLastError)) {
5585 ++ PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
5586 ++ return FALSE ;
5587 ++ }
5589 ++ nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
5591 ++ mLastError = container->CopyMessages(&entryArray,
5592 ++ &IID_IMessage,
5593 ++ (void*)&targetFolder,
5594 ++ 0,
5595 ++ NULL,
5596 ++ NULL) ;
5597 ++ if (HR_FAILED(mLastError)) {
5598 ++ PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5599 ++ return FALSE ;
5600 ++ }
5601 ++ return TRUE ;
5604 ++BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
5606 ++ nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5607 ++ ULONG objType = 0 ;
5608 ++ SBinary entry ;
5609 ++ SBinaryArray entryArray ;
5612 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object;
5613 ++ mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5614 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5615 ++ object) ;
5617 ++ if (HR_FAILED(mLastError)) {
5618 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5619 ++ return FALSE ;
5620 ++ }
5621 ++ LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5623 ++ if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5624 ++ return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
5626 ++ LPMDB lpMsgStore=GetMsgStore(aContainer);
5627 ++ if (!lpMsgStore)
5628 ++ return FALSE;
5630 ++ mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5631 ++ &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5632 ++ container) ;
5633 ++ lpMsgStore->Release();
5634 ++ if (HR_FAILED(mLastError)) {
5635 ++ PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5636 ++ return FALSE ;
5637 ++ }
5638 ++ entry.cb = aEntry.mByteCount ;
5639 ++ entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
5640 ++ entryArray.cValues = 1 ;
5641 ++ entryArray.lpbin = &entry ;
5642 ++ mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
5643 ++ if (HR_FAILED(mLastError)) {
5644 ++ PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
5645 ++ return FALSE ;
5646 ++ }
5647 ++ return TRUE ;
5650 ++//Use to open message store in write mode
5651 ++LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
5653 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object;
5654 ++ ULONG objType=0;
5656 ++ mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
5657 ++ &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
5658 ++ object) ;
5659 ++ if (HR_FAILED(mLastError)) {
5660 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5661 ++ return NULL ;
5662 ++ }
5663 ++ SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
5665 ++ LPMDB lpMsgStore=NULL;
5666 ++ mLastError=mRootSession->OpenMsgStore(0,
5667 ++ svMsgSore->Value.bin.cb,
5668 ++ (ENTRYID*)svMsgSore->Value.bin.lpb,
5669 ++ &IID_IMsgStore,
5670 ++ MAPI_BEST_ACCESS ,
5671 ++ &lpMsgStore);
5673 ++ if (HR_FAILED(mLastError)) {
5674 ++ PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
5675 ++ return NULL ;
5676 ++ }
5678 ++ return lpMsgStore;
5680 +--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5681 ++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5682 +@@ -40,12 +40,42 @@
5684 + #include "nsAbWinHelper.h"
5686 ++struct TagMap
5688 ++ ULONG AddressTag;
5689 ++ ULONG NameID;
5690 ++ ULONG TypeMask;
5691 ++};
5692 + class nsMapiAddressBook : public nsAbWinHelper
5694 + public :
5695 + nsMapiAddressBook(void) ;
5696 + virtual ~nsMapiAddressBook(void) ;
5698 ++ // Get the top address books
5699 ++ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5701 ++ // Get a default address book container
5702 ++ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5703 ++ // Is the helper correctly initialised?
5704 ++ virtual BOOL IsOK(void);
5705 ++ virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
5706 ++ ULONG aPropertyTag,
5707 ++ ULONG& aValue);
5708 ++ // Get the value of a MAPI property of type SYSTIME
5709 ++ virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
5710 ++ WORD& aYear, WORD& aMonth, WORD& aDay);
5711 ++ // Create entry in the address book
5712 ++ virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5713 ++ // Delete an entry in the address book
5714 ++ virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
5715 ++ // Create a distribution list in the address book
5716 ++ virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5717 ++ // Copy an existing entry in the address book
5718 ++ virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
5720 ++ static void FreeMapiLibrary(void) ;
5722 + protected :
5723 + // Class members to handle the library/entry points
5724 + static HMODULE mLibrary ;
5725 +@@ -67,19 +97,77 @@
5726 + static BOOL mInitialized ;
5727 + static BOOL mLogonDone ;
5728 + static LPMAPISESSION mRootSession ;
5729 +- static LPADRBOOK mRootBook ;
5732 + // Load the MAPI environment
5733 + BOOL Initialize(void) ;
5735 ++ virtual HRESULT OpenEntry(ULONG cbEntryID,
5736 ++ LPENTRYID lpEntryID,
5737 ++ LPCIID lpInterface,
5738 ++ ULONG ulFlags,
5739 ++ ULONG FAR * lpulObjType,
5740 ++ LPUNKNOWN FAR * lppUnk
5741 ++ );
5744 ++ // Retrieve the contents of a container, with an optional restriction
5745 ++ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5746 ++ nsMapiEntryArray *aList, ULONG aMapiType) ;
5747 ++ // Retrieve the values of a set of properties on a MAPI object
5748 ++ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5749 ++ ULONG aNbProperties,
5750 ++ LPSPropValue& aValues, ULONG& aValueCount) ;
5751 ++ // Set the values of a set of properties on a MAPI object
5752 ++ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5753 ++ LPSPropValue& aValues);
5756 + // Allocation of a buffer for transmission to interfaces
5757 + virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5758 + // Destruction of a buffer provided by the interfaces
5759 + virtual void FreeBuffer(LPVOID aBuffer) ;
5760 + // Library management
5761 + static BOOL LoadMapiLibrary(void) ;
5762 +- static void FreeMapiLibrary(void) ;
5764 ++ BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5765 ++ LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
5766 ++ BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
5767 ++ BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5768 ++ BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
5769 ++ ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
5770 ++ ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
5771 ++ LPMDB GetMsgStore(const nsMapiEntry& aEntry);
5772 ++ BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
5773 ++ BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
5774 ++ BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
5775 ++ BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
5776 ++ BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
5778 ++ //filter
5779 ++ BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
5780 ++ BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
5781 ++ BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
5783 ++ void AddToMDBArray(LPMDB aMDB)
5784 ++ {
5785 ++ m_MDBArray.AppendElement(aMDB);
5786 ++ }
5787 ++ void CleanUpMDB()
5788 ++ {
5789 ++ LPMDB mdb;
5790 ++ for (int i = 0; i < m_MDBArray.Count(); i++)
5791 ++ {
5792 ++ mdb = (LPMDB)m_MDBArray.ElementAt(i);
5793 ++ mdb->Release();
5794 ++ }
5795 ++ m_MDBArray.Clear();
5796 ++ }
5798 + private :
5799 ++ //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
5800 ++ //so we have to kill message stores openned
5801 ++ nsVoidArray m_MDBArray;
5802 + } ;
5804 + #endif // nsMapiAddressBook_h___
5805 +--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
5806 ++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
5807 +@@ -46,6 +46,22 @@
5809 + #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
5811 ++enum
5813 ++ ContentsColumnEntryId = 0,
5814 ++ ContentsColumnObjectType,
5815 ++ ContentsColumnsSize
5816 ++} ;
5818 ++static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
5820 ++ ContentsColumnsSize,
5821 ++ {
5822 ++ PR_ENTRYID,
5823 ++ PR_OBJECT_TYPE
5824 ++ }
5825 ++} ;
5827 + HMODULE nsWabAddressBook::mLibrary = NULL ;
5828 + PRInt32 nsWabAddressBook::mLibUsage = 0 ;
5829 + LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
5830 +@@ -94,7 +110,7 @@
5831 + MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
5833 + nsWabAddressBook::nsWabAddressBook(void)
5834 +-: nsAbWinHelper()
5835 ++: nsAbWinHelper(),mAddressBook(NULL)
5837 + BOOL result = Initialize() ;
5839 +@@ -109,9 +125,254 @@
5840 + MOZ_COUNT_DTOR(nsWabAddressBook) ;
5843 ++BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
5845 ++ aFolders.CleanUp() ;
5846 ++ nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
5847 ++ nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
5848 ++ ULONG objType = 0 ;
5849 ++ ULONG rowCount = 0 ;
5850 ++ SRestriction restriction ;
5851 ++ SPropTagArray folderColumns ;
5853 ++ mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
5854 ++ rootFolder);
5855 ++ if (HR_FAILED(mLastError)){
5856 ++ PRINTF(("Cannot open root %08x.\n", mLastError));
5857 ++ return FALSE;
5858 ++ }
5859 ++ mLastError = rootFolder->GetHierarchyTable(0, folders);
5860 ++ if (HR_FAILED(mLastError)){
5861 ++ PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
5862 ++ return FALSE;
5863 ++ }
5864 ++ // We only take into account modifiable containers,
5865 ++ // otherwise, we end up with all the directory services...
5866 ++ restriction.rt = RES_BITMASK ;
5867 ++ restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
5868 ++ restriction.res.resBitMask.relBMR = BMR_NEZ ;
5869 ++ restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
5870 ++ mLastError = folders->Restrict(&restriction, 0) ;
5871 ++ if (HR_FAILED(mLastError)) {
5872 ++ PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
5873 ++ }
5874 ++ folderColumns.cValues = 1 ;
5875 ++ folderColumns.aulPropTag [0] = PR_ENTRYID ;
5876 ++ mLastError = folders->SetColumns(&folderColumns, 0) ;
5877 ++ if (HR_FAILED(mLastError)) {
5878 ++ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5879 ++ return FALSE ;
5880 ++ }
5881 ++ mLastError = folders->GetRowCount(0, &rowCount) ;
5882 ++ if (HR_SUCCEEDED(mLastError)) {
5883 ++ do {
5884 ++ LPSRowSet rowSet = NULL ;
5886 ++ rowCount = 0 ;
5887 ++ mLastError = folders->QueryRows(1, 0, &rowSet) ;
5888 ++ if (HR_SUCCEEDED(mLastError)) {
5889 ++ rowCount = rowSet->cRows ;
5890 ++ if (rowCount > 0) {
5891 ++ SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
5893 ++ aFolders.AddItem(currentValue.Value.bin.cb,
5894 ++ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5895 ++ }
5896 ++ MyFreeProws(rowSet) ;
5897 ++ }
5898 ++ else {
5899 ++ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5900 ++ }
5901 ++ } while (rowCount > 0) ;
5902 ++ }
5903 ++ return HR_SUCCEEDED(mLastError) ;
5905 ++BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5906 ++ nsMapiEntryArray *aList, ULONG aMapiType)
5908 ++ if (aList) { aList->CleanUp(); }
5909 ++ nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
5910 ++ nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
5911 ++ ULONG objType = 0 ;
5912 ++ ULONG rowCount = 0 ;
5914 ++ mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5915 ++ &IID_IMAPIContainer, 0, &objType,
5916 ++ parent) ;
5917 ++ if (HR_FAILED(mLastError)) {
5918 ++ PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
5919 ++ return FALSE ;
5920 ++ }
5921 ++ // Here, flags for WAB and MAPI could be different, so this works
5922 ++ // only as long as we don't want to use any flag in GetContentsTable
5923 ++ mLastError = parent->GetContentsTable(0, contents) ;
5924 ++ if (HR_FAILED(mLastError)) {
5925 ++ PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
5926 ++ return FALSE ;
5927 ++ }
5928 ++ if (aRestriction) {
5929 ++ mLastError = contents->Restrict(aRestriction, 0) ;
5930 ++ if (HR_FAILED(mLastError)) {
5931 ++ PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
5932 ++ return FALSE ;
5933 ++ }
5934 ++ }
5935 ++ int entryId = ContentsColumnEntryId ;
5936 ++ int objectType = ContentsColumnObjectType ;
5938 ++ if (aRestriction)
5939 ++ {
5940 ++ LPSPropTagArray allColumns = NULL ;
5942 ++ mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
5943 ++ if (HR_FAILED(mLastError)) {
5944 ++ PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
5945 ++ return FALSE ;
5946 ++ }
5948 ++ for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
5949 ++ if (allColumns->aulPropTag [j] == PR_ENTRYID) {
5950 ++ entryId = j ;
5951 ++ }
5952 ++ else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
5953 ++ objectType = j ;
5954 ++ }
5955 ++ }
5956 ++ mLastError = contents->SetColumns(allColumns, 0) ;
5957 ++ if (HR_FAILED(mLastError)) {
5958 ++ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5959 ++ return FALSE ;
5960 ++ }
5961 ++ FreeBuffer(allColumns) ;
5962 ++ }
5963 ++ else
5964 ++ {
5966 ++ mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
5967 ++ if (HR_FAILED(mLastError)) {
5968 ++ PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5969 ++ return FALSE ;
5970 ++ }
5971 ++ }
5973 ++ mLastError = contents->GetRowCount(0, &rowCount) ;
5974 ++ if (HR_FAILED(mLastError)) {
5975 ++ PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
5976 ++ return FALSE ;
5977 ++ }
5978 ++ do {
5979 ++ LPSRowSet rowSet = NULL ;
5981 ++ rowCount = 0 ;
5982 ++ mLastError = contents->QueryRows(1, 0, &rowSet) ;
5983 ++ if (HR_FAILED(mLastError)) {
5984 ++ PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5985 ++ return FALSE ;
5986 ++ }
5987 ++ rowCount = rowSet->cRows ;
5988 ++ if (rowCount > 0 &&
5989 ++ (aMapiType == 0 ||
5990 ++ rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
5991 ++ if (aList) {
5992 ++ SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
5994 ++ aList->AddItem(currentValue.Value.bin.cb,
5995 ++ NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5997 ++ }
5998 ++ }
5999 ++ MyFreeProws(rowSet) ;
6000 ++ } while (rowCount > 0) ;
6001 ++ return TRUE ;
6004 ++BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
6005 ++ ULONG aNbProperties, LPSPropValue& aValue,
6006 ++ ULONG& aValueCount)
6008 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
6009 ++ IMsgStore * mdb=NULL;
6010 ++ ULONG objType = 0 ;
6011 ++ LPSPropTagArray properties = NULL ;
6012 ++ ULONG i = 0 ;
6014 ++ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
6015 ++ &IID_IMAPIProp, 0, &objType,
6016 ++ object) ;
6018 ++ if (HR_FAILED(mLastError)){
6019 ++ PRINTF(("Cannot open entry %08x.\n", mLastError));
6020 ++ return FALSE;
6021 ++ }
6022 ++ AllocateBuffer(CbNewSPropTagArray(aNbProperties),
6023 ++ NS_REINTERPRET_CAST(void **, &properties));
6024 ++ properties->cValues = aNbProperties;
6025 ++ for (i = 0 ; i < aNbProperties ; ++ i) {
6026 ++ properties->aulPropTag [i] = aPropertyTags [i];
6027 ++ }
6028 ++ mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
6029 ++ FreeBuffer(properties);
6030 ++ if (HR_FAILED(mLastError)){
6031 ++ PRINTF(("Cannot get props %08x.\n", mLastError));
6032 ++ }
6033 ++ return HR_SUCCEEDED(mLastError) ;
6036 ++BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
6037 ++ LPSPropValue& aValues)
6039 ++ nsMapiInterfaceWrapper<LPMAPIPROP> object ;
6040 ++ ULONG objType = 0 ;
6041 ++ LPSPropProblemArray problems = NULL ;
6043 ++ mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
6044 ++ &IID_IMAPIProp, MAPI_MODIFY, &objType,
6045 ++ object) ;
6046 ++ if (HR_FAILED(mLastError)) {
6047 ++ PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
6048 ++ return FALSE ;
6049 ++ }
6050 ++ mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
6051 ++ if (HR_FAILED(mLastError)) {
6052 ++ PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
6053 ++ return FALSE ;
6054 ++ }
6055 ++ if (problems) {
6056 ++ for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
6057 ++ PRINTF(("Problem %d: index %d code %08x.\n", i,
6058 ++ problems->aProblem [i].ulIndex,
6059 ++ problems->aProblem [i].scode));
6060 ++ }
6061 ++ }
6062 ++ mLastError = object->SaveChanges(0) ;
6063 ++ if (HR_FAILED(mLastError)) {
6064 ++ PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
6065 ++ }
6066 ++ return HR_SUCCEEDED(mLastError) ;
6069 ++BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
6071 ++ LPENTRYID entryId = NULL;
6072 ++ ULONG byteCount = 0;
6074 ++ mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
6075 ++ if (HR_FAILED(mLastError)){
6076 ++ PRINTF(("Cannot get PAB %08x.\n", mLastError));
6077 ++ return FALSE;
6078 ++ }
6079 ++ aContainer.Assign(byteCount, entryId);
6080 ++ FreeBuffer(entryId) ;
6081 ++ return TRUE ;
6084 ++BOOL nsWabAddressBook::IsOK(void)
6086 ++ return mAddressBook != NULL ;
6089 + BOOL nsWabAddressBook::Initialize(void)
6091 +- if (mAddressBook) { return TRUE ; }
6092 + nsAutoLock guard(mMutex) ;
6094 + if (!LoadWabLibrary()) {
6095 +--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200
6096 ++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200
6097 +@@ -47,6 +47,15 @@
6098 + nsWabAddressBook(void) ;
6099 + virtual ~nsWabAddressBook(void) ;
6101 ++ // Get the top address books
6102 ++ virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
6104 ++ // Get a default address book container
6105 ++ virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
6106 ++ // Is the helper correctly initialised?
6107 ++ virtual BOOL IsOK(void);
6108 ++ static void FreeWabLibrary(void) ;
6110 + protected :
6111 + // Session and address book that will be shared by all instances
6112 + // (see nsMapiAddressBook.h for details)
6113 +@@ -57,15 +66,46 @@
6114 + static HMODULE mLibrary ;
6115 + static LPWABOPEN mWABOpen ;
6117 ++ LPADRBOOK mAddressBook ;
6119 + // Load the WAB environment
6120 + BOOL Initialize(void) ;
6122 ++ virtual HRESULT OpenEntry(ULONG cbEntryID,
6123 ++ LPENTRYID lpEntryID,
6124 ++ LPCIID lpInterface,
6125 ++ ULONG ulFlags,
6126 ++ ULONG FAR * lpulObjType,
6127 ++ LPUNKNOWN FAR * lppUnk
6128 ++ )
6129 ++ {
6130 ++ return mAddressBook->OpenEntry(cbEntryID,
6131 ++ lpEntryID,
6132 ++ lpInterface,
6133 ++ ulFlags,
6134 ++ lpulObjType,
6135 ++ lppUnk
6136 ++ );
6137 ++ }
6140 ++ // Retrieve the contents of a container, with an optional restriction
6141 ++ virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
6142 ++ nsMapiEntryArray *aList, ULONG aMapiType) ;
6143 ++ // Retrieve the values of a set of properties on a MAPI object
6144 ++ virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
6145 ++ ULONG aNbProperties,
6146 ++ LPSPropValue& aValues, ULONG& aValueCount) ;
6147 ++ // Set the values of a set of properties on a MAPI object
6148 ++ virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
6149 ++ LPSPropValue& aValues) ;
6151 + // Allocation of a buffer for transmission to interfaces
6152 + virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
6153 + // Destruction of a buffer provided by the interfaces
6154 + virtual void FreeBuffer(LPVOID aBuffer) ;
6155 + // Manage the library
6156 + static BOOL LoadWabLibrary(void) ;
6157 +- static void FreeWabLibrary(void) ;
6159 + private :
6160 + } ;
6161 +--- misc/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp 2007-05-03 03:39:41.000000000 +0200
6162 ++++ misc/build/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp 2008-08-20 16:46:58.000000000 +0200
6163 +@@ -819,8 +819,13 @@
6165 + if (mUseWideCharBiffIcon)
6167 +- ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
6168 +- if (wcslen(aToolTipString) >= toolTipBufSize)
6169 ++#ifdef __MINGW32__
6170 ++ ::wcsncpy( sWideBiffIconData.szTip, NS_REINTERPRET_CAST(LPCWSTR, aToolTipString), toolTipBufSize);
6171 ++ if (wcslen(NS_REINTERPRET_CAST(LPCWSTR, aToolTipString)) >= toolTipBufSize)
6172 ++#else
6173 ++ ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
6174 ++ if (wcslen(aToolTipString) >= toolTipBufSize)
6175 ++#endif
6176 + sWideBiffIconData.szTip[toolTipBufSize - 1] = 0;
6178 + else
6179 +@@ -862,7 +867,11 @@
6180 + // now we need to copy over any left over tool tip strings
6181 + if (sWideBiffIconData.szTip)
6183 ++#ifdef __MINGW32__
6184 ++ const PRUnichar * oldTooltipString = reinterpret_cast<PRUnichar*>(sWideBiffIconData.szTip);
6185 ++#else
6186 + const PRUnichar * oldTooltipString = sWideBiffIconData.szTip;
6187 ++#endif
6188 + SetToolTipStringOnIconData(oldTooltipString);
6191 +@@ -1040,7 +1049,11 @@
6192 + registryUnreadMailCountKey,
6193 + sizeof(registryUnreadMailCountKey))))
6195 ++#ifdef __MINGW32__
6196 ++ if (wcscmp(registryUnreadMailCountKey, NS_REINTERPRET_CAST(LPCWSTR, currentUnreadMailCountKey.get()))==0) {
6197 ++#else
6198 + if (wcscmp(registryUnreadMailCountKey, currentUnreadMailCountKey.get())==0) {
6199 ++#endif
6200 + nsAutoString deleteKey;
6201 + deleteKey.Assign(NS_LITERAL_STRING(UNREADMAILNODEKEY).get());
6202 + deleteKey.Append(currentUnreadMailCountKey.get());
6203 +@@ -1108,9 +1121,15 @@
6206 + // Write the info into the registry
6207 ++#ifdef __MINGW32__
6208 ++ HRESULT hr = mSHSetUnreadMailCount(NS_REINTERPRET_CAST(LPCWSTR, pBuffer.get()),
6209 ++ mCurrentUnreadCount,
6210 ++ NS_REINTERPRET_CAST(LPCWSTR, commandLinerForAppLaunch.get()));
6211 ++#else
6212 + HRESULT hr = mSHSetUnreadMailCount(pBuffer.get(),
6213 + mCurrentUnreadCount,
6214 + commandLinerForAppLaunch.get());
6215 ++#endif
6218 + // do this last
6219 +--- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100
6220 ++++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6221 +@@ -91,7 +91,7 @@
6222 + PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
6223 + endif
6225 +-EXTRA_DSO_LDOPTS = \
6226 ++EXTRA_DSO_LDOPTS += \
6227 + $(LIBS_DIR) \
6228 + $(MOZ_JS_LIBS) \
6229 + $(MOZ_COMPONENT_LIBS) \
6230 +--- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200
6231 ++++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200
6232 +@@ -277,7 +277,7 @@
6233 + nsresult
6234 + nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
6236 +- PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
6237 ++ PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
6238 + return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
6241 +--- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100
6242 ++++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
6243 +@@ -1,4 +1,4 @@
6244 +-#!/bin/sh
6245 ++#!/bin/bash
6247 + # Stupid wrapper to avoid win32 dospath/cygdrive issues
6248 + # Try not to spawn programs from within this file. If the stuff in here looks royally
6249 +--- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100
6250 ++++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
6251 +@@ -22,6 +22,7 @@
6252 + RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
6253 + OBJDIR_NAME = @OBJDIR_NAME@
6254 + OBJDIR = @OBJDIR@
6255 ++LIB_PREFIX = @LIB_PREFIX@
6256 + OBJ_SUFFIX = @OBJ_SUFFIX@
6257 + LIB_SUFFIX = @LIB_SUFFIX@
6258 + DLL_SUFFIX = @DLL_SUFFIX@
6259 +--- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100
6260 ++++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100
6261 +@@ -340,6 +340,10 @@
6262 + else # AIX 4.1
6263 + ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
6264 + $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
6265 ++ @if test -f $@.manifest; then \
6266 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
6267 ++ rm -f $@.manifest; \
6268 ++ fi
6269 + else
6270 + ifeq ($(MOZ_OS2_TOOLS),VACPP)
6271 + $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
6272 +--- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100
6273 ++++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200
6274 +@@ -2737,6 +2737,7 @@
6275 + LIB_SUFFIX=a
6276 + DLL_SUFFIX=so
6277 + ASM_SUFFIX=s
6278 ++LIB_PREFIX=lib
6279 + MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
6280 + PR_MD_ASFILES=
6281 + PR_MD_CSRCS=
6282 +@@ -3475,7 +3476,7 @@
6283 + EOF
6285 + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
6286 +- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
6287 ++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
6288 + if test "$MOZ_OBJFORMAT" = "elf"; then
6289 + DLL_SUFFIX=so
6290 + else
6291 +@@ -3941,7 +3942,7 @@
6292 + CC="$CC -mno-cygwin"
6293 + CXX="$CXX -mno-cygwin"
6294 + DLL_SUFFIX=dll
6295 +- MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
6296 ++ MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
6297 + RC=$WINDRES
6298 + # Use temp file for windres (bug 213281)
6299 + RCFLAGS='-O coff --use-temp-file'
6300 +@@ -5766,6 +5767,7 @@
6301 + CC="\$(CYGWIN_WRAPPER) $CC"
6302 + CXX="\$(CYGWIN_WRAPPER) $CXX"
6303 + RC="\$(CYGWIN_WRAPPER) $RC"
6304 ++ LD="\$(CYGWIN_WRAPPER) $LD"
6305 + ;;
6306 + esac
6308 +@@ -6127,6 +6129,7 @@
6309 + s%@LIB_SUFFIX@%$LIB_SUFFIX%g
6310 + s%@DLL_SUFFIX@%$DLL_SUFFIX%g
6311 + s%@ASM_SUFFIX@%$ASM_SUFFIX%g
6312 ++s%@LIB_PREFIX@%$LIB_PREFIX%g
6313 + s%@MKSHLIB@%$MKSHLIB%g
6314 + s%@DSO_CFLAGS@%$DSO_CFLAGS%g
6315 + s%@DSO_LDOPTS@%$DSO_LDOPTS%g
6316 +--- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100
6317 ++++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200
6318 +@@ -1137,7 +1137,7 @@
6319 + AC_DEFINE(HAVE_BSD_FLOCK)
6320 + AC_DEFINE(HAVE_SOCKLEN_T)
6321 + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
6322 +- MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
6323 ++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
6324 + if test "$MOZ_OBJFORMAT" = "elf"; then
6325 + DLL_SUFFIX=so
6326 + else
6327 +--- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100
6328 ++++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6329 +@@ -79,18 +79,22 @@
6330 + OS_LIBS = -lc
6331 + endif
6333 ++ifeq ($(OS_ARCH),Linux)
6334 ++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6335 ++endif
6337 + ifeq ($(OS_ARCH),SunOS)
6338 + OS_LIBS = -lc
6339 + MAPFILE = $(OBJDIR)/pldsmap.sun
6340 + GARBAGE += $(MAPFILE)
6341 + ifdef NS_USE_GCC
6342 + ifdef GCC_USE_GNU_LD
6343 +-MKSHLIB += -Wl,--version-script,$(MAPFILE)
6344 ++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6345 + else
6346 +-MKSHLIB += -Wl,-M,$(MAPFILE)
6347 ++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
6348 + endif
6349 + else
6350 +-MKSHLIB += -M $(MAPFILE)
6351 ++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
6352 + endif
6353 + # The -R '$ORIGIN' linker option instructs this library to search for its
6354 + # dependencies in the same directory where it resides.
6355 +--- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100
6356 ++++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6357 +@@ -89,18 +89,22 @@
6358 + OS_LIBS = -lc
6359 + endif
6361 ++ifeq ($(OS_ARCH),Linux)
6362 ++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6363 ++endif
6365 + ifeq ($(OS_ARCH),SunOS)
6366 + OS_LIBS = -lc
6367 + MAPFILE = $(OBJDIR)/plcmap.sun
6368 + GARBAGE += $(MAPFILE)
6369 + ifdef NS_USE_GCC
6370 + ifdef GCC_USE_GNU_LD
6371 +-MKSHLIB += -Wl,--version-script,$(MAPFILE)
6372 ++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6373 + else
6374 +-MKSHLIB += -Wl,-M,$(MAPFILE)
6375 ++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
6376 + endif
6377 + else
6378 +-MKSHLIB += -M $(MAPFILE)
6379 ++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
6380 + endif
6381 + # The -R '$ORIGIN' linker option instructs this library to search for its
6382 + # dependencies in the same directory where it resides.
6383 +--- misc/mozilla/nsprpub/pr/include/prtypes.h 2006-12-22 14:47:19.000000000 +0100
6384 ++++ misc/build/mozilla/nsprpub/pr/include/prtypes.h 2008-08-14 16:22:21.000000000 +0200
6385 +@@ -472,7 +472,7 @@
6387 + #ifndef __PRUNICHAR__
6388 + #define __PRUNICHAR__
6389 +-#if defined(WIN32) || defined(XP_MAC)
6390 ++#if !defined(__MINGW32__) && (defined(WIN32) || defined(XP_MAC))
6391 + typedef wchar_t PRUnichar;
6392 + #else
6393 + typedef PRUint16 PRUnichar;
6394 +--- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100
6395 ++++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200
6396 +@@ -113,7 +113,8 @@
6397 + #define _PR_HAVE_5_ARG_GETPROTO_R
6398 + #endif
6400 +-#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
6401 ++#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
6402 ++ (defined(__FreeBSD__) && __FreeBSD_version > 601103)
6403 + #define _PR_HAVE_GETPROTO_R
6404 + #define _PR_HAVE_5_ARG_GETPROTO_R
6405 + #endif
6406 +--- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100
6407 ++++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
6408 +@@ -65,7 +65,7 @@
6410 + ARCH = freebsd
6412 +-MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
6413 ++MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
6415 + ifeq ($(MOZ_OBJFORMAT),elf)
6416 + DLL_SUFFIX = so
6417 +--- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100
6418 ++++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200
6419 +@@ -139,7 +139,7 @@
6421 + ifeq ($(OS_RELEASE),2.0)
6422 + OS_REL_CFLAGS += -DLINUX2_0
6423 +- MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
6424 ++ MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
6425 + ifdef MAPFILE
6426 + MKSHLIB += -Wl,--version-script,$(MAPFILE)
6427 + endif
6428 +@@ -166,6 +166,7 @@
6430 + DSO_CFLAGS = -fPIC
6431 + DSO_LDOPTS = -shared $(ARCHFLAG)
6432 ++DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6433 + DSO_LDFLAGS =
6434 + LDFLAGS += $(ARCHFLAG)
6436 +--- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200
6437 ++++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200
6438 +@@ -161,12 +161,14 @@
6440 + # ld options:
6441 + # -G: produce a shared object
6442 ++# -R '$ORIGIN': search for dependencies in same directory
6443 + # -z defs: no unresolved symbols allowed
6444 + ifdef NS_USE_GCC
6445 + ifeq ($(USE_64), 1)
6446 + DSO_LDOPTS += -m64
6447 + endif
6448 + DSO_LDOPTS += -shared -h $(notdir $@)
6449 ++ DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6450 + else
6451 + ifeq ($(USE_64), 1)
6452 + ifeq ($(OS_TEST),i86pc)
6453 +@@ -176,6 +178,7 @@
6454 + endif
6455 + endif
6456 + DSO_LDOPTS += -G -h $(notdir $@)
6457 ++ DSO_LDOPTS += -R '$$ORIGIN'
6458 + endif
6459 + DSO_LDOPTS += -z combreloc -z defs -z ignore
6461 +--- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200
6462 ++++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200
6463 +@@ -43,24 +43,24 @@
6464 + DEFAULT_COMPILER = cl
6466 + ifdef NS_USE_GCC
6467 +- CC = gcc
6468 +- CCC = g++
6469 +- LINK = ld
6470 +- AR = ar
6471 ++ CC = $(CYGWIN_WRAPPER) gcc
6472 ++ CCC = $(CYGWIN_WRAPPER) g++
6473 ++ LINK = $(CYGWIN_WRAPPER) ld
6474 ++ AR = $(CYGWIN_WRAPPER) ar
6475 + AR += cr $@
6476 +- RANLIB = ranlib
6477 ++ RANLIB = $(CYGWIN_WRAPPER) ranlib
6478 + BSDECHO = echo
6479 +- RC = windres.exe -O coff --use-temp-file
6480 +- LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
6481 ++ RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
6482 ++ LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
6483 + else
6484 +- CC = cl
6485 +- CCC = cl
6486 +- LINK = link
6487 +- AR = lib
6488 ++ CC = $(CYGWIN_WRAPPER) cl
6489 ++ CCC = $(CYGWIN_WRAPPER) cl
6490 ++ LINK = $(CYGWIN_WRAPPER) link
6491 ++ AR = $(CYGWIN_WRAPPER) lib
6492 + AR += -NOLOGO -OUT:"$@"
6493 + RANLIB = echo
6494 + BSDECHO = echo
6495 +- RC = rc.exe
6496 ++ RC = $(CYGWIN_WRAPPER) rc.exe
6497 + MT = mt.exe
6498 + endif
6500 +@@ -69,7 +69,7 @@
6501 + else
6502 + NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
6503 + endif
6504 +-NSINSTALL = nsinstall
6505 ++NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
6507 + MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
6508 + MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
6509 +@@ -95,7 +95,7 @@
6510 + # dllimport cannot be used as as a constant address.
6511 + OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
6512 + _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
6513 +- DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
6514 ++ DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
6515 + ifdef BUILD_OPT
6516 + OPTIMIZER += -O2
6517 + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
6518 +--- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200
6519 ++++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200
6520 +@@ -72,3 +72,7 @@
6521 + endif
6522 + endif
6523 + DEFINES += -DWIN95
6525 ++ifdef NS_USE_GCC
6526 ++NSPR31_LIB_PREFIX = lib
6527 ++endif
6528 +--- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200
6529 ++++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200
6530 +@@ -45,7 +45,7 @@
6531 + CCF = $(CC) $(CFLAGS)
6532 + LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
6533 + LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
6534 +-CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6535 ++CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6536 + $(XCFLAGS)
6537 + PERL = perl
6538 + RANLIB = echo
6539 +--- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200
6540 ++++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200
6541 +@@ -284,7 +284,7 @@
6542 + $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
6543 + @$(MAKE_OBJDIR)
6544 + ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6545 +- $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
6546 ++ $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
6547 + ifdef MT
6548 + if test -f $@.manifest; then \
6549 + $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
6550 +@@ -305,11 +305,7 @@
6551 + $(LIBRARY): $(OBJS)
6552 + @$(MAKE_OBJDIR)
6553 + rm -f $@
6554 +-ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6555 +- $(AR) $(subst /,\\,$(OBJS))
6556 +-else
6557 + $(AR) $(OBJS)
6558 +-endif
6559 + $(RANLIB) $@
6562 +@@ -344,7 +340,7 @@
6563 + ifdef NS_USE_GCC
6564 + $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6565 + else
6566 +- $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
6567 ++ $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6568 + ifdef MT
6569 + if test -f $@.manifest; then \
6570 + $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
6571 +@@ -429,15 +425,15 @@
6572 + endif
6573 + endif
6575 +-core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6576 ++mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6578 + $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6579 + @$(MAKE_OBJDIR)
6580 + ifdef USE_NT_C_SYNTAX
6581 +- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6582 ++ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6583 + else
6584 + ifdef NEED_ABSOLUTE_PATH
6585 +- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6586 ++ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6587 + else
6588 + $(CC) -o $@ -c $(CFLAGS) $<
6589 + endif
6590 +@@ -445,10 +441,10 @@
6592 + $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6593 + ifdef USE_NT_C_SYNTAX
6594 +- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6595 ++ $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6596 + else
6597 + ifdef NEED_ABSOLUTE_PATH
6598 +- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6599 ++ $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6600 + else
6601 + $(CC) -o $@ -c $(CFLAGS) $<
6602 + endif
6603 +@@ -477,10 +473,10 @@
6604 + $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
6605 + @$(MAKE_OBJDIR)
6606 + ifdef USE_NT_C_SYNTAX
6607 +- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6608 ++ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6609 + else
6610 + ifdef NEED_ABSOLUTE_PATH
6611 +- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6612 ++ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6613 + else
6614 + $(CCC) -o $@ -c $(CFLAGS) $<
6615 + endif
6616 +@@ -501,10 +497,10 @@
6617 + rm -f $(OBJDIR)/t_$*.cc
6618 + else
6619 + ifdef USE_NT_C_SYNTAX
6620 +- $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6621 ++ $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6622 + else
6623 + ifdef NEED_ABSOLUTE_PATH
6624 +- $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6625 ++ $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6626 + else
6627 + $(CCC) -o $@ -c $(CFLAGS) $<
6628 + endif
6629 +--- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200
6630 ++++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6631 +@@ -172,6 +172,7 @@
6632 + endif
6633 + ifeq ($(OS_ARCH),WINNT)
6634 + DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
6635 ++DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
6636 + ifdef MOZ_DEBUG
6637 + ifndef MOZ_NO_DEBUG_RTL
6638 + DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
6639 +--- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
6640 ++++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100
6641 +@@ -86,17 +86,46 @@
6643 + include ../platrules.mk
6645 +-SRCDIR = $(call core_abspath,.)
6647 ++ifeq ($(OS_TARGET), Darwin)
6648 ++ SRCDIR = .
6649 ++else
6650 ++ifeq ($(OS_TARGET), Linux)
6651 ++ SRCDIR = .
6652 ++else
6653 ++ifeq ($(OS_TARGET), WIN95)
6654 ++ SRCDIR = $(shell cygpath -d $(SRCDIR))
6655 ++else
6656 ++ SRCDIR = .
6657 ++endif
6658 ++endif
6659 ++endif
6660 + %.chk: %.$(DLL_SUFFIX)
6661 + ifeq ($(OS_TARGET), OS2)
6662 + cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
6663 + $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6664 + $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6665 + else
6666 +- cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
6667 +- $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6668 +- $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6669 ++ifeq ($(OS_TARGET), WIN95)
6670 ++ sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
6671 ++ $(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
6672 ++ $(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
6673 ++else
6674 ++ifeq ($(OS_TARGET), Darwin)
6675 ++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6676 ++ $(OBJDIR) $(OS_TARGET) \
6677 ++ $(NSPR_LIB_DIR) $<
6678 ++else
6679 ++ifeq ($(OS_TARGET), Linux)
6680 ++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6681 ++ $(OBJDIR) $(OS_TARGET) \
6682 ++ $(NSPR_LIB_DIR) $<
6683 ++else
6684 ++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6685 ++ $(OBJDIR) $(OS_TARGET) \
6686 ++ $(NSPR_LIB_DIR) $<
6687 ++endif
6688 ++endif
6689 ++endif
6690 + endif
6692 + libs install :: $(CHECKLOC)
6693 +--- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100
6694 ++++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200
6695 +@@ -63,9 +63,4 @@
6696 + DSO_LDOPTS = -bundle
6697 + endif
6699 +-ifeq ($(OS_TARGET),SunOS)
6700 +-# The -R '$ORIGIN' linker option instructs this library to search for its
6701 +-# dependencies in the same directory where it resides.
6702 +-MKSHLIB += -R '$$ORIGIN'
6703 +-endif
6705 +--- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200
6706 ++++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200
6707 +@@ -199,10 +199,6 @@
6708 + endif
6710 + ifeq ($(OS_TARGET),SunOS)
6712 +-# The -R '$ORIGIN' linker option instructs this library to search for its
6713 +-# dependencies in the same directory where it resides.
6714 +-MKSHLIB += -R '$$ORIGIN'
6715 + ifdef NS_USE_GCC
6716 + ifdef GCC_USE_GNU_LD
6717 + MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
6718 +@@ -210,7 +206,7 @@
6719 + MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
6720 + endif # GCC_USE_GNU_LD
6721 + else
6722 +- MKSHLIB += -B symbolic -z now -z text
6723 ++ MKSHLIB += -z now -z text
6724 + endif # NS_USE_GCC
6726 + # Sun's WorkShop defines v8, v8plus and v9 architectures.
6727 +--- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100
6728 ++++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200
6729 +@@ -113,12 +113,10 @@
6730 + # The -R '$ORIGIN' linker option instructs this library to search for its
6731 + # dependencies in the same directory where it resides.
6732 + ifeq ($(USE_64), 1)
6733 +-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6734 ++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6735 + else
6736 +-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6737 ++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6738 + endif
6739 +-else
6740 +-MKSHLIB += -R '$$ORIGIN'
6741 + endif
6742 + endif
6744 +@@ -127,9 +125,9 @@
6745 + # pa-risc
6746 + ifeq ($(USE_64), 1)
6747 + MKSHLIB += +b '$$ORIGIN'
6748 +-endif
6749 +-endif
6750 +-endif
6751 ++endif # USE_64
6752 ++endif # OS_TEST
6753 ++endif # OS_ARCH
6755 + ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
6756 + ifndef NS_USE_GCC
6757 +--- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200
6758 ++++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200
6759 +@@ -61,6 +61,7 @@
6760 + CERT_CheckCertValidTimes;
6761 + CERT_CreateCertificateRequest;
6762 + CERT_ChangeCertTrust;
6763 ++CERT_DecodeDERCertificate;
6764 + CERT_DecodeDERCrl;
6765 + CERT_DestroyCertificateRequest;
6766 + CERT_DestroyCertList;
6767 +--- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100
6768 ++++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200
6769 +@@ -92,8 +92,3 @@
6770 + ../pkcs7 \
6771 + $(NULL)
6773 +-ifeq ($(OS_TARGET),SunOS)
6774 +-# The -R '$ORIGIN' linker option instructs this library to search for its
6775 +-# dependencies in the same directory where it resides.
6776 +-MKSHLIB += -R '$$ORIGIN'
6777 +-endif
6778 +--- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100
6779 ++++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200
6780 +@@ -87,13 +87,6 @@
6781 + $(NULL)
6782 + endif
6784 +-ifeq ($(OS_TARGET),SunOS)
6785 +-# The -R '$ORIGIN' linker option instructs this library to search for its
6786 +-# dependencies in the same directory where it resides.
6787 +-MKSHLIB += -R '$$ORIGIN'
6788 +-OS_LIBS += -lbsm
6789 +-endif
6791 + ifeq ($(OS_TARGET),WINCE)
6792 + DEFINES += -DDBM_USING_NSPR
6793 + endif
6794 +--- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200
6795 ++++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200
6796 +@@ -116,13 +116,6 @@
6797 + EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
6798 + endif
6800 +-ifeq ($(OS_TARGET),SunOS)
6801 +-# The -R '$ORIGIN' linker option instructs this library to search for its
6802 +-# dependencies in the same directory where it resides.
6803 +-MKSHLIB += -R '$$ORIGIN'
6804 +-#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
6805 +-endif
6807 + endif
6809 + # indicates dependency on freebl static lib
6810 +--- misc/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp 2007-10-08 21:09:06.000000000 +0200
6811 ++++ misc/build/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp 2008-08-18 09:53:47.000000000 +0200
6812 +@@ -163,11 +163,21 @@
6813 + if (aProtocolScheme && *aProtocolScheme)
6815 + HKEY hKey;
6816 +- LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
6817 ++ LONG err;
6818 ++#ifdef __MINGW32__
6819 ++ err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, NS_REINTERPRET_CAST(LPCWSTR, aProtocolScheme), 0,
6820 + KEY_QUERY_VALUE, &hKey);
6821 ++#else
6822 ++ err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
6823 ++ KEY_QUERY_VALUE, &hKey);
6824 ++#endif
6825 + if (err == ERROR_SUCCESS)
6827 ++#ifdef __MINGW32__
6828 ++ err = ::RegQueryValueEx(hKey, NS_REINTERPRET_CAST(LPCWSTR, "URL Protocol"), NULL, NULL, NULL, NULL);
6829 ++#else
6830 + err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL);
6831 ++#endif
6832 + *aHandlerExists = (err == ERROR_SUCCESS);
6833 + // close the key
6834 + ::RegCloseKey(hKey);
6835 +--- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200
6836 ++++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6837 +@@ -181,7 +181,7 @@
6838 + GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
6840 + XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
6841 +-XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6842 ++XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6844 + EXTRA_DEPS = \
6845 + $(XP_DIST_DEP_LIBS) \
6846 +--- misc/mozilla/widget/src/windows/nsDataObj.cpp 2006-06-21 06:33:32.000000000 +0200
6847 ++++ misc/build/mozilla/widget/src/windows/nsDataObj.cpp 2008-08-18 15:49:13.000000000 +0200
6848 +@@ -570,9 +570,15 @@
6849 + int currLen, textLen = (int) NS_MIN(aText.Length(), aFilenameLen);
6850 + char defaultChar = '_';
6851 + do {
6852 ++#ifdef __MINGW32__
6853 ++ currLen = WideCharToMultiByte(CP_ACP,
6854 ++ NS_REINTERPRET_CAST(LPCWSTR, WC_COMPOSITECHECK|WC_DEFAULTCHAR),
6855 ++ aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
6856 ++#else
6857 + currLen = WideCharToMultiByte(CP_ACP,
6858 + WC_COMPOSITECHECK|WC_DEFAULTCHAR,
6859 + aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
6860 ++#endif
6862 + while (currLen == 0 && textLen > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
6863 + if (currLen > 0 && textLen > 0) {
6864 +--- misc/mozilla/widget/src/windows/nsFilePicker.cpp 2006-02-03 15:41:10.000000000 +0100
6865 ++++ misc/build/mozilla/widget/src/windows/nsFilePicker.cpp 2008-08-19 10:05:12.000000000 +0200
6866 +@@ -135,7 +135,11 @@
6868 + PRBool result = PR_FALSE;
6869 + PRUnichar fileBuffer[FILE_BUFFER_SIZE+1];
6870 ++#ifdef __MINGW32__
6871 ++ wcsncpy(NS_REINTERPRET_CAST(LPOWSTR, fileBuffer), NS_REINTERPRET_CAST(LPOWSTR, mDefault.get()), FILE_BUFFER_SIZE);
6872 ++#else
6873 + wcsncpy(fileBuffer, mDefault.get(), FILE_BUFFER_SIZE);
6874 ++#endif
6875 + fileBuffer[FILE_BUFFER_SIZE] = '\0'; // null terminate in case copy truncated
6877 + NS_NAMED_LITERAL_STRING(htmExt, "html");
6878 +@@ -155,14 +159,22 @@
6880 + if (mMode == modeGetFolder) {
6881 + PRUnichar dirBuffer[MAX_PATH+1];
6882 ++#ifdef __MINGW32__
6883 ++ wcsncpy(NS_REINTERPRET_CAST(LPWSTR, dirBuffer), NS_REINTERPRET_CAST(LPCWSTR, initialDir.get()), MAX_PATH);
6884 ++#else
6885 + wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
6886 ++#endif
6888 + BROWSEINFOW browserInfo;
6889 + browserInfo.hwndOwner = (HWND)
6890 + (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
6891 + browserInfo.pidlRoot = nsnull;
6892 + browserInfo.pszDisplayName = (LPWSTR)dirBuffer;
6893 ++#ifdef __MINGW32__
6894 ++ browserInfo.lpszTitle = NS_REINTERPRET_CAST(LPCWSTR, mTitle.get());
6895 ++#else
6896 + browserInfo.lpszTitle = mTitle.get();
6897 ++#endif
6898 + browserInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
6899 + if (initialDir.Length()) // convert folder path to native, the strdup copy will be released in BrowseCallbackProc
6901 +@@ -202,7 +214,11 @@
6902 + nsString filterBuffer = mFilterList;
6904 + if (!initialDir.IsEmpty()) {
6905 ++#ifdef __MINGW32__
6906 ++ ofn.lpstrInitialDir = NS_REINTERPRET_CAST(LPCWSTR, initialDir.get());
6907 ++#else
6908 + ofn.lpstrInitialDir = initialDir.get();
6909 ++#endif
6912 + ofn.lpstrTitle = (LPCWSTR)mTitle.get();
6913 +@@ -210,13 +226,21 @@
6914 + ofn.nFilterIndex = mSelectedType;
6915 + ofn.hwndOwner = (HWND)
6916 + (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
6917 ++#ifdef __MINGW32__
6918 ++ ofn.lpstrFile = NS_REINTERPRET_CAST(LPWSTR, fileBuffer);
6919 ++#else
6920 + ofn.lpstrFile = fileBuffer;
6921 ++#endif
6922 + ofn.nMaxFile = FILE_BUFFER_SIZE;
6924 + ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
6926 + if (!mDefaultExtension.IsEmpty()) {
6927 ++#ifdef __MINGW32__
6928 ++ ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, mDefaultExtension.get());
6929 ++#else
6930 + ofn.lpstrDefExt = mDefaultExtension.get();
6931 ++#endif
6933 + else {
6934 + // Get file extension from suggested filename
6935 +@@ -236,7 +260,11 @@
6936 + //XXX Actually, behavior is sort of weird:
6937 + // often appends ".html" even if you have an extension
6938 + // It obeys your extension if you put quotes around name
6939 ++#ifdef __MINGW32__
6940 ++ ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, htmExt.get());
6941 ++#else
6942 + ofn.lpstrDefExt = htmExt.get();
6943 ++#endif
6947 +--- misc/mozilla/widget/src/windows/nsWindow.cpp 2007-11-19 21:40:12.000000000 +0100
6948 ++++ misc/build/mozilla/widget/src/windows/nsWindow.cpp 2008-08-20 16:18:08.000000000 +0200
6949 +@@ -7088,7 +7088,11 @@
6950 + return; // out of memory
6952 + unicharSize = MultiByteToWideChar(gCurrentKeyboardCP, MB_PRECOMPOSED,
6953 +- aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
6954 ++#ifdef __MINGW32__
6955 ++ aStrAnsi->get(), aStrAnsi->Length(), S_REINTERPRET_CAST(LPWSTR, aStrUnicode->BeginWriting()), unicharSize + 1);
6956 ++#else
6957 ++ aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
6958 ++#endif
6959 + aStrUnicode->SetLength(unicharSize);
6962 +@@ -7265,7 +7269,11 @@
6963 + sIMEAttributeArray[i] = sIMEAttributeArray[offset];
6965 + offset += ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6966 +- sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
6967 ++#ifdef __MINGW32__
6968 ++ REINTERPRET_CAST(LPCWSTR, sIMECompUnicode->get() + i), 1, NULL, 0, NULL, NULL);
6969 ++#else
6970 ++ sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
6971 ++#endif
6974 + sIMEAttributeArrayLength = sIMECompUnicode->Length();
6975 +@@ -7477,7 +7485,11 @@
6976 + *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
6977 + } else {
6978 + len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6979 ++#ifdef __MINGW32__
6980 ++ NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
6981 ++#else
6982 + sIMEReconvertUnicode,
6983 ++#endif
6984 + nsCRT::strlen(sIMEReconvertUnicode),
6985 + NULL, 0, NULL, NULL);
6986 + *oResult = sizeof(RECONVERTSTRING) + len;
6987 +@@ -7496,7 +7508,11 @@
6988 + *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
6989 + } else {
6990 + len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6991 ++#ifdef __MINGW32__
6992 ++ NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
6993 ++#else
6994 + sIMEReconvertUnicode,
6995 ++#endif
6996 + nsCRT::strlen(sIMEReconvertUnicode),
6997 + NULL, 0, NULL, NULL);
6998 + *oResult = sizeof(RECONVERTSTRING) + len;
6999 +@@ -7523,7 +7539,11 @@
7000 + sIMEReconvertUnicode, len * sizeof(WCHAR));
7001 + } else {
7002 + ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
7003 ++#ifdef __MINGW32__
7004 ++ NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
7005 ++#else
7006 + sIMEReconvertUnicode,
7007 ++#endif
7008 + nsCRT::strlen(sIMEReconvertUnicode),
7009 + (LPSTR) (aData + sizeof(RECONVERTSTRING)),
7010 + len,
7011 +--- misc/mozilla/xpcom/base/nscore.h 2006-08-24 23:46:32.000000000 +0200
7012 ++++ misc/build/mozilla/xpcom/base/nscore.h 2008-08-16 12:01:53.000000000 +0200
7013 +@@ -337,7 +337,7 @@
7014 + * commercial build. When this is fixed there will be no need for the
7015 + * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
7016 + */
7017 +- #if defined(HAVE_CPP_2BYTE_WCHAR_T) && defined(NS_WIN32)
7018 ++ #if defined(HAVE_CPP_2BYTE_WCHAR_T) && !defined(__MINGW32__) && (defined(NS_WIN32) || defined(XP_MAC))
7019 + typedef wchar_t PRUnichar;
7020 + #else
7021 + typedef PRUint16 PRUnichar;
7022 +--- misc/mozilla/xpcom/io/nsLocalFileWin.cpp 2007-11-19 21:38:17.000000000 +0100
7023 ++++ misc/build/mozilla/xpcom/io/nsLocalFileWin.cpp 2008-08-20 16:39:58.000000000 +0200
7024 +@@ -836,8 +836,11 @@
7025 + PRUnichar *resolvedPath = mResolvedPath.BeginWriting();
7027 + // resolve this shortcut
7028 ++#ifdef __MINGW32__
7029 ++ nsresult rv = gResolver->Resolve(NS_REINTERPRET_CAST(LPCWSTR, mWorkingPath.get()), resolvedPath);
7030 ++#else
7031 + nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
7033 ++#endif
7034 + size_t len = NS_FAILED(rv) ? 0 : wcslen(resolvedPath);
7035 + mResolvedPath.SetLength(len);
7037 +--- misc/mozilla/xpcom/io/nsNativeCharsetUtils.cpp 2006-06-22 21:13:01.000000000 +0200
7038 ++++ misc/build/mozilla/xpcom/io/nsNativeCharsetUtils.cpp 2008-08-14 16:22:21.000000000 +0200
7039 +@@ -935,7 +935,11 @@
7041 + PRUnichar *result = out_iter.get();
7043 ++#ifdef __MINGW32__
7044 ++ ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, NS_REINTERPRET_CAST(LPWSTR, result), resultLen);
7045 ++#else
7046 + ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen);
7047 ++#endif
7049 + return NS_OK;
7051 +@@ -953,7 +957,11 @@
7052 + // determine length of result
7053 + PRUint32 resultLen = 0;
7055 ++#ifdef __MINGW32__
7056 ++ int n = ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, NULL, 0, NULL, NULL);
7057 ++#else
7058 + int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, NULL, 0, NULL, NULL);
7059 ++#endif
7060 + if (n > 0)
7061 + resultLen += n;
7063 +@@ -970,7 +978,11 @@
7065 + char *result = out_iter.get();
7067 ++#ifdef __MINGW32__
7068 ++ ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, result, resultLen,
7069 ++#else
7070 + ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen,
7071 ++#endif
7072 + &defaultChar, NULL);
7074 + return NS_OK;
7075 +--- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200
7076 ++++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200
7077 +@@ -132,7 +132,7 @@
7080 + PRBool IsArray() const
7081 +- {return (PRBool) TagPart() == T_ARRAY;}
7082 ++ {return (PRBool) (TagPart() == T_ARRAY);}
7084 + // 'Dependent' means that params of this type are dependent upon other
7085 + // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
7086 +@@ -152,7 +152,7 @@
7087 + uint8 TagPart() const
7088 + {return (uint8) (flags & XPT_TDP_TAGMASK);}
7090 +- enum
7091 ++ enum _xpttype
7093 + T_I8 = TD_INT8 ,
7094 + T_I16 = TD_INT16 ,
7095 +--- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200
7096 ++++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200
7097 +@@ -115,11 +115,14 @@
7099 + include $(topsrcdir)/config/config.mk
7101 ++# reduce prerequisites by disabling mozilla binary
7102 ++ifndef DISABLE_MOZ_EXECUTABLE
7103 + ifeq ($(USE_SHORT_LIBNAME),1)
7104 + PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
7105 + else
7106 + PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
7107 + endif
7108 ++endif
7110 + # Force applications to be built non-statically
7111 + # when building the mozcomps meta component
7112 +@@ -491,6 +494,7 @@
7113 + APP_NAME = $(MOZ_APP_DISPLAYNAME)
7114 + endif
7116 ++ifdef PROGRAM
7117 + libs:: $(PROGRAM)
7118 + mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
7119 + rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
7120 +@@ -505,6 +509,7 @@
7121 + rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
7122 + cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
7123 + echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
7124 ++endif
7126 + clean clobber::
7127 + rm -rf $(DIST)/$(APP_NAME).app
7128 +--- misc/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2007-02-22 14:05:28.000000000 +0100
7129 ++++ misc/build/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2008-08-20 16:53:04.000000000 +0200
7130 +@@ -142,7 +142,11 @@
7131 + int acplen = aStr.Length() * 2 + 1;
7132 + char * acp = new char[ acplen ];
7133 + if( acp ) {
7134 +- int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
7135 ++#ifdef __MINGW32__
7136 ++ int outlen = ::WideCharToMultiByte( CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aStr.get()), aStr.Length(),
7137 ++#else
7138 ++ int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
7139 ++#endif
7140 + acp, acplen-1, NULL, NULL );
7141 + acp[ outlen ] = '\0'; // null terminate
7143 +@@ -2507,7 +2511,11 @@
7145 + // Create menu and add item.
7146 + mTrayIconMenu = ::CreatePopupMenu();
7147 ++#ifdef __MINGW32__
7148 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, NS_REINTERPRET_CAST(LPCWSTR, navigatorText.get()) );
7149 ++#else
7150 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, navigatorText.get() );
7151 ++#endif
7152 + if ( ::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
7153 + AppendMenuItem( mTrayIconMenu, TURBO_NAVIGATOR, navigatorText );
7154 + if ( isMail )
7155 +@@ -2521,6 +2529,15 @@
7157 + else {
7158 + if (isMail)
7159 ++#ifdef __MINGW32__
7160 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, NS_REINTERPRET_CAST(LPCWSTR, mailText.get()) );
7161 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, NS_REINTERPRET_CAST(LPCWSTR, editorText.get()) );
7162 ++ if (isMail)
7163 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_ADDRESSBOOK, NS_REINTERPRET_CAST(LPCWSTR, addressbookText.get()) );
7164 ++ ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
7165 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, NS_REINTERPRET_CAST(LPCWSTR, disableText.get()) );
7166 ++ ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, NS_REINTERPRET_CAST(LPCWSTR, exitText.get()) );
7167 ++#else
7168 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, mailText.get() );
7169 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, editorText.get() );
7170 + if (isMail)
7171 +@@ -2528,6 +2545,7 @@
7172 + ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
7173 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, disableText.get() );
7174 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, exitText.get() );
7175 ++#endif
7179 --- moz/download/mozilla-source.txt (.../tags/DEV300_m41/moz) (revision 268999)
7180 +++ moz/download/mozilla-source.txt (.../cws/moz2seamonkey01/moz) (revision 268999)
7181 @@ -1,15 +1,9 @@
7182 Please copy the source archive for the Mozilla sources into this directory.
7183 -At the moment "mozilla-source-1.7.5.tar.gz" is required, it can be found
7184 +At the moment "seamonkey-1.1.12-source.tar.gz" is required, it can be found
7185 here:
7186 - http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.5/source/
7187 + http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.13
7189 Windows builders need also
7190 - "vc71-glib-1.2.10-bin.zip" and
7191 - "vc71-libIDL-0.6.8-bin.zip".
7192 -They can be found here:
7193 - ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/
7195 -And also
7196 - "wintools.zip"
7197 + "vc8-moztools.zip"
7198 which can be found here:
7199 - http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip
7200 \ No newline at end of file
7201 + ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/
7202 --- moz/patches/embed_manifest.patch (.../tags/DEV300_m41/moz) (revision 0)
7203 +++ moz/patches/embed_manifest.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
7204 @@ -0,0 +1,142 @@
7205 +--- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200
7206 ++++ mozilla/configure 2008-11-09 23:59:19.984375000 +0100
7207 +@@ -1068,6 +1068,8 @@
7208 + GCONF_VERSION=1.2.1
7209 + LIBGNOME_VERSION=2.0
7211 ++MSMANIFEST_TOOL=
7213 + MISSING_X=
7214 + for ac_prog in gawk mawk nawk awk
7215 + do
7216 +@@ -3025,6 +3027,22 @@
7217 + else
7218 + { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
7219 + fi
7221 ++ # bug #249782
7222 ++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
7223 ++ if test "$_CC_SUITE" -ge "8"; then
7224 ++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
7225 ++ if test -n "MSMT_TOOL"; then
7226 ++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
7227 ++ if test -z "MSMANIFEST_TOOL_VERSION"; then
7228 ++ echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
7229 ++ fi
7230 ++ MSMANIFEST_TOOL=1
7231 ++ unset MSMT_TOOL
7232 ++ else
7233 ++ { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
7234 ++ fi
7235 ++ fi
7237 + # Check linker version
7238 + _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
7239 +--- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200
7240 ++++ mozilla/configure.in 2008-11-09 23:59:20.000000000 +0100
7241 +@@ -126,6 +126,8 @@
7242 + GCONF_VERSION=1.2.1
7243 + LIBGNOME_VERSION=2.0
7245 ++MSMANIFEST_TOOL=
7247 + dnl Set various checks
7248 + dnl ========================================================
7249 + MISSING_X=
7250 +@@ -428,6 +430,22 @@
7251 + else
7252 + AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
7253 + fi
7255 ++ # bug #249782
7256 ++ # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
7257 ++ if test "$_CC_SUITE" -ge "8"; then
7258 ++ MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
7259 ++ if test -n "MSMT_TOOL"; then
7260 ++ MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
7261 ++ if test -z "MSMANIFEST_TOOL_VERSION"; then
7262 ++ AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
7263 ++ fi
7264 ++ MSMANIFEST_TOOL=1
7265 ++ unset MSMT_TOOL
7266 ++ else
7267 ++ AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
7268 ++ fi
7269 ++ fi
7271 + # Check linker version
7272 + _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
7273 +@@ -7319,6 +7339,7 @@
7274 + AC_SUBST(USE_N32)
7275 + AC_SUBST(CC_VERSION)
7276 + AC_SUBST(CXX_VERSION)
7277 ++AC_SUBST(MSMANIFEST_TOOL)
7279 + if test "$USING_HCC"; then
7280 + CC='${topsrcdir}/build/hcc'
7281 +--- mozilla.pure/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
7282 ++++ mozilla/config/rules.mk 2008-11-09 23:59:19.968750000 +0100
7283 +@@ -811,6 +812,12 @@
7285 + ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
7286 + $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
7287 ++ifdef MSMANIFEST_TOOL
7288 ++ @if test -f $@.manifest; then \
7289 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
7290 ++ rm -f $@.manifest; \
7291 ++ fi
7292 ++endif # MSVC with manifest tool
7293 + else
7294 + ifeq ($(CPP_PROG_LINK),1)
7295 + $(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)
7296 +@@ -843,6 +850,12 @@
7297 + else
7298 + ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
7299 + $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
7300 ++ifdef MSMANIFEST_TOOL
7301 ++ @if test -f $@.manifest; then \
7302 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
7303 ++ rm -f $@.manifest; \
7304 ++ fi
7305 ++endif # MSVC with manifest tool
7306 + else
7307 + $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
7308 + endif
7309 +@@ -866,6 +879,12 @@
7310 + else
7311 + ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
7312 + $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
7313 ++ifdef MSMANIFEST_TOOL
7314 ++ @if test -f $@.manifest; then \
7315 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
7316 ++ rm -f $@.manifest; \
7317 ++ fi
7318 ++endif # MSVC with manifest tool
7319 + else
7320 + ifeq ($(CPP_PROG_LINK),1)
7321 + $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
7322 +@@ -1019,6 +1038,14 @@
7323 + endif # SHARED_LIBRARY_LIBS
7324 + endif # NO_LD_ARCHIVE_FLAGS
7325 + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
7326 ++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
7327 ++ifdef MSMANIFEST_TOOL
7328 ++ @if test -f $@.manifest; then \
7329 ++ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
7330 ++ rm -f $@.manifest; \
7331 ++ fi
7332 ++endif # MSVC with manifest tool
7333 ++endif # WINNT && !GCC
7334 + @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
7335 + else # os2 vacpp
7336 + $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
7337 +--- mozilla.pure/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
7338 ++++ mozilla/config/autoconf.mk.in 2008-11-09 23:59:19.953125000 +0100
7339 +@@ -543,6 +543,7 @@
7340 + MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
7341 + MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
7342 + MOZ_QUANTIFY = @MOZ_QUANTIFY@
7343 ++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
7345 + #python options
7346 + PYTHON = @MOZ_PYTHON@
7348 Property changes on: patches/embed_manifest.patch
7349 ___________________________________________________________________
7350 Added: svn:executable
7353 --- moz/patches/consecutive_ldap_queries.patch (.../tags/DEV300_m41/moz) (revision 0)
7354 +++ moz/patches/consecutive_ldap_queries.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
7355 @@ -0,0 +1,13 @@
7356 +--- mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:39:32.054968600 +0100
7357 ++++ mozilla.patched/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2009-02-02 09:35:35.633832119 +0100
7358 +@@ -833,6 +833,10 @@
7359 + if (msgListener)
7361 + msgListener->mUrl = url;
7362 ++ msgListener->mQueryListener = listener;
7363 ++ msgListener->mResultLimit = resultLimit;
7364 ++ msgListener->mTimeOut = timeOut;
7365 ++ msgListener->mQueryArguments = arguments;
7366 + return msgListener->DoSearch();
7369 --- moz/patches/wchart_on_msvc8.patch (.../tags/DEV300_m41/moz) (revision 0)
7370 +++ moz/patches/wchart_on_msvc8.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
7371 @@ -0,0 +1,20 @@
7372 +--- mozilla.pure/configure.in 2008-06-16 00:25:32.000000000 +0200
7373 ++++ mozilla/configure.in 2008-11-10 16:15:36.859375000 +0100
7374 +@@ -425,6 +425,7 @@
7375 + _CC_SUITE=7
7376 + elif test "$_CC_MAJOR_VERSION" = "14"; then
7377 + _CC_SUITE=8
7378 ++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
7379 + else
7380 + AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
7381 + fi
7382 +--- mozilla.pure/configure 2008-06-16 00:25:31.000000000 +0200
7383 ++++ mozilla/configure 2008-11-10 16:15:30.437500000 +0100
7384 +@@ -3022,6 +3022,7 @@
7385 + _CC_SUITE=7
7386 + elif test "$_CC_MAJOR_VERSION" = "14"; then
7387 + _CC_SUITE=8
7388 ++ CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
7389 + else
7390 + { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
7391 + fi
7392 --- moz/patches/cygwin_paths_in_ldap_sdk.patch (.../tags/DEV300_m41/moz) (revision 0)
7393 +++ moz/patches/cygwin_paths_in_ldap_sdk.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
7394 @@ -0,0 +1,12 @@
7395 +--- mozilla.org/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
7396 ++++ mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-10-31 23:34:41.695625000 +0100
7397 +@@ -85,6 +85,9 @@
7399 + ###########################################################################
7401 ++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
7402 ++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
7404 + all export:: $(INCLUDEDIR) $(GENHEADERS)
7405 + $(NSINSTALL) -D $(PRIVATEINCDIR)
7406 + $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
7407 --- moz/patches/index.txt (.../tags/DEV300_m41/moz) (revision 0)
7408 +++ moz/patches/index.txt (.../cws/moz2seamonkey01/moz) (revision 268999)
7409 @@ -0,0 +1,65 @@
7410 +====================================================================================
7411 +File name
7412 +---------
7413 + embed_manifest.patch
7415 +Description
7416 +-----------
7417 + When building Mozilla with MSVC2005, generated libraries and applications
7418 + require the manifest file (name.dll.manifest) to reside beside the file
7419 + itself, or to be embedded.
7421 + The patch does the latter: embedding the manifest file into the
7422 + library/application itself, using the Manifest Tool from the Platform SDK
7423 + resp. MSVC installation.
7425 + The patch is effectively the patch as was committed to the Mozilla trunk,
7426 + taken from here: https://bugzilla.mozilla.org/show_bug.cgi?id=249782#c81.
7428 +====================================================================================
7429 +File name
7430 +---------
7431 + wchart_on_msvc8.patch
7433 +Description
7434 +-----------
7435 + For compiling with MSVC2005: See https://bugzilla.mozilla.org/show_bug.cgi?id=324842.
7437 +====================================================================================
7438 +File name
7439 +---------
7440 + cygwin_paths_in_ldap_sdk.patch
7442 +Description
7443 +-----------
7444 + make 1.81, as currently part of cygwin, does not support Windows paths anymore.
7445 + So, targets, and target dependencies, in makefile may need to be converted to cygwin
7446 + notation. This patch does this for directory/c-sdk/ldap/include, other occurances are
7447 + not known, yet.
7449 +====================================================================================
7450 +File name
7451 +---------
7452 + no_core_abspath_in_nss.patch
7454 +Description
7455 +-----------
7456 + On various platforms, building security/nss/cmd/shlibsign fails. In all cases, the
7457 + error messages indicate the core_abspath macro used in the Makefile is not resolved
7458 + properly.
7459 + This patch replaces the usage of core_abspath with platform-specific constructs.
7461 +====================================================================================
7462 +File name
7463 +---------
7464 + consecutive_ldap_queries.patch
7466 +Description
7467 +-----------
7468 + Consecutive LDAP address book queries (using the same instance of nsAbLDAPDirectoryQuery,
7469 + but different parameters to the DoQuery method) do not work in OOo. The reason is that
7470 + the second call to DoQuery ignores most of its arguments, including the listener which
7471 + is to be notified about the query results, and re-uses the arguments from the first
7472 + call.
7473 + The patch changes the DoQuery behavior to respect the arguments of the second call.
7475 --- moz/patches/no_core_abspath_in_nss.patch (.../tags/DEV300_m41/moz) (revision 0)
7476 +++ moz/patches/no_core_abspath_in_nss.patch (.../cws/moz2seamonkey01/moz) (revision 268999)
7477 @@ -0,0 +1,52 @@
7478 +--- mozilla.pure/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
7479 ++++ mozilla/security/nss/cmd/shlibsign/Makefile 2008-11-05 14:04:54.798875000 +0100
7480 +@@ -86,18 +86,47 @@
7482 + include ../platrules.mk
7484 +-SRCDIR = $(call core_abspath,.)
7486 ++ifeq ($(OS_TARGET), Darwin)
7487 ++ SRCDIR = .
7488 ++else
7489 ++ifeq ($(OS_TARGET), Linux)
7490 ++ SRCDIR = .
7491 ++else
7492 ++ifeq ($(OS_TARGET), WIN95)
7493 ++ SRCDIR = $(shell cygpath -d $(SRCDIR))
7494 ++else
7495 ++ SRCDIR = $(call core_abspath,.)
7496 ++endif
7497 ++endif
7498 ++endif
7499 + %.chk: %.$(DLL_SUFFIX)
7500 + ifeq ($(OS_TARGET), OS2)
7501 + cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
7502 + $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
7503 + $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
7504 + else
7505 ++ifeq ($(OS_TARGET), WIN95)
7506 ++ sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
7507 ++ $(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
7508 ++ $(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
7509 ++else
7510 ++ifeq ($(OS_TARGET), Darwin)
7511 ++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
7512 ++ $(OBJDIR) $(OS_TARGET) \
7513 ++ $(NSPR_LIB_DIR) $<
7514 ++else
7515 ++ifeq ($(OS_TARGET), Linux)
7516 ++ cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
7517 ++ $(OBJDIR) $(OS_TARGET) \
7518 ++ $(NSPR_LIB_DIR) $<
7519 ++else
7520 + cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
7521 + $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
7522 + $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
7523 + endif
7524 ++endif
7525 ++endif
7526 ++endif
7528 + libs install :: $(CHECKLOC)