1 --- misc/mozilla/build/autoconf/mozconfig-find 2007-02-16 03:19:06.000000000 +0100
2 +++ misc/build/mozilla/build/autoconf/mozconfig-find 2008-08-19 10:12:04.000000000 +0200
4 "$topsrcdir/.mozconfig" \
5 "$topsrcdir/mozconfig" \
6 "$topsrcdir/mozconfig.sh" \
7 - "$topsrcdir/myconfig.sh" \
9 - "$HOME/.mozconfig.sh" \
10 - "$HOME/.mozmyconfig.sh"
11 + "$topsrcdir/myconfig.sh"
13 if test -f "$_config"; then
15 --- misc/mozilla/build/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
16 +++ misc/build/mozilla/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
21 # Stupid wrapper to avoid win32 dospath/cygdrive issues
22 # Try not to spawn programs from within this file. If the stuff in here looks royally
24 i=-I${mountpoint}/${driveletter}/${pathname}
27 - eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
28 - if ! test "${leader}" = "${i}"; then
29 - eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
30 - eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
31 - driveletter=${no_mountpoint%%/*}
32 - i=${leader}${driveletter}:/${pathname}
33 + # The original version missed mounted paths, the new version below
34 + # doesn't transform /para as this is most likely a parameter.
35 + eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
36 + if ! test "$notinpath" = "$i"; then
38 + eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
39 + eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
40 + driveletter=${withdrive%%/*}
41 + i=${notinpath}${driveletter}:/${restpath}
43 + # check for potential path. Precheck using shell methods
45 + # Shortcut -X<path> when path does not begin with '/'
46 + noswitch=${i#-[a-zA-Z]}
47 + if test "$noswitch" != "$i"; then
48 + test "${noswitch#/}" != "$noswitch" && doconvert="1"
50 + # Precheck for possible path. Consider only absolute paths that contain at least
51 + # a second / to prevent converting of /abc parameters.
52 + test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
53 + if test -n "$doconvert"; then
54 + # Can be a path. If forking grep would be faster or we could require bash 3
55 + # this regexp would be all that's needed to find pathnames that need converting
56 + pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
57 + eval 'notinpath=${i%'${pathname}'}'
58 + if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
59 + pathname=`cygpath -am "$pathname"`
60 + i=${notinpath}${pathname}
66 --- misc/mozilla/config/Makefile.in 2006-12-22 14:50:41.000000000 +0100
67 +++ misc/build/mozilla/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
71 GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
72 - GLIB_LIBS = $(MOZ_GTK2_LIBS)
73 + GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
77 --- misc/mozilla/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
78 +++ misc/build/mozilla/config/autoconf.mk.in 2008-11-07 16:08:52.937500000 +0100
80 MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
81 MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
82 MOZ_QUANTIFY = @MOZ_QUANTIFY@
83 +MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
87 --- misc/mozilla/config/config.mk 2008-01-29 20:30:22.000000000 +0100
88 +++ misc/build/mozilla/config/config.mk 2008-08-14 16:22:21.000000000 +0200
93 +# Shared library RUNPATH linker option(s)
95 +ifeq ($(OS_ARCH),Linux)
96 +EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
98 +EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
102 +ifeq ($(OS_ARCH),SunOS)
103 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
105 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
106 +endif # IS_COMPONENT
110 # Include any personal overrides the user might think are needed.
112 -include $(MY_CONFIG)
113 --- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
114 +++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100
116 ifeq ($(OS_ARCH),WINNT)
119 -DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
120 +DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
122 +DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
128 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
129 $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
130 +ifdef MSMANIFEST_TOOL
131 + @if test -f $@.manifest; then \
132 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
133 + rm -f $@.manifest; \
135 +endif # MSVC with manifest tool
137 ifeq ($(CPP_PROG_LINK),1)
138 $(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)
141 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
142 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
143 +ifdef MSMANIFEST_TOOL
144 + @if test -f $@.manifest; then \
145 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
146 + rm -f $@.manifest; \
148 +endif # MSVC with manifest tool
150 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
154 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
155 $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
156 +ifdef MSMANIFEST_TOOL
157 + @if test -f $@.manifest; then \
158 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
159 + rm -f $@.manifest; \
161 +endif # MSVC with manifest tool
163 ifeq ($(CPP_PROG_LINK),1)
164 $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
165 @@ -1019,6 +1036,14 @@
166 endif # SHARED_LIBRARY_LIBS
167 endif # NO_LD_ARCHIVE_FLAGS
168 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
169 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
170 +ifdef MSMANIFEST_TOOL
171 + @if test -f $@.manifest; then \
172 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
173 + rm -f $@.manifest; \
175 +endif # MSVC with manifest tool
176 +endif # WINNT && !GCC
177 @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
179 $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
180 @@ -1043,7 +1070,7 @@
181 if test -d $(@D); then \
182 echo "Building deps for $<"; \
183 touch $(_MDDEPFILE) && \
184 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
185 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
186 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
187 cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
189 @@ -1053,7 +1080,7 @@
190 if test -d $(@D); then \
191 echo "Building deps for $<"; \
192 touch $(_MDDEPFILE) && \
193 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
194 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
195 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
196 cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
198 @@ -1325,6 +1352,7 @@
200 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
202 + echo "PATH=" $(PATH)
203 $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
204 @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
205 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
206 @@ -1696,14 +1724,14 @@
207 define MAKE_DEPS_NOAUTO
210 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
211 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
212 mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
215 define MAKE_DEPS_NOAUTO
218 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
219 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
220 mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
223 --- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100
224 +++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100
225 @@ -1068,6 +1068,8 @@
232 for ac_prog in gawk mawk nawk awk
234 @@ -3022,9 +3024,26 @@
236 elif test "$_CC_MAJOR_VERSION" = "14"; then
238 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
240 { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
244 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
245 + if test "$_CC_SUITE" -ge "8"; then
246 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
247 + if test -n "MSMT_TOOL"; then
248 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
249 + if test -z "MSMANIFEST_TOOL_VERSION"; then
250 + echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
255 + { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
259 # Check linker version
260 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
261 @@ -5726,6 +5745,7 @@
262 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
264 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
265 + CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
267 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
269 @@ -6036,7 +6056,7 @@
270 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
273 - STRIP="$STRIP -x -S"
274 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
275 _PLATFORM_DEFAULT_TOOLKIT='mac'
276 MOZ_ENABLE_POSTSCRIPT=
277 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
278 @@ -6075,7 +6095,7 @@
282 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
283 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
287 @@ -6718,7 +6738,7 @@
288 MOZ_USER_DIR="Mozilla"
290 if test "$MOZTOOLS"; then
291 - MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
292 + MOZ_TOOLS_DIR=`echo $MOZTOOLS`
294 { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
296 @@ -8614,6 +8634,8 @@
303 echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
304 echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
305 @@ -12259,7 +12281,7 @@
309 - MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-}
310 + MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-1}
311 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
312 TK_LIBS='$(MOZ_GTK2_LIBS)'
313 cat >> confdefs.h <<\EOF
314 @@ -19233,7 +19255,8 @@
315 MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
317 if test "$MOZ_X11"; then
318 - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
319 +# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
320 + MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
322 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
323 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
324 @@ -20076,8 +20099,12 @@
325 WIN_TOP_SRC=`cd $srcdir; pwd -W`
328 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
329 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
330 +# Don't add the wrapper for the HOST_* versions as they contain an
331 +# unexpanded $CC and therfore wil get the wrapper below.
332 + if test -n "$GNU_CC"; then
333 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
334 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
336 CC="\$(CYGWIN_WRAPPER) $CC"
337 CXX="\$(CYGWIN_WRAPPER) $CXX"
338 CPP="\$(CYGWIN_WRAPPER) $CPP"
339 --- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100
340 +++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100
347 dnl Set various checks
348 dnl ========================================================
352 elif test "$_CC_MAJOR_VERSION" = "14"; then
354 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
356 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
360 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
361 + if test "$_CC_SUITE" -ge "8"; then
362 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
363 + if test -n "MSMT_TOOL"; then
364 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
365 + if test -z "MSMANIFEST_TOOL_VERSION"; then
366 + AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
371 + AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
375 # Check linker version
376 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
377 @@ -1530,7 +1549,7 @@
378 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
381 - STRIP="$STRIP -x -S"
382 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
383 _PLATFORM_DEFAULT_TOOLKIT='mac'
384 MOZ_ENABLE_POSTSCRIPT=
385 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
386 @@ -1552,7 +1571,7 @@
390 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
391 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
395 @@ -2749,6 +2768,8 @@
402 AC_CHECK_LIB(c_r, gethostbyname_r)
404 @@ -7321,6 +7342,7 @@
407 AC_SUBST(CXX_VERSION)
408 +AC_SUBST(MSMANIFEST_TOOL)
410 if test "$USING_HCC"; then
411 CC='${topsrcdir}/build/hcc'
412 @@ -7416,8 +7438,12 @@
413 WIN_TOP_SRC=`cd $srcdir; pwd -W`
416 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
417 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
418 +# Don't add the wrapper for the HOST_* versions as they contain an
419 +# unexpanded $CC and therfore wil get the wrapper below.
420 + if test -n "$GNU_CC"; then
421 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
422 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
424 CC="\$(CYGWIN_WRAPPER) $CC"
425 CXX="\$(CYGWIN_WRAPPER) $CXX"
426 CPP="\$(CYGWIN_WRAPPER) $CPP"
427 --- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100
428 +++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200
431 LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
432 LINK_LIB = $(AR) cr $@ $(OBJS)
433 -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)
434 +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)
436 DEBUG_LINK_OPT=-DEBUG
437 ifeq ($(BUILD_OPT), 1)
438 --- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100
439 +++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
444 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
445 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
447 ifeq ($(MOZ_OBJFORMAT),elf)
449 --- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100
450 +++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
452 LIB_SUFFIX = @LIB_SUFFIX@
453 LIB_PREFIX = @LIB_PREFIX@
454 DLL_SUFFIX = @DLL_SUFFIX@
455 +DLL_PREFIX = @DLL_PREFIX@
456 ASM_SUFFIX = @ASM_SUFFIX@
457 PROG_SUFFIX = @PROG_SUFFIX@
458 MOD_NAME = @NSPR_MODNAME@
459 --- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
460 +++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
465 # Stupid wrapper to avoid win32 dospath/cygdrive issues
466 # Try not to spawn programs from within this file. If the stuff in here looks royally
467 --- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100
468 +++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200
469 @@ -2738,6 +2738,7 @@
475 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
477 @@ -3444,7 +3445,7 @@
480 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
481 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
482 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
483 if test "$MOZ_OBJFORMAT" = "elf"; then
486 @@ -3811,6 +3812,7 @@
487 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
489 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
490 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
491 OS_LIBS="$OS_LIBS -lc"
493 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
494 @@ -3880,7 +3882,8 @@
496 CXX="$CXX -mno-cygwin"
498 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
500 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
501 # Use temp file for windres (bug 213281)
502 RC="$WINDRES -O coff --use-temp-file"
504 @@ -3897,6 +3900,7 @@
510 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
512 @@ -4293,6 +4297,7 @@
520 @@ -4660,6 +4665,7 @@
522 RANLIB=/usr/ccs/bin/ranlib
523 DSO_LDOPTS='-G -h $(notdir $@)'
524 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
525 if test -n "$GNU_CC"; then
528 @@ -5844,6 +5850,7 @@
529 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
530 s%@LIB_PREFIX@%$LIB_PREFIX%g
531 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
532 +s%@DLL_PREFIX@%$DLL_PREFIX%g
533 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
534 s%@PROG_SUFFIX@%$PROG_SUFFIX%g
535 s%@MKSHLIB@%$MKSHLIB%g
536 --- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200
537 +++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200
544 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
546 @@ -1037,7 +1038,7 @@
548 AC_DEFINE(HAVE_BSD_FLOCK)
549 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
550 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
551 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
552 if test "$MOZ_OBJFORMAT" = "elf"; then
555 @@ -1285,6 +1286,7 @@
556 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
558 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
559 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
560 OS_LIBS="$OS_LIBS -lc"
562 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
563 @@ -1336,6 +1338,8 @@
565 CXX="$CXX -mno-cygwin"
569 MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
570 # Use temp file for windres (bug 213281)
571 RC="$WINDRES -O coff --use-temp-file"
572 @@ -1353,6 +1357,7 @@
578 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
580 @@ -1820,6 +1825,7 @@
582 RANLIB=/usr/ccs/bin/ranlib
583 DSO_LDOPTS='-G -h $(notdir $@)'
584 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
585 if test -n "$GNU_CC"; then
588 @@ -2410,6 +2416,7 @@
592 +AC_SUBST(DLL_PREFIX)
594 AC_SUBST(PROG_SUFFIX)
596 --- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
597 +++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100
600 ###########################################################################
602 +ifeq ($(TERM),cygwin)
603 +INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
604 +GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
607 all export:: $(INCLUDEDIR) $(GENHEADERS)
608 $(NSINSTALL) -D $(PRIVATEINCDIR)
609 $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
610 --- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100
611 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
613 HDIR = $(topsrcdir)/ldap/include
615 LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
616 -DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
617 +DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
619 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
622 -$(RM) $(SO_FILES_TO_REMOVE)
624 $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
625 + if test -f $@.manifest; then \
626 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
627 + rm -f $@.manifest; \
632 --- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
633 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
637 DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
638 - $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
639 + $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
641 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
643 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200
644 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200
646 HDIR = $(topsrcdir)/ldap/include
648 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
649 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
650 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
652 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
656 # variable definitions for exported symbols
657 ifeq ($(OS_ARCH), WINNT)
658 - SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
659 + SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
661 SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
663 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
664 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
666 HDIR = $(topsrcdir)/ldap/include
668 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
669 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
670 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
672 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
674 --- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100
675 +++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
676 @@ -112,14 +112,14 @@
677 gtkmozembed_internal.h
680 -EXTRA_DSO_LDOPTS = \
681 +EXTRA_DSO_LDOPTS += \
682 $(MOZ_COMPONENT_LIBS) \
687 ifdef MOZ_ENABLE_GTK2
688 -EXTRA_DSO_LDOPTS = \
689 +EXTRA_DSO_LDOPTS += \
690 $(MOZ_COMPONENT_LIBS) \
693 --- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100
694 +++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200
696 TestGtkEmbedNotebook.cpp \
697 TestGtkEmbedSocket.cpp \
698 TestGtkEmbedChild.cpp
701 SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
708 --- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200
709 +++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100
714 -ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
715 -ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
717 - rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
718 - ln -fs $(srcdir)/src
719 - ln -fs $(srcdir)/res
720 - ln -fs $(srcdir)/public
721 - ln -fs $(srcdir)/Info-*.plist .
725 # Bug 297227: The next line doesn't need to stay around forever, only
726 # long enough to clean up existing depend builds from when xcodebuild
727 # was being instructed to "install"
728 if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
730 - $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
731 - mkdir -p $(DIST)/package
732 - $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
733 +# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
734 +# mkdir -p $(DIST)/package
735 +# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
739 --- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200
740 +++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
742 $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
743 $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
745 - -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
746 + -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
748 ifeq ($(OS_ARCH),WINNT)
749 ifeq ($(WINAPP),mfcembed)
750 --- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100
751 +++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
756 -EXTRA_DSO_LDOPTS = \
757 +EXTRA_DSO_LDOPTS += \
760 $(MOZ_COMPONENT_LIBS) \
761 --- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100
762 +++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200
764 bin/components/sqlpgsql.xpt \
765 bin/components/sqlsqlite.xpt \
766 bin/components/sqlmysql.xpt \
767 - bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
768 + bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
770 --- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200
771 +++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200
773 native FT_Sfnt_Tag(FT_Sfnt_Tag);
774 native FT_Size(FT_Size);
776 -[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
777 +[ptr] native FTC_ImageType_p(FTC_ImageType);
778 native FTC_Face_Requester(FTC_Face_Requester);
779 native FTC_Font(FTC_Font);
780 -native FTC_Image_Cache(FTC_Image_Cache);
781 +native FTC_FaceID(FTC_FaceID);
782 +native FTC_ImageCache(FTC_ImageCache);
783 native FTC_Manager(FTC_Manager);
788 readonly attribute FT_Library library;
789 readonly attribute FTC_Manager FTCacheManager;
790 - readonly attribute FTC_Image_Cache ImageCache;
791 + readonly attribute FTC_ImageCache ImageCache;
793 void doneFace(in FT_Face face);
794 void doneFreeType(in FT_Library lib);
795 @@ -115,16 +116,16 @@
796 void outlineDecompose(in FT_Outline_p outline,
797 in const_FT_Outline_Funcs_p funcs, in voidPtr p);
798 void setCharmap(in FT_Face face, in FT_CharMap charmap);
799 - void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
800 + void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
801 in FT_UInt gindex, out FT_Glyph glyph);
802 - void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
803 - out FT_Face face, out FT_Size size);
804 + void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
806 void managerDone(in FTC_Manager manager);
807 void managerNew(in FT_Library lib, in FT_UInt max_faces,
808 in FT_UInt max_sizes, in FT_ULong max_bytes,
809 in FTC_Face_Requester requester, in FT_Pointer req_data,
810 out FTC_Manager manager);
811 - void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
812 + void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
814 void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
815 in FT_Vector_p delta);
816 --- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200
817 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
819 {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
820 {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
821 {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
822 - {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
823 + {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
824 {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
825 {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
826 {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
831 -nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
832 +nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
833 FT_UInt glyphID, FT_Glyph *glyph)
835 // call the FreeType2 function via the function pointer
836 @@ -297,11 +297,11 @@
840 -nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
841 - FT_Face *face, FT_Size *size)
842 +nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
845 // call the FreeType2 function via the function pointer
846 - FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
847 + FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
848 return error ? NS_ERROR_FAILURE : NS_OK;
855 -nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
856 +nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
858 // call the FreeType2 function via the function pointer
859 FT_Error error = nsFTC_Image_Cache_New(manager, cache);
864 -nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
865 +nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
867 *aCache = mImageCache;
869 --- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200
870 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200
871 @@ -120,13 +120,13 @@
872 typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
873 typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
874 typedef FT_Error (*FTC_Image_Cache_Lookup_t)
875 - (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
876 -typedef FT_Error (*FTC_Manager_Lookup_Size_t)
877 - (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
878 + (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
879 +typedef FT_Error (*FTC_Manager_LookupFace_t)
880 + (FTC_Manager, FTC_FaceID, FT_Face*);
881 typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
882 typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
883 FTC_Face_Requester, FT_Pointer, FTC_Manager*);
884 -typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
885 +typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
887 typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
888 typedef FT_Error (*FT_Get_Kerning_t)
890 FT_Outline_Decompose_t nsFT_Outline_Decompose;
891 FT_Set_Charmap_t nsFT_Set_Charmap;
892 FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
893 - FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
894 + FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
895 FTC_Manager_Done_t nsFTC_Manager_Done;
896 FTC_Manager_New_t nsFTC_Manager_New;
897 FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
899 PRLibrary *mSharedLib;
900 FT_Library mFreeTypeLibrary;
901 FTC_Manager mFTCacheManager;
902 - FTC_Image_Cache mImageCache;
903 + FTC_ImageCache mImageCache;
905 static nsHashtable *sFontFamilies;
906 static nsHashtable *sRange1CharSetNames;
907 --- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200
908 +++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200
910 CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
911 CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
913 +ifeq ($(OS_ARCH), Darwin)
914 +EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
917 ifeq ($(OS_ARCH), SunOS)
919 # When using Sun's WorkShop compiler, including
920 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100
921 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200
922 @@ -1870,10 +1870,10 @@
924 mPixelSize = NSToIntRound(app2dev * mFont->size);
926 - mImageDesc.font.face_id = (void*)mEntry;
927 - mImageDesc.font.pix_width = mPixelSize;
928 - mImageDesc.font.pix_height = mPixelSize;
929 - mImageDesc.image_type = 0;
930 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
931 + mImageDesc->width = mPixelSize;
932 + mImageDesc->height = mPixelSize;
933 + mImageDesc->flags = 0;
936 mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
937 @@ -1907,7 +1907,7 @@
941 - FTC_Image_Cache iCache;
942 + FTC_ImageCache iCache;
943 nsresult rv = mFt2->GetImageCache(&iCache);
945 NS_ERROR("Failed to get Image Cache");
946 @@ -1945,8 +1945,8 @@
948 FTC_Manager cManager;
949 mFt2->GetFTCacheManager(&cManager);
950 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
952 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
954 NS_ASSERTION(rv==0, "failed to get face/size");
957 @@ -2392,16 +2392,16 @@
958 mEntry->GetFamilyName(fontName);
959 mEntry->GetStyleName(styleName);
961 - mImageDesc.font.face_id = (void*)mEntry;
962 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
963 // TT glyph has no relation to size
964 - mImageDesc.font.pix_width = 16;
965 - mImageDesc.font.pix_height = 16;
966 - mImageDesc.image_type = 0;
967 + mImageDesc->width = 16;
968 + mImageDesc->height = 16;
969 + mImageDesc->flags = 0;
970 FT_Face face = nsnull;
971 FTC_Manager cManager;
972 mFt2->GetFTCacheManager(&cManager);
973 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
975 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
980 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200
981 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200
983 nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
984 nsCOMPtr<nsIFreeType2> mFt2;
986 - FTC_Image_Desc mImageDesc;
987 + FTC_ImageType mImageDesc;
988 nsCString mFontNameBase; // the base name of type 1 (sub) fonts
993 nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
994 nsCOMPtr<nsIFreeType2> mFt2;
995 - FTC_Image_Desc mImageDesc;
996 + FTC_ImageType mImageDesc;
998 #endif // MOZ_ENABLE_FREETYPE2
999 #endif // MOZ_ENABLE_XFT
1000 --- misc/mozilla/gfx/src/windows/nsDeviceContextWin.cpp 2006-01-29 17:51:00.000000000 +0100
1001 +++ misc/build/mozilla/gfx/src/windows/nsDeviceContextWin.cpp 2008-08-14 16:22:21.000000000 +0200
1002 @@ -330,7 +330,11 @@
1003 memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
1005 MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
1007 + strlen(ptrLogFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
1009 strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
1014 @@ -577,7 +581,11 @@
1016 logFont.lfCharSet = DEFAULT_CHARSET;
1017 logFont.lfPitchAndFamily = 0;
1019 + int outlen = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aFontName.get()), aFontName.Length() + 1,
1021 int outlen = WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
1023 logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
1025 // somehow the WideCharToMultiByte failed, let's try the old code
1026 @@ -894,7 +902,11 @@
1029 int outlen = ::WideCharToMultiByte( CP_ACP, 0,
1031 + NS_REINTERPRET_CAST(LPCWSTR, PromiseFlatString(aStr).get()), aStr.Length(),
1033 PromiseFlatString(aStr).get(), aStr.Length(),
1035 acp, acplen, NULL, NULL);
1037 acp[outlen] = '\0'; // null terminate
1038 --- misc/mozilla/gfx/src/windows/nsFontMetricsWin.cpp 2007-07-15 16:43:45.000000000 +0200
1039 +++ misc/build/mozilla/gfx/src/windows/nsFontMetricsWin.cpp 2008-08-14 16:22:21.000000000 +0200
1040 @@ -1363,7 +1363,11 @@
1041 PRUnichar fname[LF_FACESIZE];
1043 MultiByteToWideChar(CP_ACP, 0, aFontName,
1045 + strlen(aFontName) + 1, NS_REINTERPRET_CAST(LPWSTR, fname), sizeof(fname)/sizeof(fname[0]));
1047 strlen(aFontName) + 1, fname, sizeof(fname)/sizeof(fname[0]));
1049 name.Assign(NS_LITERAL_CSTRING("encoding.") + NS_ConvertUCS2toUTF8(fname) + NS_LITERAL_CSTRING(".ttf"));
1052 @@ -2236,7 +2240,11 @@
1054 // get the final rightBearing and width. Possible kerning is taken into account.
1057 + ::GetTextExtentPointW(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1059 ::GetTextExtentPointW(aDC, aString, aLength, &size);
1061 size.cx -= aOverhangCorrection;
1062 aBoundingMetrics.width = size.cx;
1063 aBoundingMetrics.rightBearing = size.cx - gm.gmCellIncX + gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
1064 @@ -2630,7 +2638,11 @@
1065 PRUnichar name[LF_FACESIZE];
1067 MultiByteToWideChar(CP_ACP, 0, logFont->lfFaceName,
1069 + strlen(logFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
1071 strlen(logFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
1074 nsGlobalFont* font = new nsGlobalFont;
1076 @@ -4286,14 +4298,22 @@
1079 NS_ExtTextOutW(HDC aDC, nsFontWin* aFont, PRInt32 aX, PRInt32 aY, UINT uOptions,
1081 + LPCRECT lprc, const PRUnichar* aString, UINT aLength, INT *lpDx)
1083 LPCRECT lprc, LPCWSTR aString, UINT aLength, INT *lpDx)
1087 if (!lpDx && !lprc && aFont->FillClipRect(aX, aY, aLength, uOptions, clipRect)) {
1089 uOptions |= ETO_CLIPPED;
1092 + return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, lpDx);
1094 return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, aString, aLength, lpDx);
1099 @@ -4359,7 +4379,11 @@
1101 DEBUG_VERIFY_FONT_HASGLYPH(this, aString, aLength);
1104 + ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1106 ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
1108 size.cx -= mOverhangCorrection;
1111 @@ -4385,7 +4409,11 @@
1112 // Clip out the extra underline/strikethru caused by the
1116 + ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
1118 ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
1120 size.cx -= mOverhangCorrection;
1122 clipRect.top = aY - size.cy;
1123 @@ -4466,7 +4494,11 @@
1125 ::GetTextExtentPoint32A(aDC, buffer.get(), destLength, &size);
1128 + ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), destLength / 2, &size);
1130 ::GetTextExtentPoint32W(aDC, (const PRUnichar*) buffer.get(), destLength / 2, &size);
1132 size.cx -= mOverhangCorrection;
1135 @@ -4649,7 +4681,11 @@
1136 if (NS_FAILED(rv) || !aLength) return 0;
1140 + ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), aLength, &size);
1142 ::GetTextExtentPoint32W(aDC, buffer.get(), aLength, &size);
1144 size.cx -= mOverhangCorrection;
1147 @@ -4828,13 +4864,21 @@
1150 // Get the number of bytes needed for the conversion
1152 + int nb = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
1154 int nb = WideCharToMultiByte(mCodePage, 0, aString, aLength,
1156 nsnull, 0, nsnull, nsnull);
1158 if (!nb || !aResult.EnsureElemCapacity(nb)) return;
1159 char* buf = aResult.get();
1160 // Convert the Unicode string to ANSI
1162 + *aResultLength = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
1164 *aResultLength = WideCharToMultiByte(mCodePage, 0, aString, aLength,
1166 buf, nb, nsnull, nsnull);
1169 --- misc/mozilla/gfx/src/windows/nsRenderingContextWin.cpp 2006-06-30 01:18:35.000000000 +0200
1170 +++ misc/build/mozilla/gfx/src/windows/nsRenderingContextWin.cpp 2008-08-14 16:22:21.000000000 +0200
1171 @@ -2935,17 +2935,29 @@
1173 GCP_RESULTSW gcpResult;
1174 gcpResult.lStructSize = sizeof(GCP_RESULTS);
1176 + gcpResult.lpOutString = NS_REINTERPRET_CAST(LPWSTR, outStr); // Output string
1178 gcpResult.lpOutString = outStr; // Output string
1180 gcpResult.lpOrder = nsnull; // Ordering indices
1181 gcpResult.lpDx = distanceArray; // Distances between character cells
1182 gcpResult.lpCaretPos = nsnull; // Caret positions
1183 gcpResult.lpClass = nsnull; // Character classifications
1185 + gcpResult.lpGlyphs = NS_REINTERPRET_CAST(LPWSTR, glyphArray); // Character glyphs
1187 gcpResult.lpGlyphs = glyphArray; // Character glyphs
1189 gcpResult.nGlyphs = 2; // Array size
1191 PRUnichar inStr[] = {araAin, one};
1194 + if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
1196 if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
1198 && (inStr[0] == outStr[1]) ) {
1199 gBidiInfo = GCP_REORDER | GCP_GLYPHSHAPE;
1201 @@ -2956,7 +2968,11 @@
1202 const PRUnichar hebAlef = 0x05D0;
1206 + if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER)
1208 if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER)
1210 && (inStr[0] == outStr[1]) ) {
1211 gBidiInfo = GCP_REORDER;
1213 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200
1214 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
1218 mFt2->GetFTCacheManager(&mgr);
1219 - rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
1220 + rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
1221 NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
1224 @@ -191,22 +191,15 @@
1225 PRBool embedded_bimap = PR_FALSE;
1227 mPixelSize = aPixelSize;
1228 - mImageDesc.font.face_id = (void*)mFaceID;
1229 - mImageDesc.font.pix_width = aPixelSize;
1230 - mImageDesc.font.pix_height = aPixelSize;
1231 - mImageDesc.image_type = 0;
1232 + mImageDesc->face_id = (FTC_FaceID)&mFaceID;
1233 + mImageDesc->width = aPixelSize;
1234 + mImageDesc->height = aPixelSize;
1235 + mImageDesc->flags = 0;
1237 if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
1238 - mImageDesc.image_type |= ftc_image_mono;
1239 anti_alias = PR_FALSE;
1242 - if (nsFreeType2::gFreeType2Autohinted)
1243 - mImageDesc.image_type |= ftc_image_flag_autohinted;
1245 - if (nsFreeType2::gFreeType2Unhinted)
1246 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1248 PRUint32 num_embedded_bitmaps, i;
1249 PRInt32* embedded_bitmapheights;
1250 mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
1252 if (embedded_bitmapheights[i] == aPixelSize) {
1253 embedded_bimap = PR_TRUE;
1254 // unhinted must be set for embedded bitmaps to be used
1255 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1261 return NS_ERROR_FAILURE;
1263 - FTC_Image_Cache icache;
1264 + FTC_ImageCache icache;
1265 mFt2->GetImageCache(&icache);
1267 return NS_ERROR_FAILURE;
1272 - FTC_Image_Cache icache;
1273 + FTC_ImageCache icache;
1274 mFt2->GetImageCache(&icache);
1278 if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
1281 - FTC_Image_Cache icache;
1282 + FTC_ImageCache icache;
1283 mFt2->GetImageCache(&icache);
1286 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200
1287 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200
1289 XImage *GetXImage(PRUint32 width, PRUint32 height);
1290 nsITrueTypeFontCatalogEntry *mFaceID;
1291 PRUint16 mPixelSize;
1292 - FTC_Image_Desc mImageDesc;
1293 + FTC_ImageType mImageDesc;
1294 nsCOMPtr<nsIFreeType2> mFt2;
1297 --- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100
1298 +++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200
1300 /* Defines for MMX/SSE2 support. */
1302 #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
1303 -#define HAVE_MMX_INTEL_MNEMONICS
1304 +//#define HAVE_MMX_INTEL_MNEMONICS
1306 /* SSE2 code appears broken for some cpus (bug 247437) */
1307 /* #define HAVE_SSE2_INTEL_MNEMONICS */
1308 --- misc/mozilla/js/src/xpconnect/src/Makefile.in 2006-01-31 02:57:35.000000000 +0100
1309 +++ misc/build/mozilla/js/src/xpconnect/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
1315 --- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100
1316 +++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200
1317 @@ -423,19 +423,19 @@
1321 - FTC_Image_Desc imageDesc;
1322 - imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
1323 + FTC_ImageType imageDesc;
1324 + imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
1325 float twipstopixel = GetTwipsToPixels();
1326 float scale = GetPixelScale();
1327 - imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1328 - imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1329 - imageDesc.image_type |= ftc_image_grays;
1330 + imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1331 + imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1332 + imageDesc->flags |= /* ftc_image_grays */0;
1337 nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
1338 - rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
1339 + rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
1340 NS_ASSERTION(mFace, "failed to get face/size");
1343 --- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200
1344 +++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200
1348 nsMsgVCardService.cpp \
1350 nsAbLDIFService.cpp \
1355 nsAbCardProperty.h \
1356 nsAbMDBCardProperty.h \
1359 + nsAbAddressCollecter.h \
1360 + nsAbDirectoryQuery.h \
1363 ifeq ($(OS_ARCH),WINNT)
1364 --- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200
1365 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200
1367 #include "nsIAbBooleanExpression.h"
1368 #include "nsCOMPtr.h"
1369 #include "nsString.h"
1370 +#include "nsAbUtils.h"
1372 class nsIAbLDAPAttributeMap;
1375 nsIAbBooleanConditionString* condition,
1378 + static void GenerateMultipleFilter(
1379 + nsAbBooleanConditionType conditionType,
1380 + nsCString& filter,
1381 + NS_ConvertUCS2toUTF8 &vUTF8,
1382 + CharPtrArrayGuard *pAttrs);
1383 + static void GenerateSingleFilter(
1384 + nsAbBooleanConditionType conditionType,
1385 + nsCString& filter,
1386 + NS_ConvertUCS2toUTF8 &vUTF8,
1387 + const char *ldapProperty);
1391 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100
1392 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200
1393 @@ -126,11 +126,13 @@
1395 // use mURINoQuery to get a prefName
1396 nsCAutoString prefName;
1397 - prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
1398 + prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
1400 // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
1402 - rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
1403 + nsCAutoString uriPrefName;
1404 + uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
1405 + rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
1409 @@ -154,6 +156,27 @@
1410 nsCAutoString tempLDAPURL(mURINoQuery);
1411 tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
1412 rv = mURL->SetSpec(tempLDAPURL);
1413 + NS_ENSURE_SUCCESS(rv,rv);
1415 + nsCAutoString aHost;
1416 + mURL->GetHost(aHost);
1417 + aHost.ReplaceChar('.','_');
1418 + prefName = nsDependentCString("ldap_2.servers.") + aHost;
1420 + rv = prefs->GetBoolPref(
1421 + PromiseFlatCString(prefName
1422 + + NS_LITERAL_CSTRING(".UseSSL")).get(),
1426 + // If use SSL,ldap url will look like this ldaps://host:port/.....
1427 + if (!NS_FAILED(rv) && useSSL)
1429 + tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
1430 + rv = mURL->SetSpec(tempLDAPURL);
1432 + //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
1437 @@ -164,24 +187,29 @@
1438 // get the login information, if there is any
1440 rv = prefs->GetCharPref(
1441 - PromiseFlatCString(
1442 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1443 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1444 + PromiseFlatCString(prefName
1445 + NS_LITERAL_CSTRING(".auth.dn")).get(),
1446 getter_Copies(mLogin));
1447 if (NS_FAILED(rv)) {
1448 mLogin.Truncate(); // zero out mLogin
1451 + // get the password information, if there is any
1453 + rv = prefs->GetCharPref(
1454 + PromiseFlatCString(prefName
1455 + + NS_LITERAL_CSTRING(".auth.pwd")).get(),
1456 + getter_Copies(mPassword));
1457 + if (NS_FAILED(rv)) {
1458 + mPassword.Truncate(); // zero out mLogin
1460 // get the protocol version, if there is any. using a string pref
1461 // here instead of an int, as protocol versions sometimes have names like
1464 nsXPIDLCString protocolVersion;
1465 rv = prefs->GetCharPref(
1466 - PromiseFlatCString(
1467 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1468 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1469 + PromiseFlatCString(prefName
1470 + NS_LITERAL_CSTRING(".protocolVersion")).get(),
1471 getter_Copies(protocolVersion));
1473 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100
1474 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200
1476 PRInt32 resultLimit = -1,
1477 PRInt32 timeOut = 0);
1478 virtual ~nsAbQueryLDAPMessageListener ();
1480 + void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
1482 nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
1483 nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
1486 PRBool mWaitingForPrevQueryToFinish;
1488 + nsAutoString m_sPassword;
1490 nsCOMPtr<nsILDAPOperation> mSearchOperation;
1495 // If mLogin is set, we're expected to use it to get a password.
1497 - if (!mDirectoryQuery->mLogin.IsEmpty()) {
1498 + if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
1499 // XXX hack until nsUTF8AutoString exists
1500 #define nsUTF8AutoString nsCAutoString
1501 nsUTF8AutoString spec;
1502 @@ -415,10 +417,13 @@
1503 rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
1504 NS_ENSURE_SUCCESS(rv, rv);
1507 - rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1510 + if (m_sPassword.Length())
1511 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
1513 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1514 NS_ENSURE_SUCCESS(rv, rv);
1520 rv = getLdapReturnAttributes (arguments, returnAttributes);
1521 NS_ENSURE_SUCCESS(rv, rv);
1526 nsCOMPtr<nsISupports> supportsExpression;
1527 rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
1528 @@ -828,6 +833,10 @@
1531 msgListener->mUrl = url;
1532 + msgListener->mQueryListener = listener;
1533 + msgListener->mResultLimit = resultLimit;
1534 + msgListener->mTimeOut = timeOut;
1535 + msgListener->mQueryArguments = arguments;
1536 return msgListener->DoSearch();
1539 @@ -845,6 +854,11 @@
1541 if (_messageListener == NULL)
1542 return NS_ERROR_OUT_OF_MEMORY;
1544 + nsAutoString wPassword;
1545 + wPassword.AssignWithConversion(mPassword.get());
1546 + _messageListener->SetPassword(wPassword);
1548 mListener = _messageListener;
1551 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200
1552 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200
1554 friend class nsAbQueryLDAPMessageListener;
1555 nsresult Initiate ();
1556 nsXPIDLCString mLogin; // authenticate to the LDAP server as...
1557 + nsXPIDLCString mPassword; // password to the LDAP server as...
1558 nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
1559 PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
1561 --- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200
1562 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200
1566 + * The contents of this file are subject to the Mozilla Public
1567 + * License Version 1.1 (the "License"); you may not use this file
1568 + * except in compliance with the License. You may obtain a copy of
1569 + * the License at http://www.mozilla.org/MPL/
1571 + * Software distributed under the License is distributed on an "AS
1572 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1573 + * implied. See the License for the specific language governing
1574 + * rights and limitations under the License.
1576 + * The Original Code is the Netscape security libraries.
1578 + * The Initial Developer of the Original Code is Netscape
1579 + * Communications Corporation. Portions created by Netscape are
1580 + * Copyright (C) 1994-2000 Netscape Communications Corporation. All
1581 + * Rights Reserved.
1585 + * Alternatively, the contents of this file may be used under the
1586 + * terms of the GNU General Public License Version 2 or later (the
1587 + * "GPL"), in which case the provisions of the GPL are applicable
1588 + * instead of those above. If you wish to allow use of your
1589 + * version of this file only under the terms of the GPL and not to
1590 + * allow others to use your version of this file under the MPL,
1591 + * indicate your decision by deleting the provisions above and
1592 + * replace them with the notice and other provisions required by
1593 + * the GPL. If you do not delete the provisions above, a recipient
1594 + * may use your version of this file under either the MPL or the
1598 +#include <stdlib.h>
1602 +#include "prtypes.h"
1603 +#include "prlong.h"
1605 +#include "nsMemory.h"
1607 +#define MD5_HASH_LEN 16
1608 +#define MD5_BUFFER_SIZE 64
1609 +#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
1611 +#define CV0_1 0x67452301
1612 +#define CV0_2 0xefcdab89
1613 +#define CV0_3 0x98badcfe
1614 +#define CV0_4 0x10325476
1616 +#define T1_0 0xd76aa478
1617 +#define T1_1 0xe8c7b756
1618 +#define T1_2 0x242070db
1619 +#define T1_3 0xc1bdceee
1620 +#define T1_4 0xf57c0faf
1621 +#define T1_5 0x4787c62a
1622 +#define T1_6 0xa8304613
1623 +#define T1_7 0xfd469501
1624 +#define T1_8 0x698098d8
1625 +#define T1_9 0x8b44f7af
1626 +#define T1_10 0xffff5bb1
1627 +#define T1_11 0x895cd7be
1628 +#define T1_12 0x6b901122
1629 +#define T1_13 0xfd987193
1630 +#define T1_14 0xa679438e
1631 +#define T1_15 0x49b40821
1633 +#define T2_0 0xf61e2562
1634 +#define T2_1 0xc040b340
1635 +#define T2_2 0x265e5a51
1636 +#define T2_3 0xe9b6c7aa
1637 +#define T2_4 0xd62f105d
1638 +#define T2_5 0x02441453
1639 +#define T2_6 0xd8a1e681
1640 +#define T2_7 0xe7d3fbc8
1641 +#define T2_8 0x21e1cde6
1642 +#define T2_9 0xc33707d6
1643 +#define T2_10 0xf4d50d87
1644 +#define T2_11 0x455a14ed
1645 +#define T2_12 0xa9e3e905
1646 +#define T2_13 0xfcefa3f8
1647 +#define T2_14 0x676f02d9
1648 +#define T2_15 0x8d2a4c8a
1650 +#define T3_0 0xfffa3942
1651 +#define T3_1 0x8771f681
1652 +#define T3_2 0x6d9d6122
1653 +#define T3_3 0xfde5380c
1654 +#define T3_4 0xa4beea44
1655 +#define T3_5 0x4bdecfa9
1656 +#define T3_6 0xf6bb4b60
1657 +#define T3_7 0xbebfbc70
1658 +#define T3_8 0x289b7ec6
1659 +#define T3_9 0xeaa127fa
1660 +#define T3_10 0xd4ef3085
1661 +#define T3_11 0x04881d05
1662 +#define T3_12 0xd9d4d039
1663 +#define T3_13 0xe6db99e5
1664 +#define T3_14 0x1fa27cf8
1665 +#define T3_15 0xc4ac5665
1667 +#define T4_0 0xf4292244
1668 +#define T4_1 0x432aff97
1669 +#define T4_2 0xab9423a7
1670 +#define T4_3 0xfc93a039
1671 +#define T4_4 0x655b59c3
1672 +#define T4_5 0x8f0ccc92
1673 +#define T4_6 0xffeff47d
1674 +#define T4_7 0x85845dd1
1675 +#define T4_8 0x6fa87e4f
1676 +#define T4_9 0xfe2ce6e0
1677 +#define T4_10 0xa3014314
1678 +#define T4_11 0x4e0811a1
1679 +#define T4_12 0xf7537e82
1680 +#define T4_13 0xbd3af235
1681 +#define T4_14 0x2ad7d2bb
1682 +#define T4_15 0xeb86d391
1772 +struct MD5ContextStr {
1773 + PRUint32 lsbInput;
1774 + PRUint32 msbInput;
1781 +typedef struct MD5ContextStr MD5Context;
1785 +int MD5_Hash(unsigned char *dest, const char *src);
1786 +int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
1787 +MD5Context * MD5_NewContext(void);
1788 +void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
1789 +void MD5_Begin(MD5Context *cx);
1790 +static void md5_compress(MD5Context *cx);
1791 +void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
1792 +void MD5_End(MD5Context *cx, unsigned char *digest,
1793 + unsigned int *digestLen, unsigned int maxDigestLen);
1794 +unsigned int MD5_FlattenSize(MD5Context *cx);
1795 +int MD5_Flatten(MD5Context *cx, unsigned char *space);
1796 +MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
1797 +void MD5_TraceState(MD5Context *cx);
1800 +MD5_Hash(unsigned char *dest, const char *src)
1802 + return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
1806 +MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
1809 + MD5Context *cx = MD5_NewContext();
1811 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1815 + MD5_Update(cx, src, src_length);
1816 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
1817 + MD5_DestroyContext(cx, PR_TRUE);
1822 +MD5_NewContext(void)
1824 + MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
1826 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1833 +MD5_DestroyContext(MD5Context *cx, PRBool freeit)
1841 +MD5_Begin(MD5Context *cx)
1845 + memset(cx->inBuf, 0, sizeof(cx->inBuf));
1846 + cx->cv[0] = CV0_1;
1847 + cx->cv[1] = CV0_2;
1848 + cx->cv[2] = CV0_3;
1849 + cx->cv[3] = CV0_4;
1852 +#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
1854 +#define MASK 0x00ff00ff
1855 +#ifdef IS_LITTLE_ENDIAN
1856 +#define lendian(i32) \
1859 +#define lendian(i32) \
1860 + (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
1863 +#if defined(SOLARIS) || defined(HPUX)
1864 +#define addto64(sumhigh, sumlow, addend) \
1865 + sumlow += addend; sumhigh += (sumlow < addend);
1867 +#define addto64(sumhigh, sumlow, addend) \
1868 + sumlow += addend; if (sumlow < addend) ++sumhigh;
1871 +#define F(X, Y, Z) \
1872 + ((X & Y) | ((~X) & Z))
1874 +#define G(X, Y, Z) \
1875 + ((X & Z) | (Y & (~Z)))
1877 +#define H(X, Y, Z) \
1880 +#define I(X, Y, Z) \
1883 +#define FF(a, b, c, d, bufint, s, ti) \
1884 + a = b + cls(a + F(b, c, d) + bufint + ti, s)
1886 +#define GG(a, b, c, d, bufint, s, ti) \
1887 + a = b + cls(a + G(b, c, d) + bufint + ti, s)
1889 +#define HH(a, b, c, d, bufint, s, ti) \
1890 + a = b + cls(a + H(b, c, d) + bufint + ti, s)
1892 +#define II(a, b, c, d, bufint, s, ti) \
1893 + a = b + cls(a + I(b, c, d) + bufint + ti, s)
1896 +md5_compress(MD5Context *cx)
1898 + PRUint32 a, b, c, d;
1904 +#ifndef IS_LITTLE_ENDIAN
1905 + cx->u.w[0] = lendian(cx->u.w[0]);
1906 + cx->u.w[1] = lendian(cx->u.w[1]);
1907 + cx->u.w[2] = lendian(cx->u.w[2]);
1908 + cx->u.w[3] = lendian(cx->u.w[3]);
1909 + cx->u.w[4] = lendian(cx->u.w[4]);
1910 + cx->u.w[5] = lendian(cx->u.w[5]);
1911 + cx->u.w[6] = lendian(cx->u.w[6]);
1912 + cx->u.w[7] = lendian(cx->u.w[7]);
1913 + cx->u.w[8] = lendian(cx->u.w[8]);
1914 + cx->u.w[9] = lendian(cx->u.w[9]);
1915 + cx->u.w[10] = lendian(cx->u.w[10]);
1916 + cx->u.w[11] = lendian(cx->u.w[11]);
1917 + cx->u.w[12] = lendian(cx->u.w[12]);
1918 + cx->u.w[13] = lendian(cx->u.w[13]);
1919 + cx->u.w[14] = lendian(cx->u.w[14]);
1920 + cx->u.w[15] = lendian(cx->u.w[15]);
1922 + FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
1923 + FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
1924 + FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
1925 + FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
1926 + FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
1927 + FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
1928 + FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
1929 + FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
1930 + FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
1931 + FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
1932 + FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
1933 + FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
1934 + FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
1935 + FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
1936 + FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
1937 + FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
1938 + GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
1939 + GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
1940 + GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
1941 + GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
1942 + GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
1943 + GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
1944 + GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
1945 + GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
1946 + GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
1947 + GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
1948 + GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
1949 + GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
1950 + GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
1951 + GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
1952 + GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
1953 + GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
1954 + HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
1955 + HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
1956 + HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
1957 + HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
1958 + HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
1959 + HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
1960 + HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
1961 + HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
1962 + HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
1963 + HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
1964 + HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
1965 + HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
1966 + HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
1967 + HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
1968 + HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
1969 + HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
1970 + II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
1971 + II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
1972 + II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
1973 + II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
1974 + II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
1975 + II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
1976 + II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
1977 + II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
1978 + II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
1979 + II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
1980 + II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
1981 + II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
1982 + II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
1983 + II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
1984 + II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
1985 + II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
1993 +MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
1995 + PRUint32 bytesToConsume;
1996 + PRUint32 inBufIndex = cx->lsbInput & 63;
1998 + /* Add the number of input bytes to the 64-bit input counter. */
1999 + addto64(cx->msbInput, cx->lsbInput, inputLen);
2001 + /* There is already data in the buffer. Fill with input. */
2002 + bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
2003 + memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
2004 + if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
2005 + /* The buffer is filled. Run the compression function. */
2007 + /* Remaining input. */
2008 + inputLen -= bytesToConsume;
2009 + input += bytesToConsume;
2012 + /* Iterate over 64-byte chunks of the message. */
2013 + while (inputLen >= MD5_BUFFER_SIZE) {
2014 + memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
2016 + inputLen -= MD5_BUFFER_SIZE;
2017 + input += MD5_BUFFER_SIZE;
2020 + /* Tail of message (message bytes mod 64). */
2022 + memcpy(cx->inBuf, input, inputLen);
2025 +static const unsigned char padbytes[] = {
2026 + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2027 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2028 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2029 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2030 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2031 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2032 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2033 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2034 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2035 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2036 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2037 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2041 +MD5_End(MD5Context *cx, unsigned char *digest,
2042 + unsigned int *digestLen, unsigned int maxDigestLen)
2044 +#ifndef IS_LITTLE_ENDIAN
2047 + PRUint32 lowInput, highInput;
2048 + PRUint32 inBufIndex = cx->lsbInput & 63;
2050 + if (maxDigestLen < MD5_HASH_LEN) {
2051 +// PORT_SetError(SEC_ERROR_INVALID_ARGS);
2055 + /* Copy out the length of bits input before padding. */
2056 + lowInput = cx->lsbInput;
2057 + highInput = (cx->msbInput << 3) | (lowInput >> 29);
2060 + if (inBufIndex < MD5_END_BUFFER) {
2061 + MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
2063 + MD5_Update(cx, padbytes,
2064 + MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
2067 + /* Store the number of bytes input (before padding) in final 64 bits. */
2068 + cx->u.w[14] = lendian(lowInput);
2069 + cx->u.w[15] = lendian(highInput);
2071 + /* Final call to compress. */
2074 + /* Copy the resulting values out of the chain variables into return buf. */
2075 + *digestLen = MD5_HASH_LEN;
2076 +#ifndef IS_LITTLE_ENDIAN
2077 + cx->cv[0] = lendian(cx->cv[0]);
2078 + cx->cv[1] = lendian(cx->cv[1]);
2079 + cx->cv[2] = lendian(cx->cv[2]);
2080 + cx->cv[3] = lendian(cx->cv[3]);
2082 + memcpy(digest, cx->cv, MD5_HASH_LEN);
2086 +MD5_FlattenSize(MD5Context *cx)
2088 + return sizeof(*cx);
2092 +MD5_Flatten(MD5Context *cx, unsigned char *space)
2094 + memcpy(space, cx, sizeof(*cx));
2099 +MD5_Resurrect(unsigned char *space, void *arg)
2101 + MD5Context *cx = MD5_NewContext();
2103 + memcpy(cx, space, sizeof(*cx));
2108 +MD5_TraceState(MD5Context *cx)
2110 +// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
2114 +md5_stream (FILE *stream, unsigned char *dest)
2116 + /* Important: BLOCKSIZE must be a multiple of 64. */
2117 +#define BLOCKSIZE 4096
2119 + MD5Context *cx = MD5_NewContext();
2121 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
2125 + unsigned char buffer[BLOCKSIZE + 72];
2128 + /* Initialize the computation context. */
2131 + /* Iterate over full file contents. */
2134 + /* We read the file in blocks of BLOCKSIZE bytes. One call of the
2135 + computation function processes the whole buffer so that with the
2136 + next round of the loop another block can be read. */
2140 + /* Read block. Take care for partial reads. */
2143 + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
2147 + while (sum < BLOCKSIZE && n != 0);
2148 + if (n == 0 && ferror (stream))
2151 + /* If end of file is reached, end the loop. */
2155 + /* Process buffer with BLOCKSIZE bytes. Note that
2156 + BLOCKSIZE % 64 == 0
2158 + MD5_Update(cx, buffer, BLOCKSIZE);
2161 + /* Add the last bytes if necessary. */
2163 + MD5_Update(cx, buffer, sum);
2165 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
2166 + MD5_DestroyContext(cx, PR_TRUE);
2171 +int getMD5sum(const char * fileName,char * sum)
2173 + unsigned char bin_sum[16];
2177 + FILE *fp=fopen(fileName,"rb");
2180 + len=md5_stream(fp,bin_sum);
2182 + for (int i = 0; i < len; ++i)
2183 + sprintf (sum,"%s%02x",sum, bin_sum[i]);
2191 +int testMD5sum(const char * fileName,char * sum)
2193 + char newSum[33]="";
2194 + if (getMD5sum(fileName,newSum))
2196 + return strcmp(newSum,sum);
2198 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100
2199 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200
2203 mCardDatabase->EditCard(this, PR_TRUE);
2204 - mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2206 + return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2209 return NS_ERROR_FAILURE;
2210 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100
2211 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2216 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2217 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2222 return NS_ERROR_NOT_IMPLEMENTED;
2224 nsresult rv = NS_OK;
2227 rv = GetAbDatabase();
2229 @@ -736,10 +737,11 @@
2230 mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
2232 mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
2233 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2234 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2236 + NS_ENSURE_SUCCESS(rv, rv);
2237 NS_IF_ADDREF(*addedCard = newCard);
2242 NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
2243 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200
2244 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200
2247 index_DisplayName = 0,
2249 + index_SecondEmailAddress,
2253 @@ -121,32 +122,34 @@
2255 static const ULONG OutlookCardMAPIProps [] =
2257 - PR_DISPLAY_NAME_W,
2258 - PR_EMAIL_ADDRESS_W,
2262 - PR_BUSINESS_TELEPHONE_NUMBER_W,
2263 - PR_HOME_TELEPHONE_NUMBER_W,
2264 - PR_BUSINESS_FAX_NUMBER_W,
2265 - PR_PAGER_TELEPHONE_NUMBER_W,
2266 - PR_MOBILE_TELEPHONE_NUMBER_W,
2267 - PR_HOME_ADDRESS_CITY_W,
2268 - PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
2269 - PR_HOME_ADDRESS_POSTAL_CODE_W,
2270 - PR_HOME_ADDRESS_COUNTRY_W,
2271 - PR_BUSINESS_ADDRESS_CITY_W,
2272 - PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
2273 - PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
2274 - PR_BUSINESS_ADDRESS_COUNTRY_W,
2276 - PR_DEPARTMENT_NAME_W,
2277 - PR_COMPANY_NAME_W,
2278 - PR_BUSINESS_HOME_PAGE_W,
2279 - PR_PERSONAL_HOME_PAGE_W,
2281 + PR_DISPLAY_NAME_A,//0x8035001E
2282 + PR_EMAIL_ADDRESS_A,//0x8034001E
2283 + PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
2287 + PR_BUSINESS_TELEPHONE_NUMBER_A,
2288 + PR_HOME_TELEPHONE_NUMBER_A,
2289 + PR_BUSINESS_FAX_NUMBER_A,
2290 + PR_PAGER_TELEPHONE_NUMBER_A,
2291 + PR_MOBILE_TELEPHONE_NUMBER_A,
2292 + PR_HOME_ADDRESS_CITY_A,
2293 + PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
2294 + PR_HOME_ADDRESS_POSTAL_CODE_A,
2295 + PR_HOME_ADDRESS_COUNTRY_A,
2296 + PR_BUSINESS_ADDRESS_CITY_A,
2297 + PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
2298 + PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
2299 + PR_BUSINESS_ADDRESS_COUNTRY_A,
2301 + PR_DEPARTMENT_NAME_A,
2302 + PR_COMPANY_NAME_A,
2303 + PR_BUSINESS_HOME_PAGE_A,
2304 + PR_PERSONAL_HOME_PAGE_A,
2309 nsresult nsAbOutlookCard::Init(const char *aUri)
2311 nsresult retCode = nsRDFResource::Init(aUri) ;
2313 SetDisplayName(unichars [index_DisplayName]->get()) ;
2314 SetNickName(unichars [index_NickName]->get()) ;
2315 SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
2316 + SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
2317 SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
2318 SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
2319 SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
2320 @@ -207,12 +211,12 @@
2321 nsAutoString unichar ;
2322 nsAutoString unicharBis ;
2324 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
2325 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
2326 splitString(unichar, unicharBis) ;
2327 SetHomeAddress(unichar.get()) ;
2328 SetHomeAddress2(unicharBis.get()) ;
2330 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
2331 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
2332 splitString(unichar, unicharBis) ;
2333 SetWorkAddress(unichar.get()) ;
2334 SetWorkAddress2(unicharBis.get()) ;
2336 SetDisplayName(properties [index_DisplayName]) ;
2337 GetNickName(getter_Copies(properties [index_NickName])) ;
2338 GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
2339 + GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
2340 GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
2341 GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
2342 GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
2343 @@ -309,9 +314,16 @@
2344 GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
2345 GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
2346 GetNotes(getter_Copies(properties [index_Comments])) ;
2347 - if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
2348 - index_LastProp, properties)) {
2349 - PRINTF(("Cannot set general properties.\n")) ;
2352 + for (i=0;i<index_LastProp;i++)
2354 + if (!mapiAddBook->SetPropertyUString(*mMapiData,
2355 + OutlookCardMAPIProps[i],
2358 + PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
2361 delete [] properties ;
2362 nsXPIDLString unichar ;
2363 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200
2364 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200
2367 nsCOMPtr<nsIRDFResource> resource ;
2369 - for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
2370 - folders.mEntries [i].ToString(entryId) ;
2371 + for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
2372 + folders[i].ToString(entryId) ;
2373 buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
2374 uri.Append(entryId) ;
2376 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100
2377 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2379 PRINTF(("Cannot get type.\n")) ;
2380 return NS_ERROR_FAILURE ;
2382 - if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
2383 + if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
2384 PRINTF(("Cannot get name.\n")) ;
2385 return NS_ERROR_FAILURE ;
2387 @@ -163,45 +163,85 @@
2391 +nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2392 + PRBool aSearchForOld, PRBool& aIsNewCard)
2394 + nsresult retCode = NS_OK ;
2395 + if (aSearchForOld) {
2396 + nsCStringKey key(uriName) ;
2397 + nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
2399 + if (existingCard) {
2400 + nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
2402 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2403 + NS_IF_ADDREF(*aNewCard = card) ;
2404 + aIsNewCard = PR_FALSE ;
2408 + aIsNewCard = PR_TRUE ;
2409 + nsCOMPtr<nsIRDFResource> resource ;
2411 + nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2412 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2413 + resource = do_QueryInterface(childCard, &retCode) ;
2414 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2415 + retCode = resource->Init(uriName.get()) ;
2416 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2417 + NS_IF_ADDREF(*aNewCard = childCard);
2421 NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
2423 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2425 nsCOMPtr<nsISupportsArray> cardList ;
2426 + nsCStringArray uriList ;
2427 + nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2430 - mCardList.Reset() ;
2432 retCode = StartSearch() ;
2433 - NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2436 - retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
2437 + retCode = GetChildCards(uriList, nsnull) ;
2439 + NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2440 if (NS_SUCCEEDED(retCode)) {
2441 // Fill the results array and update the card list
2442 // Also update the address list and notify any changes.
2443 PRUint32 nbCards = 0 ;
2444 - nsCOMPtr<nsISupports> element ;
2445 + nsCAutoString uriName;
2446 + nsCOMPtr <nsIAbCard> childCard;
2447 + PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
2449 + nbCards = uriList.Count();
2450 + NS_NewISupportsArray(getter_AddRefs(m_AddressList));
2452 - cardList->Enumerate(aCards) ;
2453 - cardList->Count(&nbCards) ;
2454 for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
2455 - cardList->GetElementAt(i, getter_AddRefs(element)) ;
2456 - nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
2457 - nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
2458 + PRBool isNewCard = PR_FALSE ;
2460 - if (!oldElement) {
2461 + uriList.CStringAt(i,uriName);
2462 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
2463 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2464 + cardList->AppendElement(childCard);
2467 // We are dealing with a new element (probably directly
2468 // added from Outlook), we may need to sync m_AddressList
2469 - mCardList.Put(&newKey, element) ;
2470 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2471 + nsCStringKey newKey(uriName) ;
2473 + mCardList.Put(&newKey, childCard) ;
2474 + nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
2476 NS_ENSURE_SUCCESS(retCode, retCode) ;
2477 PRBool isMailList = PR_FALSE ;
2479 retCode = card->GetIsMailList(&isMailList) ;
2480 NS_ENSURE_SUCCESS(retCode, retCode) ;
2483 // We can have mailing lists only in folder,
2484 // we must add the directory to m_AddressList
2485 @@ -224,18 +264,33 @@
2486 NotifyItemAddition(card) ;
2490 - NS_ASSERTION(oldElement == element, "Different card stored") ;
2493 + return cardList->Enumerate(aCards) ;
2496 +static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
2497 + nsresult retCode = NS_OK ;
2498 + nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
2500 + // Receiving a non-RDF card is accepted
2501 + if (NS_FAILED(retCode)) { return NS_OK ; }
2502 + nsXPIDLCString uri ;
2504 + retCode = resource->GetValue(getter_Copies(uri)) ;
2505 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2506 + aUri = uri.get() ;
2510 NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
2512 if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
2513 - nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
2514 + *aHasCard = PR_FALSE ;
2517 + ExtractUriFromCard(aCard, uri) ;
2518 + nsCStringKey key(uri) ;
2520 *aHasCard = mCardList.Exists(&key) ;
2522 @@ -317,7 +372,10 @@
2523 PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
2526 - nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
2529 + ExtractUriFromCard(card, uri) ;
2530 + nsCStringKey key(uri) ;
2532 mCardList.Remove(&key) ;
2533 if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
2534 @@ -386,7 +444,10 @@
2536 retCode = CreateCard(aData, addedCard) ;
2537 NS_ENSURE_SUCCESS(retCode, retCode) ;
2538 - nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
2541 + ExtractUriFromCard(*addedCard, uri) ;
2542 + nsCStringKey newKey(uri) ;
2544 mCardList.Put(&newKey, *addedCard) ;
2545 if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
2547 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2548 retCode = GetDirName(getter_Copies(name)) ;
2549 NS_ENSURE_SUCCESS(retCode, retCode) ;
2550 - if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
2551 + if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
2552 return NS_ERROR_FAILURE ;
2554 retCode = CommitAddressList() ;
2556 {"DisplayName", PR_DISPLAY_NAME_A},
2557 {"NickName", PR_NICKNAME_A},
2558 {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
2559 + {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
2560 {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
2561 {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
2562 {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
2563 @@ -1027,7 +1089,10 @@
2565 nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
2567 - nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
2570 + ExtractUriFromCard(aCard, uri) ;
2571 + nsCStringKey newKey(uri) ;
2572 nsresult retCode = NS_OK ;
2574 mCardList.Put(&newKey, aCard) ;
2575 @@ -1051,14 +1116,14 @@
2576 retCode = BuildRestriction(aArguments, arguments) ;
2577 NS_ENSURE_SUCCESS(retCode, retCode) ;
2578 nsCOMPtr<nsISupportsArray> resultsArray ;
2579 + nsCStringArray uriArray ;
2580 PRUint32 nbResults = 0 ;
2582 - retCode = GetChildCards(getter_AddRefs(resultsArray),
2583 + retCode = GetChildCards(uriArray,
2584 arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
2585 DestroyRestriction(arguments) ;
2586 NS_ENSURE_SUCCESS(retCode, retCode) ;
2587 - retCode = resultsArray->Count(&nbResults) ;
2588 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2589 + nbResults = uriArray.Count() ;
2590 nsCOMPtr<nsIAbDirectoryQueryResult> result ;
2591 nsAbDirectoryQueryResult *newResult = nsnull ;
2593 @@ -1066,15 +1131,18 @@
2594 nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
2597 - nsCOMPtr<nsISupports> element ;
2598 nsCOMPtr<nsISupportsArray> propertyValues ;
2600 + nsCAutoString uriName;
2601 + nsCOMPtr <nsIAbCard> card;
2603 for (i = 0 ; i < nbResults ; ++ i) {
2604 - retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
2605 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2606 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2607 + PRBool isNewCard = PR_FALSE ;
2609 + uriArray.CStringAt(i,uriName);
2610 + retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
2611 NS_ENSURE_SUCCESS(retCode, retCode) ;
2613 FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
2614 newResult = new nsAbDirectoryQueryResult(0, aArguments,
2615 nsIAbDirectoryQueryResult::queryResultMatch,
2616 @@ -1099,13 +1167,43 @@
2617 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2619 nsresult retCode = NS_OK ;
2620 - nsCOMPtr<nsISupportsArray> cards ;
2622 + nsCOMPtr<nsISupportsArray> cards;
2623 + retCode = NS_NewISupportsArray(getter_AddRefs(cards));
2624 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2626 + nsCStringArray uriList;
2627 + retCode = GetChildCards(uriList,aRestriction);
2628 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2630 + nsCAutoString uriName;
2631 + nsCOMPtr <nsIAbCard> childCard;
2632 + PRUint32 nbURIs = 0 ;
2633 + nbURIs = uriList.Count();
2636 + for (i = 0 ; i < nbURIs ; ++ i) {
2637 + PRBool isNewCard = PR_FALSE ;
2639 + uriList.CStringAt(i,uriName);
2640 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
2641 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2642 + cards->AppendElement(childCard);
2645 + NS_IF_ADDREF(*aCards = cards);
2649 +nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
2650 + void *aRestriction)
2652 + nsresult retCode = NS_OK ;
2653 nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2654 nsMapiEntryArray cardEntries ;
2655 LPSRestriction restriction = (LPSRestriction) aRestriction ;
2657 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2658 - retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
2659 NS_ENSURE_SUCCESS(retCode, retCode) ;
2660 if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
2661 PRINTF(("Cannot get cards.\n")) ;
2662 @@ -1114,22 +1212,14 @@
2663 nsCAutoString entryId ;
2664 nsCAutoString uriName ;
2665 nsCOMPtr<nsIRDFResource> resource ;
2666 - nsCOMPtr <nsIAbCard> childCard;
2668 - for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
2669 - cardEntries.mEntries [card].ToString(entryId) ;
2672 + for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
2673 + cardEntries [card].ToString(entryId) ;
2674 buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
2675 uriName.Append(entryId) ;
2676 - childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2677 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2678 - resource = do_QueryInterface(childCard, &retCode) ;
2679 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2680 - retCode = resource->Init(uriName.get()) ;
2681 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2682 - cards->AppendElement(childCard) ;
2683 + aURI.AppendCString(uriName);
2686 - NS_ADDREF(*aCards) ;
2690 @@ -1153,8 +1243,8 @@
2691 nsCAutoString uriName ;
2692 nsCOMPtr <nsIRDFResource> resource ;
2694 - for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
2695 - nodeEntries.mEntries [node].ToString(entryId) ;
2696 + for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
2697 + nodeEntries [node].ToString(entryId) ;
2698 buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
2699 uriName.Append(entryId) ;
2700 retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
2701 @@ -1275,7 +1365,7 @@
2702 // In the case of a mailing list, we cannot directly create a new card,
2703 // we have to create a temporary one in a real folder (to be able to use
2704 // templates) and then copy it to the mailing list.
2705 - if (m_IsMailList) {
2706 + if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
2707 nsMapiEntry parentEntry ;
2708 nsMapiEntry temporaryEntry ;
2710 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200
2711 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200
2713 #include "nsHashtable.h"
2715 #include "nsISupportsArray.h"
2716 +#include "nsVoidArray.h"
2718 struct nsMapiEntry ;
2722 // Retrieve hierarchy as cards, with an optional restriction
2723 nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
2724 + // Retrieve hierarchy as URIs, with an optional restriction
2725 + nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
2726 // Retrieve hierarchy as directories
2727 nsresult GetChildNodes(nsISupportsArray **aNodes) ;
2728 // Create a new card
2730 nsresult CommitAddressList(void) ;
2731 // Read MAPI repository
2732 nsresult UpdateAddressList(void) ;
2733 + // Search for an existing card or build a new one
2734 + nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2735 + PRBool aSearchForOld, PRBool& aIsNewCard) ;
2737 nsMapiEntry *mMapiData ;
2738 // Container for the query threads
2739 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200
2740 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200
2742 #define USES_IID_IABContainer
2743 #define USES_IID_IMAPITable
2744 #define USES_IID_IDistList
2745 +#define USES_IID_IMsgStore
2746 +#define USES_IID_IMessage
2747 +#define USES_IID_IMAPIFolder
2749 #include "nsAbWinHelper.h"
2750 #include "nsMapiAddressBook.h"
2753 #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
2755 -// Small utility to ensure release of all MAPI interfaces
2756 -template <class tInterface> struct nsMapiInterfaceWrapper
2758 - tInterface mInterface ;
2760 - nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
2761 - ~nsMapiInterfaceWrapper(void) {
2762 - if (mInterface != NULL) { mInterface->Release() ; }
2764 - operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
2765 - tInterface operator -> (void) const { return mInterface ; }
2766 - operator tInterface *(void) { return &mInterface ; }
2769 static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
2771 @@ -249,24 +239,28 @@
2772 MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
2774 nsMapiEntryArray::nsMapiEntryArray(void)
2775 -: mEntries(NULL), mNbEntries(0)
2777 MOZ_COUNT_CTOR(nsMapiEntryArray) ;
2780 nsMapiEntryArray::~nsMapiEntryArray(void)
2782 - if (mEntries) { delete [] mEntries ; }
2784 MOZ_COUNT_DTOR(nsMapiEntryArray) ;
2787 +void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
2789 + m_array.AppendElement(aEntries);
2791 void nsMapiEntryArray::CleanUp(void)
2793 - if (mEntries != NULL) {
2794 - delete [] mEntries ;
2797 + nsMapiEntry *pEntries;
2798 + for (int i = 0; i < m_array.Count(); i++)
2800 + pEntries = (nsMapiEntry *)m_array.ElementAt( i);
2806 MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
2807 @@ -280,100 +274,55 @@
2808 // same protection (MAPI is supposed to be thread-safe).
2809 PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
2811 +int nsAbWinHelper::m_clients = 0;
2813 +PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
2814 +int nsAbWinHelper::m_uniBuffLen = 0;
2815 +char * nsAbWinHelper::m_pCStrBuff = NULL;
2816 +int nsAbWinHelper::m_cstrBuffLen = 0;
2818 nsAbWinHelper::nsAbWinHelper(void)
2819 -: mAddressBook(NULL), mLastError(S_OK)
2822 MOZ_COUNT_CTOR(nsAbWinHelper) ;
2826 nsAbWinHelper::~nsAbWinHelper(void)
2828 MOZ_COUNT_DTOR(nsAbWinHelper) ;
2831 -BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
2835 - aFolders.CleanUp() ;
2836 - nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
2837 - nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
2838 - ULONG objType = 0 ;
2839 - ULONG rowCount = 0 ;
2840 - SRestriction restriction ;
2841 - SPropTagArray folderColumns ;
2843 - mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
2845 - if (HR_FAILED(mLastError)) {
2846 - PRINTF(("Cannot open root %08x.\n", mLastError)) ;
2848 + delete [] m_pUniBuff;
2849 + m_pUniBuff = NULL;
2851 + delete [] m_pCStrBuff;
2852 + m_pCStrBuff = NULL;
2853 + m_cstrBuffLen = 0;
2855 - mLastError = rootFolder->GetHierarchyTable(0, folders) ;
2856 - if (HR_FAILED(mLastError)) {
2857 - PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
2860 - // We only take into account modifiable containers,
2861 - // otherwise, we end up with all the directory services...
2862 - restriction.rt = RES_BITMASK ;
2863 - restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
2864 - restriction.res.resBitMask.relBMR = BMR_NEZ ;
2865 - restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
2866 - mLastError = folders->Restrict(&restriction, 0) ;
2867 - if (HR_FAILED(mLastError)) {
2868 - PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
2870 - folderColumns.cValues = 1 ;
2871 - folderColumns.aulPropTag [0] = PR_ENTRYID ;
2872 - mLastError = folders->SetColumns(&folderColumns, 0) ;
2873 - if (HR_FAILED(mLastError)) {
2874 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
2877 - mLastError = folders->GetRowCount(0, &rowCount) ;
2878 - if (HR_SUCCEEDED(mLastError)) {
2879 - aFolders.mEntries = new nsMapiEntry [rowCount] ;
2880 - aFolders.mNbEntries = 0 ;
2882 - LPSRowSet rowSet = NULL ;
2885 - mLastError = folders->QueryRows(1, 0, &rowSet) ;
2886 - if (HR_SUCCEEDED(mLastError)) {
2887 - rowCount = rowSet->cRows ;
2888 - if (rowCount > 0) {
2889 - nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
2890 - SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
2892 - current.Assign(currentValue.Value.bin.cb,
2893 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
2895 - MyFreeProws(rowSet) ;
2898 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
2900 - } while (rowCount > 0) ;
2902 - return HR_SUCCEEDED(mLastError) ;
2906 BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
2907 nsMapiEntryArray& aCards)
2910 - return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
2911 + return GetContents(aParent, aRestriction, &aCards, 0) ;
2914 BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
2917 - return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
2918 + return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
2921 BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
2924 - return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
2925 + nsMapiEntryArray aCards;
2926 + BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
2927 + aNbCards=aCards.GetSize();
2931 BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
2933 aName = values->Value.lpszA ;
2935 else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
2936 - aName.AssignWithConversion(values->Value.lpszW) ;
2937 + UnicodeToCStr(values->Value.lpszW,aName) ;
2940 FreeBuffer(values) ;
2942 aName = values->Value.lpszW ;
2944 else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
2945 - aName.AssignWithConversion(values->Value.lpszA) ;
2946 + CStrToUnicode(values->Value.lpszA,aName) ;
2949 FreeBuffer(values) ;
2950 @@ -431,16 +380,22 @@
2953 for (i = 0 ; i < valueCount ; ++ i) {
2954 - if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
2955 + if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
2956 if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
2959 - temp.AssignWithConversion (values [i].Value.lpszA) ;
2960 + CStrToUnicode(values [i].Value.lpszA,temp) ;
2961 aNames.AppendString(temp) ;
2963 else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
2964 aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
2966 + else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
2967 + nsAutoString temp ;
2969 + CStrToUnicode (values [i].Value.lpszA,temp) ;
2970 + aNames.AppendString(temp) ;
2973 aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
2976 if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
2977 if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
2978 SYSTEMTIME readableTime ;
2980 if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
2981 aYear = readableTime.wYear ;
2982 aMonth = readableTime.wMonth ;
2984 nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
2987 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2988 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2989 &IID_IMAPIContainer, 0, &objType,
2991 if (HR_FAILED(mLastError)) {
2994 SBinaryArray entryArray ;
2996 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2997 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2998 &IID_IABContainer, MAPI_MODIFY, &objType,
3000 if (HR_FAILED(mLastError)) {
3001 @@ -567,14 +521,15 @@
3002 value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
3004 else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
3005 - alternativeValue.AssignWithConversion(aValue) ;
3006 + UnicodeToCStr(aValue,alternativeValue) ;
3007 value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
3010 PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
3013 - return SetMAPIProperties(aObject, 1, &value) ;
3014 + LPSPropValue values=&value;
3015 + return SetMAPIProperties(aObject, 1, values) ;
3018 BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3020 values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
3022 else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
3023 - alternativeValue.AssignWithConversion(aValues [i].get()) ;
3024 + UnicodeToCStr(aValues [i].get(),alternativeValue) ;
3025 char *av = nsCRT::strdup(alternativeValue.get()) ;
3029 readableTime.wSecond = 0 ;
3030 readableTime.wMilliseconds = 0 ;
3031 if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
3032 - return SetMAPIProperties(aObject, 1, &value) ;
3033 + LPSPropValue values=&value;
3034 + return SetMAPIProperties(aObject, 1, values) ;
3039 nsMapiInterfaceWrapper<LPABCONT> container ;
3042 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3043 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
3044 &IID_IABContainer, MAPI_MODIFY, &objType,
3046 if (HR_FAILED(mLastError)) {
3048 nsMapiInterfaceWrapper<LPABCONT> container ;
3051 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3052 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
3053 &IID_IABContainer, MAPI_MODIFY, &objType,
3055 if (HR_FAILED(mLastError)) {
3057 nsMapiInterfaceWrapper<LPABCONT> container ;
3060 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3061 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
3062 &IID_IABContainer, MAPI_MODIFY, &objType,
3064 if (HR_FAILED(mLastError)) {
3065 @@ -810,194 +766,77 @@
3069 -BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
3071 - LPENTRYID entryId = NULL ;
3072 - ULONG byteCount = 0 ;
3074 - mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
3075 - if (HR_FAILED(mLastError)) {
3076 - PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
3079 - aContainer.Assign(byteCount, entryId) ;
3080 - FreeBuffer(entryId) ;
3086 - ContentsColumnEntryId = 0,
3087 - ContentsColumnObjectType,
3088 - ContentsColumnsSize
3091 -static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3093 - ContentsColumnsSize,
3100 -BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3101 - nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
3102 +void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3104 - if (aList != NULL) { *aList = NULL ; }
3106 - nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
3107 - nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
3108 - ULONG objType = 0 ;
3109 - ULONG rowCount = 0 ;
3110 + if (aRowset == NULL) { return ; }
3113 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
3114 - &IID_IMAPIContainer, 0, &objType,
3116 - if (HR_FAILED(mLastError)) {
3117 - PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
3120 - // Here, flags for WAB and MAPI could be different, so this works
3121 - // only as long as we don't want to use any flag in GetContentsTable
3122 - mLastError = parent->GetContentsTable(0, contents) ;
3123 - if (HR_FAILED(mLastError)) {
3124 - PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
3126 + for (i = 0 ; i < aRowset->cRows ; ++ i) {
3127 + FreeBuffer(aRowset->aRow [i].lpProps) ;
3129 - if (aRestriction != NULL) {
3130 - mLastError = contents->Restrict(aRestriction, 0) ;
3131 - if (HR_FAILED(mLastError)) {
3132 - PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
3136 - mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
3137 - if (HR_FAILED(mLastError)) {
3138 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
3141 - mLastError = contents->GetRowCount(0, &rowCount) ;
3142 - if (HR_FAILED(mLastError)) {
3143 - PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
3146 - if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
3149 - LPSRowSet rowSet = NULL ;
3152 - mLastError = contents->QueryRows(1, 0, &rowSet) ;
3153 - if (HR_FAILED(mLastError)) {
3154 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
3157 - rowCount = rowSet->cRows ;
3158 - if (rowCount > 0 &&
3159 - (aMapiType == 0 ||
3160 - rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
3161 - if (aList != NULL) {
3162 - nsMapiEntry& current = (*aList) [aNbElements] ;
3163 - SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
3165 - current.Assign(currentValue.Value.bin.cb,
3166 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
3167 + FreeBuffer(aRowset) ;
3169 +void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
3171 + result.Truncate( 0);
3172 + int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
3173 + if (wLen >= m_uniBuffLen)
3175 + delete [] m_pUniBuff;
3176 + m_pUniBuff = new PRUnichar[wLen + 64];
3177 + m_uniBuffLen = wLen + 64;
3182 + MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
3183 + result = m_pUniBuff;
3185 - MyFreeProws(rowSet) ;
3186 - } while (rowCount > 0) ;
3190 -BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3191 - ULONG aNbProperties, LPSPropValue& aValue,
3192 - ULONG& aValueCount)
3193 +void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
3195 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3196 - ULONG objType = 0 ;
3197 - LPSPropTagArray properties = NULL ;
3200 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3201 - &IID_IMAPIProp, 0, &objType,
3203 - if (HR_FAILED(mLastError)) {
3204 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3206 + result.Truncate( 0);
3207 + int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
3208 + if (cLen >= m_cstrBuffLen) {
3210 + delete [] m_pCStrBuff;
3211 + m_pCStrBuff = new char[cLen + 64];
3212 + m_cstrBuffLen = cLen + 64;
3214 - AllocateBuffer(CbNewSPropTagArray(aNbProperties),
3215 - NS_REINTERPRET_CAST(void **, &properties)) ;
3216 - properties->cValues = aNbProperties ;
3217 - for (i = 0 ; i < aNbProperties ; ++ i) {
3218 - properties->aulPropTag [i] = aPropertyTags [i] ;
3220 - mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
3221 - FreeBuffer(properties) ;
3222 - if (HR_FAILED(mLastError)) {
3223 - PRINTF(("Cannot get props %08x.\n", mLastError)) ;
3225 + WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
3226 + result = m_pCStrBuff;
3228 - return HR_SUCCEEDED(mLastError) ;
3231 -BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3232 - const LPSPropValue& aValues)
3234 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3235 - ULONG objType = 0 ;
3236 - LPSPropProblemArray problems = NULL ;
3237 +static nsAbWinHelper *getOutlookAddressBook(void) {
3238 + static nsMapiAddressBook *addressBook = NULL ;
3240 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3241 - &IID_IMAPIProp, MAPI_MODIFY, &objType,
3243 - if (HR_FAILED(mLastError)) {
3244 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3247 - mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
3248 - if (HR_FAILED(mLastError)) {
3249 - PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
3252 - if (problems != NULL) {
3253 - for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
3254 - PRINTF(("Problem %d: index %d code %08x.\n", i,
3255 - problems->aProblem [i].ulIndex,
3256 - problems->aProblem [i].scode)) ;
3259 - mLastError = object->SaveChanges(0) ;
3260 - if (HR_FAILED(mLastError)) {
3261 - PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
3263 - return HR_SUCCEEDED(mLastError) ;
3264 + if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
3265 + return addressBook ;
3268 -void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3270 - if (aRowset == NULL) { return ; }
3272 +static nsAbWinHelper *getOutlookExpAddressBook(void) {
3273 + static nsWabAddressBook *addressBook = NULL ;
3275 - for (i = 0 ; i < aRowset->cRows ; ++ i) {
3276 - FreeBuffer(aRowset->aRow [i].lpProps) ;
3278 - FreeBuffer(aRowset) ;
3279 + if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
3280 + return addressBook ;
3283 nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
3287 - case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
3288 - case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
3289 + case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
3290 + case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
3295 nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
3300 const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
3301 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200
3302 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200
3304 #include "nsVoidArray.h"
3305 #include "nsXPIDLString.h"
3307 +#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
3308 +#define PR_SCREEN_NAME_A 0x805B001E
3311 +// Small utility to ensure release of all MAPI interfaces
3312 +template <class tInterface> struct nsMapiInterfaceWrapper
3314 + tInterface mInterface ;
3316 + nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
3317 + ~nsMapiInterfaceWrapper(void) {
3318 + if (mInterface ) { mInterface->Release() ; }
3320 + operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
3321 + tInterface operator -> (void) const { return mInterface ; }
3322 + operator tInterface *(void) { return &mInterface ; }
3330 struct nsMapiEntryArray
3332 - nsMapiEntry *mEntries ;
3333 - ULONG mNbEntries ;
3335 nsMapiEntryArray(void) ;
3336 ~nsMapiEntryArray(void) ;
3338 - const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
3339 + void AddItem(nsMapiEntry * aEntries);
3340 + void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
3342 + nsMapiEntry * aEntries=new nsMapiEntry();
3343 + aEntries->Assign(mByteCount,mEntryId);
3344 + AddItem(aEntries);
3347 + ULONG GetSize( void) { return( m_array.Count());}
3348 + nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
3349 + nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
3350 void CleanUp(void) ;
3351 + void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
3352 + void Remove(int index){ m_array.RemoveElementAt(index); }
3353 + ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
3355 + nsVoidArray m_array;
3361 virtual ~nsAbWinHelper(void) ;
3363 // Get the top address books
3364 - BOOL GetFolders(nsMapiEntryArray& aFolders) ;
3365 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
3366 // Get a list of entries for cards/mailing lists in a folder/mailing list
3367 BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3368 nsMapiEntryArray& aCards) ;
3369 @@ -97,18 +129,14 @@
3370 BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3371 ULONG aNbProperties, nsStringArray& aValues) ;
3372 // Get the value of a MAPI property of type SYSTIME
3373 - BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3374 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3375 WORD& aYear, WORD& aMonth, WORD& aDay) ;
3376 - // Get the value of a MAPI property of type LONG
3377 - BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3378 // Get the value of a MAPI property of type BIN
3379 BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
3380 // Tests if a container contains an entry
3381 BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3382 - // Delete an entry in the address book
3383 - BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3384 // Set the value of a MAPI property of type string in unicode
3385 - BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3386 + virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3387 const PRUnichar *aValue) ;
3388 // Same as previous, but with a bunch of properties in one call
3389 BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3390 @@ -117,32 +145,44 @@
3391 BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3392 WORD aYear, WORD aMonth, WORD aDay) ;
3393 // Create entry in the address book
3394 - BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3395 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3396 + // Delete an entry in the address book
3397 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3398 // Create a distribution list in the address book
3399 - BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3400 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3401 // Copy an existing entry in the address book
3402 - BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3403 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3404 // Get a default address book container
3405 - BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
3406 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
3407 // Is the helper correctly initialised?
3408 - BOOL IsOK(void) const { return mAddressBook != NULL ; }
3409 + virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
3411 + // Get the value of a MAPI property of type LONG
3412 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3415 HRESULT mLastError ;
3416 - LPADRBOOK mAddressBook ;
3417 static PRUint32 mEntryCounter ;
3418 static PRLock *mMutex ;
3420 + virtual HRESULT OpenEntry(ULONG cbEntryID,
3421 + LPENTRYID lpEntryID,
3422 + LPCIID lpInterface,
3424 + ULONG FAR * lpulObjType,
3425 + LPUNKNOWN FAR * lppUnk
3428 // Retrieve the contents of a container, with an optional restriction
3429 - BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3430 - nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
3431 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3432 + nsMapiEntryArray *aList, ULONG aMapiType) =0;
3433 // Retrieve the values of a set of properties on a MAPI object
3434 - BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3435 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3436 ULONG aNbProperties,
3437 - LPSPropValue& aValues, ULONG& aValueCount) ;
3438 + LPSPropValue& aValues, ULONG& aValueCount) =0;
3439 // Set the values of a set of properties on a MAPI object
3440 - BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3441 - const LPSPropValue& aValues) ;
3442 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3443 + LPSPropValue& aValues) =0;
3444 // Clean-up a rowset returned by QueryRows
3445 void MyFreeProws(LPSRowSet aSet) ;
3446 // Allocation of a buffer for transmission to interfaces
3447 @@ -150,7 +190,16 @@
3448 // Destruction of a buffer provided by the interfaces
3449 virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
3451 + static void CStrToUnicode( const char *pStr, nsString& result);
3452 + static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
3455 + static int m_clients;
3456 + static PRUnichar * m_pUniBuff;
3457 + static int m_uniBuffLen;
3458 + static char * m_pCStrBuff;
3459 + static int m_cstrBuffLen;
3466 nsAbWinHelper *operator ->(void) { return mHelper ; }
3468 + static void FreeWinAbLibrarys();
3470 nsAbWinHelper *mHelper ;
3472 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100
3473 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200
3476 static const char kMailListAddressFormat[] = "Address%d";
3478 +extern int getMD5sum(const char * fileName,char * sum);
3479 +extern int testMD5sum(const char * fileName,char * sum);
3481 static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
3483 nsAddrDatabase::nsAddrDatabase()
3486 m_dbDirectory(nsnull)
3488 + memset(m_dbMd5Sum,0,33);
3491 nsAddrDatabase::~nsAddrDatabase()
3492 @@ -790,7 +794,11 @@
3494 ret = NS_ERROR_FILE_ACCESS_DENIED;
3498 + ret = getMD5sum(nativeFileName,m_dbMd5Sum);
3500 + ret = NS_ERROR_FAILURE;
3502 nsCRT::free(nativeFileName);
3504 if (NS_SUCCEEDED(ret) && thumb)
3505 @@ -883,6 +891,17 @@
3507 nsresult err = NS_OK;
3508 nsIMdbThumb *commitThumb = nsnull;
3510 + const char *pFilename = m_dbName.GetCString(); /* do not free */
3511 + char *nativeFileName = nsCRT::strdup(pFilename);
3512 +#if defined(XP_PC) || defined(XP_MAC)
3513 + UnixToNative(nativeFileName);
3515 + if (testMD5sum(nativeFileName,m_dbMd5Sum))
3517 + nsCRT::free(nativeFileName);
3518 + return NS_ERROR_FILE_ACCESS_DENIED;
3521 if (commitType == nsAddrDBCommitType::kLargeCommit ||
3522 commitType == nsAddrDBCommitType::kSessionCommit)
3523 @@ -936,6 +955,10 @@
3524 // ### do something with error, but clear it now because mork errors out on commits.
3526 m_mdbEnv->ClearErrors();
3527 + if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
3528 + err = NS_ERROR_FAILURE;
3529 + nsCRT::free(nativeFileName);
3534 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100
3535 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200
3537 nsIMdbTable *m_mdbPabTable;
3538 nsIMdbTable *m_mdbDeletedCardsTable;
3539 nsFileSpec m_dbName;
3540 + char m_dbMd5Sum[33];
3541 PRBool m_mdbTokensInitialized;
3542 nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
3544 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
3545 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
3550 +static char * stristr(const char *big, const char *little)
3554 + if (!big || !little || !*big || !*little)
3556 + len = strlen(little);
3558 + for( ; *big; big++ )
3559 + if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
3560 + return (char *)big;
3567 static PRLogModuleInfo* gMapiAddressBookLog
3568 = PR_NewLogModule("nsMapiAddressBookLog");
3571 #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
3573 +#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
3574 +#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
3575 +#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
3576 +#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
3577 +#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
3578 +#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
3579 +#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
3581 +static const TagMap TagMaps[]={
3582 + {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
3583 + {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
3584 + {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
3585 + {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
3588 + ieidPR_ENTRYID = 0,
3589 + ieidPR_OBJECT_TYPE,
3590 + ieidPR_DISPLAY_NAME,
3591 + ieidPR_MESSAGE_CLASS,
3592 + ieidPR_STORE_ENTRYID,
3593 + ieidPR_MESSAGE_RECIPIENTS,
3597 +static const SizedSPropTagArray(ieidMax, ptaEid)=
3606 + PR_MESSAGE_RECIPIENTS
3612 + ContentsColumnEntryId = 0,
3613 + ContentsColumnObjectType,
3614 + ContentsColumnMessageClass,
3615 + ContentsColumnsSize
3618 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3620 + ContentsColumnsSize,
3628 HMODULE nsMapiAddressBook::mLibrary = NULL ;
3629 PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
3631 BOOL nsMapiAddressBook::mInitialized = FALSE ;
3632 BOOL nsMapiAddressBook::mLogonDone = FALSE ;
3633 LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
3634 -LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
3635 +#define MAPI_NO_COINIT 8
3637 BOOL nsMapiAddressBook::LoadMapiLibrary(void)
3640 mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
3641 GetProcAddress(mLibrary, "MAPILogonEx")) ;
3642 if (!mMAPILogonEx) { return FALSE ; }
3643 - MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
3644 + MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
3645 HRESULT retCode = mMAPIInitialize(&mapiInit) ;
3647 if (HR_FAILED(retCode)) {
3648 @@ -105,22 +175,19 @@
3651 if (HR_FAILED(retCode)) {
3652 - PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
3653 + PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
3657 - retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
3658 - if (HR_FAILED(retCode)) {
3659 - PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
3662 return HR_SUCCEEDED(retCode) ;
3665 void nsMapiAddressBook::FreeMapiLibrary(void)
3668 - if (-- mLibUsage == 0) {
3669 + if (--mLibUsage < 0) {
3671 - if (mRootBook) { mRootBook->Release() ; }
3674 mRootSession->Logoff(NULL, 0, 0) ;
3678 FreeLibrary(mLibrary) ;
3679 + mRootSession = NULL;
3686 BOOL result = Initialize() ;
3688 NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
3689 MOZ_COUNT_CTOR(nsMapiAddressBook) ;
3691 @@ -153,22 +220,882 @@
3692 nsMapiAddressBook::~nsMapiAddressBook(void)
3694 nsAutoLock guard(mMutex) ;
3698 MOZ_COUNT_DTOR(nsMapiAddressBook) ;
3701 +LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
3706 + int sz = CbNewSPropTagArray( 1);
3707 + SPropTagArray *pTag = (SPropTagArray *) new char[sz];
3708 + pTag->cValues = 1;
3709 + pTag->aulPropTag[0] = tag;
3710 + LPSPropValue lpProp = NULL;
3711 + ULONG cValues = 0;
3712 + HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
3714 + if (HR_FAILED( hr) || (cValues != 1)) {
3716 + mMAPIFreeBuffer( lpProp);
3720 + if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
3721 + if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
3722 + mMAPIFreeBuffer( lpProp);
3730 +BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
3735 + BOOL bResult = TRUE;
3736 + switch (PROP_TYPE(pVal->ulPropTag))
3739 + cbEntryId = pVal->Value.bin.cb;
3740 + mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
3741 + memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
3745 + PRINTF(( "EntryId not in BINARY prop value\n"));
3750 + if (pVal && delVal)
3751 + mMAPIFreeBuffer( pVal);
3756 +BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3762 + if (oType == MAPI_MESSAGE)
3764 + if (oType == MAPI_STORE)
3766 + hr=mRootSession->OpenEntry(
3772 + (IUnknown**)&lpMsgStore);
3775 + //Add MDB to a list to make it can be released when class destroyed.
3776 + //We must leave it openned or else we can't open address store in it.
3777 + AddToMDBArray(lpMsgStore);
3779 + LPSPropValue pVal;
3780 + pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
3786 + nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
3788 + if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
3789 + // Open up the folder!
3790 + BOOL bResult = TRUE;
3791 + bResult = lpMsgStore->OpenEntry(
3798 + mMAPIFreeBuffer( pEntry);
3799 + if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
3800 + // Iterate the subtree with the results going into the folder list
3801 + bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
3804 + PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
3808 + PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
3812 + PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
3817 + PRINTF(("Type:%d\n",oType));
3823 +BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
3825 + // flags can be CONVENIENT_DEPTH or 0
3826 + // CONVENIENT_DEPTH will return all depths I believe instead
3827 + // of just children
3829 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3830 + hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
3831 + if (HR_FAILED(hr)) {
3832 + PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
3837 + hr = lpTable->GetRowCount( 0, &rowCount);
3842 + hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3843 + if (HR_FAILED(hr)) {
3844 + PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
3848 + hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3849 + if (HR_FAILED(hr)) {
3850 + PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
3856 + BOOL keepGoing = TRUE;
3857 + BOOL bResult = TRUE;
3861 + hr = lpTable->QueryRows( 1, 0, &lpRow);
3863 + if (HR_FAILED(hr))
3865 + PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
3871 + cNumRows = lpRow->cRows;
3874 + LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3875 + ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3876 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3878 + keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
3881 + MyFreeProws(lpRow);
3884 + } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
3887 + if (bResult && !keepGoing)
3892 +BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3895 + if (oType == MAPI_FOLDER)
3897 + nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
3898 + if (!mRootSession->OpenEntry(
3906 + LPSPropValue pVal;
3909 + pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
3912 + if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
3914 + SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
3916 + aFolders.AddItem(currentValue->Value.bin.cb,
3917 + NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
3925 + PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
3932 +BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
3934 + aFolders.CleanUp() ;
3935 + nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
3936 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
3937 + ULONG objType = 0 ;
3938 + ULONG rowCount = 0 ;
3940 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3942 + mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
3943 + if (HR_FAILED(mLastError)) {
3944 + PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
3945 + return mLastError;
3948 + mLastError = lpTable->GetRowCount( 0, &rowCount);
3950 + mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3951 + if (FAILED(mLastError))
3952 + return( mLastError);
3953 + mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3954 + if (FAILED(mLastError))
3955 + return mLastError;
3959 + BOOL keepGoing = TRUE;
3960 + BOOL bResult = TRUE;
3964 + mLastError = lpTable->QueryRows( 1, 0, &lpRow);
3966 + if (HR_FAILED(mLastError)){
3972 + cNumRows = lpRow->cRows;
3975 + LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3976 + ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3977 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3980 + keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
3982 + MyFreeProws( lpRow);
3985 + } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
3988 + return HR_SUCCEEDED(mLastError) ;
3990 +BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
3992 + ULONG conditionType = 0 ;
3994 + if (!aRestriction)
3996 + for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
3998 + conditionType = aRestriction[ulResIndex].rt;
3999 + switch (conditionType)
4002 + aRestriction[ulResIndex].res.resExist.ulPropTag =
4003 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
4005 + case RES_BITMASK :
4006 + aRestriction[ulResIndex].res.resBitMask.ulPropTag =
4007 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
4009 + case RES_CONTENT :
4010 + aRestriction[ulResIndex].res.resContent.ulPropTag =
4011 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
4012 + aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
4013 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
4015 + case RES_PROPERTY :
4016 + aRestriction[ulResIndex].res.resProperty.ulPropTag =
4017 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
4018 + aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
4019 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
4022 + aRestriction[ulResIndex].res.resSize.ulPropTag =
4023 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
4025 + case RES_COMPAREPROPS :
4026 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
4027 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
4028 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
4029 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
4032 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
4035 + CorrectRestriction(aMapiProp,
4036 + aRestriction[ulResIndex].res.resAnd.cRes,
4037 + aRestriction[ulResIndex].res.resAnd.lpRes);
4040 + CorrectRestriction(aMapiProp,
4041 + aRestriction[ulResIndex].res.resOr.cRes,
4042 + aRestriction[ulResIndex].res.resOr.lpRes);
4045 + case RES_COMMENT :
4046 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
4047 + aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
4048 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
4050 + case RES_SUBRESTRICTION :
4051 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
4059 +BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
4061 + if (!aRestriction)
4064 + ULONG conditionType = 0 ;
4066 + nsMapiEntryArray listOut;
4067 + ULONG listindex=0;
4069 + nsMapiEntryArray listDel;
4073 + ULONG resCount = 0;
4074 + ULONG resIndex = 0;
4076 + listsize = aList->GetSize();
4077 + conditionType = aRestriction->rt;
4078 + switch (conditionType)
4081 + case RES_BITMASK :
4082 + case RES_CONTENT :
4083 + case RES_PROPERTY :
4085 + case RES_COMPAREPROPS :
4086 + case RES_COMMENT :
4087 + case RES_SUBRESTRICTION :
4089 + while(listindex < aList->GetSize())
4091 + if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
4092 + aList->Remove(listindex);
4099 + aRestriction->res.resNot.ulReserved = 1;
4103 + if (conditionType == RES_OR)
4105 + for(listindex=0;listindex<aList->GetSize();listindex++)
4107 + listDel.AddItem(aList->ElementAt(listindex));
4111 + resCount = aRestriction->res.resAnd.cRes;
4112 + //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
4113 + //use the same struct
4114 + for (resIndex = 0;resIndex < resCount;resIndex++)
4116 + //can't call listOut.CleanUp() here
4117 + //because it will destroy all Element too
4118 + while(listOut.GetSize())
4120 + listOut.Remove(0);
4123 + for(listindex=0;listindex<aList->GetSize();listindex++)
4125 + listOut.AddItem(aList->ElementAt(listindex));
4128 + Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
4129 + if (conditionType == RES_NOT)
4131 + for(listindex=0;listindex<listOut.GetSize();listindex++)
4133 + aList->Remove(listOut.ElementAt(listindex));
4136 + else if (conditionType == RES_AND )
4138 + for(listindex=0;listindex<listOut.GetSize();listindex++)
4140 + if (!aList->IndexOf(listOut.ElementAt(listindex)))
4142 + aList->Remove(listOut.ElementAt(listindex));
4146 + else if (conditionType == RES_OR )
4148 + for(listindex=0;listindex<listOut.GetSize();listindex++)
4150 + listDel.Remove(listOut.ElementAt(listindex));
4152 + if (listDel.GetSize() == 0)
4158 + if (conditionType == RES_OR)
4160 + for(listindex=0;listindex<listDel.GetSize();listindex++)
4162 + aList->Remove(listDel.ElementAt(listindex));
4168 + while(listDel.GetSize())
4170 + listDel.Remove(0);
4172 + while(listOut.GetSize())
4174 + listOut.Remove(0);
4181 +BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
4183 + LPMAPIPROP object ;
4184 + ULONG objType = 0 ;
4185 + LPSPropValue realValue = NULL ;
4186 + LPSPropValue resValue = NULL ;
4187 + ULONG valueCount = 0 ;
4189 + mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
4190 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4191 + (IUnknown **)&object) ;
4193 + if (HR_FAILED(mLastError)) {
4194 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4198 + ULONG conditionType = 0 ;
4199 + conditionType = aRestriction->rt;
4201 + switch (conditionType)
4204 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
4208 + case RES_CONTENT :
4209 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
4211 + resValue = aRestriction->res.resContent.lpProp;
4213 + case RES_PROPERTY :
4214 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
4216 + resValue = aRestriction->res.resProperty.lpProp;
4218 + case RES_BITMASK :
4219 + return FALSE; //not support
4222 + return FALSE;//not been used now
4224 + case RES_COMPAREPROPS :
4225 + return FALSE;//not been used now
4228 + return FALSE;//not need care here
4231 + return FALSE;//not need care here
4234 + return FALSE;//not need care here
4236 + case RES_COMMENT :
4237 + return TRUE;//comment
4239 + case RES_SUBRESTRICTION :
4240 + return FALSE;//not been used now
4243 + return AtomyFilter(aRestriction,realValue,resValue);
4247 +BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
4249 + ULONG conditionType = 0 ;
4250 + conditionType = aRestriction->rt;
4252 + BOOL bTagEq=(aRealValue &&
4253 + PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
4255 + // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
4256 + switch (conditionType)
4259 + return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
4261 + case RES_CONTENT :
4264 + switch(aRestriction->res.resContent.ulFuzzyLevel)
4266 + case FL_FULLSTRING :
4267 + return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
4270 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
4272 + case FL_SUBSTRING :
4274 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4280 + case RES_PROPERTY :
4283 + switch(aRestriction->res.resProperty.relop)
4286 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
4289 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
4292 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
4295 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
4298 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
4301 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
4305 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4312 + case RES_BITMASK :
4313 + return FALSE; //not support
4316 + return FALSE;//not been used now
4318 + case RES_COMPAREPROPS :
4319 + return FALSE;//not been used now
4322 + return FALSE;//not need care here
4325 + return FALSE;//not need care here
4328 + return FALSE;//not need care here
4330 + case RES_COMMENT :
4331 + return TRUE;//comment
4333 + case RES_SUBRESTRICTION :
4334 + return FALSE;//not been used now
4340 +BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
4341 + nsMapiEntryArray *aList, ULONG aMapiType)
4346 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
4347 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
4348 + ULONG objType = 0 ;
4349 + ULONG rowCount = 0 ;
4352 + nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
4354 + aParent.ToString(cs);
4356 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4357 + 0, MAPI_BEST_ACCESS, &objType, pFolder);
4358 + if (HR_FAILED(mLastError))
4360 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4365 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
4366 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4369 + LPSPropValue aValue = NULL ;
4370 + ULONG aValueCount = 0 ;
4372 + LPSPropTagArray properties = NULL ;
4373 + mMAPIAllocateBuffer(CbNewSPropTagArray(1),
4374 + (void **)&properties);
4375 + properties->cValues = 1;
4376 + properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
4377 + hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
4379 + SBinaryArray *sa=&aValue->Value.MVbin;
4385 + nsMapiEntry testEntry;
4387 + for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
4389 + lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
4390 + cbEID = sa->lpbin[idx].cb;
4391 + testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
4393 + if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
4395 + aList->AddItem(cbEID,lpEID);
4398 + Filter(aRestriction,aList);
4402 + if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
4404 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4405 + &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
4407 + if (HR_FAILED(mLastError)) {
4408 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
4412 + mLastError = parent->GetContentsTable(0, contents) ;
4413 + if (HR_FAILED(mLastError)) {
4414 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
4417 + if (aRestriction) {
4418 + mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
4419 + if (HR_FAILED(mLastError)) {
4420 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
4424 + mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
4425 + if (HR_FAILED(mLastError)) {
4426 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
4429 + mLastError = contents->GetRowCount(0, &rowCount) ;
4430 + if (HR_FAILED(mLastError)) {
4431 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
4435 + LPSRowSet rowSet = NULL ;
4438 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
4439 + if (HR_FAILED(mLastError)) {
4440 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
4443 + rowCount = rowSet->cRows ;
4444 + if (rowCount > 0 && aList)
4446 + if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
4448 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4449 + aList->AddItem(currentValue.Value.bin.cb,
4450 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4452 + else if (aMapiType == MAPI_DISTLIST)
4454 + if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
4456 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4457 + aList->AddItem(currentValue.Value.bin.cb,
4458 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4464 + MyFreeProws(rowSet) ;
4465 + } while (rowCount > 0) ;
4472 +BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
4473 + ULONG aNbProperties, LPSPropValue& aValue,
4474 + ULONG& aValueCount)
4476 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4477 + ULONG objType = 0 ;
4478 + LPSPropTagArray properties = NULL ;
4481 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
4482 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4485 + if (HR_FAILED(mLastError)) {
4486 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4489 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
4490 + NS_REINTERPRET_CAST(void **, &properties));
4491 + properties->cValues = aNbProperties ;
4492 + for (i = 0 ; i < aNbProperties ; ++ i)
4494 + properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
4496 + mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
4497 + FreeBuffer(properties) ;
4499 + if (HR_FAILED(mLastError)) {
4500 + PRINTF(("Error get props %08x.\n", mLastError)) ;
4502 + return HR_SUCCEEDED(mLastError);
4505 +BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
4506 + LPSPropValue& aValues)
4508 + nsMapiInterfaceWrapper<LPMESSAGE> object;
4509 + ULONG objType = 0 ;
4510 + LPSPropProblemArray problems = NULL ;
4513 + LPMDB lpMsgStore=GetMsgStore(aObject);
4519 + mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
4520 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
4522 + lpMsgStore->Release();
4524 + if (HR_FAILED(mLastError)) {
4525 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4528 + for (i = 0 ; i < aNbProperties ; ++ i)
4530 + aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
4532 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
4533 + if (HR_FAILED(mLastError)) {
4534 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
4538 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
4539 + PRINTF(("Problem %d: index %d code %08x.\n", i,
4540 + problems->aProblem [i].ulIndex,
4541 + problems->aProblem [i].scode)) ;
4544 + mLastError = object->SaveChanges(0) ;
4545 + if (MAPI_E_OBJECT_CHANGED == mLastError)
4547 + mLastError = object->SaveChanges(FORCE_SAVE ) ;
4549 + return HR_SUCCEEDED(mLastError) ;
4552 +BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
4557 +BOOL nsMapiAddressBook::IsOK(void)
4559 + return mRootSession && mLibUsage;
4562 BOOL nsMapiAddressBook::Initialize(void)
4564 - if (mAddressBook) { return TRUE ; }
4566 nsAutoLock guard(mMutex) ;
4568 if (!LoadMapiLibrary()) {
4569 PRINTF(("Cannot load library.\n")) ;
4572 - mAddressBook = mRootBook ;
4577 void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
4578 @@ -181,7 +1108,803 @@
4579 mMAPIFreeBuffer(aBuffer) ;
4582 +ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
4584 + static GUID emailGUID =
4586 + 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
4590 + MAPINAMEID mapiNameID;
4591 + mapiNameID.lpguid = &emailGUID;
4592 + mapiNameID.ulKind = MNID_ID;
4593 + mapiNameID.Kind.lID = nameID;
4595 + LPMAPINAMEID lpMapiNames = &mapiNameID;
4596 + LPSPropTagArray lpMailTagArray = NULL;
4598 + HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
4599 + if (result == S_OK)
4601 + ULONG lTag = lpMailTagArray->aulPropTag[0];
4602 + mMAPIFreeBuffer(lpMailTagArray);
4607 +ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
4609 + LPSPropValue addr;
4610 + ULONG upRealTag=aPropertyTag;
4611 + ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
4613 + for(int i=0; i<lSize; i++)
4615 + if (TagMaps[i].AddressTag == aPropertyTag)
4618 + ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
4621 + if (PR_DISPLAY_NAME_A == aPropertyTag)
4623 + //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
4624 + LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
4625 + if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
4627 + if (kPriEmailColumn)
4628 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4632 + FreeBuffer(msgClass);
4633 + upRealTag = aPropertyTag;
4636 + else //PR_DISPLAY_NAME_A == aPropertyTag
4638 + addr=GetMapiProperty(lpProp,aPropertyTag);
4639 + if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
4640 + addr->Value.l == MAPI_E_NOT_FOUND)
4642 + if (kPriEmailColumn)
4643 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4649 + if (kPriEmailColumn)
4650 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4653 + break; //we find it,exit
4660 +BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
4661 + ULONG aPropertyTag,
4665 + LPSPropValue values = NULL ;
4666 + ULONG valueCount = 0 ;
4668 + if (PR_OBJECT_TYPE == aPropertyTag)
4670 + nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
4672 + mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
4673 + NULL,MAPI_BEST_ACCESS,&objType, pFolder);
4674 + if (HR_FAILED(mLastError))
4676 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4679 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
4680 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4682 + FreeBuffer(msgClass);
4683 + aValue = MAPI_DISTLIST;
4688 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4691 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
4692 + aValue = values->Value.ul ;
4694 + FreeBuffer(values) ;
4698 +BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
4699 + WORD& aYear, WORD& aMonth, WORD& aDay)
4704 + LPSPropValue values = NULL ;
4705 + ULONG valueCount = 0 ;
4707 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4710 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
4711 + SYSTEMTIME readableTime ;
4712 + FILETIME localTime ;
4713 + FileTimeToLocalFileTime(&values->Value.ft,&localTime);
4714 + if (FileTimeToSystemTime(&localTime, &readableTime)) {
4715 + aYear = readableTime.wYear ;
4716 + aMonth = readableTime.wMonth ;
4717 + aDay = readableTime.wDay ;
4720 + FreeBuffer(values) ;
4724 +HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
4725 + LPENTRYID lpEntryID,
4726 + LPCIID lpInterface,
4728 + ULONG FAR * lpulObjType,
4729 + LPUNKNOWN FAR * lppUnk
4737 + rv=mRootSession->OpenEntry(cbEntryID,
4749 + if (HR_FAILED(rv) && !m_MDBArray.Count())
4751 + //There are no openned Message store,so we have to open them all
4752 + nsMapiEntryArray aFolders;
4753 + if (GetFolders(aFolders))
4757 + rv=mRootSession->OpenEntry(cbEntryID,
4774 +BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4776 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4777 + ULONG objType = 0 ;
4779 + nsMapiEntry parentEntry;
4780 + if (!GetEntryParent(aDistlist,parentEntry))
4783 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4787 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4788 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4790 + lpMsgStore->Release();
4792 + if (HR_FAILED(mLastError))
4797 + When add mail address to distlist,Mapi need update 2 tag.
4799 + //update OUTLOOK_EMAIL_LIST1
4800 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4801 + SBinaryArray oldChilds;
4802 + LPSBinary bins=NULL;
4803 + SBinaryArray newChilds;
4804 + LPSPropValue oldChildValue = NULL ;
4805 + ULONG valueCount = 0 ;
4807 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4809 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4813 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4815 + oldChilds = oldChildValue->Value.MVbin;
4816 + newChilds.cValues=oldChilds.cValues + 1;
4817 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4818 + newChilds.lpbin = bins;
4819 + for (ULONG i=0;i<oldChilds.cValues;i++)
4821 + newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
4822 + newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
4827 + newChilds.cValues = 1;
4828 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4829 + newChilds.lpbin = bins;
4832 + nsMapiEntry orgEntryID;
4833 + if (!GetPropertyBin(aNewEntry,
4834 + GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
4839 + newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4840 + newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
4842 + SPropValue childs;
4843 + childs.ulPropTag = listTag;
4844 + childs.Value.MVbin = newChilds;
4846 + LPSPropProblemArray problems = NULL ;
4847 + mLastError = container->SetProps(1, &childs, &problems) ;
4848 + if (HR_FAILED(mLastError)) {
4849 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4853 + //update OUTLOOK_EMAIL_LIST2
4854 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
4855 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4857 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4861 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4863 + oldChilds = oldChildValue->Value.MVbin;
4864 + newChilds.cValues=oldChilds.cValues + 1;
4865 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4866 + newChilds.lpbin = bins;
4867 + for (ULONG i=0;i<oldChilds.cValues;i++)
4869 + newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
4870 + newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
4875 + newChilds.cValues = 1;
4876 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4877 + newChilds.lpbin = bins;
4881 + Need more work here.
4882 + There are two kind of mail address in outlook DistList.
4883 + One is sample,not include in parent folder.
4884 + The other is a link to a unattached address in parents folders.
4885 + Currently we can only add first kind of address to a outlook distlist.
4888 + newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4889 + newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
4891 + childs.ulPropTag = listTag;
4892 + childs.Value.MVbin = newChilds;
4894 + mLastError = container->SetProps(1, &childs, &problems) ;
4895 + if (HR_FAILED(mLastError))
4897 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4901 + mMAPIFreeBuffer(bins);
4903 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
4904 + if (HR_FAILED(mLastError)) {
4905 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4911 +BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4913 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4914 + ULONG objType = 0 ;
4916 + nsMapiEntry parentEntry;
4917 + if (!GetEntryParent(aDistlist,parentEntry))
4920 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4924 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4925 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4927 + lpMsgStore->Release();
4929 + if (HR_FAILED(mLastError))
4932 + When delete mail address from distlist,Mapi need update 2 tag.
4934 + //update OUTLOOK_EMAIL_LIST1
4935 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4937 + SBinaryArray oldChilds;
4938 + LPSBinary bins=NULL;
4939 + SBinaryArray newChilds;
4940 + LPSPropValue oldChildValue = NULL ;
4941 + ULONG valueCount = 0 ;
4943 + newChilds.lpbin=NULL;
4945 + ULONG lDeleteEntry=0;
4948 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4950 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4954 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4956 + oldChilds = oldChildValue->Value.MVbin;
4957 + newChilds.cValues=oldChilds.cValues - 1;
4958 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4959 + newChilds.lpbin = bins;
4960 + for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
4962 + if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
4963 + !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
4964 + (void*)(aNewEntry.mEntryId->ab),
4965 + oldChilds.lpbin[oldIndex].cb-4))
4967 + lDeleteEntry=oldIndex;
4971 + newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
4972 + newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
4981 + SPropValue childs;
4982 + LPSPropProblemArray problems = NULL ;
4984 + if (newChilds.cValues == 0)
4986 + SPropTagArray delTags;
4987 + delTags.cValues = 1;
4988 + delTags.aulPropTag[0] = listTag;
4990 + mLastError = container->DeleteProps(&delTags, &problems) ;
4994 + childs.ulPropTag = listTag;
4995 + childs.Value.MVbin = newChilds;
4996 + mLastError = container->SetProps(1, &childs, &problems) ;
4999 + if (HR_FAILED(mLastError)) {
5000 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5004 + //update OUTLOOK_EMAIL_LIST2
5005 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
5006 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
5008 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
5013 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
5015 + oldChilds = oldChildValue->Value.MVbin;
5016 + newChilds.cValues=oldChilds.cValues - 1;
5017 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5018 + newChilds.lpbin = bins;
5019 + for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
5021 + if (oldIndex != lDeleteEntry)
5023 + newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
5024 + newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
5031 + newChilds.cValues = 1;
5032 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
5033 + newChilds.lpbin = bins;
5038 + if (newChilds.cValues == 0)
5040 + SPropTagArray delTags;
5041 + delTags.cValues = 1;
5042 + delTags.aulPropTag[0] = listTag;
5044 + mLastError = container->DeleteProps(&delTags, &problems) ;
5048 + childs.ulPropTag = listTag;
5049 + childs.Value.MVbin = newChilds;
5050 + mLastError = container->SetProps(1, &childs, &problems) ;
5052 + if (HR_FAILED(mLastError)) {
5053 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
5057 + mMAPIFreeBuffer(bins);
5059 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
5060 + if (HR_FAILED(mLastError)) {
5061 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5068 +BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
5070 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5071 + ULONG objType = 0 ;
5072 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5073 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5074 + (IUnknown **)&object) ;
5076 + if (HR_FAILED(mLastError)) {
5077 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5080 + SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
5082 + if (parentID->Value.l == MAPI_E_NOT_FOUND)
5084 + aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
5087 +BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
5089 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
5090 + ULONG objType = 0 ;
5092 + nsMapiEntry parentEntry;
5093 + if (!GetEntryParent(aDistlist,parentEntry))
5097 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5098 + if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
5101 + return AddEntryToList(aDistlist,aNewEntry);
5104 +BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
5106 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5107 + ULONG objType = 0 ;
5109 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5110 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5111 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5114 + if (HR_FAILED(mLastError)) {
5115 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5118 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5120 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5121 + return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
5123 + LPMDB lpMsgStore=GetMsgStore(aParent);
5128 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
5129 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5131 + lpMsgStore->Release();
5133 + if (HR_FAILED(mLastError))
5136 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5138 + mLastError = container->CreateMessage(&IID_IMessage,
5141 + if (HR_FAILED(mLastError)) {
5142 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5145 + SPropValue messageclass ;
5146 + LPSPropProblemArray problems = NULL ;
5147 + nsCString tempName ;
5149 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5150 + tempName.Assign("IPM.Contact") ;
5151 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5152 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5153 + if (HR_FAILED(mLastError)) {
5154 + PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
5157 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5158 + if (HR_FAILED(mLastError)) {
5159 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5163 + SPropTagArray property ;
5164 + LPSPropValue value = NULL ;
5165 + ULONG valueCount = 0 ;
5167 + property.cValues = 1 ;
5168 + property.aulPropTag [0] = PR_ENTRYID ;
5169 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5170 + if (HR_FAILED(mLastError) || valueCount != 1) {
5171 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5174 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5175 + FreeBuffer(value) ;
5179 +BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
5181 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5182 + ULONG objType = 0 ;
5184 + LPMDB lpMsgStore=GetMsgStore(aParent);
5187 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
5188 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5190 + lpMsgStore->Release();
5192 + if (HR_FAILED(mLastError)) {
5193 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5197 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5198 + mLastError = container->CreateMessage(&IID_IMAPIProp,
5201 + if (HR_FAILED(mLastError)) {
5202 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5205 + SPropValue messageclass ;
5206 + LPSPropProblemArray problems = NULL ;
5207 + nsCString tempName ;
5209 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5210 + tempName.Assign("IPM.DistList") ;
5211 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5212 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5213 + if (HR_FAILED(mLastError)) {
5214 + PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
5217 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5218 + if (HR_FAILED(mLastError)) {
5219 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5223 + ULONG valueCount = 0 ;
5224 + SPropTagArray property ;
5225 + LPSPropValue value = NULL ;
5227 + property.cValues = 1 ;
5228 + property.aulPropTag [0] = PR_ENTRYID ;
5229 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5230 + if (HR_FAILED(mLastError) || valueCount != 1) {
5231 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5234 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5236 + FreeBuffer(value) ;
5241 +BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
5242 + nsMapiEntry& aTarget)
5244 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5245 + nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
5246 + ULONG objType = 0 ;
5247 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5248 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5249 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5252 + if (HR_FAILED(mLastError)) {
5253 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5256 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5258 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5260 + //Add Entry To DistList
5261 + if (!AddEntryToList(aContainer,aSource))
5263 + aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
5268 + SBinaryArray entryArray ;
5270 + entry.cb = aSource.mByteCount ;
5271 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
5272 + entryArray.cValues = 1 ;
5273 + entryArray.lpbin = &entry ;
5275 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5276 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5278 + if (HR_FAILED(mLastError)) {
5279 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5283 + mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
5284 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5286 + if (HR_FAILED(mLastError)) {
5287 + PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
5291 + nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
5293 + mLastError = container->CopyMessages(&entryArray,
5295 + (void*)&targetFolder,
5299 + if (HR_FAILED(mLastError)) {
5300 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5306 +BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
5308 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5309 + ULONG objType = 0 ;
5311 + SBinaryArray entryArray ;
5314 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5315 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5316 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5319 + if (HR_FAILED(mLastError)) {
5320 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5323 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5325 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5326 + return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
5328 + LPMDB lpMsgStore=GetMsgStore(aContainer);
5332 + mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5333 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5335 + lpMsgStore->Release();
5336 + if (HR_FAILED(mLastError)) {
5337 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5340 + entry.cb = aEntry.mByteCount ;
5341 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
5342 + entryArray.cValues = 1 ;
5343 + entryArray.lpbin = &entry ;
5344 + mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
5345 + if (HR_FAILED(mLastError)) {
5346 + PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
5352 +//Use to open message store in write mode
5353 +LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
5355 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5358 + mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
5359 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
5361 + if (HR_FAILED(mLastError)) {
5362 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5365 + SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
5367 + LPMDB lpMsgStore=NULL;
5368 + mLastError=mRootSession->OpenMsgStore(0,
5369 + svMsgSore->Value.bin.cb,
5370 + (ENTRYID*)svMsgSore->Value.bin.lpb,
5372 + MAPI_BEST_ACCESS ,
5375 + if (HR_FAILED(mLastError)) {
5376 + PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
5380 + return lpMsgStore;
5382 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5383 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5386 #include "nsAbWinHelper.h"
5394 class nsMapiAddressBook : public nsAbWinHelper
5397 nsMapiAddressBook(void) ;
5398 virtual ~nsMapiAddressBook(void) ;
5400 + // Get the top address books
5401 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5403 + // Get a default address book container
5404 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5405 + // Is the helper correctly initialised?
5406 + virtual BOOL IsOK(void);
5407 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
5408 + ULONG aPropertyTag,
5410 + // Get the value of a MAPI property of type SYSTIME
5411 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
5412 + WORD& aYear, WORD& aMonth, WORD& aDay);
5413 + // Create entry in the address book
5414 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5415 + // Delete an entry in the address book
5416 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
5417 + // Create a distribution list in the address book
5418 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5419 + // Copy an existing entry in the address book
5420 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
5422 + static void FreeMapiLibrary(void) ;
5425 // Class members to handle the library/entry points
5426 static HMODULE mLibrary ;
5428 static BOOL mInitialized ;
5429 static BOOL mLogonDone ;
5430 static LPMAPISESSION mRootSession ;
5431 - static LPADRBOOK mRootBook ;
5434 // Load the MAPI environment
5435 BOOL Initialize(void) ;
5437 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5438 + LPENTRYID lpEntryID,
5439 + LPCIID lpInterface,
5441 + ULONG FAR * lpulObjType,
5442 + LPUNKNOWN FAR * lppUnk
5446 + // Retrieve the contents of a container, with an optional restriction
5447 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5448 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5449 + // Retrieve the values of a set of properties on a MAPI object
5450 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5451 + ULONG aNbProperties,
5452 + LPSPropValue& aValues, ULONG& aValueCount) ;
5453 + // Set the values of a set of properties on a MAPI object
5454 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5455 + LPSPropValue& aValues);
5458 // Allocation of a buffer for transmission to interfaces
5459 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5460 // Destruction of a buffer provided by the interfaces
5461 virtual void FreeBuffer(LPVOID aBuffer) ;
5462 // Library management
5463 static BOOL LoadMapiLibrary(void) ;
5464 - static void FreeMapiLibrary(void) ;
5466 + BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5467 + LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
5468 + BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
5469 + BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5470 + BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
5471 + ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
5472 + ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
5473 + LPMDB GetMsgStore(const nsMapiEntry& aEntry);
5474 + BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
5475 + BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
5476 + BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
5477 + BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
5478 + BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
5481 + BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
5482 + BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
5483 + BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
5485 + void AddToMDBArray(LPMDB aMDB)
5487 + m_MDBArray.AppendElement(aMDB);
5492 + for (int i = 0; i < m_MDBArray.Count(); i++)
5494 + mdb = (LPMDB)m_MDBArray.ElementAt(i);
5497 + m_MDBArray.Clear();
5501 + //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
5502 + //so we have to kill message stores openned
5503 + nsVoidArray m_MDBArray;
5506 #endif // nsMapiAddressBook_h___
5507 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
5508 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
5511 #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
5515 + ContentsColumnEntryId = 0,
5516 + ContentsColumnObjectType,
5517 + ContentsColumnsSize
5520 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
5522 + ContentsColumnsSize,
5529 HMODULE nsWabAddressBook::mLibrary = NULL ;
5530 PRInt32 nsWabAddressBook::mLibUsage = 0 ;
5531 LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
5533 MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
5535 nsWabAddressBook::nsWabAddressBook(void)
5537 +: nsAbWinHelper(),mAddressBook(NULL)
5539 BOOL result = Initialize() ;
5541 @@ -109,9 +125,254 @@
5542 MOZ_COUNT_DTOR(nsWabAddressBook) ;
5545 +BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
5547 + aFolders.CleanUp() ;
5548 + nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
5549 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
5550 + ULONG objType = 0 ;
5551 + ULONG rowCount = 0 ;
5552 + SRestriction restriction ;
5553 + SPropTagArray folderColumns ;
5555 + mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
5557 + if (HR_FAILED(mLastError)){
5558 + PRINTF(("Cannot open root %08x.\n", mLastError));
5561 + mLastError = rootFolder->GetHierarchyTable(0, folders);
5562 + if (HR_FAILED(mLastError)){
5563 + PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
5566 + // We only take into account modifiable containers,
5567 + // otherwise, we end up with all the directory services...
5568 + restriction.rt = RES_BITMASK ;
5569 + restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
5570 + restriction.res.resBitMask.relBMR = BMR_NEZ ;
5571 + restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
5572 + mLastError = folders->Restrict(&restriction, 0) ;
5573 + if (HR_FAILED(mLastError)) {
5574 + PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
5576 + folderColumns.cValues = 1 ;
5577 + folderColumns.aulPropTag [0] = PR_ENTRYID ;
5578 + mLastError = folders->SetColumns(&folderColumns, 0) ;
5579 + if (HR_FAILED(mLastError)) {
5580 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5583 + mLastError = folders->GetRowCount(0, &rowCount) ;
5584 + if (HR_SUCCEEDED(mLastError)) {
5586 + LPSRowSet rowSet = NULL ;
5589 + mLastError = folders->QueryRows(1, 0, &rowSet) ;
5590 + if (HR_SUCCEEDED(mLastError)) {
5591 + rowCount = rowSet->cRows ;
5592 + if (rowCount > 0) {
5593 + SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
5595 + aFolders.AddItem(currentValue.Value.bin.cb,
5596 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5598 + MyFreeProws(rowSet) ;
5601 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5603 + } while (rowCount > 0) ;
5605 + return HR_SUCCEEDED(mLastError) ;
5607 +BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5608 + nsMapiEntryArray *aList, ULONG aMapiType)
5610 + if (aList) { aList->CleanUp(); }
5611 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
5612 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
5613 + ULONG objType = 0 ;
5614 + ULONG rowCount = 0 ;
5616 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5617 + &IID_IMAPIContainer, 0, &objType,
5619 + if (HR_FAILED(mLastError)) {
5620 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
5623 + // Here, flags for WAB and MAPI could be different, so this works
5624 + // only as long as we don't want to use any flag in GetContentsTable
5625 + mLastError = parent->GetContentsTable(0, contents) ;
5626 + if (HR_FAILED(mLastError)) {
5627 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
5630 + if (aRestriction) {
5631 + mLastError = contents->Restrict(aRestriction, 0) ;
5632 + if (HR_FAILED(mLastError)) {
5633 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
5637 + int entryId = ContentsColumnEntryId ;
5638 + int objectType = ContentsColumnObjectType ;
5642 + LPSPropTagArray allColumns = NULL ;
5644 + mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
5645 + if (HR_FAILED(mLastError)) {
5646 + PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
5650 + for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
5651 + if (allColumns->aulPropTag [j] == PR_ENTRYID) {
5654 + else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
5658 + mLastError = contents->SetColumns(allColumns, 0) ;
5659 + if (HR_FAILED(mLastError)) {
5660 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5663 + FreeBuffer(allColumns) ;
5668 + mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
5669 + if (HR_FAILED(mLastError)) {
5670 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5675 + mLastError = contents->GetRowCount(0, &rowCount) ;
5676 + if (HR_FAILED(mLastError)) {
5677 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
5681 + LPSRowSet rowSet = NULL ;
5684 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
5685 + if (HR_FAILED(mLastError)) {
5686 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5689 + rowCount = rowSet->cRows ;
5690 + if (rowCount > 0 &&
5691 + (aMapiType == 0 ||
5692 + rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
5694 + SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
5696 + aList->AddItem(currentValue.Value.bin.cb,
5697 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5701 + MyFreeProws(rowSet) ;
5702 + } while (rowCount > 0) ;
5706 +BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5707 + ULONG aNbProperties, LPSPropValue& aValue,
5708 + ULONG& aValueCount)
5710 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5711 + IMsgStore * mdb=NULL;
5712 + ULONG objType = 0 ;
5713 + LPSPropTagArray properties = NULL ;
5716 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5717 + &IID_IMAPIProp, 0, &objType,
5720 + if (HR_FAILED(mLastError)){
5721 + PRINTF(("Cannot open entry %08x.\n", mLastError));
5724 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
5725 + NS_REINTERPRET_CAST(void **, &properties));
5726 + properties->cValues = aNbProperties;
5727 + for (i = 0 ; i < aNbProperties ; ++ i) {
5728 + properties->aulPropTag [i] = aPropertyTags [i];
5730 + mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
5731 + FreeBuffer(properties);
5732 + if (HR_FAILED(mLastError)){
5733 + PRINTF(("Cannot get props %08x.\n", mLastError));
5735 + return HR_SUCCEEDED(mLastError) ;
5738 +BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5739 + LPSPropValue& aValues)
5741 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5742 + ULONG objType = 0 ;
5743 + LPSPropProblemArray problems = NULL ;
5745 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5746 + &IID_IMAPIProp, MAPI_MODIFY, &objType,
5748 + if (HR_FAILED(mLastError)) {
5749 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5752 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
5753 + if (HR_FAILED(mLastError)) {
5754 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
5758 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
5759 + PRINTF(("Problem %d: index %d code %08x.\n", i,
5760 + problems->aProblem [i].ulIndex,
5761 + problems->aProblem [i].scode));
5764 + mLastError = object->SaveChanges(0) ;
5765 + if (HR_FAILED(mLastError)) {
5766 + PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
5768 + return HR_SUCCEEDED(mLastError) ;
5771 +BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
5773 + LPENTRYID entryId = NULL;
5774 + ULONG byteCount = 0;
5776 + mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
5777 + if (HR_FAILED(mLastError)){
5778 + PRINTF(("Cannot get PAB %08x.\n", mLastError));
5781 + aContainer.Assign(byteCount, entryId);
5782 + FreeBuffer(entryId) ;
5786 +BOOL nsWabAddressBook::IsOK(void)
5788 + return mAddressBook != NULL ;
5791 BOOL nsWabAddressBook::Initialize(void)
5793 - if (mAddressBook) { return TRUE ; }
5794 nsAutoLock guard(mMutex) ;
5796 if (!LoadWabLibrary()) {
5797 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5798 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5800 nsWabAddressBook(void) ;
5801 virtual ~nsWabAddressBook(void) ;
5803 + // Get the top address books
5804 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5806 + // Get a default address book container
5807 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5808 + // Is the helper correctly initialised?
5809 + virtual BOOL IsOK(void);
5810 + static void FreeWabLibrary(void) ;
5813 // Session and address book that will be shared by all instances
5814 // (see nsMapiAddressBook.h for details)
5816 static HMODULE mLibrary ;
5817 static LPWABOPEN mWABOpen ;
5819 + LPADRBOOK mAddressBook ;
5821 // Load the WAB environment
5822 BOOL Initialize(void) ;
5824 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5825 + LPENTRYID lpEntryID,
5826 + LPCIID lpInterface,
5828 + ULONG FAR * lpulObjType,
5829 + LPUNKNOWN FAR * lppUnk
5832 + return mAddressBook->OpenEntry(cbEntryID,
5842 + // Retrieve the contents of a container, with an optional restriction
5843 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5844 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5845 + // Retrieve the values of a set of properties on a MAPI object
5846 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5847 + ULONG aNbProperties,
5848 + LPSPropValue& aValues, ULONG& aValueCount) ;
5849 + // Set the values of a set of properties on a MAPI object
5850 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5851 + LPSPropValue& aValues) ;
5853 // Allocation of a buffer for transmission to interfaces
5854 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5855 // Destruction of a buffer provided by the interfaces
5856 virtual void FreeBuffer(LPVOID aBuffer) ;
5857 // Manage the library
5858 static BOOL LoadWabLibrary(void) ;
5859 - static void FreeWabLibrary(void) ;
5863 --- misc/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp 2007-05-03 03:39:41.000000000 +0200
5864 +++ misc/build/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp 2008-08-20 16:46:58.000000000 +0200
5865 @@ -819,8 +819,13 @@
5867 if (mUseWideCharBiffIcon)
5869 - ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
5870 - if (wcslen(aToolTipString) >= toolTipBufSize)
5872 + ::wcsncpy( sWideBiffIconData.szTip, NS_REINTERPRET_CAST(LPCWSTR, aToolTipString), toolTipBufSize);
5873 + if (wcslen(NS_REINTERPRET_CAST(LPCWSTR, aToolTipString)) >= toolTipBufSize)
5875 + ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
5876 + if (wcslen(aToolTipString) >= toolTipBufSize)
5878 sWideBiffIconData.szTip[toolTipBufSize - 1] = 0;
5881 @@ -862,7 +867,11 @@
5882 // now we need to copy over any left over tool tip strings
5883 if (sWideBiffIconData.szTip)
5886 + const PRUnichar * oldTooltipString = reinterpret_cast<PRUnichar*>(sWideBiffIconData.szTip);
5888 const PRUnichar * oldTooltipString = sWideBiffIconData.szTip;
5890 SetToolTipStringOnIconData(oldTooltipString);
5893 @@ -1040,7 +1049,11 @@
5894 registryUnreadMailCountKey,
5895 sizeof(registryUnreadMailCountKey))))
5898 + if (wcscmp(registryUnreadMailCountKey, NS_REINTERPRET_CAST(LPCWSTR, currentUnreadMailCountKey.get()))==0) {
5900 if (wcscmp(registryUnreadMailCountKey, currentUnreadMailCountKey.get())==0) {
5902 nsAutoString deleteKey;
5903 deleteKey.Assign(NS_LITERAL_STRING(UNREADMAILNODEKEY).get());
5904 deleteKey.Append(currentUnreadMailCountKey.get());
5905 @@ -1108,9 +1121,15 @@
5908 // Write the info into the registry
5910 + HRESULT hr = mSHSetUnreadMailCount(NS_REINTERPRET_CAST(LPCWSTR, pBuffer.get()),
5911 + mCurrentUnreadCount,
5912 + NS_REINTERPRET_CAST(LPCWSTR, commandLinerForAppLaunch.get()));
5914 HRESULT hr = mSHSetUnreadMailCount(pBuffer.get(),
5915 mCurrentUnreadCount,
5916 commandLinerForAppLaunch.get());
5921 --- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100
5922 +++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5924 PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
5927 -EXTRA_DSO_LDOPTS = \
5928 +EXTRA_DSO_LDOPTS += \
5931 $(MOZ_COMPONENT_LIBS) \
5932 --- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200
5933 +++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200
5936 nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
5938 - PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
5939 + PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
5940 return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
5943 --- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100
5944 +++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
5949 # Stupid wrapper to avoid win32 dospath/cygdrive issues
5950 # Try not to spawn programs from within this file. If the stuff in here looks royally
5951 --- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100
5952 +++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
5954 RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
5955 OBJDIR_NAME = @OBJDIR_NAME@
5957 +LIB_PREFIX = @LIB_PREFIX@
5958 OBJ_SUFFIX = @OBJ_SUFFIX@
5959 LIB_SUFFIX = @LIB_SUFFIX@
5960 DLL_SUFFIX = @DLL_SUFFIX@
5961 --- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100
5962 +++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100
5963 @@ -340,6 +340,10 @@
5965 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
5966 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
5967 + @if test -f $@.manifest; then \
5968 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
5969 + rm -f $@.manifest; \
5972 ifeq ($(MOZ_OS2_TOOLS),VACPP)
5973 $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
5974 --- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100
5975 +++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200
5976 @@ -2737,6 +2737,7 @@
5981 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
5984 @@ -3475,7 +3476,7 @@
5987 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
5988 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
5989 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
5990 if test "$MOZ_OBJFORMAT" = "elf"; then
5993 @@ -3941,7 +3942,7 @@
5994 CC="$CC -mno-cygwin"
5995 CXX="$CXX -mno-cygwin"
5997 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
5998 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
6000 # Use temp file for windres (bug 213281)
6001 RCFLAGS='-O coff --use-temp-file'
6002 @@ -5766,6 +5767,7 @@
6003 CC="\$(CYGWIN_WRAPPER) $CC"
6004 CXX="\$(CYGWIN_WRAPPER) $CXX"
6005 RC="\$(CYGWIN_WRAPPER) $RC"
6006 + LD="\$(CYGWIN_WRAPPER) $LD"
6010 @@ -6127,6 +6129,7 @@
6011 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
6012 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
6013 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
6014 +s%@LIB_PREFIX@%$LIB_PREFIX%g
6015 s%@MKSHLIB@%$MKSHLIB%g
6016 s%@DSO_CFLAGS@%$DSO_CFLAGS%g
6017 s%@DSO_LDOPTS@%$DSO_LDOPTS%g
6018 --- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100
6019 +++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200
6020 @@ -1137,7 +1137,7 @@
6021 AC_DEFINE(HAVE_BSD_FLOCK)
6022 AC_DEFINE(HAVE_SOCKLEN_T)
6023 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
6024 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
6025 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
6026 if test "$MOZ_OBJFORMAT" = "elf"; then
6029 --- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100
6030 +++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6035 +ifeq ($(OS_ARCH),Linux)
6036 +MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6039 ifeq ($(OS_ARCH),SunOS)
6041 MAPFILE = $(OBJDIR)/pldsmap.sun
6042 GARBAGE += $(MAPFILE)
6044 ifdef GCC_USE_GNU_LD
6045 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
6046 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6048 -MKSHLIB += -Wl,-M,$(MAPFILE)
6049 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
6052 -MKSHLIB += -M $(MAPFILE)
6053 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
6055 # The -R '$ORIGIN' linker option instructs this library to search for its
6056 # dependencies in the same directory where it resides.
6057 --- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100
6058 +++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6063 +ifeq ($(OS_ARCH),Linux)
6064 +MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6067 ifeq ($(OS_ARCH),SunOS)
6069 MAPFILE = $(OBJDIR)/plcmap.sun
6070 GARBAGE += $(MAPFILE)
6072 ifdef GCC_USE_GNU_LD
6073 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
6074 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6076 -MKSHLIB += -Wl,-M,$(MAPFILE)
6077 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
6080 -MKSHLIB += -M $(MAPFILE)
6081 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
6083 # The -R '$ORIGIN' linker option instructs this library to search for its
6084 # dependencies in the same directory where it resides.
6085 --- misc/mozilla/nsprpub/pr/include/prtypes.h 2006-12-22 14:47:19.000000000 +0100
6086 +++ misc/build/mozilla/nsprpub/pr/include/prtypes.h 2008-08-14 16:22:21.000000000 +0200
6089 #ifndef __PRUNICHAR__
6090 #define __PRUNICHAR__
6091 -#if defined(WIN32) || defined(XP_MAC)
6092 +#if !defined(__MINGW32__) && (defined(WIN32) || defined(XP_MAC))
6093 typedef wchar_t PRUnichar;
6095 typedef PRUint16 PRUnichar;
6096 --- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100
6097 +++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200
6099 #define _PR_HAVE_5_ARG_GETPROTO_R
6102 -#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
6103 +#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
6104 + (defined(__FreeBSD__) && __FreeBSD_version > 601103)
6105 #define _PR_HAVE_GETPROTO_R
6106 #define _PR_HAVE_5_ARG_GETPROTO_R
6108 --- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100
6109 +++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
6114 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
6115 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
6117 ifeq ($(MOZ_OBJFORMAT),elf)
6119 --- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100
6120 +++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200
6123 ifeq ($(OS_RELEASE),2.0)
6124 OS_REL_CFLAGS += -DLINUX2_0
6125 - MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
6126 + MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
6128 MKSHLIB += -Wl,--version-script,$(MAPFILE)
6133 DSO_LDOPTS = -shared $(ARCHFLAG)
6134 +DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6136 LDFLAGS += $(ARCHFLAG)
6138 --- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200
6139 +++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200
6140 @@ -161,12 +161,14 @@
6143 # -G: produce a shared object
6144 +# -R '$ORIGIN': search for dependencies in same directory
6145 # -z defs: no unresolved symbols allowed
6150 DSO_LDOPTS += -shared -h $(notdir $@)
6151 + DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
6154 ifeq ($(OS_TEST),i86pc)
6158 DSO_LDOPTS += -G -h $(notdir $@)
6159 + DSO_LDOPTS += -R '$$ORIGIN'
6161 DSO_LDOPTS += -z combreloc -z defs -z ignore
6163 --- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200
6164 +++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200
6166 DEFAULT_COMPILER = cl
6173 + CC = $(CYGWIN_WRAPPER) gcc
6174 + CCC = $(CYGWIN_WRAPPER) g++
6175 + LINK = $(CYGWIN_WRAPPER) ld
6176 + AR = $(CYGWIN_WRAPPER) ar
6179 + RANLIB = $(CYGWIN_WRAPPER) ranlib
6181 - RC = windres.exe -O coff --use-temp-file
6182 - LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
6183 + RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
6184 + LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
6190 + CC = $(CYGWIN_WRAPPER) cl
6191 + CCC = $(CYGWIN_WRAPPER) cl
6192 + LINK = $(CYGWIN_WRAPPER) link
6193 + AR = $(CYGWIN_WRAPPER) lib
6194 AR += -NOLOGO -OUT:"$@"
6198 + RC = $(CYGWIN_WRAPPER) rc.exe
6204 NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
6206 -NSINSTALL = nsinstall
6207 +NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
6209 MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
6210 MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
6212 # dllimport cannot be used as as a constant address.
6213 OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
6214 _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
6215 - DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
6216 + DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
6219 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
6220 --- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200
6221 +++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200
6228 +NSPR31_LIB_PREFIX = lib
6230 --- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200
6231 +++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200
6233 CCF = $(CC) $(CFLAGS)
6234 LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
6235 LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
6236 -CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6237 +CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6241 --- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200
6242 +++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200
6244 $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
6246 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6247 - $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
6248 + $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
6250 if test -f $@.manifest; then \
6251 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
6252 @@ -305,11 +305,7 @@
6256 -ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6257 - $(AR) $(subst /,\\,$(OBJS))
6266 $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6268 - $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
6269 + $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6271 if test -f $@.manifest; then \
6272 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
6273 @@ -429,15 +425,15 @@
6277 -core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6278 +mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6280 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6282 ifdef USE_NT_C_SYNTAX
6283 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6284 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6286 ifdef NEED_ABSOLUTE_PATH
6287 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6288 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6290 $(CC) -o $@ -c $(CFLAGS) $<
6292 @@ -445,10 +441,10 @@
6294 $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6295 ifdef USE_NT_C_SYNTAX
6296 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6297 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6299 ifdef NEED_ABSOLUTE_PATH
6300 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6301 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6303 $(CC) -o $@ -c $(CFLAGS) $<
6305 @@ -477,10 +473,10 @@
6306 $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
6308 ifdef USE_NT_C_SYNTAX
6309 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6310 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6312 ifdef NEED_ABSOLUTE_PATH
6313 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6314 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6316 $(CCC) -o $@ -c $(CFLAGS) $<
6318 @@ -501,10 +497,10 @@
6319 rm -f $(OBJDIR)/t_$*.cc
6321 ifdef USE_NT_C_SYNTAX
6322 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6323 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6325 ifdef NEED_ABSOLUTE_PATH
6326 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6327 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6329 $(CCC) -o $@ -c $(CFLAGS) $<
6331 --- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200
6332 +++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6335 ifeq ($(OS_ARCH),WINNT)
6336 DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
6337 +DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
6339 ifndef MOZ_NO_DEBUG_RTL
6340 DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
6341 --- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
6342 +++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100
6345 include ../platrules.mk
6347 -SRCDIR = $(call core_abspath,.)
6349 +ifeq ($(OS_TARGET), Darwin)
6352 +ifeq ($(OS_TARGET), Linux)
6355 +ifeq ($(OS_TARGET), WIN95)
6356 + SRCDIR = $(shell cygpath -d $(SRCDIR))
6362 %.chk: %.$(DLL_SUFFIX)
6363 ifeq ($(OS_TARGET), OS2)
6364 cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
6365 $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6366 $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6368 - cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
6369 - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6370 - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6371 +ifeq ($(OS_TARGET), WIN95)
6372 + sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
6373 + $(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
6374 + $(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
6376 +ifeq ($(OS_TARGET), Darwin)
6377 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6378 + $(OBJDIR) $(OS_TARGET) \
6379 + $(NSPR_LIB_DIR) $<
6381 +ifeq ($(OS_TARGET), Linux)
6382 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6383 + $(OBJDIR) $(OS_TARGET) \
6384 + $(NSPR_LIB_DIR) $<
6386 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6387 + $(OBJDIR) $(OS_TARGET) \
6388 + $(NSPR_LIB_DIR) $<
6394 libs install :: $(CHECKLOC)
6395 --- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100
6396 +++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200
6398 DSO_LDOPTS = -bundle
6401 -ifeq ($(OS_TARGET),SunOS)
6402 -# The -R '$ORIGIN' linker option instructs this library to search for its
6403 -# dependencies in the same directory where it resides.
6404 -MKSHLIB += -R '$$ORIGIN'
6407 --- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200
6408 +++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200
6409 @@ -199,10 +199,6 @@
6412 ifeq ($(OS_TARGET),SunOS)
6414 -# The -R '$ORIGIN' linker option instructs this library to search for its
6415 -# dependencies in the same directory where it resides.
6416 -MKSHLIB += -R '$$ORIGIN'
6418 ifdef GCC_USE_GNU_LD
6419 MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
6421 MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
6422 endif # GCC_USE_GNU_LD
6424 - MKSHLIB += -B symbolic -z now -z text
6425 + MKSHLIB += -z now -z text
6428 # Sun's WorkShop defines v8, v8plus and v9 architectures.
6429 --- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100
6430 +++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200
6431 @@ -113,12 +113,10 @@
6432 # The -R '$ORIGIN' linker option instructs this library to search for its
6433 # dependencies in the same directory where it resides.
6435 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6436 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6438 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6439 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6442 -MKSHLIB += -R '$$ORIGIN'
6449 MKSHLIB += +b '$$ORIGIN'
6457 ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
6459 --- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200
6460 +++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200
6462 CERT_CheckCertValidTimes;
6463 CERT_CreateCertificateRequest;
6464 CERT_ChangeCertTrust;
6465 +CERT_DecodeDERCertificate;
6467 CERT_DestroyCertificateRequest;
6468 CERT_DestroyCertList;
6469 --- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100
6470 +++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200
6475 -ifeq ($(OS_TARGET),SunOS)
6476 -# The -R '$ORIGIN' linker option instructs this library to search for its
6477 -# dependencies in the same directory where it resides.
6478 -MKSHLIB += -R '$$ORIGIN'
6480 --- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100
6481 +++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200
6486 -ifeq ($(OS_TARGET),SunOS)
6487 -# The -R '$ORIGIN' linker option instructs this library to search for its
6488 -# dependencies in the same directory where it resides.
6489 -MKSHLIB += -R '$$ORIGIN'
6493 ifeq ($(OS_TARGET),WINCE)
6494 DEFINES += -DDBM_USING_NSPR
6496 --- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200
6497 +++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200
6498 @@ -116,13 +116,6 @@
6499 EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
6502 -ifeq ($(OS_TARGET),SunOS)
6503 -# The -R '$ORIGIN' linker option instructs this library to search for its
6504 -# dependencies in the same directory where it resides.
6505 -MKSHLIB += -R '$$ORIGIN'
6506 -#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
6511 # indicates dependency on freebl static lib
6512 --- misc/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp 2007-10-08 21:09:06.000000000 +0200
6513 +++ misc/build/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp 2008-08-18 09:53:47.000000000 +0200
6514 @@ -163,11 +163,21 @@
6515 if (aProtocolScheme && *aProtocolScheme)
6518 - LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
6521 + err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, NS_REINTERPRET_CAST(LPCWSTR, aProtocolScheme), 0,
6522 KEY_QUERY_VALUE, &hKey);
6524 + err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
6525 + KEY_QUERY_VALUE, &hKey);
6527 if (err == ERROR_SUCCESS)
6530 + err = ::RegQueryValueEx(hKey, NS_REINTERPRET_CAST(LPCWSTR, "URL Protocol"), NULL, NULL, NULL, NULL);
6532 err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL);
6534 *aHandlerExists = (err == ERROR_SUCCESS);
6536 ::RegCloseKey(hKey);
6537 --- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200
6538 +++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6540 GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
6542 XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
6543 -XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6544 +XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6547 $(XP_DIST_DEP_LIBS) \
6548 --- misc/mozilla/widget/src/windows/nsDataObj.cpp 2006-06-21 06:33:32.000000000 +0200
6549 +++ misc/build/mozilla/widget/src/windows/nsDataObj.cpp 2008-08-18 15:49:13.000000000 +0200
6550 @@ -570,9 +570,15 @@
6551 int currLen, textLen = (int) NS_MIN(aText.Length(), aFilenameLen);
6552 char defaultChar = '_';
6555 + currLen = WideCharToMultiByte(CP_ACP,
6556 + NS_REINTERPRET_CAST(LPCWSTR, WC_COMPOSITECHECK|WC_DEFAULTCHAR),
6557 + aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
6559 currLen = WideCharToMultiByte(CP_ACP,
6560 WC_COMPOSITECHECK|WC_DEFAULTCHAR,
6561 aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
6564 while (currLen == 0 && textLen > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
6565 if (currLen > 0 && textLen > 0) {
6566 --- misc/mozilla/widget/src/windows/nsFilePicker.cpp 2006-02-03 15:41:10.000000000 +0100
6567 +++ misc/build/mozilla/widget/src/windows/nsFilePicker.cpp 2008-08-19 10:05:12.000000000 +0200
6568 @@ -135,7 +135,11 @@
6570 PRBool result = PR_FALSE;
6571 PRUnichar fileBuffer[FILE_BUFFER_SIZE+1];
6573 + wcsncpy(NS_REINTERPRET_CAST(LPOWSTR, fileBuffer), NS_REINTERPRET_CAST(LPOWSTR, mDefault.get()), FILE_BUFFER_SIZE);
6575 wcsncpy(fileBuffer, mDefault.get(), FILE_BUFFER_SIZE);
6577 fileBuffer[FILE_BUFFER_SIZE] = '\0'; // null terminate in case copy truncated
6579 NS_NAMED_LITERAL_STRING(htmExt, "html");
6580 @@ -155,14 +159,22 @@
6582 if (mMode == modeGetFolder) {
6583 PRUnichar dirBuffer[MAX_PATH+1];
6585 + wcsncpy(NS_REINTERPRET_CAST(LPWSTR, dirBuffer), NS_REINTERPRET_CAST(LPCWSTR, initialDir.get()), MAX_PATH);
6587 wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
6590 BROWSEINFOW browserInfo;
6591 browserInfo.hwndOwner = (HWND)
6592 (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
6593 browserInfo.pidlRoot = nsnull;
6594 browserInfo.pszDisplayName = (LPWSTR)dirBuffer;
6596 + browserInfo.lpszTitle = NS_REINTERPRET_CAST(LPCWSTR, mTitle.get());
6598 browserInfo.lpszTitle = mTitle.get();
6600 browserInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
6601 if (initialDir.Length()) // convert folder path to native, the strdup copy will be released in BrowseCallbackProc
6603 @@ -202,7 +214,11 @@
6604 nsString filterBuffer = mFilterList;
6606 if (!initialDir.IsEmpty()) {
6608 + ofn.lpstrInitialDir = NS_REINTERPRET_CAST(LPCWSTR, initialDir.get());
6610 ofn.lpstrInitialDir = initialDir.get();
6614 ofn.lpstrTitle = (LPCWSTR)mTitle.get();
6615 @@ -210,13 +226,21 @@
6616 ofn.nFilterIndex = mSelectedType;
6617 ofn.hwndOwner = (HWND)
6618 (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0);
6620 + ofn.lpstrFile = NS_REINTERPRET_CAST(LPWSTR, fileBuffer);
6622 ofn.lpstrFile = fileBuffer;
6624 ofn.nMaxFile = FILE_BUFFER_SIZE;
6626 ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
6628 if (!mDefaultExtension.IsEmpty()) {
6630 + ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, mDefaultExtension.get());
6632 ofn.lpstrDefExt = mDefaultExtension.get();
6636 // Get file extension from suggested filename
6637 @@ -236,7 +260,11 @@
6638 //XXX Actually, behavior is sort of weird:
6639 // often appends ".html" even if you have an extension
6640 // It obeys your extension if you put quotes around name
6642 + ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, htmExt.get());
6644 ofn.lpstrDefExt = htmExt.get();
6649 --- misc/mozilla/widget/src/windows/nsWindow.cpp 2007-11-19 21:40:12.000000000 +0100
6650 +++ misc/build/mozilla/widget/src/windows/nsWindow.cpp 2008-08-20 16:18:08.000000000 +0200
6651 @@ -7088,7 +7088,11 @@
6652 return; // out of memory
6654 unicharSize = MultiByteToWideChar(gCurrentKeyboardCP, MB_PRECOMPOSED,
6655 - aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
6657 + aStrAnsi->get(), aStrAnsi->Length(), S_REINTERPRET_CAST(LPWSTR, aStrUnicode->BeginWriting()), unicharSize + 1);
6659 + aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
6661 aStrUnicode->SetLength(unicharSize);
6664 @@ -7265,7 +7269,11 @@
6665 sIMEAttributeArray[i] = sIMEAttributeArray[offset];
6667 offset += ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6668 - sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
6670 + REINTERPRET_CAST(LPCWSTR, sIMECompUnicode->get() + i), 1, NULL, 0, NULL, NULL);
6672 + sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
6676 sIMEAttributeArrayLength = sIMECompUnicode->Length();
6677 @@ -7477,7 +7485,11 @@
6678 *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
6680 len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6682 + NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
6684 sIMEReconvertUnicode,
6686 nsCRT::strlen(sIMEReconvertUnicode),
6687 NULL, 0, NULL, NULL);
6688 *oResult = sizeof(RECONVERTSTRING) + len;
6689 @@ -7496,7 +7508,11 @@
6690 *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
6692 len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6694 + NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
6696 sIMEReconvertUnicode,
6698 nsCRT::strlen(sIMEReconvertUnicode),
6699 NULL, 0, NULL, NULL);
6700 *oResult = sizeof(RECONVERTSTRING) + len;
6701 @@ -7523,7 +7539,11 @@
6702 sIMEReconvertUnicode, len * sizeof(WCHAR));
6704 ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
6706 + NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
6708 sIMEReconvertUnicode,
6710 nsCRT::strlen(sIMEReconvertUnicode),
6711 (LPSTR) (aData + sizeof(RECONVERTSTRING)),
6713 --- misc/mozilla/xpcom/base/nscore.h 2006-08-24 23:46:32.000000000 +0200
6714 +++ misc/build/mozilla/xpcom/base/nscore.h 2008-08-16 12:01:53.000000000 +0200
6716 * commercial build. When this is fixed there will be no need for the
6717 * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
6719 - #if defined(HAVE_CPP_2BYTE_WCHAR_T) && defined(NS_WIN32)
6720 + #if defined(HAVE_CPP_2BYTE_WCHAR_T) && !defined(__MINGW32__) && (defined(NS_WIN32) || defined(XP_MAC))
6721 typedef wchar_t PRUnichar;
6723 typedef PRUint16 PRUnichar;
6724 --- misc/mozilla/xpcom/io/nsLocalFileWin.cpp 2007-11-19 21:38:17.000000000 +0100
6725 +++ misc/build/mozilla/xpcom/io/nsLocalFileWin.cpp 2008-08-20 16:39:58.000000000 +0200
6726 @@ -836,8 +836,11 @@
6727 PRUnichar *resolvedPath = mResolvedPath.BeginWriting();
6729 // resolve this shortcut
6731 + nsresult rv = gResolver->Resolve(NS_REINTERPRET_CAST(LPCWSTR, mWorkingPath.get()), resolvedPath);
6733 nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
6736 size_t len = NS_FAILED(rv) ? 0 : wcslen(resolvedPath);
6737 mResolvedPath.SetLength(len);
6739 --- misc/mozilla/xpcom/io/nsNativeCharsetUtils.cpp 2006-06-22 21:13:01.000000000 +0200
6740 +++ misc/build/mozilla/xpcom/io/nsNativeCharsetUtils.cpp 2008-08-14 16:22:21.000000000 +0200
6741 @@ -935,7 +935,11 @@
6743 PRUnichar *result = out_iter.get();
6746 + ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, NS_REINTERPRET_CAST(LPWSTR, result), resultLen);
6748 ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen);
6753 @@ -953,7 +957,11 @@
6754 // determine length of result
6755 PRUint32 resultLen = 0;
6758 + int n = ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, NULL, 0, NULL, NULL);
6760 int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, NULL, 0, NULL, NULL);
6765 @@ -970,7 +978,11 @@
6767 char *result = out_iter.get();
6770 + ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, result, resultLen,
6772 ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen,
6774 &defaultChar, NULL);
6777 --- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200
6778 +++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200
6782 PRBool IsArray() const
6783 - {return (PRBool) TagPart() == T_ARRAY;}
6784 + {return (PRBool) (TagPart() == T_ARRAY);}
6786 // 'Dependent' means that params of this type are dependent upon other
6787 // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
6789 uint8 TagPart() const
6790 {return (uint8) (flags & XPT_TDP_TAGMASK);}
6797 --- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200
6798 +++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200
6799 @@ -115,11 +115,14 @@
6801 include $(topsrcdir)/config/config.mk
6803 +# reduce prerequisites by disabling mozilla binary
6804 +ifndef DISABLE_MOZ_EXECUTABLE
6805 ifeq ($(USE_SHORT_LIBNAME),1)
6806 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
6808 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
6812 # Force applications to be built non-statically
6813 # when building the mozcomps meta component
6815 APP_NAME = $(MOZ_APP_DISPLAYNAME)
6820 mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
6821 rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
6823 rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
6824 cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
6825 echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
6829 rm -rf $(DIST)/$(APP_NAME).app
6830 --- misc/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2007-02-22 14:05:28.000000000 +0100
6831 +++ misc/build/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp 2008-08-20 16:53:04.000000000 +0200
6832 @@ -142,7 +142,11 @@
6833 int acplen = aStr.Length() * 2 + 1;
6834 char * acp = new char[ acplen ];
6836 - int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
6838 + int outlen = ::WideCharToMultiByte( CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aStr.get()), aStr.Length(),
6840 + int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
6842 acp, acplen-1, NULL, NULL );
6843 acp[ outlen ] = '\0'; // null terminate
6845 @@ -2507,7 +2511,11 @@
6847 // Create menu and add item.
6848 mTrayIconMenu = ::CreatePopupMenu();
6850 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, NS_REINTERPRET_CAST(LPCWSTR, navigatorText.get()) );
6852 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, navigatorText.get() );
6854 if ( ::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
6855 AppendMenuItem( mTrayIconMenu, TURBO_NAVIGATOR, navigatorText );
6857 @@ -2521,6 +2529,15 @@
6862 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, NS_REINTERPRET_CAST(LPCWSTR, mailText.get()) );
6863 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, NS_REINTERPRET_CAST(LPCWSTR, editorText.get()) );
6865 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_ADDRESSBOOK, NS_REINTERPRET_CAST(LPCWSTR, addressbookText.get()) );
6866 + ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
6867 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, NS_REINTERPRET_CAST(LPCWSTR, disableText.get()) );
6868 + ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, NS_REINTERPRET_CAST(LPCWSTR, exitText.get()) );
6870 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, mailText.get() );
6871 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, editorText.get() );
6873 @@ -2528,6 +2545,7 @@
6874 ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
6875 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, disableText.get() );
6876 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, exitText.get() );