VirtualBox

Changeset 589 in vbox


Ignore:
Timestamp:
Feb 4, 2007 12:25:57 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18212
Message:

Make it build and run on Mac OS X.

Location:
trunk/src/libs/xpcom18a4
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r227 r589  
    2323
    2424
    25 # We start by creating a couple of templates for building XPCOM.  In L4, this is slightly
    26 # complicated by the fact that we still build the tools for use in Linux, since L4 isn't
    27 # really up to scratch yet as a development environment.  Whereas formerly the operating
    28 # system definitions were "hard coded" by copying the correct file to prcpucfg.h, we now
    29 # use a file which will include the correct definitions based on whether the variable
    30 # __LINUX_XPCOM__ or __L4_XPCOM__ is defined.  Unfortunately, we can't use __LINUX__ and
    31 # __L4ENV__, since these are defined globally, not on a per-template basis, so __L4ENV__
    32 # will also be defined when building the Linux-based tools.
    33 
    34 XPCOM_SUFF_LIB.linux = .a
    35 XPCOM_SUFF_LIB.l4    = .a
    36 XPCOM_SUFF_LIB       = $(XPCOM_SUFF_LIB.$(BUILD_TARGET))
    37 XPCOM_SUFF_DLL.linux = .so
    38 XPCOM_SUFF_DLL.l4    = .s.so
    39 XPCOM_SUFF_DLL       = $(XPCOM_SUFF_DLL.$(BUILD_TARGET))
    40 
    41 #
    42 # Template for building the XPCOM libraries
    43 #
    44 TEMPLATE_XPCOM                     = XPCOM libraries
    45 TEMPLATE_XPCOM_TOOL                = GCC3
    46 TEMPLATE_XPCOM_CXXFLAGS            = -pipe -fPIC -ansi -Wall -Wno-unused -Wno-non-virtual-dtor \
     25#
     26# Template for building the XPCOM libraries (shared).
     27#
     28TEMPLATE_XPCOM                     = XPCOM libraries (shared)
     29TEMPLATE_XPCOM_EXTENDS             = VBOXR3NP
     30TEMPLATE_XPCOM_ASTOOL              = $(TEMPLATE_VBOXR3NP_TOOL)
     31TEMPLATE_XPCOM_ASFLAGS             = $(NO_SUCH_VARIABLE)
     32TEMPLATE_XPCOM_ASDEFS              = $(NO_SUCH_VARIABLE)
     33TEMPLATE_XPCOM_CXXFLAGS            = -pipe -ansi -Wall -Wno-unused -Wno-non-virtual-dtor \
    4734                                     $(VBOX_GCC_Wno-invalid-offsetof) -Wno-sign-compare -Wno-unused -Wno-ctor-dtor-privacy
     35
    4836TEMPLATE_XPCOM_CXXFLAGS.debug      = -fno-inline
    4937TEMPLATE_XPCOM_CXXFLAGS.release    = -O
    5038TEMPLATE_XPCOM_CXXFLAGS.profile    = -O
     39TEMPLATE_XPCOM_CXXFLAGS.darwin     = -fpascal-strings -fshort-wchar -fno-common -fno-rtti
     40TEMPLATE_XPCOM_CXXFLAGS.l4         = -fno-exceptions -nostdinc
    5141TEMPLATE_XPCOM_CXXFLAGS.linux      = -pthread
    52 TEMPLATE_XPCOM_CXXFLAGS.l4         = -fno-exceptions -nostdinc
    53 TEMPLATE_XPCOM_CFLAGS              = -pipe -fPIC -ansi -pthread -Wall -Wno-unused \
    54                                      -Wno-parentheses -Wno-uninitialized
     42TEMPLATE_XPCOM_CFLAGS              = -pipe -Wall -Wno-unused -Wno-parentheses -Wno-uninitialized
    5543TEMPLATE_XPCOM_CFLAGS.debug        = -fno-inline
    5644TEMPLATE_XPCOM_CFLAGS.release      = -O
    5745TEMPLATE_XPCOM_CFLAGS.profile      = -O
    58 TEMPLATE_XPCOM_CFLAGS.linux        = -pthread
    5946TEMPLATE_XPCOM_CFLAGS.l4           = -nostdinc
    60 TEMPLATE_XPCOM_DEFS                = MOZILLA_CLIENT=1 MOZ_PRESERVE_PIC
     47TEMPLATE_XPCOM_CFLAGS.linux        = -pthread -ansi
     48TEMPLATE_XPCOM_DEFS                = MOZILLA_CLIENT=1
    6149TEMPLATE_XPCOM_DEFS.amd64          = HAVE_VA_LIST_AS_ARRAY HAVE_VA_COPY VA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\)
    62 TEMPLATE_XPCOM_DEFS.linux          = XP_UNIX=1 __LINUX_XPCOM__ OSTYPE="Linux2.6" OSARCH="Linux" \
    63                                      MOZ_DLL_SUFFIX="\".so\""
    64 TEMPLATE_XPCOM_DEFS.l4             = XP_UNIX=1 __L4_XPCOM__ OSTYPE="L4ENV" OSARCH="L4" \
    65                                      MOZ_DLL_SUFFIX="\".s.so\"" L4ENV
     50TEMPLATE_XPCOM_DEFS.darwin         = OSTYPE=\"Darwin8.8.1\" OSARCH=\"Darwin\" MOZ_DLL_SUFFIX=\".dylib\" XP_UNIX=1 XP_MACOSX=1
     51TEMPLATE_XPCOM_DEFS.linux          = OSTYPE=\"Linux2.6\"    OSARCH=\"Linux\"  MOZ_DLL_SUFFIX=\".so\"    XP_UNIX=1
     52TEMPLATE_XPCOM_DEFS.l4             = OSTYPE=\"L4ENV\"       OSARCH=\"L4\"     MOZ_DLL_SUFFIX=\".s.so\"  XP_UNIX=1 L4ENV
     53TEMPLATE_XPCOM_DEFS.os2            = OSTYPE=\"OS/2 4.5\"    OSARCH=\"OS/2\"   MOZ_DLL_SUFFIX=\".dll\"   XP_UNIX=1
     54TEMPLATE_XPCOM_LDFLAGS.darwin      = $(VBOXR3NP_LDFLAGS.darwin) \
     55                                     -fshort-wchar -fno-rtti -fno-exceptions -fpascal-strings \
     56                                     -framework CoreServices -framework CoreFoundation -framework Foundation -framework AppKit -framework Carbon
     57ifeq ($(filter os2 win,$(BUILD_TARGET)),)
     58 TEMPLATE_XPCOM_CXXFLAGS          += -fPIC
     59 TEMPLATE_XPCOM_CFLAGS            += -fPIC
     60 TEMPLATE_XPCOM_LDFLAGS           += -fPIC
     61 TEMPLATE_XPCOM_DEFS              += MOZ_PRESERVE_PIC
     62endif
    6663TEMPLATE_XPCOM_INCS                = $(PATH_TARGET) \
    6764                                     xpcom/build \
     
    8582                                     $(PATH_BIN)/sdk/include/xpcom/xpcom \
    8683                                     $(PATH_BIN)/sdk/include/xpcom/ipcd
     84TEMPLATE_XPCOM_INCS.darwin         = /Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon
    8785TEMPLATE_XPCOM_INCS.l4             = $(L4_INCDIR) $(VBOX_L4_GCC3_INCS)
    8886TEMPLATE_XPCOM_LDFLAGS.l4          = $(L4_DIR)/lib/x86_586/crt0.o \
    89     -T$(L4_DIR)/lib/x86_586/main_rel.ld -nostdlib \
    90     # -Wl,--whole-archive,--no-allow-shlib-undefined
     87                                     -T$(L4_DIR)/lib/x86_586/main_rel.ld -nostdlib \
     88                                     # -Wl,--whole-archive,--no-allow-shlib-undefined
    9189TEMPLATE_XPCOM_LIBS.l4             = $(VBOX_GCC_LIBGCC)
     90TEMPLATE_XPCOM_ORDERDEPS           = $(foreach hdrinst, $(filter %-HEADERS, $(INSTALLS)), $(TARGET_$(hdrinst)))
     91
    9292
    9393#
    9494# Template for building the XPCOM executables
    9595#
    96 TEMPLATE_XPCOMEXE                     = XPCOM executable files
    97 TEMPLATE_XPCOMEXE_TOOL                = GCC3
    98 TEMPLATE_XPCOMEXE_CXXFLAGS            = -pipe -ansi -Wall -Wno-non-virtual-dtor
    99 TEMPLATE_XPCOMEXE_CXXFLAGS.debug      = -fno-inline
    100 TEMPLATE_XPCOMEXE_CXXFLAGS.release    = -O
    101 TEMPLATE_XPCOMEXE_CXXFLAGS.profile    = -O
    102 TEMPLATE_XPCOMEXE_CXXFLAGS.linux      = -pthread
    103 TEMPLATE_XPCOMEXE_CXXFLAGS.l4         = -fno-exceptions -nostdinc
    104 TEMPLATE_XPCOMEXE_CFLAGS              = -pipe -ansi -Wall
    105 TEMPLATE_XPCOMEXE_CFLAGS.debug        = -fno-inline
    106 TEMPLATE_XPCOMEXE_CFLAGS.release      = -O
    107 TEMPLATE_XPCOMEXE_CFLAGS.profile      = -O
    108 TEMPLATE_XPCOMEXE_CFLAGS.linux        = -pthread
    109 TEMPLATE_XPCOMEXE_CFLAGS.l4           = -fno-exceptions -nostdinc
    110 TEMPLATE_XPCOMEXE_DEFS                = MOZILLA_CLIENT=1 BUILD_DCONNECT="1"
    111 TEMPLATE_XPCOMEXE_DEFS.linux          = XP_UNIX=1 __LINUX_XPCOM__ OSTYPE="Linux2.6" \
    112                                         OSARCH="Linux" MOZ_DLL_SUFFIX="\".so\"" _BSD_SOURCE
    113 TEMPLATE_XPCOMEXE_DEFS.l4             = XP_UNIX=1 __L4_XPCOM__ OSTYPE="L4ENV" OSARCH="L4" \
    114                                         MOZ_DLL_SUFFIX="\".s.so\"" _BSD_SOURCE L4ENV
    115 TEMPLATE_XPCOMEXE_INCS                = $(PATH_TARGET) ipc/ipcd/shared/src \
    116                                         $(PATH_BIN)/sdk/include \
    117                                         $(PATH_BIN)/sdk/include/xpcom \
    118                                         $(PATH_BIN)/sdk/include/xpcom/nsprpub \
    119                                         $(PATH_BIN)/sdk/include/xpcom/string \
    120                                         $(PATH_BIN)/sdk/include/xpcom/xpcom \
    121                                         $(PATH_BIN)/sdk/include/xpcom/ipcd
    122 TEMPLATE_XPCOMEXE_INCS.l4             = $(L4_INCDIR) $(VBOX_L4_GCC3_INCS)
    123 TEMPLATE_XPCOMEXE_LIBS                = \
    124         $(PATH_LIB)/VBox-xpcom-ipcshared$(VBOX_SUFF_LIB) \
    125         $(PATH_BIN)/VBoxXPCOM$(XPCOM_SUFF_DLL)
    126 TEMPLATE_XPCOMEXE_LIBS.linux          = dl $(LIB_PTHREAD)
    127 TEMPLATE_XPCOMEXE_LIBS.l4             = $(LIB_RUNTIME) $(VBOX_GCC_LIBGCC)
    128 TEMPLATE_XPCOMEXE_LDFLAGS.l4          = $(L4_DIR)/lib/x86_586/crt0.o \
     96TEMPLATE_XPCOMEXE                  = XPCOM executable files (testcases)
     97TEMPLATE_XPCOMEXE_EXTENDS          = XPCOM
     98## @todo undo -fPIC.
     99TEMPLATE_XPCOMEXE_INCS             = $(PATH_TARGET) ipc/ipcd/shared/src \
     100                                     $(PATH_BIN)/sdk/include \
     101                                     $(PATH_BIN)/sdk/include/xpcom \
     102                                     $(PATH_BIN)/sdk/include/xpcom/nsprpub \
     103                                     $(PATH_BIN)/sdk/include/xpcom/string \
     104                                     $(PATH_BIN)/sdk/include/xpcom/xpcom \
     105                                     $(PATH_BIN)/sdk/include/xpcom/ipcd
     106TEMPLATE_XPCOMEXE_LIBS             = \
     107        $(TARGET_VBox-xpcom-ipcshared) \
     108        $(TARGET_VBoxXPCOM)
     109TEMPLATE_XPCOMEXE_LIBS.linux       = dl $(LIB_PTHREAD)
     110TEMPLATE_XPCOMEXE_LIBS.l4          = $(LIB_RUNTIME) $(VBOX_GCC_LIBGCC)
     111TEMPLATE_XPCOMEXE_LDFLAGS.darwin   = -bind_at_load $(TEMPLATE_XPCOM_LDFLAGS.darwin)
     112TEMPLATE_XPCOMEXE_LDFLAGS.l4       = $(L4_DIR)/lib/x86_586/crt0.o \
    129113    -T$(L4_DIR)/lib/x86_586/main_dyn.ld -nostdlib -lgcc \
    130114    -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
     
    133117
    134118#
    135 # Template for building XPCOM Linux-based executables.
    136 #
    137 TEMPLATE_XPCOMLINUX                   = XPCOM Linux executables
    138 TEMPLATE_XPCOMLINUX_TOOL              = GCC3
    139 TEMPLATE_XPCOMLINUX_ASTOOL            = NASM
    140 TEMPLATE_XPCOMLINUX_DEFS              = __LINUX_XPCOM__ MOZILLA_CLIENT=1 \
    141                                         OSTYPE="Linux2.6" OSARCH="Linux"
    142 TEMPLATE_XPCOMLINUX_CXXFLAGS          = -pipe -ansi -Wall -pthread -Wno-non-virtual-dtor
    143 TEMPLATE_XPCOMLINUX_CXXFLAGS.debug    = fno-inline
    144 TEMPLATE_XPCOMLINUX_CXXFLAGS.release  = -O
    145 TEMPLATE_XPCOMLINUX_CXXFLAGS.profile  = -O
    146 TEMPLATE_XPCOMLINUX_CFLAGS            = -pipe -ansi -Wall -pthread -Wno-unused
    147 TEMPLATE_XPCOMLINUX_CFLAGS.debug      = -fno-inline
    148 TEMPLATE_XPCOMLINUX_CFLAGS.release    = -O
    149 TEMPLATE_XPCOMLINUX_CFLAGS.profile    = -O
    150 TEMPLATE_XPCOMLINUX_LIBS              = dl
    151 TEMPLATE_XPCOMLINUX_INCS              = $(PATH_BIN)/sdk/include \
    152                                         $(PATH_BIN)/sdk/include/xpcom \
    153                                         $(PATH_BIN)/sdk/include/xpcom/nsprpub \
    154                                         $(PATH_BIN)/sdk/include/xpcom/string \
    155                                         $(PATH_BIN)/sdk/include/xpcom/xpcom \
    156                                         $(PATH_BIN)/sdk/include/xpcom/ipcd
    157 ifdef VBOX_USE_GPROF
    158 TEMPLATE_XPCOMLINUX_CFLAGS.profile    += -pg
    159 TEMPLATE_XPCOMLINUX_CXXFLAGS.profile  += -pg
    160 TEMPLATE_XPCOMLINUX_LDFLAGS.profile   += -pg
    161 endif
    162 ifdef VBOX_USE_FNCCHECK
    163 TEMPLATE_XPCOMLINUX_CFLAGS.profile    += -finstrument-functions
    164 TEMPLATE_XPCOMLINUX_CXXFLAGS.profile  += -finstrument-functions
    165 TEMPLATE_XPCOMLINUX_LDFLAGS.profile   += -lfnccheck_hack -lfnccheck
    166 endif
    167 
    168 #
    169 # First we have to build the IDL compiler as it is required for the rest
     119# Template for building XPCOM executables for running at build time.
     120#
     121# It extends the BLDPROG template in config.kmk but overrides CFLAGS
     122# and CXXFLAGS completely at the moment.
     123#
     124TEMPLATE_XPCOMBLDPROG                   = XPCOM Build programs executables
     125TEMPLATE_XPCOMBLDPROG_EXTENDS           = BLDPROG
     126
     127TEMPLATE_XPCOMBLDPROG_DEFS                      = $(TEMPLATE_BLDPROG_DEFS)                      $(TEMPLATE_XPCOMEXE_DEFS)
     128TEMPLATE_XPCOMBLDPROG_DEFS.$(BUILD_TARGET)      = $(TEMPLATE_BLDPROG_DEFS.$(BUILD_TARGET))      $(TEMPLATE_XPCOMEXE_DEFS.$(BUILD_TARGET))
     129TEMPLATE_XPCOMBLDPROG_DEFS.$(BUILD_TARGET_ARCH) = $(TEMPLATE_BLDPROG_DEFS.$(BUILD_TARGET_ARCH)) $(TEMPLATE_XPCOMEXE_DEFS.$(BUILD_TARGET_ARCH))
     130TEMPLATE_XPCOMBLDPROG_CXXFLAGS          = -ansi -Wall -Wno-non-virtual-dtor
     131TEMPLATE_XPCOMBLDPROG_CXXFLAGS.linux    = -pthread
     132TEMPLATE_XPCOMBLDPROG_CXXFLAGS.release  = -O
     133TEMPLATE_XPCOMBLDPROG_CXXFLAGS.profile  = -O
     134TEMPLATE_XPCOMBLDPROG_CFLAGS            = -pipe -ansi -Wall -Wno-unused
     135TEMPLATE_XPCOMBLDPROG_CFLAGS.linux      = -pthread
     136TEMPLATE_XPCOMBLDPROG_CFLAGS.release    = -O
     137TEMPLATE_XPCOMBLDPROG_CFLAGS.profile    = -O
     138TEMPLATE_XPCOMBLDPROG_INCS              = $(PATH_BIN)/sdk/include \
     139                                          $(PATH_BIN)/sdk/include/xpcom \
     140                                          $(PATH_BIN)/sdk/include/xpcom/nsprpub \
     141                                          $(PATH_BIN)/sdk/include/xpcom/string \
     142                                          $(PATH_BIN)/sdk/include/xpcom/xpcom \
     143                                          $(PATH_BIN)/sdk/include/xpcom/ipcd
     144TEMPLATE_XPCOMBLDPROG_ORDERDEPS         = $(TEMPLATE_XPCOM_ORDERDEPS)
     145
     146
     147#
     148# Header installs.
     149#
     150INSTALLS = \
     151        NSPRPUB-HEADERS \
     152        NSPRPUB-MD-HEADERS \
     153        NSPRPUB-OBS-HEADERS \
     154        NSPRPUB-PRIV-HEADERS \
     155        STRING-HEADERS \
     156        XPCOM-HEADERS \
     157        IPCD-HEADERS
     158
     159#
     160# The IDL compiler and typelib linker.
    170161#
    171162BLDPROGS = \
     
    174165
    175166#
    176 # We build several libraries so that the Win32 linker command line
    177 # length limit will not be hit
     167# We build several libraries so that any linker command line
     168# length restrictions limit will be avoided. (Solaris, Mac?)
    178169#
    179170LIBRARIES = \
     
    225216#   tstTestPermanentAtoms
    226217endif # VBOX_WITH_TESTCASES
    227 PROGRAMS.linux = VBoxXPCOMIPCD
     218PROGRAMS += VBoxXPCOMIPCD
    228219
    229220OTHERS = \
    230         $(PATH_BIN)/VBoxXPCOMBase.xpt 
     221        $(PATH_BIN)/VBoxXPCOMBase.xpt
    231222
    232223OTHER_CLEAN = \
     
    235226        $(PATH_BIN)/VBoxXPCOMBase.xpt
    236227
    237 #
    238 # defines for all libraries. Unfortunately, a global DEFS
    239 # statement doesn't appear to work
    240 #
    241 # r=bird: Yes, it DOES work. It just depends on when config.kmk is included and += vs =.
    242 XPCOMDEFS = \
    243         HAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 \
    244         HAVE_VISIBILITY_PRAGMA=1 \
    245         _LARGEFILE64_SOURCE=1 \
    246         HAVE_FCNTL_FILE_LOCKING=1 \
    247         HAVE_LCHOWN=1 \
    248         HAVE_STRERROR=1 \
    249         _REENTRANT=1 \
    250         FORCE_PR_LOG \
    251         HAVE_CVAR_BUILT_ON_SEM \
    252         _NSPR_BUILD_
    253 XPCOMDEFS.linux = \
    254         _POSIX_SOURCE=1 \
    255         _BSD_SOURCE=1 \
    256         _SVID_SOURCE=1 \
    257         LINUX=1 \
    258         i386=1 \
    259         _PR_PTHREADS
    260 # _BSD_SOURCE is here to keep the Glibc header files happy and make them include the right things
    261 XPCOMDEFS.l4 = \
    262         L4=1 \
    263         _POSIX_SOURCE=1 \
    264         _BSD_SOURCE=1 \
    265         i386=1
    266 
    267 # The IDL compiler. We build it statically because we cannot
    268 # rely on additional .a files like in the original build
    269 xpidl_TEMPLATE = XPCOMLINUX
     228
     229
     230#
     231# SDK headers - lot's of files to install...
     232#
     233# Tip: If you are going to remove files here, you might
     234#      wish to do a `kmk uninstall' first to avoid have
     235#      obsoleted files in the $(INST_SDK) directory.
     236#
     237
     238NSPRPUB-HEADERS_INST = $(INST_SDK)/include/xpcom/nsprpub/
     239NSPRPUB-HEADERS_IFFLAGS = -p -m 644
     240NSPRPUB-HEADERS_SOURCES = \
     241        nsprpub/pr/include/nspr.h \
     242        nsprpub/lib/ds/plarena.h \
     243        nsprpub/lib/ds/plarenas.h \
     244        nsprpub/lib/libc/include/plbase64.h \
     245        nsprpub/lib/libc/include/plerror.h \
     246        nsprpub/lib/libc/include/plgetopt.h \
     247        nsprpub/lib/ds/plhash.h \
     248        nsprpub/lib/libc/include/plresolv.h \
     249        nsprpub/lib/libc/include/plstr.h \
     250        nsprpub/pr/include/pratom.h \
     251        nsprpub/pr/include/prbit.h \
     252        nsprpub/pr/include/prclist.h \
     253        nsprpub/pr/include/prcmon.h \
     254        nsprpub/pr/include/prcountr.h \
     255        nsprpub/pr/include/prcvar.h \
     256        nsprpub/pr/include/prdtoa.h \
     257        nsprpub/pr/include/prenv.h \
     258        nsprpub/pr/include/prerr.h \
     259        nsprpub/pr/include/prerror.h \
     260        nsprpub/pr/include/prinet.h \
     261        nsprpub/pr/include/prinit.h \
     262        nsprpub/pr/include/prinrval.h \
     263        nsprpub/pr/include/prio.h \
     264        nsprpub/pr/include/pripcsem.h \
     265        nsprpub/pr/include/prlink.h \
     266        nsprpub/pr/include/prlock.h \
     267        nsprpub/pr/include/prlog.h \
     268        nsprpub/pr/include/prlong.h \
     269        nsprpub/pr/include/prmem.h \
     270        nsprpub/pr/include/prmon.h \
     271        nsprpub/pr/include/prmwait.h \
     272        nsprpub/pr/include/prnetdb.h \
     273        nsprpub/pr/include/prolock.h \
     274        nsprpub/pr/include/prpdce.h \
     275        nsprpub/pr/include/prprf.h \
     276        nsprpub/pr/include/prproces.h \
     277        nsprpub/pr/include/prrng.h \
     278        nsprpub/pr/include/prrwlock.h \
     279        nsprpub/pr/include/prshm.h \
     280        nsprpub/pr/include/prshma.h \
     281        nsprpub/pr/include/prsystem.h \
     282        nsprpub/pr/include/prthread.h \
     283        nsprpub/pr/include/prtime.h \
     284        nsprpub/pr/include/prtpool.h \
     285        nsprpub/pr/include/prtrace.h \
     286        nsprpub/pr/include/prtypes.h \
     287        nsprpub/pr/include/prvrsion.h \
     288        nsprpub/pr/include/prwin16.h \
     289        nsprpub/pr/include/md/_vbox.cfg=>prcpucfg.h \
     290
     291NSPRPUB-MD-HEADERS_INST = $(INST_SDK)/include/xpcom/nsprpub/md
     292NSPRPUB-MD-HEADERS_IFFLAGS = -p -m 644
     293NSPRPUB-MD-HEADERS_SOURCES = \
     294        nsprpub/pr/include/md/_darwin.h \
     295        nsprpub/pr/include/md/_freebsd.h \
     296        nsprpub/pr/include/md/_l4v2.h \
     297        nsprpub/pr/include/md/_linux.h \
     298        nsprpub/pr/include/md/_macos.h \
     299        nsprpub/pr/include/md/_netbsd.h \
     300        nsprpub/pr/include/md/_openbsd.h \
     301        nsprpub/pr/include/md/_os2.h \
     302        nsprpub/pr/include/md/_solaris.h \
     303        nsprpub/pr/include/md/_unix_errors.h \
     304        nsprpub/pr/include/md/_unixos.h \
     305        nsprpub/pr/include/md/_pth.h \
     306        nsprpub/pr/include/md/prosdep.h \
     307        \
     308        nsprpub/pr/include/md/_freebsd.cfg \
     309        nsprpub/pr/include/md/_linux.cfg \
     310        nsprpub/pr/include/md/_darwin.cfg \
     311        nsprpub/pr/include/md/_netbsd.cfg \
     312        nsprpub/pr/include/md/_openbsd.cfg \
     313        nsprpub/pr/include/md/_os2.cfg \
     314        nsprpub/pr/include/md/_solaris32.cfg \
     315        nsprpub/pr/include/md/_solaris64.cfg \
     316        nsprpub/pr/include/md/_l4v2.cfg
     317
     318NSPRPUB-OBS-HEADERS_INST = $(INST_SDK)/include/xpcom/nsprpub/obsolete
     319NSPRPUB-OBS-HEADERS_IFFLAGS = -p -m 644
     320NSPRPUB-OBS-HEADERS_SOURCES = \
     321        nsprpub/pr/include/obsolete/pralarm.h \
     322        nsprpub/pr/include/obsolete/probslet.h \
     323        nsprpub/pr/include/obsolete/protypes.h \
     324        nsprpub/pr/include/obsolete/prsem.h
     325
     326NSPRPUB-PRIV-HEADERS_INST = $(INST_SDK)/include/xpcom/nsprpub/private
     327NSPRPUB-PRIV-HEADERS_IFFLAGS = -p -m 644
     328NSPRPUB-PRIV-HEADERS_SOURCES = \
     329        nsprpub/pr/include/private/pprio.h \
     330        nsprpub/pr/include/private/pprthred.h \
     331        nsprpub/pr/include/private/prpriv.h
     332
     333STRING-HEADERS_INST = $(INST_SDK)/include/xpcom/string
     334STRING-HEADERS_IFFLAGS = -p -m 644
     335STRING-HEADERS_SOURCES = \
     336        xpcom/string/public/nsAString.h \
     337        xpcom/string/public/nsAlgorithm.h \
     338        xpcom/string/public/nsCharTraits.h \
     339        xpcom/string/public/nsDependentString.h \
     340        xpcom/string/public/nsDependentSubstring.h \
     341        xpcom/string/public/nsEmbedString.h \
     342        xpcom/string/public/nsLiteralString.h \
     343        xpcom/string/public/nsObsoleteAString.h \
     344        xpcom/string/public/nsPrintfCString.h \
     345        xpcom/string/public/nsPromiseFlatString.h \
     346        xpcom/string/public/nsReadableUtils.h \
     347        xpcom/string/public/nsString.h \
     348        xpcom/string/public/nsStringAPI.h \
     349        xpcom/string/public/nsStringFwd.h \
     350        xpcom/string/public/nsStringIterator.h \
     351        xpcom/string/public/nsSubstring.h \
     352        xpcom/string/public/nsSubstringTuple.h \
     353        xpcom/string/public/nsTAString.h \
     354        xpcom/string/public/nsTDependentString.h \
     355        xpcom/string/public/nsTDependentSubstring.h \
     356        xpcom/string/public/nsTObsoleteAString.h \
     357        xpcom/string/public/nsTPromiseFlatString.h \
     358        xpcom/string/public/nsTString.h \
     359        xpcom/string/public/nsTSubstring.h \
     360        xpcom/string/public/nsTSubstringTuple.h \
     361        xpcom/string/public/nsUTF8Utils.h \
     362        xpcom/string/public/nsXPIDLString.h \
     363        xpcom/string/public/string-template-def-char.h \
     364        xpcom/string/public/string-template-def-unichar.h \
     365        xpcom/string/public/string-template-undef.h
     366
     367XPCOM-HEADERS_INST = $(INST_SDK)/include/xpcom/xpcom
     368XPCOM-HEADERS_IFFLAGS = -p -m 644
     369XPCOM-HEADERS_SOURCES = \
     370        xpcom/base/nsAgg.h \
     371        xpcom/io/nsAppDirectoryServiceDefs.h \
     372        xpcom/ds/nsArray.h \
     373        xpcom/ds/nsArrayEnumerator.h \
     374        xpcom/ds/nsAtomService.h \
     375        xpcom/ds/nsAutoBuffer.h \
     376        xpcom/threads/nsAutoLock.h \
     377        xpcom/base/nsAutoPtr.h \
     378        xpcom/ds/nsBaseHashtable.h \
     379        xpcom/ds/nsCOMArray.h \
     380        xpcom/glue/nsCOMPtr.h \
     381        xpcom/ds/nsCRT.h \
     382        xpcom/components/nsCategoryManagerUtils.h \
     383        xpcom/ds/nsCheapSets.h \
     384        xpcom/ds/nsClassHashtable.h \
     385        xpcom/base/nsCom.h \
     386        xpcom/components/nsComponentManagerObsolete.h \
     387        xpcom/components/nsComponentManagerUtils.h \
     388        xpcom/ds/nsCppSharedAllocator.h \
     389        xpcom/ds/nsDataHashtable.h \
     390        xpcom/glue/nsDebug.h \
     391        xpcom/base/nsDebugImpl.h \
     392        xpcom/ds/nsDeque.h \
     393        xpcom/io/nsDirectoryService.h \
     394        xpcom/io/nsDirectoryServiceDefs.h \
     395        xpcom/io/nsDirectoryServiceUtils.h \
     396        xpcom/ds/nsDoubleHashtable.h \
     397        xpcom/ds/nsEnumeratorUtils.h \
     398        xpcom/base/nsError.h \
     399        xpcom/io/nsEscape.h \
     400        xpcom/threads/nsEventQueueUtils.h \
     401        xpcom/io/nsFastLoadPtr.h \
     402        xpcom/io/nsFastLoadService.h \
     403        xpcom/ds/nsFixedSizeAllocator.h \
     404        xpcom/glue/nsGenericFactory.h \
     405        xpcom/ds/nsHashKeys.h \
     406        xpcom/ds/nsHashSets.h \
     407        xpcom/ds/nsHashtable.h \
     408        xpcom/base/nsIAllocator.h \
     409        xpcom/ds/nsIByteBuffer.h \
     410        xpcom/base/nsID.h \
     411        xpcom/glue/nsIGenericFactory.h \
     412        xpcom/base/nsIID.h \
     413        xpcom/glue/nsIInterfaceRequestorUtils.h \
     414        xpcom/components/nsIServiceManagerObsolete.h \
     415        xpcom/components/nsIServiceManagerUtils.h \
     416        xpcom/base/nsISupportsBase.h \
     417        xpcom/glue/nsISupportsImpl.h \
     418        xpcom/base/nsISupportsObsolete.h \
     419        xpcom/glue/nsISupportsUtils.h \
     420        xpcom/ds/nsIUnicharBuffer.h \
     421        xpcom/io/nsIUnicharInputStream.h \
     422        xpcom/glue/nsIWeakReferenceUtils.h \
     423        xpcom/ds/nsInt64.h \
     424        xpcom/ds/nsInterfaceHashtable.h \
     425        xpcom/io/nsLinebreakConverter.h \
     426        xpcom/io/nsLocalFile.h \
     427        xpcom/io/nsLocalFileUnix.h \
     428        xpcom/io/nsLocalFileOS2.h \
     429        xpcom/io/nsLocalFileOSX.h \
     430        xpcom/glue/nsMemory.h \
     431        xpcom/components/nsModule.h \
     432        xpcom/io/nsMultiplexInputStream.h \
     433        xpcom/io/nsNativeCharsetUtils.h \
     434        xpcom/components/nsNativeComponentLoader.h \
     435        xpcom/ds/nsObserverService.h \
     436        xpcom/components/nsObsoleteModuleLoading.h \
     437        xpcom/threads/nsProcess.h \
     438        xpcom/proxy/public/nsProxiedService.h \
     439        xpcom/proxy/public/nsProxyEvent.h \
     440        xpcom/proxy/public/nsProxyRelease.h \
     441        xpcom/ds/nsQuickSort.h \
     442        xpcom/ds/nsRecyclingAllocator.h \
     443        xpcom/ds/nsRefPtrHashtable.h \
     444        xpcom/io/nsScriptableInputStream.h \
     445        xpcom/ds/nsStaticAtom.h \
     446        xpcom/components/nsStaticComponent.h \
     447        xpcom/ds/nsStaticNameTable.h \
     448        xpcom/io/nsStorageStream.h \
     449        xpcom/io/nsStreamUtils.h \
     450        xpcom/ds/nsStringEnumerator.h \
     451        xpcom/io/nsStringIO.h \
     452        xpcom/io/nsStringStream.h \
     453        xpcom/ds/nsSupportsArray.h \
     454        xpcom/ds/nsSupportsPrimitives.h \
     455        xpcom/ds/nsTHashtable.h \
     456        xpcom/ds/nsTextFormatter.h \
     457        xpcom/ds/nsTime.h \
     458        xpcom/glue/nsTraceRefcnt.h \
     459        xpcom/base/nsTraceRefcntImpl.h \
     460        xpcom/ds/nsUnitConversion.h \
     461        xpcom/ds/nsValueArray.h \
     462        xpcom/ds/nsVariant.h \
     463        xpcom/ds/nsVoidArray.h \
     464        xpcom/base/nsWeakPtr.h \
     465        xpcom/glue/nsWeakReference.h \
     466        xpcom/build/nsXPCOM.h \
     467        xpcom/build/nsXPCOMCID.h \
     468        xpcom/glue/standalone/nsXPCOMGlue.h \
     469        xpcom/base/nscore.h \
     470        xpcom/ds/pldhash.h \
     471        xpcom/threads/plevent.h \
     472        xpcom/components/xcDll.h \
     473        xpcom/typelib/xpt/public/xpt_arena.h \
     474        xpcom/typelib/xpt/public/xpt_struct.h \
     475        xpcom/typelib/xpt/public/xpt_xdr.h \
     476        xpcom/reflect/xptcall/public/xptcall.h \
     477        xpcom/reflect/xptcall/public/xptcstubsdecl.inc \
     478        xpcom/reflect/xptcall/public/xptcstubsdef.inc \
     479        xpcom/reflect/xptinfo/public/xptinfo.h \
     480        xpcom-config.h
     481
     482IPCD-HEADERS_INST = $(INST_SDK)/include/xpcom/ipcd
     483IPCD-HEADERS_IFFLAGS = -p -m 644
     484IPCD-HEADERS_SOURCES = \
     485        ipc/ipcd/client/public/ipcCID.h \
     486        ipc/ipcd/extensions/lock/public/ipcLockCID.h \
     487        ipc/ipcd/util/public/ipcMessageReader.h \
     488        ipc/ipcd/util/public/ipcMessageWriter.h \
     489        ipc/ipcd/daemon/public/ipcModule.h \
     490        ipc/ipcd/daemon/public/ipcModuleUtil.h \
     491        ipc/ipcd/client/public/ipcdclient.h
     492
     493
     494#
     495# The IDL compiler.
     496#
     497# We build it statically because we cannot rely on additional .a files
     498# like in the original build
     499#
     500xpidl_TEMPLATE = XPCOMBLDPROG
    270501xpidl_DEFS = EXPORT_XPT_API
     502## @todo This assumes HOST == TARGET.
    271503xpidl_INST = bin/ $(INST_SDK)/bin/
    272504xpidl_SOURCES = \
     
    281513        xpcom/typelib/xpt/src/xpt_struct.c \
    282514        xpcom/typelib/xpt/src/xpt_xdr.c
    283 # This will, because this is the very first target built, cause the headers
    284 # to be installed.
    285 xpidl_DEPS = \
    286         $(PATH_BIN)/sdk/include/xpcom/.keep
    287515
    288516# We do these ONCE.
     
    295523        $(libIDL_config_libs)
    296524
    297 # XPT linker
    298 xpt_link_TEMPLATE = XPCOMLINUX
     525#
     526# The XPT linker.
     527#
     528xpt_link_TEMPLATE = XPCOMBLDPROG
    299529xpt_link_SOURCES = \
    300530        xpcom/typelib/xpt/tools/xpt_link.c \
    301         xpcom/typelib/xpt/src/xpt_arena.c \
     531        xpcom/typelib/xpt/src/xpt_arena.c \
    302532        xpcom/typelib/xpt/src/xpt_struct.c \
    303533        xpcom/typelib/xpt/src/xpt_xdr.c
    304534
     535
     536#
     537# The NSPR Library.
     538#
    305539VBox-xpcom-nspr_TEMPLATE   = XPCOM
    306 VBox-xpcom-nspr_DEFS       = $(XPCOMDEFS)
    307 VBox-xpcom-nspr_DEFS.linux = $(XPCOMDEFS.linux)
    308 VBox-xpcom-nspr_DEFS.l4    = $(XPCOMDEFS.l4)
     540VBox-xpcom-nspr_NOINST     = 1
     541VBox-xpcom-nspr_DEFS       = \
     542        _NSPR_BUILD_ \
     543        HAVE_LCHOWN=1 \
     544        HAVE_STRERROR=1 \
     545        FORCE_PR_LOG
     546VBox-xpcom-nspr_DEFS.darwin = \
     547        HAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 \
     548        HAVE_BSD_FLOCK=1 \
     549        _PR_PTHREADS
     550VBox-xpcom-nspr_DEFS.freebsd = \
     551        HAVE_CVAR_BUILT_ON_SEM \
     552        _PR_PTHREADS
     553# FIXME: LINUX should be defined by _linux.cfg
     554VBox-xpcom-nspr_DEFS.linux = \
     555        LINUX=1 \
     556        _POSIX_SOURCE=1 \
     557        _BSD_SOURCE=1 \
     558        _SVID_SOURCE=1 \
     559        _REENTRANT=1 \
     560        _LARGEFILE64_SOURCE=1 \
     561        HAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 \
     562        HAVE_VISIBILITY_PRAGMA=1 \
     563        HAVE_FCNTL_FILE_LOCKING=1 \
     564        HAVE_CVAR_BUILT_ON_SEM \
     565        _PR_PTHREADS
     566# _BSD_SOURCE is here to keep the Glibc header files happy and make them include the right things
     567# FIXME: L4 should be defined by _linux.cfg
     568VBox-xpcom-nspr_DEFS.l4 = \
     569        L4=1 \
     570        _REENTRANT=1 \
     571        _LARGEFILE64_SOURCE=1 \
     572        _POSIX_SOURCE=1 \
     573        _BSD_SOURCE=1 \
     574        HAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 \
     575        HAVE_VISIBILITY_PRAGMA=1 \
     576        HAVE_FCNTL_FILE_LOCKING=1 \
     577        HAVE_CVAR_BUILT_ON_SEM
     578VBox-xpcom-nspr_DEFS.netbsd = \
     579        _PR_PTHREADS
     580VBox-xpcom-nspr_DEFS.openbsd = \
     581        _PR_PTHREADS
     582VBox-xpcom-nspr_DEFS.os2 =
     583VBox-xpcom-nspr_DEFS.solaris = \
     584        _PR_PTHREADS
     585VBox-xpcom-nspr_DEFS.x86   = i386=1
     586VBox-xpcom-nspr_DEFS.amd64 = i386=1
    309587VBox-xpcom-nspr_DEFS.debug = NDEBUG
    310588VBox-xpcom-nspr_INCS = \
    311589        nsprpub/pr/include/private \
    312590        $(PATH_TARGET)/VBox-xpcom-nspr
    313 VBoxXPCOM_LIBS.l4 = $(L4_LIBDIR)/libxpcomstubs.a $(L4_LIBDIR)/../libuc_c++.a \
    314     $(VBOX_PATH_L4_GCC3_INSTALL)/libsupc++.a $(VBOX_PATH_L4_GCC3_INSTALL)/libgcc_eh.a
     591
    315592VBox-xpcom-nspr_SOURCES  = \
    316593        nsprpub/pr/src/io/prfdcach.c \
     
    375652        nsprpub/lib/libc/src/plgetopt.c
    376653
    377 VBox-xpcom-nspr_SOURCES.linux  = \
     654VBox-xpcom-nspr_SOURCES.darwin  = \
    378655        nsprpub/pr/src/md/unix/unix.c \
    379656        nsprpub/pr/src/md/unix/unix_errors.c \
     
    382659        nsprpub/pr/src/md/unix/uxshm.c \
    383660        nsprpub/pr/src/md/unix/uxwrap.c \
    384         nsprpub/pr/src/md/unix/linux.c \
     661        nsprpub/pr/src/md/unix/darwin.c \
    385662        nsprpub/pr/src/pthreads/ptio.c \
    386663        nsprpub/pr/src/pthreads/ptsynch.c \
    387664        nsprpub/pr/src/pthreads/ptthread.c \
    388665        nsprpub/pr/src/pthreads/ptmisc.c
    389 
    390 # L4 is ok with os_Linux_x86.
    391 VBox-xpcom-nspr_SOURCES.x86 = nsprpub/pr/src/md/unix/os_Linux_x86.s
    392 VBox-xpcom-nspr_SOURCES.amd64 = nsprpub/pr/src/md/unix/os_Linux_x86_64.s
     666VBox-xpcom-nspr_SOURCES.darwin.x86 = nsprpub/pr/src/md/unix/os_Darwin_x86.s
    393667
    394668VBox-xpcom-nspr_SOURCES.l4  = \
     
    413687#   nsprpub/pr/src/md/l4env/prnetdb.c \
    414688#   nsprpub/pr/src/md/l4env/threads.c
     689VBox-xpcom-nspr_SOURCES.l4.x86 = nsprpub/pr/src/md/unix/os_Linux_x86.s
     690VBox-xpcom-nspr_SOURCES.l4.amd64 = nsprpub/pr/src/md/unix/os_Linux_x86_64.s
     691
     692VBox-xpcom-nspr_SOURCES.linux  = \
     693        nsprpub/pr/src/md/unix/unix.c \
     694        nsprpub/pr/src/md/unix/unix_errors.c \
     695        nsprpub/pr/src/md/unix/uxproces.c \
     696        nsprpub/pr/src/md/unix/uxrng.c \
     697        nsprpub/pr/src/md/unix/uxshm.c \
     698        nsprpub/pr/src/md/unix/uxwrap.c \
     699        nsprpub/pr/src/md/unix/linux.c \
     700        nsprpub/pr/src/pthreads/ptio.c \
     701        nsprpub/pr/src/pthreads/ptsynch.c \
     702        nsprpub/pr/src/pthreads/ptthread.c \
     703        nsprpub/pr/src/pthreads/ptmisc.c
     704VBox-xpcom-nspr_SOURCES.linux.x86 = nsprpub/pr/src/md/unix/os_Linux_x86.s
     705VBox-xpcom-nspr_SOURCES.linux.amd64 = nsprpub/pr/src/md/unix/os_Linux_x86_64.s
     706
    415707
    416708nsprpub/pr/src/linking/prlink.c_DEFS = _GNU_SOURCE
    417709nsprpub/pr/src/prvrsion.c_DEPS = $(PATH_VBox-xpcom-nspr)/_pr_bld.h
    418710nsprpub/lib/ds/plvrsion.c_DEPS = $(PATH_VBox-xpcom-nspr)/_pl_bld.h
     711
     712
     713VBox-xpcom-typelib_TEMPLATE = XPCOM
     714VBox-xpcom-typelib_NOINST   = 1
     715VBox-xpcom-typelib_SOURCES = \
     716        xpcom/typelib/xpt/src/xpt_arena.c \
     717        xpcom/typelib/xpt/src/xpt_struct.c \
     718        xpcom/typelib/xpt/src/xpt_xdr.c
     719
     720VBox-xpcom-string_TEMPLATE = XPCOM
     721VBox-xpcom-string_NOINST = 1
     722VBox-xpcom-string_DEFS = _IMPL_NS_COM
     723VBox-xpcom-string_SOURCES = \
     724        xpcom/string/src/nsAString.cpp \
     725        xpcom/string/src/nsDependentSubstring.cpp \
     726        xpcom/string/src/nsObsoleteAStringThunk.cpp \
     727        xpcom/string/src/nsPrintfCString.cpp \
     728        xpcom/string/src/nsPromiseFlatString.cpp \
     729        xpcom/string/src/nsReadableUtils.cpp \
     730        xpcom/string/src/nsSubstring.cpp \
     731        xpcom/string/src/nsSubstringTuple.cpp \
     732        xpcom/string/src/nsString.cpp \
     733        xpcom/string/src/nsStringComparator.cpp \
     734        xpcom/string/src/nsStringObsolete.cpp
     735
     736VBox-xpcom-base_TEMPLATE = XPCOM
     737VBox-xpcom-base_NOINST = 1
     738VBox-xpcom-base_SOURCES = \
     739        xpcom/base/nsAllocator.cpp \
     740        xpcom/base/nsConsoleMessage.cpp \
     741        xpcom/base/nsConsoleService.cpp \
     742        xpcom/base/nsDebugImpl.cpp \
     743        xpcom/base/nsErrorService.cpp \
     744        xpcom/base/nsExceptionService.cpp \
     745        xpcom/base/nsID.cpp \
     746        xpcom/base/nsMemoryImpl.cpp \
     747        xpcom/base/nsTraceRefcntImpl.cpp \
     748        xpcom/base/nsStackFrameUnix.cpp
     749
     750VBox-xpcom-ds_TEMPLATE = XPCOM
     751VBox-xpcom-ds_NOINST = 1
     752VBox-xpcom-ds_SOURCES = \
     753        xpcom/ds/pldhash.c \
     754        xpcom/ds/nsAtomTable.cpp \
     755        xpcom/ds/nsAtomService.cpp \
     756        xpcom/ds/nsByteBuffer.cpp \
     757        xpcom/ds/nsCheapSets.cpp \
     758        xpcom/ds/nsCRT.cpp \
     759        xpcom/ds/nsDeque.cpp \
     760        xpcom/ds/nsEmptyEnumerator.cpp \
     761        xpcom/ds/nsEnumeratorUtils.cpp \
     762        xpcom/ds/nsFixedSizeAllocator.cpp \
     763        xpcom/ds/nsHashSets.cpp \
     764        xpcom/ds/nsHashtable.cpp \
     765        xpcom/ds/nsObserverList.cpp \
     766        xpcom/ds/nsObserverService.cpp \
     767        xpcom/ds/nsProperties.cpp \
     768        xpcom/ds/nsPersistentProperties.cpp \
     769        xpcom/ds/nsQuickSort.cpp \
     770        xpcom/ds/nsRecyclingAllocator.cpp \
     771        xpcom/ds/nsStaticNameTable.cpp \
     772        xpcom/ds/nsStringEnumerator.cpp \
     773        xpcom/ds/nsSupportsArray.cpp \
     774        xpcom/ds/nsSupportsArrayEnumerator.cpp \
     775        xpcom/ds/nsSupportsPrimitives.cpp \
     776        xpcom/ds/nsTHashtable.cpp \
     777        xpcom/ds/nsUnicharBuffer.cpp \
     778        xpcom/ds/nsVariant.cpp \
     779        xpcom/ds/nsVoidArray.cpp \
     780        xpcom/ds/nsTextFormatter.cpp \
     781        xpcom/ds/nsTimelineService.cpp \
     782        xpcom/ds/nsValueArray.cpp \
     783        xpcom/ds/nsCOMArray.cpp \
     784        xpcom/ds/nsArray.cpp \
     785        xpcom/ds/nsArrayEnumerator.cpp
     786#   xpcom/ds/nsHashPropertyBag.cpp
     787
     788# @todo what about MOZ_USER_DIR?
     789VBox-xpcom-io_TEMPLATE = XPCOM
     790VBox-xpcom-io_NOINST = 1
     791VBox-xpcom-io_DEFS = MOZ_USER_DIR=\".mozilla\"
     792VBox-xpcom-io_INCS.darwin = \
     793        xpcom/MoreFiles
     794VBox-xpcom-io_SOURCES = \
     795        xpcom/io/nsAppFileLocationProvider.cpp \
     796        xpcom/io/nsBinaryStream.cpp \
     797        xpcom/io/nsByteArrayInputStream.cpp \
     798        xpcom/io/nsDirectoryService.cpp \
     799        xpcom/io/nsEscape.cpp \
     800        xpcom/io/nsFastLoadFile.cpp \
     801        xpcom/io/nsFastLoadService.cpp \
     802        xpcom/io/nsInputStreamTee.cpp \
     803        xpcom/io/nsLinebreakConverter.cpp \
     804        xpcom/io/nsLocalFileCommon.cpp \
     805        xpcom/io/nsMultiplexInputStream.cpp \
     806        xpcom/io/nsPipe3.cpp \
     807        xpcom/io/nsStreamUtils.cpp \
     808        xpcom/io/nsScriptableInputStream.cpp \
     809        xpcom/io/nsSegmentedBuffer.cpp \
     810        xpcom/io/SpecialSystemDirectory.cpp \
     811        xpcom/io/nsStorageStream.cpp \
     812        xpcom/io/nsStringStream.cpp \
     813        xpcom/io/nsUnicharInputStream.cpp \
     814        xpcom/io/nsNativeCharsetUtils.cpp
     815VBox-xpcom-io_SOURCES.darwin = \
     816        xpcom/io/nsLocalFileOSX.cpp \
     817        xpcom/MoreFiles/FSCopyObject.c \
     818        xpcom/MoreFiles/MoreFilesX.c
     819VBox-xpcom-io_SOURCES.l4 = \
     820        xpcom/io/nsLocalFileL4.cpp
     821ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),)
     822VBox-xpcom-io_SOURCES += \
     823        xpcom/io/nsLocalFileUnix.cpp
     824endif
     825VBox-xpcom-io_SOURCES.os2 = \
     826        xpcom/io/nsLocalFileOS2.cpp
     827
     828VBox-xpcom-components_TEMPLATE = XPCOM
     829VBox-xpcom-components_NOINST = 1
     830VBox-xpcom-components_DEFS = EXPORT_XPTI_API
     831VBox-xpcom-components_SOURCES = \
     832        xpcom/components/nsCategoryManager.cpp \
     833        xpcom/components/nsComponentManager.cpp \
     834        xpcom/components/nsComponentManagerObsolete.cpp \
     835        xpcom/components/nsNativeComponentLoader.cpp \
     836        xpcom/components/nsServiceManagerObsolete.cpp \
     837        xpcom/components/xcDll.cpp \
     838        xpcom/components/nsStaticComponentLoader.cpp
     839
     840VBox-xpcom-threads_TEMPLATE = XPCOM
     841VBox-xpcom-threads_NOINST = 1
     842VBox-xpcom-threads_SOURCES = \
     843        xpcom/threads/plevent.c \
     844        xpcom/threads/nsAutoLock.cpp \
     845        xpcom/threads/nsEnvironment.cpp \
     846        xpcom/threads/nsEventQueue.cpp \
     847        xpcom/threads/nsEventQueueService.cpp \
     848        xpcom/threads/nsThread.cpp \
     849        xpcom/threads/nsTimerImpl.cpp \
     850        xpcom/threads/nsProcessCommon.cpp \
     851        xpcom/threads/TimerThread.cpp
     852
     853VBox-xpcom-xptinfo_TEMPLATE = XPCOM
     854VBox-xpcom-xptinfo_NOINST = 1
     855VBox-xpcom-xptinfo_DEFS = EXPORT_XPTI_API
     856VBox-xpcom-xptinfo_SOURCES = \
     857        xpcom/reflect/xptinfo/src/xptiFile.cpp \
     858        xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp \
     859        xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp \
     860        xpcom/reflect/xptinfo/src/xptiManifest.cpp \
     861        xpcom/reflect/xptinfo/src/xptiMisc.cpp \
     862        xpcom/reflect/xptinfo/src/xptiTypelibGuts.cpp \
     863        xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp \
     864        xpcom/reflect/xptinfo/src/xptiZipItem.cpp \
     865        xpcom/reflect/xptinfo/src/xptiZipLoader.cpp
     866
     867
     868VBox-xpcom-xptcall_TEMPLATE = XPCOM
     869VBox-xpcom-xptcall_NOINST = 1
     870VBox-xpcom-xptcall_DEFS                = EXPORT_XPTC_API
     871VBox-xpcom-xptcall_DEFS.darwin         = KEEP_STACK_16_BYTE_ALIGNED
     872VBox-xpcom-xptcall_DEFS.l4             = L4
     873VBox-xpcom-xptcall_SOURCES             = xpcom/reflect/xptcall/src/xptcall.cpp
     874VBox-xpcom-xptcall_SOURCES.darwin.x86  = xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp \
     875                                         xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp
     876VBox-xpcom-xptcall_SOURCES.linux.x86   = xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp \
     877                                         xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
     878VBox-xpcom-xptcall_SOURCES.linux.amd64 = xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp \
     879                                         xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
     880
     881VBox-xpcom-proxy_TEMPLATE = XPCOM
     882VBox-xpcom-proxy_NOINST   = 1
     883VBox-xpcom-proxy_SOURCES  = xpcom/proxy/src/nsProxyEvent.cpp \
     884                            xpcom/proxy/src/nsProxyEventClass.cpp \
     885                            xpcom/proxy/src/nsProxyEventObject.cpp \
     886                            xpcom/proxy/src/nsProxyObjectManager.cpp \
     887                            xpcom/proxy/src/nsProxyRelease.cpp
     888
     889# glue library which all client apps will link with
     890VBoxXPCOMGlue_TEMPLATE = XPCOM
     891VBoxXPCOMGlue_DEFS     = XPCOM_GLUE
     892VBoxXPCOMGlue_SOURCES  = xpcom/glue/nsCOMPtr.cpp \
     893                         xpcom/glue/nsComponentManagerUtils.cpp \
     894                         xpcom/glue/nsDebug.cpp \
     895                         xpcom/glue/nsGenericFactory.cpp \
     896                         xpcom/glue/nsIInterfaceRequestorUtils.cpp \
     897                         xpcom/glue/nsMemory.cpp \
     898                         xpcom/glue/nsTraceRefcnt.cpp \
     899                         xpcom/glue/nsWeakReference.cpp \
     900                         xpcom/glue/standalone/nsXPCOMGlue.cpp \
     901                         xpcom/glue/standalone/nsGREDirServiceProvider.cpp
     902VBoxXPCOMGlue_INST     = lib/ $(INST_SDK)/lib/
     903
     904
     905#
     906# The VBoxXPCOM Shared Object, assembling all lib files.
     907#
     908VBoxXPCOM_TEMPLATE = XPCOM
     909VBoxXPCOM_DEFS = BUILD_DCONNECT="1"
     910VBoxXPCOM_SOURCES = \
     911        xpcom/glue/nsCOMPtr.cpp \
     912        xpcom/glue/nsComponentManagerUtils.cpp \
     913        xpcom/glue/nsDebug.cpp \
     914        xpcom/glue/nsGenericFactory.cpp \
     915        xpcom/glue/nsIInterfaceRequestorUtils.cpp \
     916        xpcom/glue/nsMemory.cpp \
     917        xpcom/glue/nsTraceRefcnt.cpp \
     918        xpcom/glue/nsWeakReference.cpp \
     919        xpcom/build/nsXPComInit.cpp \
     920        xpcom/build/nsStringAPI.cpp
     921VBoxXPCOM_SOURCES.darwin = \
     922        darwindeps.cpp
     923VBoxXPCOM_LIBS = \
     924        $(TARGET_VBox-xpcom-typelib) \
     925        $(TARGET_VBox-xpcom-string) \
     926        $(TARGET_VBox-xpcom-base) \
     927        $(TARGET_VBox-xpcom-ds) \
     928        $(TARGET_VBox-xpcom-io) \
     929        $(TARGET_VBox-xpcom-components) \
     930        $(TARGET_VBox-xpcom-threads) \
     931        $(TARGET_VBox-xpcom-xptinfo) \
     932        $(TARGET_VBox-xpcom-xptcall) \
     933        $(TARGET_VBox-xpcom-proxy) \
     934        $(TARGET_VBox-xpcom-nspr)
     935
     936VBoxXPCOM_LDFLAGS.linux = -Wl,--whole-archive \
     937        $(TARGET_VBox-xpcom-typelib) \
     938        $(TARGET_VBox-xpcom-string) \
     939        $(TARGET_VBox-xpcom-base) \
     940        $(TARGET_VBox-xpcom-ds) \
     941        $(TARGET_VBox-xpcom-io) \
     942        $(TARGET_VBox-xpcom-components) \
     943        $(TARGET_VBox-xpcom-threads) \
     944        $(TARGET_VBox-xpcom-xptinfo) \
     945        $(TARGET_VBox-xpcom-xptcall) \
     946        $(TARGET_VBox-xpcom-proxy) \
     947        $(TARGET_VBox-xpcom-nspr) \
     948        -Wl,--no-whole-archive
     949#VBoxXPCOM_LIBS.l4 = $(L4_LIBDIR)/libxpcomstubs.a $(L4_LIBDIR)/../libuc_c++.a \
     950#    $(VBOX_PATH_L4_GCC3_INSTALL)/libsupc++.a $(VBOX_PATH_L4_GCC3_INSTALL)/libgcc_eh.a
     951# EF heap
     952#VBoxXPCOM_LIBS += $(LIB_RUNTIME_EF)
     953#VBoxXPCOM_LDFLAGS = -Wl,--whole-archive $(VBoxXPCOM_LIBS) -Wl,--no-whole-archive $(LIB_RUNTIME)
     954
     955ifdef VBOX_IPC_RELEASE_LOG
     956IPC_LOGGING = 1
     957else ifneq ($(BUILD_TYPE),release)
     958IPC_LOGGING = 1
     959endif
     960
     961TEMPLATE_XPCOMIPC                  = XPCOM IPC libraries
     962TEMPLATE_XPCOMIPC_EXTENDS          = XPCOM
     963TEMPLATE_XPCOMIPC_DEFS             = $(TEMPLATE_XPCOM_DEFS) BUILD_DCONNECT="1"
     964ifdef IPC_LOGGING
     965 TEMPLATE_XPCOMIPC_DEFS           += IN_RING3 IPC_LOGGING
     966 TEMPLATE_XPCOMIPC_LIBS            = $(TEMPLATE_XPCOM_LIBS) $(LIB_RUNTIME)
     967endif
     968TEMPLATE_XPCOMIPC_LIBS.darwin      = $(TARGET_VBoxXPCOM)
     969
     970TEMPLATE_XPCOMIPCEXE               = XPCOM IPC executables
     971TEMPLATE_XPCOMIPCEXE_EXTENDS       = XPCOMEXE
     972TEMPLATE_XPCOMIPCEXE_DEFS          = $(TEMPLATE_XPCOMEXE_DEFS) BUILD_DCONNECT="1"
     973ifdef IPC_LOGGING
     974 TEMPLATE_XPCOMIPCEXE_DEFS        += IN_RING3 IPC_LOGGING
     975 TEMPLATE_XPCOMIPCEXE_LIBS         = $(TEMPLATE_XPCOMEXE_LIBS) $(LIB_RUNTIME)
     976endif
     977
     978VBox-xpcom-ipcutils_TEMPLATE = XPCOMIPC
     979VBox-xpcom-ipcutils_NOINST = 1
     980VBox-xpcom-ipcutils_SOURCES = \
     981        ipc/ipcd/util/src/ipcMessageReader.cpp \
     982        ipc/ipcd/util/src/ipcMessageWriter.cpp
     983
     984VBox-xpcom-ipcshared_TEMPLATE = XPCOMIPC
     985VBox-xpcom-ipcshared_NOINST = 1
     986VBox-xpcom-ipcshared_SOURCES = \
     987        ipc/ipcd/shared/src/ipcLog.cpp \
     988        ipc/ipcd/shared/src/ipcConfig.cpp \
     989        ipc/ipcd/shared/src/ipcMessage.cpp \
     990        ipc/ipcd/shared/src/ipcMessagePrimitives.cpp \
     991        ipc/ipcd/shared/src/ipcStringList.cpp \
     992        ipc/ipcd/shared/src/ipcIDList.cpp \
     993        ipc/ipcd/shared/src/ipcm.cpp
     994
     995VBox-xpcom-ipcdlock_TEMPLATE = XPCOMIPC
     996VBox-xpcom-ipcdlock_NOINST = 1
     997VBox-xpcom-ipcdlock_SOURCES = \
     998        ipc/ipcd/extensions/lock/src/ipcLockProtocol.cpp \
     999        ipc/ipcd/extensions/lock/src/ipcLockService.cpp
     1000
     1001VBox-xpcom-ipctransmgr_TEMPLATE = XPCOMIPC
     1002VBox-xpcom-ipctransmgr_NOINST = 1
     1003VBox-xpcom-ipctransmgr_SOURCES = \
     1004        ipc/ipcd/extensions/transmngr/src/tmTransactionService.cpp
     1005
     1006VBox-xcpom-ipctmgrcom_TEMPLATE = XPCOMIPC
     1007VBox-xcpom-ipctmgrcom_NOINST = 1
     1008VBox-xcpom-ipctmgrcom_SOURCES = \
     1009        ipc/ipcd/extensions/transmngr/common/tmTransaction.cpp \
     1010        ipc/ipcd/extensions/transmngr/common/tmVector.cpp
     1011
     1012
     1013# DCONNECT client shared object
     1014VBoxXPCOMIPCC_TEMPLATE = XPCOMIPC
     1015VBoxXPCOMIPCC_DEFS = HAVE_DEPENDENT_LIBS
     1016VBoxXPCOMIPCC_SOURCES = \
     1017        ipc/ipcd/client/src/ipcdclient.cpp \
     1018        ipc/ipcd/client/src/ipcService.cpp \
     1019        ipc/ipcd/client/src/ipcModuleFactory.cpp \
     1020        ipc/ipcd/client/src/ipcConnectionUnix.cpp \
     1021        ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
     1022VBoxXPCOMIPCC_LIBS = \
     1023        $(TARGET_VBox-xpcom-ipcutils) \
     1024        $(TARGET_VBox-xpcom-ipcshared) \
     1025        $(TARGET_VBox-xpcom-ipcdlock) \
     1026        $(TARGET_VBox-xpcom-ipctransmgr) \
     1027        $(TARGET_VBox-xcpom-ipctmgrcom)
     1028# EF
     1029#VBoxXPCOMIPCC_LIBS += $(LIB_RUNTIME)
     1030
     1031# DCONNECT daemon executable
     1032VBoxXPCOMIPCD_TEMPLATE = XPCOMIPCEXE
     1033VBoxXPCOMIPCD_SOURCES = \
     1034        ipc/ipcd/daemon/src/ipcd.cpp \
     1035        ipc/ipcd/daemon/src/ipcClient.cpp \
     1036        ipc/ipcd/daemon/src/ipcModuleReg.cpp \
     1037        ipc/ipcd/daemon/src/ipcCommandModule.cpp \
     1038        ipc/ipcd/daemon/src/ipcdUnix.cpp
     1039
     1040#
     1041# testcases
     1042#
     1043tstnsIFileEnumerator_TEMPLATE  = XPCOMEXE
     1044tstnsIFileEnumerator_SOURCES   = xpcom/tests/nsIFileEnumerator.cpp
     1045tstnsIFileTest_TEMPLATE        = XPCOMEXE
     1046tstnsIFileTest_SOURCES         = xpcom/tests/nsIFileTest.cpp
     1047tstTestArray_TEMPLATE          = XPCOMEXE
     1048tstTestArray_SOURCES           = xpcom/tests/TestArray.cpp
     1049tstTestAtoms_TEMPLATE          = XPCOMEXE
     1050tstTestAtoms_SOURCES           = xpcom/tests/TestAtoms.cpp
     1051tstTestAutoLock_TEMPLATE       = XPCOMEXE
     1052tstTestAutoLock_SOURCES        = xpcom/tests/TestAutoLock.cpp
     1053tstTestCallTemplates_TEMPLATE  = XPCOMEXE
     1054tstTestCallTemplates_SOURCES   = xpcom/tests/TestCallTemplates.cpp
     1055tstTestCOMPtr_TEMPLATE         = XPCOMEXE
     1056tstTestCOMPtr_SOURCES          = xpcom/tests/TestCOMPtr.cpp
     1057tstTestCOMPtrEq_TEMPLATE       = XPCOMEXE
     1058tstTestCOMPtrEq_SOURCES        = xpcom/tests/TestCOMPtrEq.cpp
     1059tstTestCRT_TEMPLATE            = XPCOMEXE
     1060tstTestCRT_SOURCES             = xpcom/tests/TestCRT.cpp
     1061tstTestFactory_TEMPLATE        = XPCOMEXE
     1062tstTestFactory_SOURCES         = xpcom/tests/TestFactory.cpp
     1063tstTestHashtables_TEMPLATE     = XPCOMEXE
     1064tstTestHashtables_SOURCES      = xpcom/tests/TestHashtables.cpp
     1065tstTestID_TEMPLATE             = XPCOMEXE
     1066tstTestID_SOURCES              = xpcom/tests/TestID.cpp
     1067tstTestObserverService_TEMPLATE= XPCOMEXE
     1068tstTestObserverService_SOURCES = xpcom/tests/TestObserverService.cpp
     1069tstTestPermanentAtoms_TEMPLATE = XPCOMEXE
     1070tstTestPermanentAtoms_SOURCES  = xpcom/tests/TestPermanentAtoms.cpp
     1071tstTestPipes_TEMPLATE          = XPCOMEXE
     1072tstTestPipes_SOURCES           = xpcom/tests/TestPipes.cpp
     1073tstTestServMgr_TEMPLATE        = XPCOMEXE
     1074tstTestServMgr_SOURCES         = xpcom/tests/TestServMgr.cpp
     1075tstTestServMgr_INCS            = xpcom/tests/services
     1076tstTestThreads_TEMPLATE        = XPCOMEXE
     1077tstTestThreads_SOURCES         = xpcom/tests/TestThreads.cpp
     1078tstTestXPIDLString_TEMPLATE    = XPCOMEXE
     1079tstTestXPIDLString_SOURCES     = xpcom/tests/TestXPIDLString.cpp
     1080tstTestDeque_TEMPLATE          = XPCOMEXE
     1081tstTestDeque_SOURCES           = xpcom/tests/TestDeque.cpp
     1082tstTestAutoPtr_TEMPLATE        = XPCOMEXE
     1083tstTestAutoPtr_SOURCES         = xpcom/tests/TestAutoPtr.cpp
     1084tstTestMinStringAPI_TEMPLATE   = XPCOMEXE
     1085tstTestMinStringAPI_SOURCES    = xpcom/tests/TestMinStringAPI.cpp
     1086tstTestStrings_TEMPLATE        = XPCOMEXE
     1087tstTestStrings_SOURCES         = xpcom/tests/TestStrings.cpp
     1088
    4191089
    4201090IDLFILES = \
     
    4631133        xpcom/ds/nsIArray.idl \
    4641134        xpcom/ds/nsIPropertyBag.idl \
     1135        xpcom/ds/nsIHashable.idl \
    4651136        xpcom/io/nsIDirectoryService.idl \
     1137        xpcom/io/nsIDirectoryEnumerator.idl \
    4661138        xpcom/io/nsIFile.idl \
    4671139        xpcom/io/nsILocalFile.idl \
     1140        xpcom/io/nsILocalFileMac.idl \
    4681141        xpcom/io/nsIInputStream.idl \
    4691142        xpcom/io/nsIObjectInputStream.idl \
     
    5081181        ipc/ipcd/extensions/transmngr/public/ipcITransactionObserver.idl
    5091182
    510 VBox-xpcom-typelib_TEMPLATE = XPCOM
    511 VBox-xpcom-typelib_SOURCES = \
    512         xpcom/typelib/xpt/src/xpt_arena.c \
    513         xpcom/typelib/xpt/src/xpt_struct.c \
    514         xpcom/typelib/xpt/src/xpt_xdr.c
    515 
    516 VBox-xpcom-string_TEMPLATE = XPCOM
    517 VBox-xpcom-string_DEFS = _IMPL_NS_COM
    518 VBox-xpcom-string_SOURCES = \
    519         xpcom/string/src/nsAString.cpp \
    520         xpcom/string/src/nsDependentSubstring.cpp \
    521         xpcom/string/src/nsObsoleteAStringThunk.cpp \
    522         xpcom/string/src/nsPrintfCString.cpp \
    523         xpcom/string/src/nsPromiseFlatString.cpp \
    524         xpcom/string/src/nsReadableUtils.cpp \
    525         xpcom/string/src/nsSubstring.cpp \
    526         xpcom/string/src/nsSubstringTuple.cpp \
    527         xpcom/string/src/nsString.cpp \
    528         xpcom/string/src/nsStringComparator.cpp \
    529         xpcom/string/src/nsStringObsolete.cpp
    530 
    531 VBox-xpcom-base_TEMPLATE = XPCOM
    532 VBox-xpcom-base_SOURCES = \
    533         xpcom/base/nsAllocator.cpp \
    534         xpcom/base/nsConsoleMessage.cpp \
    535         xpcom/base/nsConsoleService.cpp \
    536         xpcom/base/nsDebugImpl.cpp \
    537         xpcom/base/nsErrorService.cpp \
    538         xpcom/base/nsExceptionService.cpp \
    539         xpcom/base/nsID.cpp \
    540         xpcom/base/nsMemoryImpl.cpp \
    541         xpcom/base/nsTraceRefcntImpl.cpp \
    542         xpcom/base/nsStackFrameUnix.cpp
    543 
    544 VBox-xpcom-ds_TEMPLATE = XPCOM
    545 VBox-xpcom-ds_SOURCES = \
    546         xpcom/ds/pldhash.c \
    547         xpcom/ds/nsAtomTable.cpp \
    548         xpcom/ds/nsAtomService.cpp \
    549         xpcom/ds/nsByteBuffer.cpp \
    550         xpcom/ds/nsCheapSets.cpp \
    551         xpcom/ds/nsCRT.cpp \
    552         xpcom/ds/nsDeque.cpp \
    553         xpcom/ds/nsEmptyEnumerator.cpp \
    554         xpcom/ds/nsEnumeratorUtils.cpp \
    555         xpcom/ds/nsFixedSizeAllocator.cpp \
    556         xpcom/ds/nsHashSets.cpp \
    557         xpcom/ds/nsHashtable.cpp \
    558         xpcom/ds/nsObserverList.cpp \
    559         xpcom/ds/nsObserverService.cpp \
    560         xpcom/ds/nsProperties.cpp \
    561         xpcom/ds/nsPersistentProperties.cpp \
    562         xpcom/ds/nsQuickSort.cpp \
    563         xpcom/ds/nsRecyclingAllocator.cpp \
    564         xpcom/ds/nsStaticNameTable.cpp \
    565         xpcom/ds/nsStringEnumerator.cpp \
    566         xpcom/ds/nsSupportsArray.cpp \
    567         xpcom/ds/nsSupportsArrayEnumerator.cpp \
    568         xpcom/ds/nsSupportsPrimitives.cpp \
    569         xpcom/ds/nsTHashtable.cpp \
    570         xpcom/ds/nsUnicharBuffer.cpp \
    571         xpcom/ds/nsVariant.cpp \
    572         xpcom/ds/nsVoidArray.cpp \
    573         xpcom/ds/nsTextFormatter.cpp \
    574         xpcom/ds/nsTimelineService.cpp \
    575         xpcom/ds/nsValueArray.cpp \
    576         xpcom/ds/nsCOMArray.cpp \
    577         xpcom/ds/nsArray.cpp \
    578         xpcom/ds/nsArrayEnumerator.cpp
    579 #   xpcom/ds/nsHashPropertyBag.cpp
    580 
    581 # @todo what about MOZ_USER_DIR?
    582 VBox-xpcom-io_TEMPLATE = XPCOM
    583 VBox-xpcom-io_DEFS = MOZ_USER_DIR="\".mozilla\""
    584 VBox-xpcom-io_SOURCES = \
    585         xpcom/io/nsAppFileLocationProvider.cpp \
    586         xpcom/io/nsBinaryStream.cpp \
    587         xpcom/io/nsByteArrayInputStream.cpp \
    588         xpcom/io/nsDirectoryService.cpp \
    589         xpcom/io/nsEscape.cpp \
    590         xpcom/io/nsFastLoadFile.cpp \
    591         xpcom/io/nsFastLoadService.cpp \
    592         xpcom/io/nsInputStreamTee.cpp \
    593         xpcom/io/nsLinebreakConverter.cpp \
    594         xpcom/io/nsLocalFileCommon.cpp \
    595         xpcom/io/nsMultiplexInputStream.cpp \
    596         xpcom/io/nsPipe3.cpp \
    597         xpcom/io/nsStreamUtils.cpp \
    598         xpcom/io/nsScriptableInputStream.cpp \
    599         xpcom/io/nsSegmentedBuffer.cpp \
    600         xpcom/io/SpecialSystemDirectory.cpp \
    601         xpcom/io/nsStorageStream.cpp \
    602         xpcom/io/nsStringStream.cpp \
    603         xpcom/io/nsUnicharInputStream.cpp \
    604         xpcom/io/nsNativeCharsetUtils.cpp
    605 VBox-xpcom-io_SOURCES.linux = \
    606         xpcom/io/nsLocalFileUnix.cpp
    607 VBox-xpcom-io_SOURCES.l4 = \
    608         xpcom/io/nsLocalFileL4.cpp
    609 
    610 VBox-xpcom-components_TEMPLATE = XPCOM
    611 VBox-xpcom-components_DEFS = EXPORT_XPTI_API
    612 VBox-xpcom-components_SOURCES = \
    613         xpcom/components/nsCategoryManager.cpp \
    614         xpcom/components/nsComponentManager.cpp \
    615         xpcom/components/nsComponentManagerObsolete.cpp \
    616         xpcom/components/nsNativeComponentLoader.cpp \
    617         xpcom/components/nsServiceManagerObsolete.cpp \
    618         xpcom/components/xcDll.cpp \
    619         xpcom/components/nsStaticComponentLoader.cpp
    620 
    621 VBox-xpcom-threads_TEMPLATE = XPCOM
    622 VBox-xpcom-threads_SOURCES = \
    623         xpcom/threads/plevent.c \
    624         xpcom/threads/nsAutoLock.cpp \
    625         xpcom/threads/nsEnvironment.cpp \
    626         xpcom/threads/nsEventQueue.cpp \
    627         xpcom/threads/nsEventQueueService.cpp \
    628         xpcom/threads/nsThread.cpp \
    629         xpcom/threads/nsTimerImpl.cpp \
    630         xpcom/threads/nsProcessCommon.cpp \
    631         xpcom/threads/TimerThread.cpp
    632 
    633 VBox-xpcom-xptinfo_TEMPLATE = XPCOM
    634 VBox-xpcom-xptinfo_DEFS = EXPORT_XPTI_API
    635 VBox-xpcom-xptinfo_SOURCES = \
    636         xpcom/reflect/xptinfo/src/xptiFile.cpp \
    637         xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp \
    638         xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp \
    639         xpcom/reflect/xptinfo/src/xptiManifest.cpp \
    640         xpcom/reflect/xptinfo/src/xptiMisc.cpp \
    641         xpcom/reflect/xptinfo/src/xptiTypelibGuts.cpp \
    642         xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp \
    643         xpcom/reflect/xptinfo/src/xptiZipItem.cpp \
    644         xpcom/reflect/xptinfo/src/xptiZipLoader.cpp
    645 
    646 
    647 VBox-xpcom-xptcall_TEMPLATE = XPCOM
    648 VBox-xpcom-xptcall_DEFS     = EXPORT_XPTC_API
    649 VBox-xpcom-xptcall_DEFS.l4  = L4
    650 VBox-xpcom-xptcall_SOURCES       = xpcom/reflect/xptcall/src/xptcall.cpp
    651 VBox-xpcom-xptcall_SOURCES.x86   = xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp \
    652                                    xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp
    653 VBox-xpcom-xptcall_SOURCES.amd64 = xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp \
    654                                    xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
    655 
    656 VBox-xpcom-proxy_TEMPLATE = XPCOM
    657 VBox-xpcom-proxy_SOURCES  = xpcom/proxy/src/nsProxyEvent.cpp \
    658                             xpcom/proxy/src/nsProxyEventClass.cpp \
    659                             xpcom/proxy/src/nsProxyEventObject.cpp \
    660                             xpcom/proxy/src/nsProxyObjectManager.cpp \
    661                             xpcom/proxy/src/nsProxyRelease.cpp
    662 
    663 # glue library which all client apps will link with
    664 VBoxXPCOMGlue_TEMPLATE = XPCOM
    665 VBoxXPCOMGlue_DEFS     = XPCOM_GLUE
    666 VBoxXPCOMGlue_SOURCES  = xpcom/glue/nsCOMPtr.cpp \
    667                          xpcom/glue/nsComponentManagerUtils.cpp \
    668                          xpcom/glue/nsDebug.cpp \
    669                          xpcom/glue/nsGenericFactory.cpp \
    670                          xpcom/glue/nsIInterfaceRequestorUtils.cpp \
    671                          xpcom/glue/nsMemory.cpp \
    672                          xpcom/glue/nsTraceRefcnt.cpp \
    673                          xpcom/glue/nsWeakReference.cpp \
    674                          xpcom/glue/standalone/nsXPCOMGlue.cpp \
    675                          xpcom/glue/standalone/nsGREDirServiceProvider.cpp
    676 VBoxXPCOMGlue_INST     = lib/ $(INST_SDK)/lib/
    677 
    678 # the big DLL, assembling all lib files
    679 VBoxXPCOM_TEMPLATE = XPCOM
    680 VBoxXPCOM_DEFS = BUILD_DCONNECT="1"
    681 VBoxXPCOM_SOURCES = \
    682         xpcom/glue/nsCOMPtr.cpp \
    683         xpcom/glue/nsComponentManagerUtils.cpp \
    684         xpcom/glue/nsDebug.cpp \
    685         xpcom/glue/nsGenericFactory.cpp \
    686         xpcom/glue/nsIInterfaceRequestorUtils.cpp \
    687         xpcom/glue/nsMemory.cpp \
    688         xpcom/glue/nsTraceRefcnt.cpp \
    689         xpcom/glue/nsWeakReference.cpp \
    690         xpcom/build/nsXPComInit.cpp \
    691         xpcom/build/nsStringAPI.cpp
    692 VBoxXPCOM_LIBS = \
    693         $(PATH_LIB)/VBox-xpcom-typelib$(XPCOM_SUFF_LIB) \
    694         $(PATH_LIB)/VBox-xpcom-string$(XPCOM_SUFF_LIB) \
    695         $(PATH_LIB)/VBox-xpcom-base$(XPCOM_SUFF_LIB) \
    696         $(PATH_LIB)/VBox-xpcom-ds$(XPCOM_SUFF_LIB) \
    697         $(PATH_LIB)/VBox-xpcom-io$(XPCOM_SUFF_LIB) \
    698         $(PATH_LIB)/VBox-xpcom-components$(XPCOM_SUFF_LIB) \
    699         $(PATH_LIB)/VBox-xpcom-threads$(XPCOM_SUFF_LIB) \
    700         $(PATH_LIB)/VBox-xpcom-xptinfo$(XPCOM_SUFF_LIB) \
    701         $(PATH_LIB)/VBox-xpcom-xptcall$(XPCOM_SUFF_LIB) \
    702         $(PATH_LIB)/VBox-xpcom-proxy$(XPCOM_SUFF_LIB) \
    703         $(PATH_LIB)/VBox-xpcom-nspr$(XPCOM_SUFF_LIB)
    704 VBoxXPCOM_LDFLAGS = -Wl,--whole-archive $(VBoxXPCOM_LIBS) -Wl,--no-whole-archive
    705 # EF heap
    706 #VBoxXPCOM_LIBS += $(LIB_RUNTIME_EF)
    707 #VBoxXPCOM_LDFLAGS = -Wl,--whole-archive $(VBoxXPCOM_LIBS) -Wl,--no-whole-archive $(LIB_RUNTIME)
    708 
    709 ifdef VBOX_IPC_RELEASE_LOG
    710 IPC_LOGGING = 1
    711 else ifneq ($(BUILD_TYPE),release)
    712 IPC_LOGGING = 1
    713 endif
    714 
    715 TEMPLATE_XPCOMIPC                  = XPCOM IPC libraries
    716 TEMPLATE_XPCOMIPC_EXTENDS          = XPCOM
    717 TEMPLATE_XPCOMIPC_DEFS             = $(TEMPLATE_XPCOM_DEFS) BUILD_DCONNECT="1"
    718 ifdef IPC_LOGGING
    719 TEMPLATE_XPCOMIPC_DEFS             += IN_RING3 IPC_LOGGING
    720 TEMPLATE_XPCOMIPC_LIBS             = $(TEMPLATE_XPCOM_LIBS) $(LIB_RUNTIME)
    721 endif
    722 
    723 TEMPLATE_XPCOMIPCEXE               = XPCOM IPC executables
    724 TEMPLATE_XPCOMIPCEXE_EXTENDS       = XPCOMEXE
    725 TEMPLATE_XPCOMIPCEXE_DEFS          = $(TEMPLATE_XPCOMEXE_DEFS) BUILD_DCONNECT="1"
    726 ifdef IPC_LOGGING
    727 TEMPLATE_XPCOMIPCEXE_DEFS          += IN_RING3 IPC_LOGGING
    728 TEMPLATE_XPCOMIPCEXE_LIBS          = $(TEMPLATE_XPCOMEXE_LIBS) $(LIB_RUNTIME)
    729 endif
    730 
    731 VBox-xpcom-ipcutils_TEMPLATE = XPCOMIPC
    732 VBox-xpcom-ipcutils_SOURCES = \
    733         ipc/ipcd/util/src/ipcMessageReader.cpp \
    734         ipc/ipcd/util/src/ipcMessageWriter.cpp
    735 
    736 VBox-xpcom-ipcshared_TEMPLATE = XPCOMIPC
    737 VBox-xpcom-ipcshared_SOURCES = \
    738         ipc/ipcd/shared/src/ipcLog.cpp \
    739         ipc/ipcd/shared/src/ipcConfig.cpp \
    740         ipc/ipcd/shared/src/ipcMessage.cpp \
    741         ipc/ipcd/shared/src/ipcMessagePrimitives.cpp \
    742         ipc/ipcd/shared/src/ipcStringList.cpp \
    743         ipc/ipcd/shared/src/ipcIDList.cpp \
    744         ipc/ipcd/shared/src/ipcm.cpp
    745 
    746 VBox-xpcom-ipcdlock_TEMPLATE = XPCOMIPC
    747 VBox-xpcom-ipcdlock_SOURCES = \
    748         ipc/ipcd/extensions/lock/src/ipcLockProtocol.cpp \
    749         ipc/ipcd/extensions/lock/src/ipcLockService.cpp
    750 
    751 VBox-xpcom-ipctransmgr_TEMPLATE = XPCOMIPC
    752 VBox-xpcom-ipctransmgr_SOURCES = \
    753         ipc/ipcd/extensions/transmngr/src/tmTransactionService.cpp
    754 
    755 VBox-xcpom-ipctmgrcom_TEMPLATE = XPCOMIPC
    756 VBox-xcpom-ipctmgrcom_SOURCES = \
    757         ipc/ipcd/extensions/transmngr/common/tmTransaction.cpp \
    758         ipc/ipcd/extensions/transmngr/common/tmVector.cpp
    759 
    760 
    761 # DCONNECT client shared object
    762 VBoxXPCOMIPCC_TEMPLATE = XPCOMIPC
    763 VBoxXPCOMIPCC_DEFS = HAVE_DEPENDENT_LIBS
    764 VBoxXPCOMIPCC_SOURCES = \
    765         ipc/ipcd/client/src/ipcdclient.cpp \
    766         ipc/ipcd/client/src/ipcService.cpp \
    767         ipc/ipcd/client/src/ipcModuleFactory.cpp \
    768         ipc/ipcd/client/src/ipcConnectionUnix.cpp \
    769         ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
    770 VBoxXPCOMIPCC_LIBS = \
    771         $(PATH_LIB)/VBox-xpcom-ipcutils$(XPCOM_SUFF_LIB) \
    772         $(PATH_LIB)/VBox-xpcom-ipcshared$(XPCOM_SUFF_LIB) \
    773         $(PATH_LIB)/VBox-xpcom-ipcdlock$(XPCOM_SUFF_LIB) \
    774         $(PATH_LIB)/VBox-xpcom-ipctransmgr$(XPCOM_SUFF_LIB) \
    775         $(PATH_LIB)/VBox-xcpom-ipctmgrcom$(XPCOM_SUFF_LIB)
    776 # EF
    777 #VBoxXPCOMIPCC_LIBS += $(LIB_RUNTIME)
    778 
    779 # DCONNECT daemon executable
    780 VBoxXPCOMIPCD_TEMPLATE = XPCOMIPCEXE
    781 VBoxXPCOMIPCD_SOURCES = \
    782         ipc/ipcd/daemon/src/ipcd.cpp \
    783         ipc/ipcd/daemon/src/ipcClient.cpp \
    784         ipc/ipcd/daemon/src/ipcModuleReg.cpp \
    785         ipc/ipcd/daemon/src/ipcCommandModule.cpp \
    786         ipc/ipcd/daemon/src/ipcdUnix.cpp
    787 
    788 #
    789 # testcases
    790 #
    791 tstnsIFileEnumerator_TEMPLATE  = XPCOMEXE
    792 tstnsIFileEnumerator_SOURCES   = xpcom/tests/nsIFileEnumerator.cpp
    793 tstnsIFileTest_TEMPLATE        = XPCOMEXE
    794 tstnsIFileTest_SOURCES         = xpcom/tests/nsIFileTest.cpp
    795 tstTestArray_TEMPLATE          = XPCOMEXE
    796 tstTestArray_SOURCES           = xpcom/tests/TestArray.cpp
    797 tstTestAtoms_TEMPLATE          = XPCOMEXE
    798 tstTestAtoms_SOURCES           = xpcom/tests/TestAtoms.cpp
    799 tstTestAutoLock_TEMPLATE       = XPCOMEXE
    800 tstTestAutoLock_SOURCES        = xpcom/tests/TestAutoLock.cpp
    801 tstTestCallTemplates_TEMPLATE  = XPCOMEXE
    802 tstTestCallTemplates_SOURCES   = xpcom/tests/TestCallTemplates.cpp
    803 tstTestCOMPtr_TEMPLATE         = XPCOMEXE
    804 tstTestCOMPtr_SOURCES          = xpcom/tests/TestCOMPtr.cpp
    805 tstTestCOMPtrEq_TEMPLATE       = XPCOMEXE
    806 tstTestCOMPtrEq_SOURCES        = xpcom/tests/TestCOMPtrEq.cpp
    807 tstTestCRT_TEMPLATE            = XPCOMEXE
    808 tstTestCRT_SOURCES             = xpcom/tests/TestCRT.cpp
    809 tstTestFactory_TEMPLATE        = XPCOMEXE
    810 tstTestFactory_SOURCES         = xpcom/tests/TestFactory.cpp
    811 tstTestHashtables_TEMPLATE     = XPCOMEXE
    812 tstTestHashtables_SOURCES      = xpcom/tests/TestHashtables.cpp
    813 tstTestID_TEMPLATE             = XPCOMEXE
    814 tstTestID_SOURCES              = xpcom/tests/TestID.cpp
    815 tstTestObserverService_TEMPLATE= XPCOMEXE
    816 tstTestObserverService_SOURCES = xpcom/tests/TestObserverService.cpp
    817 tstTestPermanentAtoms_TEMPLATE = XPCOMEXE
    818 tstTestPermanentAtoms_SOURCES  = xpcom/tests/TestPermanentAtoms.cpp
    819 tstTestPipes_TEMPLATE          = XPCOMEXE
    820 tstTestPipes_SOURCES           = xpcom/tests/TestPipes.cpp
    821 tstTestServMgr_TEMPLATE        = XPCOMEXE
    822 tstTestServMgr_SOURCES         = xpcom/tests/TestServMgr.cpp
    823 tstTestServMgr_INCS            = xpcom/tests/services
    824 tstTestThreads_TEMPLATE        = XPCOMEXE
    825 tstTestThreads_SOURCES         = xpcom/tests/TestThreads.cpp
    826 tstTestXPIDLString_TEMPLATE    = XPCOMEXE
    827 tstTestXPIDLString_SOURCES     = xpcom/tests/TestXPIDLString.cpp
    828 tstTestDeque_TEMPLATE          = XPCOMEXE
    829 tstTestDeque_SOURCES           = xpcom/tests/TestDeque.cpp
    830 tstTestAutoPtr_TEMPLATE        = XPCOMEXE
    831 tstTestAutoPtr_SOURCES         = xpcom/tests/TestAutoPtr.cpp
    832 tstTestMinStringAPI_TEMPLATE   = XPCOMEXE
    833 tstTestMinStringAPI_SOURCES    = xpcom/tests/TestMinStringAPI.cpp
    834 tstTestStrings_TEMPLATE        = XPCOMEXE
    835 tstTestStrings_SOURCES         = xpcom/tests/TestStrings.cpp
    8361183
    8371184OTHER_CLEAN += \
     
    8461193
    8471194
    848 NSPRPUB_HEADERS = nsprpub/pr/include/nspr.h nsprpub/lib/ds/plarena.h nsprpub/lib/ds/plarenas.h \
    849         nsprpub/lib/libc/include/plbase64.h nsprpub/lib/libc/include/plerror.h \
    850         nsprpub/lib/libc/include/plgetopt.h nsprpub/lib/ds/plhash.h \
    851         nsprpub/lib/libc/include/plresolv.h nsprpub/lib/libc/include/plstr.h \
    852         nsprpub/pr/include/pratom.h nsprpub/pr/include/prbit.h nsprpub/pr/include/prclist.h \
    853         nsprpub/pr/include/prcmon.h nsprpub/pr/include/prcountr.h nsprpub/pr/include/prcvar.h \
    854         nsprpub/pr/include/prdtoa.h nsprpub/pr/include/prenv.h nsprpub/pr/include/prerr.h \
    855         nsprpub/pr/include/prerror.h nsprpub/pr/include/prinet.h nsprpub/pr/include/prinit.h \
    856         nsprpub/pr/include/prinrval.h nsprpub/pr/include/prio.h nsprpub/pr/include/pripcsem.h \
    857         nsprpub/pr/include/prlink.h nsprpub/pr/include/prlock.h nsprpub/pr/include/prlog.h \
    858         nsprpub/pr/include/prlong.h nsprpub/pr/include/prmem.h nsprpub/pr/include/prmon.h \
    859         nsprpub/pr/include/prmwait.h nsprpub/pr/include/prnetdb.h nsprpub/pr/include/prolock.h \
    860         nsprpub/pr/include/prpdce.h nsprpub/pr/include/prprf.h nsprpub/pr/include/prproces.h \
    861         nsprpub/pr/include/prrng.h nsprpub/pr/include/prrwlock.h nsprpub/pr/include/prshm.h \
    862         nsprpub/pr/include/prshma.h nsprpub/pr/include/prsystem.h nsprpub/pr/include/prthread.h \
    863         nsprpub/pr/include/prtime.h nsprpub/pr/include/prtpool.h nsprpub/pr/include/prtrace.h \
    864         nsprpub/pr/include/prtypes.h nsprpub/pr/include/prvrsion.h nsprpub/pr/include/prwin16.h
    865 NSPRPUB_MD_HEADERS = \
    866         nsprpub/pr/include/md/_linux.h nsprpub/pr/include/md/_l4v2.h \
    867         nsprpub/pr/include/md/_unixos.h nsprpub/pr/include/md/_unix_errors.h \
    868         nsprpub/pr/include/md/_pth.h nsprpub/pr/include/md/prosdep.h
    869 NSPRPUB_OBS_HEADERS = \
    870         nsprpub/pr/include/obsolete/pralarm.h nsprpub/pr/include/obsolete/probslet.h \
    871         nsprpub/pr/include/obsolete/protypes.h nsprpub/pr/include/obsolete/prsem.h
    872 
    873 NSPRPUB_PRIV_HEADERS = \
    874         nsprpub/pr/include/private/pprio.h nsprpub/pr/include/private/pprthred.h \
    875         nsprpub/pr/include/private/prpriv.h
    876 
    877 STRING_HEADERS = xpcom/string/public/nsAString.h xpcom/string/public/nsAlgorithm.h \
    878         xpcom/string/public/nsCharTraits.h xpcom/string/public/nsDependentString.h \
    879         xpcom/string/public/nsDependentSubstring.h xpcom/string/public/nsEmbedString.h \
    880         xpcom/string/public/nsLiteralString.h xpcom/string/public/nsObsoleteAString.h \
    881         xpcom/string/public/nsPrintfCString.h xpcom/string/public/nsPromiseFlatString.h \
    882         xpcom/string/public/nsReadableUtils.h xpcom/string/public/nsString.h \
    883         xpcom/string/public/nsStringAPI.h xpcom/string/public/nsStringFwd.h \
    884         xpcom/string/public/nsStringIterator.h xpcom/string/public/nsSubstring.h \
    885         xpcom/string/public/nsSubstringTuple.h xpcom/string/public/nsTAString.h \
    886         xpcom/string/public/nsTDependentString.h xpcom/string/public/nsTDependentSubstring.h \
    887         xpcom/string/public/nsTObsoleteAString.h xpcom/string/public/nsTPromiseFlatString.h \
    888         xpcom/string/public/nsTString.h xpcom/string/public/nsTSubstring.h \
    889         xpcom/string/public/nsTSubstringTuple.h xpcom/string/public/nsUTF8Utils.h \
    890         xpcom/string/public/nsXPIDLString.h xpcom/string/public/string-template-def-char.h \
    891         xpcom/string/public/string-template-def-unichar.h \
    892         xpcom/string/public/string-template-undef.h
    893 
    894 XPCOM_HEADERS = xpcom/base/nsAgg.h xpcom/io/nsAppDirectoryServiceDefs.h \
    895         xpcom/ds/nsArray.h xpcom/ds/nsArrayEnumerator.h xpcom/ds/nsAtomService.h \
    896         xpcom/ds/nsAutoBuffer.h xpcom/threads/nsAutoLock.h xpcom/base/nsAutoPtr.h \
    897         xpcom/ds/nsBaseHashtable.h xpcom/ds/nsCOMArray.h xpcom/glue/nsCOMPtr.h \
    898         xpcom/ds/nsCRT.h xpcom/components/nsCategoryManagerUtils.h xpcom/ds/nsCheapSets.h \
    899         xpcom/ds/nsClassHashtable.h xpcom/base/nsCom.h \
    900         xpcom/components/nsComponentManagerObsolete.h \
    901         xpcom/components/nsComponentManagerUtils.h xpcom/ds/nsCppSharedAllocator.h \
    902         xpcom/ds/nsDataHashtable.h xpcom/glue/nsDebug.h xpcom/base/nsDebugImpl.h \
    903         xpcom/ds/nsDeque.h xpcom/io/nsDirectoryService.h xpcom/io/nsDirectoryServiceDefs.h \
    904         xpcom/io/nsDirectoryServiceUtils.h xpcom/ds/nsDoubleHashtable.h \
    905         xpcom/ds/nsEnumeratorUtils.h xpcom/base/nsError.h xpcom/io/nsEscape.h \
    906         xpcom/threads/nsEventQueueUtils.h xpcom/io/nsFastLoadPtr.h \
    907         xpcom/io/nsFastLoadService.h xpcom/ds/nsFixedSizeAllocator.h \
    908         xpcom/glue/nsGenericFactory.h xpcom/ds/nsHashKeys.h xpcom/ds/nsHashSets.h \
    909         xpcom/ds/nsHashtable.h xpcom/base/nsIAllocator.h xpcom/ds/nsIByteBuffer.h \
    910         xpcom/base/nsID.h xpcom/glue/nsIGenericFactory.h xpcom/base/nsIID.h \
    911         xpcom/glue/nsIInterfaceRequestorUtils.h xpcom/components/nsIServiceManagerObsolete.h \
    912         xpcom/components/nsIServiceManagerUtils.h xpcom/base/nsISupportsBase.h \
    913         xpcom/glue/nsISupportsImpl.h xpcom/base/nsISupportsObsolete.h \
    914         xpcom/glue/nsISupportsUtils.h xpcom/ds/nsIUnicharBuffer.h \
    915         xpcom/io/nsIUnicharInputStream.h xpcom/glue/nsIWeakReferenceUtils.h \
    916         xpcom/ds/nsInt64.h xpcom/ds/nsInterfaceHashtable.h \
    917         xpcom/io/nsLinebreakConverter.h xpcom/io/nsLocalFile.h xpcom/io/nsLocalFileUnix.h \
    918         xpcom/glue/nsMemory.h xpcom/components/nsModule.h xpcom/io/nsMultiplexInputStream.h \
    919         xpcom/io/nsNativeCharsetUtils.h xpcom/components/nsNativeComponentLoader.h \
    920         xpcom/ds/nsObserverService.h xpcom/components/nsObsoleteModuleLoading.h \
    921         xpcom/threads/nsProcess.h xpcom/proxy/public/nsProxiedService.h \
    922         xpcom/proxy/public/nsProxyEvent.h xpcom/proxy/public/nsProxyRelease.h \
    923         xpcom/ds/nsQuickSort.h xpcom/ds/nsRecyclingAllocator.h xpcom/ds/nsRefPtrHashtable.h \
    924         xpcom/io/nsScriptableInputStream.h xpcom/ds/nsStaticAtom.h \
    925         xpcom/components/nsStaticComponent.h xpcom/ds/nsStaticNameTable.h \
    926         xpcom/io/nsStorageStream.h xpcom/io/nsStreamUtils.h xpcom/ds/nsStringEnumerator.h \
    927         xpcom/io/nsStringIO.h xpcom/io/nsStringStream.h xpcom/ds/nsSupportsArray.h \
    928         xpcom/ds/nsSupportsPrimitives.h xpcom/ds/nsTHashtable.h xpcom/ds/nsTextFormatter.h \
    929         xpcom/ds/nsTime.h xpcom/glue/nsTraceRefcnt.h xpcom/base/nsTraceRefcntImpl.h \
    930         xpcom/ds/nsUnitConversion.h xpcom/ds/nsValueArray.h xpcom/ds/nsVariant.h \
    931         xpcom/ds/nsVoidArray.h xpcom/base/nsWeakPtr.h xpcom/glue/nsWeakReference.h \
    932         xpcom/build/nsXPCOM.h xpcom/build/nsXPCOMCID.h xpcom/glue/standalone/nsXPCOMGlue.h \
    933         xpcom/base/nscore.h xpcom/ds/pldhash.h xpcom/threads/plevent.h \
    934         xpcom/components/xcDll.h xpcom/typelib/xpt/public/xpt_arena.h \
    935         xpcom/typelib/xpt/public/xpt_struct.h xpcom/typelib/xpt/public/xpt_xdr.h \
    936         xpcom/reflect/xptcall/public/xptcall.h xpcom/reflect/xptcall/public/xptcstubsdecl.inc \
    937         xpcom/reflect/xptcall/public/xptcstubsdef.inc xpcom/reflect/xptinfo/public/xptinfo.h \
    938         xpcom-config.h
    939 
    940 IPCD_HEADERS = ipc/ipcd/client/public/ipcCID.h ipc/ipcd/extensions/lock/public/ipcLockCID.h \
    941         ipc/ipcd/util/public/ipcMessageReader.h ipc/ipcd/util/public/ipcMessageWriter.h \
    942         ipc/ipcd/daemon/public/ipcModule.h ipc/ipcd/daemon/public/ipcModuleUtil.h \
    943         ipc/ipcd/client/public/ipcdclient.h
    944 
    945 # dummy target for copying XPCOM header files. This is done manually for now
    946 # as we have to choose the right target directories
    947 $(PATH_BIN)/sdk/include/xpcom/.keep: nsprpub/pr/include/md/_vbox.cfg \
    948                 nsprpub/pr/include/md/_linux.cfg nsprpub/pr/include/md/_l4v2.cfg $(NSPRPUB_HEADERS) \
    949                 $(NSPRPUB_MD_HEADERS) $(NSPRPUB_OBS_HEADERS) $(NSPRPUB_PRIV_HEADERS) \
    950                 $(STRING_HEADERS) $(XPCOM_HEADERS) $(IPCD_HEADERS)
    951         $(call MSG_L1,Installing XPCOM headers)
    952         $(QUIET)$(MKDIR) -p \
    953                 $(@D)/nsprpub \
    954                 $(@D)/nsprpub/md \
    955                 $(@D)/nsprpub/obsolete \
    956                 $(@D)/nsprpub/private \
    957                 $(@D)/string \
    958                 $(@D)/xpcom \
    959                 $(@D)/ipcd
    960         $(QUIET)$(CP) -p nsprpub/pr/include/md/_vbox.cfg $(@D)/nsprpub/prcpucfg.h
    961         $(QUIET)$(CP) -p nsprpub/pr/include/md/_linux.cfg $(@D)/nsprpub/_linuxcfg.h
    962         $(QUIET)$(CP) -p nsprpub/pr/include/md/_l4v2.cfg $(@D)/nsprpub/_l4v2cfg.h
    963         $(QUIET)$(CP) -p $(NSPRPUB_HEADERS) $(@D)/nsprpub
    964         $(QUIET)$(CP) -p $(NSPRPUB_MD_HEADERS) $(@D)/nsprpub/md
    965         $(QUIET)$(CP) -p $(NSPRPUB_OBS_HEADERS) $(@D)/nsprpub/obsolete
    966         $(QUIET)$(CP) -p $(NSPRPUB_PRIV_HEADERS) $(@D)/nsprpub/private
    967         $(QUIET)$(CP) -p $(STRING_HEADERS) $(@D)/string
    968         $(QUIET)$(CP) -p $(XPCOM_HEADERS) $(@D)/xpcom
    969         $(QUIET)$(CP) -p $(IPCD_HEADERS) $(@D)/ipcd
    970         $(QUIET)$(RM) -f $@
    971         $(QUIET)$(APPEND) "$@" "keep"
    972 
    973 # Add the header files which we just installed to the "CLEAN" target
    974 OTHER_CLEAN += \
    975         $(PATH_BIN)/sdk/include/xpcom/nsprpub/prcpucfg.h \
    976         $(PATH_BIN)/sdk/include/xpcom/nsprpub/_linuxcfg.h \
    977         $(PATH_BIN)/sdk/include/xpcom/nsprpub/_l4v2cfg.h \
    978         $(addprefix $(PATH_BIN)/sdk/include/xpcom/nsprpub/,$(notdir $(NSPRPUB_HEADERS))) \
    979         $(addprefix $(PATH_BIN)/sdk/include/xpcom/nsprpub/md/,$(notdir $(NSPRPUB_MD_HEADERS))) \
    980         $(addprefix $(PATH_BIN)/sdk/include/xpcom/nsprpub/obsolete/,$(notdir $(NSPRPUB_OBS_HEADERS))) \
    981         $(addprefix $(PATH_BIN)/sdk/include/xpcom/nsprpub/private/,$(notdir $(NSPRPUB_PRIV_HEADERS))) \
    982         $(addprefix $(PATH_BIN)/sdk/include/xpcom/string/,$(notdir $(STRING_HEADERS))) \
    983         $(addprefix $(PATH_BIN)/sdk/include/xpcom/xpcom/,$(notdir $(XPCOM_HEADERS))) \
    984         $(addprefix $(PATH_BIN)/sdk/include/xpcom/ipcd/,$(notdir $(IPCD_HEADERS))) \
    985         $(PATH_BIN)/sdk/include/xpcom/.keep
    9861195
    9871196XPTFILES = $(addprefix $(PATH_TARGET)/, \
     
    11121321# Manual dependency...
    11131322xpcom/string/src/nsAString.cpp: $(PATH_VBox-xpcom-string)/idl_ts
     1323
     1324#/home/bird/pdp8/coding/vbox/svn/trunk/out/linux.x86/release/obj/src/libs/xpcom18a4/VBoxXPCOMGlue/xpcom/glue/nsMemory.o
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.cfg

    r1 r589  
    4242#define XP_UNIX
    4343#endif
     44
     45#ifndef DARWIN      /*bird*/
     46#define DARWIN      /*bird*/
     47#endif              /*bird*/
    4448
    4549#define PR_AF_INET6 30  /* same as AF_INET6 */
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h

    r1 r589  
    4343#include <sys/syscall.h>
    4444
     45#ifdef XP_MACOSX
     46#include <AvailabilityMacros.h>
     47#endif
     48
    4549#define PR_LINKER_ARCH  "darwin"
    4650#define _PR_SI_SYSNAME  "DARWIN"
    47 #ifdef i386
     51#ifdef __i386__
    4852#define _PR_SI_ARCHITECTURE "x86"
    49 #else
     53#elif defined(__ppc__)
    5054#define _PR_SI_ARCHITECTURE "ppc"
    5155#endif
     
    6266#define _PR_HAVE_SOCKADDR_LEN 
    6367#define _PR_STAT_HAS_ST_ATIMESPEC
    64 #define _PR_NO_LARGE_FILES
     68#define _PR_HAVE_LARGE_OFF_T
    6569#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
    6670
     
    7882 */
    7983#define _PR_GHBA_DISALLOW_V4MAPPED
     84#ifdef XP_MACOSX
     85#if !defined(MAC_OS_X_VERSION_10_3) || \
     86    MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
    8087/*
    8188 * socket(AF_INET6) fails with EPROTONOSUPPORT on Mac OS X 10.1.
    8289 * IPv6 under OS X 10.2 and below is not complete (see bug 222031).
    8390 */
    84 #if MACOS_DEPLOYMENT_TARGET < 100300
    8591#define _PR_INET6_PROBE
    86 #endif
     92#endif /* DT < 10.3 */
     93#if defined(MAC_OS_X_VERSION_10_2) && \
     94    MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2
    8795/* Mac OS X 10.2 has inet_ntop and inet_pton. */
    88 #if MACOS_DEPLOYMENT_TARGET >= 100200
    8996#define _PR_HAVE_INET_NTOP
     97#endif /* DT >= 10.2 */
     98#endif /* XP_MACOSX */
     99#define _PR_IPV6_V6ONLY_PROBE
     100/* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */
     101#ifndef IPV6_V6ONLY
     102#define IPV6_V6ONLY 27
    90103#endif
    91104
     
    101114extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val);
    102115#define _MD_ATOMIC_ADD(ptr, val)    _PR_DarwinPPC_AtomicAdd(ptr, val)
    103 #endif /* __ppc__ */
     116#elif defined(__i386__)
     117#define _PR_HAVE_ATOMIC_OPS
     118#define _MD_INIT_ATOMIC()
     119extern PRInt32 _PR_Darwin_x86_AtomicIncrement(PRInt32 *val);
     120#define _MD_ATOMIC_INCREMENT(val)   _PR_Darwin_x86_AtomicIncrement(val)
     121extern PRInt32 _PR_Darwin_x86_AtomicDecrement(PRInt32 *val);
     122#define _MD_ATOMIC_DECREMENT(val)   _PR_Darwin_x86_AtomicDecrement(val)
     123extern PRInt32 _PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
     124#define _MD_ATOMIC_SET(val, newval) _PR_Darwin_x86_AtomicSet(val, newval)
     125extern PRInt32 _PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
     126#define _MD_ATOMIC_ADD(ptr, val)    _PR_Darwin_x86_AtomicAdd(ptr, val)
     127#endif /* __i386__ */
    104128
    105129#define USE_SETJMP
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg

    r1 r589  
    2121 *
    2222 * Contributor(s):
     23 *  InnoTek
    2324 *
    2425 * Alternatively, the contents of this file may be used under the terms of
     
    3940#define nspr_vboxcfg___
    4041
    41 #ifndef __L4_XPCOM__
    42 # include <_linuxcfg.h>
     42#ifdef __DARWIN__
     43# include <md/_darwin.cfg>
     44#elif defined(__FREEBSD__)
     45# include <md/_freebsd.cfg>
     46#elif defined(__L4__)
     47# include <md/_l4v2.cfg>
     48#elif defined(__LINUX__)
     49# include <md/_linux.cfg>
     50#elif defined(__NETBSD__)
     51# include <md/_netbsd.cfg>
     52#elif defined(__OPENBSD__)
     53# include <md/_openbsd.cfg>
     54#elif defined(__SOLARIS__)
     55# include <md/_solaris.cfg>
    4356#else
    44 # include <_l4v2cfg.h>
     57# error "Define the correct platform identifier / Port me."
    4558#endif
    4659
  • trunk/src/libs/xpcom18a4/xpcom/MoreFiles/FSCopyObject.c

    r1 r589  
    4444        Copyright © 2002 Apple Computer, Inc., All Rights Reserved
    4545*/
     46
     47// Modified 2006-01-23 - added this comment.
    4648
    4749#include "FSCopyObject.h"
  • trunk/src/libs/xpcom18a4/xpcom/MoreFiles/FSCopyObject.h

    r1 r589  
    4242*/
    4343
     44// Modified 2006-01-23 - added this comment.
    4445
    4546#ifndef __FSCOPYOBJECT_H__
  • trunk/src/libs/xpcom18a4/xpcom/MoreFiles/MoreFilesX.c

    r1 r589  
    6969                 <1>     1/25/02        JL              MoreFilesX 1.0
    7070*/
     71
     72// Modified 2006-01-23 - added this comment.
    7173
    7274#if defined(__MACH__)
     
    21252127/*****************************************************************************/
    21262128
    2127 OSErr
    2128 FSLockRange(
     2129/* Renamed from FSLockRange to MFX_FSLockRange to avoid a conflict with
     2130 * the FSLockRange function present in the system library since Mac OS X
     2131 * 10.4. */
     2132
     2133OSErr
     2134MFX_FSLockRange(
    21292135        SInt16 refNum,
    21302136        SInt32 rangeLength,
     
    21482154/*****************************************************************************/
    21492155
    2150 OSErr
    2151 FSUnlockRange(
     2156/* Renamed from FSUnlockRange to MFX_FSUnlockRange to avoid a conflict with
     2157 * the FSUnlockRange function present in the system library since Mac OS X
     2158 * 10.4. */
     2159
     2160OSErr
     2161MFX_FSUnlockRange(
    21522162        SInt16 refNum,
    21532163        SInt32 rangeLength,
     
    23072317/*****************************************************************************/
    23082318
     2319// This function exists in Mac OS X 10.5, we cannot re-define it here.
     2320// We don't use this function, so just don't compile it.
     2321#if 0
    23092322OSErr
    23102323FSVolumeMount(
     
    23302343        return ( result );
    23312344}
     2345#endif
    23322346
    23332347/*****************************************************************************/
  • trunk/src/libs/xpcom18a4/xpcom/MoreFiles/MoreFilesX.h

    r1 r589  
    8484                                do less work.
    8585*/
     86
     87// Modified 2006-01-23 - added this comment.
    8688
    8789#ifndef __MOREFILESX__
     
    13331335/*****************************************************************************/
    13341336
    1335 #pragma mark FSLockRange
    1336 
    1337 OSErr
    1338 FSLockRange(
     1337#pragma mark MFX_FSLockRange
     1338/* Renamed from FSLockRange to MFX_FSLockRange to avoid a conflict with
     1339 * the FSLockRange function present in the system library since Mac OS X
     1340 * 10.4. */
     1341
     1342OSErr
     1343MFX_FSLockRange(
    13391344        SInt16 refNum,
    13401345        SInt32 rangeLength,
     
    13561361/*****************************************************************************/
    13571362
    1358 #pragma mark FSUnlockRange
    1359 
    1360 OSErr
    1361 FSUnlockRange(
     1363#pragma mark MFX_FSUnlockRange
     1364/* Renamed from FSUnlockRange to MFX_FSUnlockRange to avoid a conflict with
     1365 * the FSUnlockRange function present in the system library since Mac OS X
     1366 * 10.4. */
     1367
     1368OSErr
     1369MFX_FSUnlockRange(
    13621370        SInt16 refNum,
    13631371        SInt32 rangeLength,
     
    14831491#pragma mark FSVolumeMount
    14841492
     1493// This function exists in Mac OS X 10.5, we cannot re-define it here.
     1494// We don't use this function, so just don't compile it.
     1495#if 0
    14851496OSErr
    14861497FSVolumeMount(
    14871498        const void *volMountInfo,
    14881499        FSVolumeRefNum *volRefNum);
     1500#endif
    14891501
    14901502/*
  • trunk/src/libs/xpcom18a4/xpcom/io/nsILocalFileMac.idl

    r1 r589  
    2222 * Contributor(s):
    2323 *  Conrad Carlen <[email protected]>
     24 *  Mark Mentovai <[email protected]>
    2425 *
    2526 * Alternatively, the contents of this file may be used under the terms of
     
    5152      native CFURLRef(CFURLRef);
    5253
    53 [uuid(614c3010-1dd2-11b2-be04-bcd57a64ffc9)]
     54[scriptable, uuid(748f3ffe-27d9-4402-9de9-494badbeebf4)]
    5455interface nsILocalFileMac : nsILocalFile
    5556{
     
    6566    *
    6667    */
    67     void initWithCFURL(in CFURLRef aCFURL);
     68  [noscript] void initWithCFURL(in CFURLRef aCFURL);
    6869
    6970   /**
     
    7778    *
    7879    */
    79     void initWithFSRef([const] in FSRefPtr aFSRef);
     80  [noscript] void initWithFSRef([const] in FSRefPtr aFSRef);
    8081
    8182   /**
     
    8889    *
    8990    */
    90     void initWithFSSpec([const] in FSSpecPtr aFileSpec);
     91  [noscript] void initWithFSSpec([const] in FSSpecPtr aFileSpec);
    9192
    9293   /**
     
    100101    *
    101102    */
    102     void initToAppWithCreatorCode(in OSType aAppCreator);
     103  [noscript] void initToAppWithCreatorCode(in OSType aAppCreator);
    103104
    104105    /**
     
    116117    *
    117118    * @return
    118     * 
    119     */ 
    120     CFURLRef getCFURL();
    121  
     119    *
     120    */
     121  [noscript] CFURLRef getCFURL();
     122
    122123    /**
    123124    * getFSRef
     
    133134    *
    134135    * @return
    135     * 
    136     */ 
    137     FSRef getFSRef();
    138    
     136    *
     137    */
     138  [noscript] FSRef getFSRef();
     139
    139140   /**
    140141    * getFSSpec
     
    148149    *
    149150    * @return
    150     * 
    151     */ 
    152     FSSpec getFSSpec();
     151    *
     152    */
     153  [noscript] FSSpec getFSSpec();
    153154
    154155   /**
    155156    * fileSizeWithResFork
    156     * 
     157    *
    157158    * Returns the combined size of both the data fork and the resource
    158159    * fork (if present) rather than just the size of the data fork
     
    160161    *
    161162    */
    162     readonly attribute PRInt64 fileSizeWithResFork;
    163    
     163   readonly attribute PRInt64 fileSizeWithResFork;
     164
    164165   /**
    165166    * Use with SetFileType() to specify the signature of current process
    166167    */
    167     const unsigned long CURRENT_PROCESS_CREATOR = 0x8000000;
    168    
     168   const unsigned long CURRENT_PROCESS_CREATOR = 0x8000000;
     169
    169170   /**
    170171    * fileType, creator
     
    173174    *
    174175    */
    175     attribute OSType fileType;
    176     attribute OSType fileCreator;
    177    
     176   [noscript] attribute OSType fileType;
     177   [noscript] attribute OSType fileCreator;
     178
    178179   /**
    179180    * setFileTypeAndCreatorFromMIMEType
     
    185186    *
    186187    */
    187     void setFileTypeAndCreatorFromMIMEType(in string aMIMEType);
    188    
     188   void setFileTypeAndCreatorFromMIMEType(in string aMIMEType);
     189
    189190   /**
    190191    * setFileTypeAndCreatorFromExtension
     
    196197    *
    197198    */
    198     void setFileTypeAndCreatorFromExtension(in string aExtension);
    199    
     199   void setFileTypeAndCreatorFromExtension(in string aExtension);
     200
    200201   /**
    201202    * launchWithDoc
     
    207208    *
    208209    */
    209     void launchWithDoc(in nsILocalFile aDocToLoad, in boolean aLaunchInBackground);
     210   void launchWithDoc(in nsILocalFile aDocToLoad, in boolean aLaunchInBackground);
    210211
    211212   /**
     
    220221    *
    221222    */
    222     void openDocWithApp(in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground);
     223   void openDocWithApp(in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground);
    223224
    224225   /**
     
    228229    *
    229230    */
    230     boolean isPackage();
     231   boolean isPackage();
     232
     233   /**
     234    * bundleDisplayName
     235    *
     236    * returns the display name of the application bundle (usually the human
     237    * readable name of the application)
     238    */
     239   readonly attribute AString bundleDisplayName;
     240
     241   /**
     242    * bundleIdentifier
     243    *
     244    * returns the identifier of the bundle
     245    */
     246   readonly attribute AUTF8String bundleIdentifier;
    231247};
    232248
     
    240256
    241257NS_EXPORT nsresult NS_NewLocalFileWithFSSpec(const FSSpec* inSpec, PRBool followSymlinks, nsILocalFileMac* *result);
     258
     259// NS_NewLocalFileWithFSRef is available since Mozilla 1.8.1.
     260NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, PRBool aFollowSymlinks, nsILocalFileMac** result);
    242261}
    243262%}
  • trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileOSX.cpp

    r1 r589  
    2323 *  Conrad Carlen <[email protected]>
    2424 *  Jungshik Shin <[email protected]>
     25 *  Asaf Romano <[email protected]>
     26 *  Mark Mentovai <[email protected]>
    2527 *
    2628 * Alternatively, the contents of this file may be used under the terms of
     
    3941
    4042#include "nsLocalFile.h"
     43#include "nsDirectoryServiceDefs.h"
    4144
    4245#include "nsString.h"
    4346#include "nsReadableUtils.h"
     47#include "nsIDirectoryEnumerator.h"
    4448#include "nsISimpleEnumerator.h"
    4549#include "nsITimelineService.h"
     
    4953#include "prmem.h"
    5054#include "nsCRT.h"
     55#include "nsHashKeys.h"
    5156
    5257#include "MoreFilesX.h"
    5358#include "FSCopyObject.h"
    5459#include "nsAutoBuffer.h"
     60#include "nsTraceRefcntImpl.h"
    5561
    5662// Mac Includes
    57 #include <Aliases.h>
    58 #include <Gestalt.h>
    59 #include <AppleEvents.h>
    60 #include <AEDataModel.h>
    61 #include <Processes.h>
    6263#include <Carbon/Carbon.h>
    6364
    6465// Unix Includes
     66#include <unistd.h>
    6567#include <sys/stat.h>
     68#include <stdlib.h>
     69
     70#if !defined(MAC_OS_X_VERSION_10_4) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
     71#define GetAliasSizeFromRecord(aliasRecord) aliasRecord.aliasSize
     72#else
     73#define GetAliasSizeFromRecord(aliasRecord) GetAliasSizeFromPtr(&aliasRecord)
     74#endif
     75
     76#define CHECK_mBaseRef()                        \
     77    PR_BEGIN_MACRO                              \
     78        if (!mBaseRef)                          \
     79            return NS_ERROR_NOT_INITIALIZED;    \
     80    PR_END_MACRO
    6681
    6782//*****************************************************************************
     
    108123        mFile.SetFollowLinks(mSavedState);
    109124    }
    110    
     125
    111126  private:
    112127    nsLocalFile& mFile;
     
    117132#pragma mark [nsDirEnumerator]
    118133
    119 class nsDirEnumerator : public nsISimpleEnumerator
     134class nsDirEnumerator : public nsISimpleEnumerator,
     135                        public nsIDirectoryEnumerator
    120136{
    121137    public:
     
    130146        }
    131147
    132         nsresult Init(nsILocalFileMac* parent) 
     148        nsresult Init(nsILocalFileMac* parent)
    133149        {
    134150          NS_ENSURE_ARG(parent);
    135          
     151
    136152          OSErr err;
    137153          nsresult rv;
    138154          FSRef parentRef;
    139          
     155
    140156          rv = parent->GetFSRef(&parentRef);
    141157          if (NS_FAILED(rv))
    142158            return rv;
    143          
     159
    144160          mFSRefsArray = (FSRef *)nsMemory::Alloc(sizeof(FSRef)
    145161                                                  * kRequestCountPerIteration);
    146162          if (!mFSRefsArray)
    147163            return NS_ERROR_OUT_OF_MEMORY;
    148          
     164
    149165          err = ::FSOpenIterator(&parentRef, kFSIterateFlat, &mIterator);
    150166          if (err != noErr)
    151167            return MacErrorMapper(err);
    152                              
     168
    153169          return NS_OK;
    154170        }
    155171
    156         NS_IMETHOD HasMoreElements(PRBool *result) 
     172        NS_IMETHOD HasMoreElements(PRBool *result)
    157173        {
    158174          if (mNext == nsnull) {
     
    168184                                           nsnull,
    169185                                           nsnull);
    170            
     186
    171187              if (err == noErr || err == errFSNoMoreItems) {
    172188                mArrayCnt = actualCnt;
     
    183199              mArrayIndex++;
    184200              mNext = newFile;
    185             } 
     201            }
    186202          }
    187203          *result = mNext != nsnull;
     204          if (!*result)
     205            Close();
    188206          return NS_OK;
    189207        }
    190208
    191         NS_IMETHOD GetNext(nsISupports **result) 
     209        NS_IMETHOD GetNext(nsISupports **result)
    192210        {
    193211            NS_ENSURE_ARG_POINTER(result);
     
    206224        }
    207225
     226        NS_IMETHOD GetNextFile(nsIFile **result)
     227        {
     228            *result = nsnull;
     229            PRBool hasMore = PR_FALSE;
     230            nsresult rv = HasMoreElements(&hasMore);
     231            if (NS_FAILED(rv) || !hasMore)
     232                return rv;
     233            *result = mNext;
     234            NS_IF_ADDREF(*result);
     235            mNext = nsnull;
     236            return NS_OK;
     237        }
     238
     239        NS_IMETHOD Close()
     240        {
     241          if (mIterator) {
     242            ::FSCloseIterator(mIterator);
     243            mIterator = nsnull;
     244          }
     245          if (mFSRefsArray) {
     246            nsMemory::Free(mFSRefsArray);
     247            mFSRefsArray = nsnull;
     248          }
     249          return NS_OK;
     250        }
     251
    208252    private:
    209         ~nsDirEnumerator() 
     253        ~nsDirEnumerator()
    210254        {
    211           if (mIterator)
    212             ::FSCloseIterator(mIterator);
    213           if (mFSRefsArray)
    214             nsMemory::Free(mFSRefsArray);
     255          Close();
    215256        }
    216257
     
    221262          kRequestCountPerIteration = ((4096 * 4) / sizeof(FSRef))
    222263        };
    223        
     264
    224265        nsCOMPtr<nsILocalFileMac>   mNext;
    225        
     266
    226267        FSIterator              mIterator;
    227268        FSRef                   *mFSRefsArray;
     
    229270};
    230271
    231 NS_IMPL_ISUPPORTS1(nsDirEnumerator, nsISimpleEnumerator)
     272NS_IMPL_ISUPPORTS2(nsDirEnumerator, nsISimpleEnumerator, nsIDirectoryEnumerator)
    232273
    233274#pragma mark -
     
    242283      dataHandle = nil;
    243284    }
    244              
     285
    245286    ~StAEDesc()
    246287    {
     
    305346#pragma mark [nsISupports]
    306347
    307 NS_IMPL_THREADSAFE_ISUPPORTS3(nsLocalFile,
     348NS_IMPL_THREADSAFE_ISUPPORTS4(nsLocalFile,
    308349                              nsILocalFileMac,
    309350                              nsILocalFile,
    310                               nsIFile)
    311                              
     351                              nsIFile,
     352                              nsIHashable)
     353
    312354NS_METHOD nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
    313355{
     
    318360  if (inst == NULL)
    319361    return NS_ERROR_OUT_OF_MEMORY;
    320  
     362
    321363  nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
    322364  if (NS_FAILED(rv))
     
    338380NS_IMETHODIMP nsLocalFile::Append(const nsAString& aNode)
    339381{
    340   return AppendNative(NS_ConvertUCS2toUTF8(aNode));
     382  return AppendNative(NS_ConvertUTF16toUTF8(aNode));
    341383}
    342384
     
    344386NS_IMETHODIMP nsLocalFile::AppendNative(const nsACString& aNode)
    345387{
    346   if (!mBaseRef)
    347     return NS_ERROR_NOT_INITIALIZED;
     388  // Check we are correctly initialized.
     389  CHECK_mBaseRef();
    348390
    349391  nsACString::const_iterator start, end;
     
    372414NS_IMETHODIMP nsLocalFile::Normalize()
    373415{
    374     return NS_OK;
     416  // Check we are correctly initialized.
     417  CHECK_mBaseRef();
     418
     419  // CFURL doesn't doesn't seem to resolve paths containing relative
     420  // components, so we'll nick the stdlib code from nsLocalFileUnix
     421  UInt8 path[PATH_MAX] = "";
     422  Boolean success;
     423  success = ::CFURLGetFileSystemRepresentation(mBaseRef, true, path, PATH_MAX);
     424  if (!success)
     425    return NS_ERROR_FAILURE;
     426
     427  char resolved_path[PATH_MAX] = "";
     428  char *resolved_path_ptr = nsnull;
     429  resolved_path_ptr = realpath((char*)path, resolved_path);
     430
     431  // if there is an error, the return is null.
     432  if (!resolved_path_ptr)
     433      return NSRESULT_FOR_ERRNO();
     434
     435  // Need to know whether we're a directory to create a new CFURLRef
     436  PRBool isDirectory;
     437  nsresult rv = IsDirectory(&isDirectory);
     438  NS_ENSURE_SUCCESS(rv, rv);
     439
     440  rv = NS_ERROR_FAILURE;
     441  CFStringRef pathStrRef =
     442    ::CFStringCreateWithCString(kCFAllocatorDefault,
     443                                resolved_path,
     444                                kCFStringEncodingUTF8);
     445  if (pathStrRef) {
     446    CFURLRef newURLRef =
     447      ::CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pathStrRef,
     448                                      kCFURLPOSIXPathStyle, isDirectory);
     449    if (newURLRef) {
     450      SetBaseRef(newURLRef);
     451      ::CFRelease(newURLRef);
     452      rv = NS_OK;
     453    }
     454    ::CFRelease(pathStrRef);
     455  }
     456
     457  return rv;
    375458}
    376459
     
    380463  if (type != NORMAL_FILE_TYPE && type != DIRECTORY_TYPE)
    381464    return NS_ERROR_FILE_UNKNOWN_TYPE;
    382   if (!mBaseRef)
    383     return NS_ERROR_NOT_INITIALIZED;
    384  
     465
     466  // Check we are correctly initialized.
     467  CHECK_mBaseRef();
     468
    385469  nsStringArray nonExtantNodes;
    386470  CFURLRef pathURLRef = mBaseRef;
     
    389473  nsAutoBuffer<UniChar, FILENAME_BUFFER_SIZE> buffer;
    390474  Boolean success;
    391  
     475
    392476  // Work backwards through the path to find the last node which
    393477  // exists. Place the nodes which don't exist in an array and we'll
     
    405489    ::CFRelease(leafStrRef);
    406490    leafStrRef = nsnull;
    407    
     491
    408492    // Get the parent of the leaf for the next go round
    409493    CFURLRef parent = ::CFURLCreateCopyDeletingLastPathComponent(NULL, pathURLRef);
     
    423507  if (nodesToCreate == 0)
    424508    return NS_ERROR_FILE_ALREADY_EXISTS;
    425  
    426   OSErr err;   
     509
     510  OSErr err;
    427511  nsAutoString nextNodeName;
    428512  for (PRInt32 i = nodesToCreate - 1; i > 0; i--) {
     
    451535                                    nsnull, nsnull, nsnull, nsnull);
    452536  }
    453            
     537
    454538  return MacErrorMapper(err);
    455539}
     
    468552NS_IMETHODIMP nsLocalFile::SetLeafName(const nsAString& aLeafName)
    469553{
    470   return SetNativeLeafName(NS_ConvertUCS2toUTF8(aLeafName));
     554  return SetNativeLeafName(NS_ConvertUTF16toUTF8(aLeafName));
    471555}
    472556
     
    474558NS_IMETHODIMP nsLocalFile::GetNativeLeafName(nsACString& aNativeLeafName)
    475559{
    476   if (!mBaseRef)
    477     return NS_ERROR_NOT_INITIALIZED;
     560  // Check we are correctly initialized.
     561  CHECK_mBaseRef();
     562
    478563  nsresult rv = NS_ERROR_FAILURE;
    479564  CFStringRef leafStrRef = ::CFURLCopyLastPathComponent(mBaseRef);
     
    482567    ::CFRelease(leafStrRef);
    483568  }
    484   return rv;                                 
     569  return rv;
    485570}
    486571
    487572NS_IMETHODIMP nsLocalFile::SetNativeLeafName(const nsACString& aNativeLeafName)
    488573{
    489   if (!mBaseRef)
    490     return NS_ERROR_NOT_INITIALIZED;
     574  // Check we are correctly initialized.
     575  CHECK_mBaseRef();
     576
    491577  nsresult rv = NS_ERROR_FAILURE;
    492578  CFURLRef parentURLRef = ::CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, mBaseRef);
     
    514600NS_IMETHODIMP nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString& newName)
    515601{
    516     return MoveCopy(newParentDir, newName, PR_TRUE, PR_FALSE);
     602  return CopyInternal(newParentDir, newName, PR_FALSE);
    517603}
    518604
     
    520606NS_IMETHODIMP nsLocalFile::CopyToNative(nsIFile *newParentDir, const nsACString& newName)
    521607{
    522     return MoveCopy(newParentDir, NS_ConvertUTF8toUCS2(newName), PR_TRUE, PR_FALSE);
     608  return CopyInternal(newParentDir, NS_ConvertUTF8toUTF16(newName), PR_FALSE);
    523609}
    524610
     
    526612NS_IMETHODIMP nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString& newName)
    527613{
    528     return MoveCopy(newParentDir, newName, PR_TRUE, PR_TRUE);
     614  return CopyInternal(newParentDir, newName, PR_TRUE);
    529615}
    530616
     
    532618NS_IMETHODIMP nsLocalFile::CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString& newName)
    533619{
    534     return MoveCopy(newParentDir, NS_ConvertUTF8toUCS2(newName), PR_TRUE, PR_TRUE);
     620  return CopyInternal(newParentDir, NS_ConvertUTF8toUTF16(newName), PR_TRUE);
    535621}
    536622
     
    538624NS_IMETHODIMP nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString& newName)
    539625{
    540     return MoveCopy(newParentDir, newName, FALSE, FALSE);
     626  return MoveToNative(newParentDir, NS_ConvertUTF16toUTF8(newName));
    541627}
    542628
     
    544630NS_IMETHODIMP nsLocalFile::MoveToNative(nsIFile *newParentDir, const nsACString& newName)
    545631{
    546     return MoveCopy(newParentDir, NS_ConvertUTF8toUCS2(newName), FALSE, FALSE);
     632  // Check we are correctly initialized.
     633  CHECK_mBaseRef();
     634
     635  StFollowLinksState followLinks(*this, PR_FALSE);
     636
     637  PRBool isDirectory;
     638  nsresult rv = IsDirectory(&isDirectory);
     639  if (NS_FAILED(rv))
     640    return rv;
     641
     642  // Get the source path.
     643  nsCAutoString srcPath;
     644  rv = GetNativePath(srcPath);
     645  if (NS_FAILED(rv))
     646    return rv;
     647
     648  // Build the destination path.
     649  nsCOMPtr<nsIFile> parentDir = newParentDir;
     650  if (!parentDir) {
     651    if (newName.IsEmpty())
     652      return NS_ERROR_INVALID_ARG;
     653    rv = GetParent(getter_AddRefs(parentDir));
     654    if (NS_FAILED(rv))
     655      return rv;
     656  }
     657  else {
     658    PRBool exists;
     659    rv = parentDir->Exists(&exists);
     660    if (NS_FAILED(rv))
     661      return rv;
     662    if (!exists) {
     663      rv = parentDir->Create(nsIFile::DIRECTORY_TYPE, 0777);
     664      if (NS_FAILED(rv))
     665        return rv;
     666    }
     667  }
     668
     669  nsCAutoString destPath;
     670  rv = parentDir->GetNativePath(destPath);
     671  if (NS_FAILED(rv))
     672    return rv;
     673
     674  if (!newName.IsEmpty())
     675    destPath.Append(NS_LITERAL_CSTRING("/") + newName);
     676  else {
     677    nsCAutoString leafName;
     678    rv = GetNativeLeafName(leafName);
     679    if (NS_FAILED(rv))
     680      return rv;
     681    destPath.Append(NS_LITERAL_CSTRING("/") + leafName);
     682  }
     683
     684  // Perform the move.
     685  if (rename(srcPath.get(), destPath.get()) != 0) {
     686    if (errno == EXDEV) {
     687      // Can't move across volume (device) boundaries.  Copy and remove.
     688      rv = CopyToNative(parentDir, newName);
     689      if (NS_SUCCEEDED(rv)) {
     690        // Permit removal failure.
     691        Remove(PR_TRUE);
     692      }
     693    }
     694    else
     695      rv = NSRESULT_FOR_ERRNO();
     696
     697    if (NS_FAILED(rv))
     698      return rv;
     699  }
     700
     701  // Update |this| to refer to the moved file.
     702  CFURLRef newBaseRef =
     703   ::CFURLCreateFromFileSystemRepresentation(NULL, (UInt8*)destPath.get(),
     704                                             destPath.Length(), isDirectory);
     705  if (!newBaseRef)
     706    return NS_ERROR_FAILURE;
     707  SetBaseRef(newBaseRef);
     708  ::CFRelease(newBaseRef);
     709
     710  return rv;
    547711}
    548712
     
    550714NS_IMETHODIMP nsLocalFile::Remove(PRBool recursive)
    551715{
    552   StFollowLinksState followLinks(*this, PR_FALSE); // XXX If we're an alias, never remove target
    553  
     716  // Check we are correctly initialized.
     717  CHECK_mBaseRef();
     718
     719  // XXX If we're an alias, never remove target
     720  StFollowLinksState followLinks(*this, PR_FALSE);
     721
     722  PRBool isDirectory;
     723  nsresult rv = IsDirectory(&isDirectory);
     724  if (NS_FAILED(rv))
     725    return rv;
     726
     727  if (recursive && isDirectory) {
     728    FSRef fsRef;
     729    rv = GetFSRefInternal(fsRef);
     730    if (NS_FAILED(rv))
     731      return rv;
     732
     733    // Call MoreFilesX to do a recursive removal.
     734    OSStatus err = ::FSDeleteContainer(&fsRef);
     735    rv = MacErrorMapper(err);
     736  }
     737  else {
     738    nsCAutoString path;
     739    rv = GetNativePath(path);
     740    if (NS_FAILED(rv))
     741      return rv;
     742
     743    const char* pathPtr = path.get();
     744    int status;
     745    if (isDirectory)
     746      status = rmdir(pathPtr);
     747    else
     748      status = unlink(pathPtr);
     749
     750    if (status != 0)
     751      rv = NSRESULT_FOR_ERRNO();
     752  }
     753
     754  mCachedFSRefValid = PR_FALSE;
     755  return rv;
     756}
     757
     758/* attribute unsigned long permissions; */
     759NS_IMETHODIMP nsLocalFile::GetPermissions(PRUint32 *aPermissions)
     760{
     761  NS_ENSURE_ARG_POINTER(aPermissions);
     762
    554763  FSRef fsRef;
    555764  nsresult rv = GetFSRefInternal(fsRef);
    556765  if (NS_FAILED(rv))
    557766    return rv;
    558    
    559   PRBool isDir;
    560   rv = IsDirectory(&isDir);
    561   if (NS_FAILED(rv))
    562     return rv;
    563  
    564   OSErr err;
    565   if (recursive && isDir)
    566     err = ::FSDeleteContainer(&fsRef);
    567   else
    568     err = ::FSDeleteObject(&fsRef);
    569  
    570   mCachedFSRefValid = PR_FALSE;
    571   return MacErrorMapper(err);
    572 }
    573 
    574 /* attribute unsigned long permissions; */
    575 NS_IMETHODIMP nsLocalFile::GetPermissions(PRUint32 *aPermissions)
    576 {
    577   NS_ENSURE_ARG_POINTER(aPermissions);
    578  
    579   FSRef fsRef;
    580   nsresult rv = GetFSRefInternal(fsRef);
    581   if (NS_FAILED(rv))
    582     return rv;
    583    
     767
    584768  FSCatalogInfo catalogInfo;
    585769  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoPermissions, &catalogInfo,
     
    598782  if (NS_FAILED(rv))
    599783    return rv;
    600  
     784
    601785  FSCatalogInfo catalogInfo;
    602786  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoPermissions, &catalogInfo,
     
    626810NS_IMETHODIMP nsLocalFile::GetLastModifiedTime(PRInt64 *aLastModifiedTime)
    627811{
     812  // Check we are correctly initialized.
     813  CHECK_mBaseRef();
     814
    628815  NS_ENSURE_ARG_POINTER(aLastModifiedTime);
    629  
     816
    630817  FSRef fsRef;
    631818  nsresult rv = GetFSRefInternal(fsRef);
    632819  if (NS_FAILED(rv))
    633820    return rv;
    634    
     821
    635822  FSCatalogInfo catalogInfo;
    636823  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoContentMod, &catalogInfo,
     
    638825  if (err != noErr)
    639826    return MacErrorMapper(err);
    640   *aLastModifiedTime = HFSPlustoNSPRTime(catalogInfo.contentModDate); 
     827  *aLastModifiedTime = HFSPlustoNSPRTime(catalogInfo.contentModDate);
    641828  return NS_OK;
    642829}
     
    644831NS_IMETHODIMP nsLocalFile::SetLastModifiedTime(PRInt64 aLastModifiedTime)
    645832{
     833  // Check we are correctly initialized.
     834  CHECK_mBaseRef();
     835
    646836  OSErr err;
    647837  nsresult rv;
     
    661851  if (err != noErr)
    662852    return MacErrorMapper(err);
    663  
     853
    664854  /* Notify the parent if this is a file */
    665855  notifyParent = (0 == (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask));
     
    695885  NS_ENSURE_ARG_POINTER(aFileSize);
    696886  *aFileSize = 0;
    697  
     887
    698888  FSRef fsRef;
    699889  nsresult rv = GetFSRefInternal(fsRef);
    700890  if (NS_FAILED(rv))
    701891    return rv;
    702      
     892
    703893  FSCatalogInfo catalogInfo;
    704894  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNodeFlags + kFSCatInfoDataSizes, &catalogInfo,
     
    706896  if (err != noErr)
    707897    return MacErrorMapper(err);
    708  
     898
    709899  // FSGetCatalogInfo can return a bogus size for directories sometimes, so only
    710900  // rely on the answer for files
     
    716906NS_IMETHODIMP nsLocalFile::SetFileSize(PRInt64 aFileSize)
    717907{
     908  // Check we are correctly initialized.
     909  CHECK_mBaseRef();
     910
    718911  FSRef fsRef;
    719912  nsresult rv = GetFSRefInternal(fsRef);
    720913  if (NS_FAILED(rv))
    721914    return rv;
    722  
    723   SInt16 refNum;   
     915
     916  SInt16 refNum;
    724917  OSErr err = ::FSOpenFork(&fsRef, 0, nsnull, fsWrPerm, &refNum);
    725918  if (err != noErr)
    726919    return MacErrorMapper(err);
    727920  err = ::FSSetForkSize(refNum, fsFromStart, aFileSize);
    728   ::FSCloseFork(refNum); 
    729  
     921  ::FSCloseFork(refNum);
     922
    730923  return MacErrorMapper(err);
    731924}
     
    734927NS_IMETHODIMP nsLocalFile::GetFileSizeOfLink(PRInt64 *aFileSizeOfLink)
    735928{
     929  // Check we are correctly initialized.
     930  CHECK_mBaseRef();
     931
    736932  NS_ENSURE_ARG_POINTER(aFileSizeOfLink);
    737  
     933
    738934  StFollowLinksState followLinks(*this, PR_FALSE);
    739935  return GetFileSize(aFileSizeOfLink);
     
    768964NS_IMETHODIMP nsLocalFile::GetNativePath(nsACString& aNativePath)
    769965{
    770   if (!mBaseRef)
    771     return NS_ERROR_NOT_INITIALIZED;
     966  // Check we are correctly initialized.
     967  CHECK_mBaseRef();
     968
    772969  nsresult rv = NS_ERROR_FAILURE;
    773970  CFStringRef pathStrRef = ::CFURLCopyFileSystemPath(mBaseRef, kCFURLPOSIXPathStyle);
     
    782979NS_IMETHODIMP nsLocalFile::Exists(PRBool *_retval)
    783980{
     981  // Check we are correctly initialized.
     982  CHECK_mBaseRef();
     983
    784984  NS_ENSURE_ARG_POINTER(_retval);
    785985  *_retval = PR_FALSE;
    786  
     986
    787987  FSRef fsRef;
    788988  if (NS_SUCCEEDED(GetFSRefInternal(fsRef, PR_TRUE))) {
    789989    *_retval = PR_TRUE;
    790990  }
    791  
     991
    792992  return NS_OK;
    793993}
     
    796996NS_IMETHODIMP nsLocalFile::IsWritable(PRBool *_retval)
    797997{
     998    // Check we are correctly initialized.
     999    CHECK_mBaseRef();
     1000
    7981001    NS_ENSURE_ARG_POINTER(_retval);
    7991002    *_retval = PR_FALSE;
    800    
     1003
    8011004    FSRef fsRef;
    8021005    nsresult rv = GetFSRefInternal(fsRef);
    8031006    if (NS_FAILED(rv))
    8041007      return rv;
    805     if (::FSCheckLock(&fsRef) == noErr) {     
     1008    if (::FSCheckLock(&fsRef) == noErr) {
    8061009      PRUint32 permissions;
    8071010      rv = GetPermissions(&permissions);
     
    8161019NS_IMETHODIMP nsLocalFile::IsReadable(PRBool *_retval)
    8171020{
     1021    // Check we are correctly initialized.
     1022    CHECK_mBaseRef();
     1023
    8181024    NS_ENSURE_ARG_POINTER(_retval);
    8191025    *_retval = PR_FALSE;
    820    
     1026
    8211027    PRUint32 permissions;
    8221028    nsresult rv = GetPermissions(&permissions);
     
    8301036NS_IMETHODIMP nsLocalFile::IsExecutable(PRBool *_retval)
    8311037{
     1038  // Check we are correctly initialized.
     1039  CHECK_mBaseRef();
     1040
    8321041  NS_ENSURE_ARG_POINTER(_retval);
    8331042  *_retval = PR_FALSE;
    834  
     1043
    8351044  FSRef fsRef;
    8361045  nsresult rv = GetFSRefInternal(fsRef);
    8371046  if (NS_FAILED(rv))
    8381047    return rv;
    839    
     1048
    8401049  LSRequestedInfo theInfoRequest = kLSRequestAllInfo;
    8411050  LSItemInfoRecord theInfo;
     
    8521061  NS_ENSURE_ARG_POINTER(_retval);
    8531062  *_retval = PR_FALSE;
    854  
     1063
    8551064  FSRef fsRef;
    8561065  nsresult rv = GetFSRefInternal(fsRef);
    8571066  if (NS_FAILED(rv))
    8581067    return rv;
    859  
     1068
    8601069  FSCatalogInfo catalogInfo;
    861   HFSUniStr255 leafName; 
    862   OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNodeFlags, &catalogInfo,
     1070  HFSUniStr255 leafName;
     1071  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &catalogInfo,
    8631072                                &leafName, nsnull, nsnull);
    8641073  if (err != noErr)
    8651074    return MacErrorMapper(err);
    866      
     1075
    8671076  FileInfo *fInfoPtr = (FileInfo *)(catalogInfo.finderInfo); // Finder flags are in the same place whether we use FileInfo or FolderInfo
    8681077  if ((fInfoPtr->finderFlags & kIsInvisible) != 0) {
     
    8821091  NS_ENSURE_ARG_POINTER(_retval);
    8831092  *_retval = PR_FALSE;
    884  
     1093
    8851094  FSRef fsRef;
    8861095  nsresult rv = GetFSRefInternal(fsRef, PR_FALSE);
    8871096  if (NS_FAILED(rv))
    8881097    return rv;
    889    
     1098
    8901099  FSCatalogInfo catalogInfo;
    8911100  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNodeFlags, &catalogInfo,
     
    9021111  NS_ENSURE_ARG_POINTER(_retval);
    9031112  *_retval = PR_FALSE;
    904  
     1113
    9051114  FSRef fsRef;
    9061115  nsresult rv = GetFSRefInternal(fsRef, PR_FALSE);
    9071116  if (NS_FAILED(rv))
    9081117    return rv;
    909    
     1118
    9101119  FSCatalogInfo catalogInfo;
    9111120  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNodeFlags, &catalogInfo,
     
    9201129NS_IMETHODIMP nsLocalFile::IsSymlink(PRBool *_retval)
    9211130{
     1131  // Check we are correctly initialized.
     1132  CHECK_mBaseRef();
     1133
    9221134  NS_ENSURE_ARG(_retval);
    9231135  *_retval = PR_FALSE;
    924   if (!mBaseRef)
    925     return NS_ERROR_NOT_INITIALIZED;
    926  
     1136
     1137  // Check we are correctly initialized.
     1138  CHECK_mBaseRef();
     1139
    9271140  FSRef fsRef;
    9281141  if (::CFURLGetFSRef(mBaseRef, &fsRef)) {
     
    9501163
    9511164    NS_ADDREF(*_retval);
    952    
     1165
    9531166    return NS_OK;
    9541167}
     
    9571170NS_IMETHODIMP nsLocalFile::Equals(nsIFile *inFile, PRBool *_retval)
    9581171{
     1172    return EqualsInternal(inFile, PR_TRUE, _retval);
     1173}
     1174
     1175nsresult
     1176nsLocalFile::EqualsInternal(nsISupports* inFile, PRBool aUpdateCache,
     1177                            PRBool *_retval)
     1178{
    9591179  NS_ENSURE_ARG_POINTER(_retval);
    9601180  *_retval = PR_FALSE;
    961  
     1181
    9621182  nsCOMPtr<nsILocalFileMac> inMacFile(do_QueryInterface(inFile));
    9631183  if (!inFile)
    9641184    return NS_OK;
    965    
     1185
     1186  nsLocalFile* inLF =
     1187      NS_STATIC_CAST(nsLocalFile*, (nsILocalFileMac*) inMacFile);
     1188
    9661189  // If both exist, compare FSRefs
    9671190  FSRef thisFSRef, inFSRef;
    968   nsresult rv1 = GetFSRef(&thisFSRef);
    969   nsresult rv2 = inMacFile->GetFSRef(&inFSRef);
     1191  nsresult rv1 = GetFSRefInternal(thisFSRef, aUpdateCache);
     1192  nsresult rv2 = inLF->GetFSRefInternal(inFSRef, aUpdateCache);
    9701193  if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
    9711194    *_retval = (thisFSRef == inFSRef);
    9721195    return NS_OK;
    9731196  }
    974   // If one exists and the other doesn't, not equal 
     1197  // If one exists and the other doesn't, not equal
    9751198  if (rv1 != rv2)
    9761199    return NS_OK;
    977    
     1200
    9781201  // Arg, we have to get their paths and compare
    9791202  nsCAutoString thisPath, inPath;
     
    9831206    return NS_ERROR_FAILURE;
    9841207  *_retval = thisPath.Equals(inPath);
    985  
     1208
    9861209  return NS_OK;
    9871210}
     
    9901213NS_IMETHODIMP nsLocalFile::Contains(nsIFile *inFile, PRBool recur, PRBool *_retval)
    9911214{
     1215  // Check we are correctly initialized.
     1216  CHECK_mBaseRef();
     1217
    9921218  NS_ENSURE_ARG_POINTER(_retval);
    9931219  *_retval = PR_FALSE;
     
    10091235    if (inPath[thisPathLen] == kPathSepChar)
    10101236      *_retval = PR_TRUE;
    1011   } 
     1237  }
    10121238  return NS_OK;
    10131239}
     
    10181244  NS_ENSURE_ARG_POINTER(aParent);
    10191245  *aParent = nsnull;
    1020   if (!mBaseRef)
    1021     return NS_ERROR_NOT_INITIALIZED;
    1022  
     1246
     1247  // Check we are correctly initialized.
     1248  CHECK_mBaseRef();
     1249
    10231250  nsLocalFile *newFile = nsnull;
    10241251
     
    10391266    }
    10401267    ::CFRelease(parentURLRef);
    1041   } 
     1268  }
    10421269  return rv;
    10431270}
     
    10521279  PRBool isDir;
    10531280  rv = IsDirectory(&isDir);
    1054   if (NS_FAILED(rv)) 
     1281  if (NS_FAILED(rv))
    10551282    return rv;
    10561283  if (!isDir)
     
    10671294  }
    10681295  *aDirectoryEntries = dirEnum;
    1069  
     1296
    10701297  return NS_OK;
    10711298}
     
    10811308NS_IMETHODIMP nsLocalFile::InitWithPath(const nsAString& filePath)
    10821309{
    1083   return InitWithNativePath(NS_ConvertUCS2toUTF8(filePath));
     1310  return InitWithNativePath(NS_ConvertUTF16toUTF8(filePath));
    10841311}
    10851312
     
    10871314NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& filePath)
    10881315{
    1089   if (filePath.IsEmpty() || filePath.First() != '/')
     1316  nsCAutoString fixedPath;
     1317  if (Substring(filePath, 0, 2).EqualsLiteral("~/")) {
     1318    nsCOMPtr<nsIFile> homeDir;
     1319    nsCAutoString homePath;
     1320    nsresult rv = NS_GetSpecialDirectory(NS_OS_HOME_DIR,
     1321                                        getter_AddRefs(homeDir));
     1322    NS_ENSURE_SUCCESS(rv, rv);
     1323    rv = homeDir->GetNativePath(homePath);
     1324    NS_ENSURE_SUCCESS(rv, rv);
     1325
     1326    fixedPath = homePath + Substring(filePath, 1, filePath.Length() - 1);
     1327  }
     1328  else if (filePath.IsEmpty() || filePath.First() != '/')
    10901329    return NS_ERROR_FILE_UNRECOGNIZED_PATH;
    1091   // On 10.2, huge paths crash CFURLGetFSRef()
    1092   if (filePath.Length() > PATH_MAX)
    1093     return NS_ERROR_FILE_NAME_TOO_LONG;
    1094   // And, a path with consecutive '/'s which are not between
    1095   // nodes also crashes CFURLGetFSRef(). Consecutive '/'s which
     1330  else
     1331    fixedPath.Assign(filePath);
     1332
     1333  // A path with consecutive '/'s which are not between
     1334  // nodes crashes CFURLGetFSRef(). Consecutive '/'s which
    10961335  // are between actual nodes are OK. So, convert consecutive
    10971336  // '/'s to a single one.
    1098   nsCAutoString fixedPath;
    1099   fixedPath.Assign(filePath);
    11001337  fixedPath.ReplaceSubstring("//", "/");
     1338
     1339  // On 10.2, huge paths also crash CFURLGetFSRef()
     1340  if (fixedPath.Length() > PATH_MAX)
     1341    return NS_ERROR_FILE_NAME_TOO_LONG;
    11011342
    11021343  CFStringRef pathAsCFString;
     
    11131354  SetBaseRef(pathAsCFURL);
    11141355  ::CFRelease(pathAsCFURL);
     1356  ::CFRelease(pathAsCFString);
    11151357  return NS_OK;
    11161358}
     
    11201362{
    11211363  NS_ENSURE_ARG(aFile);
    1122  
     1364
    11231365  nsCOMPtr<nsILocalFileMac> aFileMac(do_QueryInterface(aFile));
    11241366  if (!aFileMac)
     
    11371379{
    11381380  NS_ENSURE_ARG_POINTER(aFollowLinks);
    1139  
     1381
    11401382  *aFollowLinks = mFollowLinks;
    11411383  return NS_OK;
     
    11601402  if (NS_FAILED(rv))
    11611403    return rv;
    1162    
     1404
    11631405  *_retval = PR_Open(path.get(), flags, mode);
    11641406  if (! *_retval)
     
    11771419  if (NS_FAILED(rv))
    11781420    return rv;
    1179    
     1421
    11801422  *_retval = fopen(path.get(), mode);
    11811423  if (! *_retval)
     
    11881430NS_IMETHODIMP nsLocalFile::Load(PRLibrary **_retval)
    11891431{
     1432  // Check we are correctly initialized.
     1433  CHECK_mBaseRef();
     1434
    11901435  NS_ENSURE_ARG_POINTER(_retval);
    11911436
     
    11971442    return rv;
    11981443
     1444#ifdef NS_BUILD_REFCNT_LOGGING
     1445  nsTraceRefcntImpl::SetActivityIsLegal(PR_FALSE);
     1446#endif
     1447
    11991448  *_retval = PR_LoadLibrary(path.get());
     1449
     1450#ifdef NS_BUILD_REFCNT_LOGGING
     1451  nsTraceRefcntImpl::SetActivityIsLegal(PR_TRUE);
     1452#endif
    12001453
    12011454  NS_TIMELINE_STOP_TIMER("PR_LoadLibrary");
     
    12041457  if (!*_retval)
    12051458    return NS_ERROR_FAILURE;
    1206  
     1459
    12071460  return NS_OK;
    12081461}
     
    12111464NS_IMETHODIMP nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
    12121465{
     1466  // Check we are correctly initialized.
     1467  CHECK_mBaseRef();
     1468
    12131469  NS_ENSURE_ARG_POINTER(aDiskSpaceAvailable);
    1214  
     1470
    12151471  FSRef fsRef;
    12161472  nsresult rv = GetFSRefInternal(fsRef);
    12171473  if (NS_FAILED(rv))
    12181474    return rv;
    1219    
     1475
    12201476  OSErr err;
    12211477  FSCatalogInfo catalogInfo;
     
    12241480  if (err != noErr)
    12251481    return MacErrorMapper(err);
    1226  
    1227   FSVolumeInfo volumeInfo; 
     1482
     1483  FSVolumeInfo volumeInfo;
    12281484  err = ::FSGetVolumeInfo(catalogInfo.volume, 0, nsnull, kFSVolInfoSizes,
    12291485                          &volumeInfo, nsnull, nsnull);
    12301486  if (err != noErr)
    12311487    return MacErrorMapper(err);
    1232    
     1488
    12331489  *aDiskSpaceAvailable = volumeInfo.freeBytes;
    12341490  return NS_OK;
     
    12381494NS_IMETHODIMP nsLocalFile::AppendRelativePath(const nsAString& relativeFilePath)
    12391495{
    1240   return AppendRelativeNativePath(NS_ConvertUCS2toUTF8(relativeFilePath));
     1496  return AppendRelativeNativePath(NS_ConvertUTF16toUTF8(relativeFilePath));
    12411497}
    12421498
    12431499/* [noscript] void appendRelativeNativePath (in ACString relativeFilePath); */
    12441500NS_IMETHODIMP nsLocalFile::AppendRelativeNativePath(const nsACString& relativeFilePath)
    1245 { 
     1501{
    12461502  if (relativeFilePath.IsEmpty())
    12471503    return NS_OK;
    1248   // No leading '/' 
     1504  // No leading '/'
    12491505  if (relativeFilePath.First() == '/')
    12501506    return NS_ERROR_FILE_UNRECOGNIZED_PATH;
     
    12551511  relativeFilePath.EndReading(pathEnd);
    12561512  nsACString::const_iterator nodeEnd(nodeBegin);
    1257  
     1513
    12581514  while (nodeEnd != pathEnd) {
    12591515    FindCharInReadable(kPathSepChar, nodeEnd, pathEnd);
     
    12751531  if (NS_FAILED(rv))
    12761532    return rv;
    1277    
     1533
    12781534  AliasHandle aliasH;
    12791535  OSErr err = ::FSNewAlias(nsnull, &fsRef, &aliasH);
    12801536  if (err != noErr)
    12811537    return MacErrorMapper(err);
    1282    
     1538
    12831539   PRUint32 bytes = ::GetHandleSize((Handle) aliasH);
    12841540   ::HLock((Handle) aliasH);
     
    12871543   ::DisposeHandle((Handle) aliasH);
    12881544   NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
    1289    
     1545
    12901546   aPersistentDescriptor = buf;
    12911547   PR_Free(buf);
     
    12991555    return NS_ERROR_INVALID_ARG;
    13001556
     1557  // Support pathnames as user-supplied descriptors if they begin with '/'
     1558  // or '~'.  These characters do not collide with the base64 set used for
     1559  // encoding alias records.
     1560  char first = aPersistentDescriptor.First();
     1561  if (first == '/' || first == '~')
     1562    return InitWithNativePath(aPersistentDescriptor);
     1563
    13011564  nsresult rv = NS_OK;
    1302  
    1303   PRUint32 dataSize = aPersistentDescriptor.Length();   
     1565
     1566  PRUint32 dataSize = aPersistentDescriptor.Length();
    13041567  char* decodedData = PL_Base64Decode(PromiseFlatCString(aPersistentDescriptor).get(), dataSize, nsnull);
    13051568  if (!decodedData) {
     
    13071570    return NS_ERROR_FAILURE;
    13081571  }
    1309  
     1572
    13101573  // Cast to an alias record and resolve.
    1311   PRInt32               aliasSize = (dataSize * 3) / 4;
    1312   AliasRecord   aliasHeader = *(AliasPtr)decodedData;
    1313   if (aliasHeader.aliasSize > aliasSize) {              // be paranoid about having too few data
     1574  AliasRecord aliasHeader = *(AliasPtr)decodedData;
     1575  PRInt32 aliasSize = GetAliasSizeFromRecord(aliasHeader);
     1576  if (aliasSize > (dataSize * 3) / 4) { // be paranoid about having too few data
    13141577    PR_Free(decodedData);
    13151578    return NS_ERROR_FAILURE;
    13161579  }
    1317  
    1318   aliasSize = aliasHeader.aliasSize;
    1319  
     1580
    13201581  // Move the now-decoded data into the Handle.
    13211582  // The size of the decoded data is 3/4 the size of the encoded data. See plbase64.h
     
    13301591  FSRef resolvedFSRef;
    13311592  OSErr err = ::FSResolveAlias(nsnull, (AliasHandle)newHandle, &resolvedFSRef, &changed);
    1332    
     1593
    13331594  rv = MacErrorMapper(err);
    13341595  DisposeHandle(newHandle);
    13351596  if (NS_FAILED(rv))
    13361597    return rv;
    1337  
     1598
    13381599  return InitWithFSRef(&resolvedFSRef);
    13391600}
     
    13481609  OSErr             err;
    13491610  ProcessSerialNumber   process;
    1350    
     1611
    13511612  nsresult rv = GetFSRefInternal(fsRefToReveal);
    13521613  if (NS_FAILED(rv))
    13531614    return rv;
    1354  
     1615
    13551616  err = ::FindRunningAppBySignature ('MACS', process);
    1356   if (err == noErr) { 
     1617  if (err == noErr) {
    13571618    err = ::AECreateDesc(typeProcessSerialNumber, (Ptr)&process, sizeof(process), &myAddressDesc);
    13581619    if (err == noErr) {
    13591620      // Create the FinderEvent
    13601621      err = ::AECreateAppleEvent(kAEMiscStandards, kAEMakeObjectsVisible, &myAddressDesc,
    1361                         kAutoGenerateReturnID, kAnyTransactionID, &aeEvent);   
     1622                        kAutoGenerateReturnID, kAnyTransactionID, &aeEvent);
    13621623      if (err == noErr) {
    13631624        // Create the file list
     
    13811642    }
    13821643  }
    1383    
     1644
    13841645  return NS_OK;
    13851646}
     
    14081669{
    14091670  NS_ENSURE_ARG(aCFURL);
    1410  
     1671
    14111672  SetBaseRef(aCFURL);
    14121673  return NS_OK;
     
    14181679  NS_ENSURE_ARG(aFSRef);
    14191680  nsresult rv = NS_ERROR_FAILURE;
    1420  
     1681
    14211682  CFURLRef newURLRef = ::CFURLCreateFromFSRef(kCFAllocatorDefault, aFSRef);
    14221683  if (newURLRef) {
     
    14321693{
    14331694  NS_ENSURE_ARG(aFileSpec);
    1434  
     1695
    14351696  FSRef fsRef;
    14361697  OSErr err = ::FSpMakeFSRef(aFileSpec, &fsRef);
     
    14401701    CInfoPBRec  pBlock;
    14411702    FSSpec parentDirSpec;
    1442    
     1703
    14431704    memset(&pBlock, 0, sizeof(CInfoPBRec));
    14441705    parentDirSpec.name[0] = 0;
     
    14501711    if (err != noErr)
    14511712      return MacErrorMapper(err);
    1452    
     1713
    14531714    parentDirSpec.vRefNum = aFileSpec->vRefNum;
    14541715    parentDirSpec.parID = pBlock.dirInfo.ioDrParID;
     
    14631724    if (NS_FAILED(rv))
    14641725      return rv;
    1465     return Append(nsDependentString(unicodeName.unicode, unicodeName.length)); 
     1726    return Append(nsDependentString(unicodeName.unicode, unicodeName.length));
    14661727  }
    14671728  return MacErrorMapper(err);
     
    15001761{
    15011762  NS_ENSURE_ARG_POINTER(_retval);
    1502   if (!mBaseRef)
    1503     return NS_ERROR_NOT_INITIALIZED;
    1504  
     1763
     1764  // Check we are correctly initialized.
     1765  CHECK_mBaseRef();
     1766
    15051767  OSErr err;
    15061768  FSRef fsRef;
     
    15101772    err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone,
    15111773              nsnull, nsnull, _retval, nsnull);
    1512     return MacErrorMapper(err); 
     1774    return MacErrorMapper(err);
    15131775  }
    15141776  else if (rv == NS_ERROR_FILE_NOT_FOUND) {
     
    15321794                          catalogInfo.nodeID == fsRtDirID,
    15331795                          hfsName)) == noErr)
    1534             err = ::FSMakeFSSpec(catalogInfo.volume, catalogInfo.nodeID, hfsName, _retval);       
     1796            err = ::FSMakeFSSpec(catalogInfo.volume, catalogInfo.nodeID, hfsName, _retval);
    15351797        }
    15361798      }
     
    15461808{
    15471809  NS_ENSURE_ARG_POINTER(aFileSizeWithResFork);
    1548  
     1810
    15491811  FSRef fsRef;
    15501812  nsresult rv = GetFSRefInternal(fsRef);
    15511813  if (NS_FAILED(rv))
    15521814    return rv;
    1553      
     1815
    15541816  FSCatalogInfo catalogInfo;
    15551817  OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoDataSizes + kFSCatInfoRsrcSizes,
     
    15571819  if (err != noErr)
    15581820    return MacErrorMapper(err);
    1559    
     1821
    15601822  *aFileSizeWithResFork = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
    15611823  return NS_OK;
     
    15661828{
    15671829  NS_ENSURE_ARG_POINTER(aFileType);
    1568  
     1830
    15691831  FSRef fsRef;
    15701832  nsresult rv = GetFSRefInternal(fsRef);
    15711833  if (NS_FAILED(rv))
    15721834    return rv;
    1573  
    1574   FinderInfo fInfo; 
     1835
     1836  FinderInfo fInfo;
    15751837  OSErr err = ::FSGetFinderInfo(&fsRef, &fInfo, nsnull, nsnull);
    15761838  if (err != noErr)
     
    15861848  if (NS_FAILED(rv))
    15871849    return rv;
    1588    
     1850
    15891851  OSErr err = ::FSChangeCreatorType(&fsRef, 0, aFileType);
    15901852  return MacErrorMapper(err);
     
    15951857{
    15961858  NS_ENSURE_ARG_POINTER(aFileCreator);
    1597  
     1859
    15981860  FSRef fsRef;
    15991861  nsresult rv = GetFSRefInternal(fsRef);
    16001862  if (NS_FAILED(rv))
    16011863    return rv;
    1602  
    1603   FinderInfo fInfo; 
     1864
     1865  FinderInfo fInfo;
    16041866  OSErr err = ::FSGetFinderInfo(&fsRef, &fInfo, nsnull, nsnull);
    16051867  if (err != noErr)
     
    16151877  if (NS_FAILED(rv))
    16161878    return rv;
    1617    
     1879
    16181880  OSErr err = ::FSChangeCreatorType(&fsRef, aFileCreator, 0);
    16191881  return MacErrorMapper(err);
     
    16571919      return rv;
    16581920  }
    1659  
     1921
    16601922  LSLaunchFlags       theLaunchFlags = kLSLaunchDefaults;
    16611923  LSLaunchFSRefSpec   thelaunchSpec;
     
    17011963    if (!isExecutable)
    17021964      return NS_ERROR_FILE_EXECUTION_FAILED;
    1703    
     1965
    17041966    rv = appFileMac->GetFSRef(&appFSRef);
    17051967    if (NS_FAILED(rv))
     
    17161978      return MacErrorMapper(err);
    17171979  }
    1718  
     1980
    17191981  LSLaunchFlags       theLaunchFlags = kLSLaunchDefaults;
    17201982  LSLaunchFSRefSpec   thelaunchSpec;
     
    17412003  NS_ENSURE_ARG(_retval);
    17422004  *_retval = PR_FALSE;
    1743  
     2005
    17442006  FSRef fsRef;
    17452007  nsresult rv = GetFSRefInternal(fsRef);
     
    17732035}
    17742036
     2037NS_IMETHODIMP
     2038nsLocalFile::GetBundleDisplayName(nsAString& outBundleName)
     2039{
     2040  PRBool isPackage = PR_FALSE;
     2041  nsresult rv = IsPackage(&isPackage);
     2042  if (NS_FAILED(rv) || !isPackage)
     2043    return NS_ERROR_FAILURE;
     2044
     2045  nsAutoString name;
     2046  rv = GetLeafName(name);
     2047  if (NS_FAILED(rv))
     2048    return rv;
     2049
     2050  PRInt32 length = name.Length();
     2051  if (Substring(name, length - 4, length).EqualsLiteral(".app")) {
     2052    // 4 characters in ".app"
     2053    outBundleName = Substring(name, 0, length - 4);
     2054  }
     2055  else
     2056    outBundleName = name;
     2057
     2058  return NS_OK;
     2059}
     2060
     2061NS_IMETHODIMP
     2062nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
     2063{
     2064  nsresult rv = NS_ERROR_FAILURE;
     2065
     2066  CFURLRef urlRef;
     2067  if (NS_SUCCEEDED(GetCFURL(&urlRef))) {
     2068    CFBundleRef bundle = ::CFBundleCreate(NULL, urlRef);
     2069    if (bundle) {
     2070      CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle);
     2071      if (bundleIdentifier)
     2072        rv = CFStringReftoUTF8(bundleIdentifier, outBundleIdentifier);
     2073
     2074      ::CFRelease(bundle);
     2075    }
     2076    ::CFRelease(urlRef);
     2077  }
     2078
     2079  return rv;
     2080}
     2081
    17752082
    17762083//*****************************************************************************
     
    17832090{
    17842091  NS_ENSURE_ARG(aCFURLRef);
    1785  
     2092
    17862093  ::CFRetain(aCFURLRef);
    17872094  if (mBaseRef)
     
    17892096  mBaseRef = aCFURLRef;
    17902097
    1791   mFollowLinksDirty = PR_TRUE; 
     2098  mFollowLinksDirty = PR_TRUE;
    17922099  UpdateTargetRef();
    17932100  mCachedFSRefValid = PR_FALSE;
     
    17972104nsresult nsLocalFile::UpdateTargetRef()
    17982105{
    1799   if (!mBaseRef)
    1800     return NS_ERROR_NOT_INITIALIZED;
    1801  
     2106  // Check we are correctly initialized.
     2107  CHECK_mBaseRef();
     2108
    18022109  if (mFollowLinksDirty) {
    18032110    if (mTargetRef) {
     
    18122119      if (::CFURLGetFSRef(mBaseRef, &fsRef)) {
    18132120        Boolean targetIsFolder, wasAliased;
    1814         if (FSResolveAliasFile(&fsRef, true /*resolveAliasChains*/, 
     2121        if (FSResolveAliasFile(&fsRef, true /*resolveAliasChains*/,
    18152122            &targetIsFolder, &wasAliased) == noErr && wasAliased) {
    18162123          ::CFRelease(mTargetRef);
     
    18482155{
    18492156  nsresult rv = NS_ERROR_FAILURE;
    1850  
     2157
    18512158  CFURLRef whichURLRef = mFollowLinks ? mTargetRef : mBaseRef;
    18522159  NS_ENSURE_TRUE(whichURLRef, NS_ERROR_NULL_POINTER);
    1853    
     2160
    18542161  CFStringRef pathStrRef = ::CFURLCopyFileSystemPath(whichURLRef, kCFURLPOSIXPathStyle);
    18552162  if (pathStrRef) {
     
    18602167}
    18612168
    1862 nsresult nsLocalFile::MoveCopy(nsIFile* aParentDir, const nsAString& newName, PRBool isCopy, PRBool followLinks)
    1863 {
     2169nsresult nsLocalFile::CopyInternal(nsIFile* aParentDir,
     2170                                   const nsAString& newName,
     2171                                   PRBool followLinks)
     2172{
     2173  // Check we are correctly initialized.
     2174  CHECK_mBaseRef();
     2175
    18642176  StFollowLinksState srcFollowState(*this, followLinks);
    18652177
     
    18672179  OSErr err;
    18682180  FSRef srcFSRef, newFSRef;
    1869  
     2181
    18702182  rv = GetFSRefInternal(srcFSRef);
    18712183  if (NS_FAILED(rv))
    18722184    return rv;
    1873    
     2185
    18742186  nsCOMPtr<nsIFile> newParentDir = aParentDir;
    1875   CFURLRef newBaseURLRef;
    18762187
    18772188  if (!newParentDir) {
     
    18802191    rv = GetParent(getter_AddRefs(newParentDir));
    18812192    if (NS_FAILED(rv))
    1882       return rv;   
    1883   }
    1884  
     2193      return rv;
     2194  }
     2195
    18852196  // If newParentDir does not exist, create it
    18862197  PRBool exists;
     
    18892200    return rv;
    18902201  if (!exists) {
    1891     rv = newParentDir->Create(nsIFile::DIRECTORY_TYPE, 0666);
     2202    rv = newParentDir->Create(nsIFile::DIRECTORY_TYPE, 0777);
    18922203    if (NS_FAILED(rv))
    18932204      return rv;
    18942205  }
    1895    
     2206
    18962207  FSRef destFSRef;
    18972208  nsCOMPtr<nsILocalFileMac> newParentDirMac(do_QueryInterface(newParentDir));
     
    19012212  if (NS_FAILED(rv))
    19022213    return rv;
    1903    
    1904   if (isCopy) {
    1905     err = ::FSCopyObject(&srcFSRef, &destFSRef,
    1906                          newName.Length(), newName.Length() ? PromiseFlatString(newName).get() : nsnull,
    1907                          0, kFSCatInfoNone, false, false, nsnull, nsnull, &newFSRef);
    1908     // don't update ourselves on a copy
    1909   }
    1910   else {
    1911     // According to the API: "If 'this' is a file, and the destination file already
    1912     // exists, moveTo will replace the old file."
    1913     FSCatalogInfo catalogInfo;
    1914     HFSUniStr255 leafName;
    1915     err = ::FSGetCatalogInfo(&srcFSRef, kFSCatInfoNodeFlags, &catalogInfo,
    1916                              newName.IsEmpty() ? &leafName : nsnull, nsnull, nsnull);
    1917     if (err == noErr) {     
    1918       if (!(catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) {
    1919         FSRef oldFileRef;
    1920         if (newName.IsEmpty())
    1921           err = ::FSMakeFSRefUnicode(&destFSRef, leafName.length, leafName.unicode,
    1922                     kTextEncodingUnknown, &oldFileRef);
    1923         else
    1924           err = ::FSMakeFSRefUnicode(&destFSRef, newName.Length(), PromiseFlatString(newName).get(),
    1925                     kTextEncodingUnknown, &oldFileRef);
    1926         if (err == noErr)
    1927           ::FSDeleteObject(&oldFileRef);
    1928       }
    1929     }
    1930     // First, try the quick way which works only within the same volume
    1931     err = ::FSMoveRenameObjectUnicode(&srcFSRef, &destFSRef,
    1932               newName.Length(), newName.Length() ? PromiseFlatString(newName).get() : nsnull,
    1933               kTextEncodingUnknown, &newFSRef);
    1934              
    1935     if (err == diffVolErr) {
    1936       // If on different volumes, resort to copy & delete
    1937       err = ::FSCopyObject(&srcFSRef, &destFSRef,
    1938                            newName.Length(), newName.Length() ? PromiseFlatString(newName).get() : nsnull,
    1939                            0, kFSCatInfoNone, false, false, nsnull, nsnull, &newFSRef);
    1940       ::FSDeleteObjects(&srcFSRef);
    1941     }
    1942     if (err == noErr) {
    1943       newBaseURLRef = ::CFURLCreateFromFSRef(kCFAllocatorDefault, &newFSRef);
    1944       if (!newBaseURLRef)
    1945         return NS_ERROR_FAILURE;
    1946       SetBaseRef(newBaseURLRef);
    1947       ::CFRelease(newBaseURLRef);
    1948     }
    1949   }
     2214
     2215  err =
     2216   ::FSCopyObject(&srcFSRef, &destFSRef, newName.Length(),
     2217                  newName.Length() ? PromiseFlatString(newName).get() : NULL,
     2218                  0, kFSCatInfoNone, false, false, NULL, NULL, &newFSRef);
     2219
    19502220  return MacErrorMapper(err);
    19512221}
    19522222
    1953 const PRInt64 kMilisecsPerSec = 1000LL;
     2223const PRInt64 kMillisecsPerSec = 1000LL;
    19542224const PRInt64 kUTCDateTimeFractionDivisor = 65535LL;
    19552225
     
    19572227{
    19582228  // Start with seconds since Jan. 1, 1904 GMT
    1959   PRInt64 result = ((PRInt64)utcTime.highSeconds << 32) + (PRInt64)utcTime.lowSeconds; 
     2229  PRInt64 result = ((PRInt64)utcTime.highSeconds << 32) + (PRInt64)utcTime.lowSeconds;
    19602230  // Subtract to convert to NSPR epoch of 1970
    19612231  result -= kJanuaryFirst1970Seconds;
    1962   // Convert to milisecs
    1963   result *= kMilisecsPerSec;
    1964   // Convert the fraction to milisecs and add it
    1965   result += ((PRInt64)utcTime.fraction * kMilisecsPerSec) / kUTCDateTimeFractionDivisor;
     2232  // Convert to millisecs
     2233  result *= kMillisecsPerSec;
     2234  // Convert the fraction to millisecs and add it
     2235  result += ((PRInt64)utcTime.fraction * kMillisecsPerSec) / kUTCDateTimeFractionDivisor;
    19662236
    19672237  return result;
     
    19702240void nsLocalFile::NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime)
    19712241{
    1972   PRInt64 fraction = nsprTime % kMilisecsPerSec;
    1973   PRInt64 seconds = (nsprTime / kMilisecsPerSec) + kJanuaryFirst1970Seconds;
     2242  PRInt64 fraction = nsprTime % kMillisecsPerSec;
     2243  PRInt64 seconds = (nsprTime / kMillisecsPerSec) + kJanuaryFirst1970Seconds;
    19742244  utcTime.highSeconds = (UInt16)((PRUint64)seconds >> 32);
    19752245  utcTime.lowSeconds = (UInt32)seconds;
    1976   utcTime.fraction = (UInt16)((fraction * kUTCDateTimeFractionDivisor) / kMilisecsPerSec);
     2246  utcTime.fraction = (UInt16)((fraction * kUTCDateTimeFractionDivisor) / kMillisecsPerSec);
    19772247}
    19782248
     
    19842254                              kCFStringEncodingUTF8, 0, PR_FALSE, nsnull, 0, &usedBufLen);
    19852255  if (charsConverted == inStrLen) {
     2256#if 0 /* bird: too new? */
     2257    aOutStr.SetLength(usedBufLen);
     2258    if (aOutStr.Length() != usedBufLen)
     2259      return NS_ERROR_OUT_OF_MEMORY;
     2260    UInt8 *buffer = (UInt8*) aOutStr.BeginWriting();
     2261
     2262    ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen),
     2263                       kCFStringEncodingUTF8, 0, false, buffer, usedBufLen, &usedBufLen);
     2264    rv = NS_OK;
     2265#else
    19862266    nsAutoBuffer<UInt8, FILENAME_BUFFER_SIZE> buffer;
    19872267    if (buffer.EnsureElemCapacity(usedBufLen + 1)) {
     
    19922272      rv = NS_OK;
    19932273    }
     2274#endif
    19942275  }
    19952276  return rv;
     2277}
     2278
     2279// nsIHashable
     2280
     2281NS_IMETHODIMP
     2282nsLocalFile::Equals(nsIHashable* aOther, PRBool *aResult)
     2283{
     2284    return EqualsInternal(aOther, PR_FALSE, aResult);
     2285}
     2286
     2287NS_IMETHODIMP
     2288nsLocalFile::GetHashCode(PRUint32 *aResult)
     2289{
     2290    CFStringRef pathStrRef = ::CFURLCopyFileSystemPath(mBaseRef, kCFURLPOSIXPathStyle);
     2291    nsCAutoString path;
     2292    CFStringReftoUTF8(pathStrRef, path);
     2293    *aResult = HashString(path);
     2294    return NS_OK;
    19962295}
    19972296
     
    20322331nsresult NS_NewNativeLocalFile(const nsACString& path, PRBool followLinks, nsILocalFile **result)
    20332332{
    2034     return NS_NewLocalFile(NS_ConvertUTF8toUCS2(path), followLinks, result);
     2333    return NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), followLinks, result);
    20352334}
    20362335
     
    20532352}
    20542353
     2354nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, PRBool aFollowLinks, nsILocalFileMac** result)
     2355{
     2356    nsLocalFile* file = new nsLocalFile();
     2357    if (file == nsnull)
     2358        return NS_ERROR_OUT_OF_MEMORY;
     2359    NS_ADDREF(file);
     2360
     2361    file->SetFollowLinks(aFollowLinks);
     2362
     2363    nsresult rv = file->InitWithFSRef(aFSRef);
     2364    if (NS_FAILED(rv)) {
     2365        NS_RELEASE(file);
     2366        return rv;
     2367    }
     2368    *result = file;
     2369    return NS_OK;
     2370}
     2371
    20552372//*****************************************************************************
    20562373//  Static Functions
     
    20602377{
    20612378    nsresult outErr;
    2062    
     2379
    20632380    switch (inErr)
    20642381    {
     
    20742391            outErr = NS_ERROR_FILE_ALREADY_EXISTS;
    20752392            break;
    2076        
     2393
    20772394        case dskFulErr:
    20782395            outErr = NS_ERROR_FILE_DISK_FULL;
    20792396            break;
    2080        
     2397
    20812398        case fLckdErr:
    20822399            outErr = NS_ERROR_FILE_IS_LOCKED;
    20832400            break;
    2084        
     2401
    20852402        // Can't find good map for some
    20862403        case bdNamErr:
     
    20882405            break;
    20892406
    2090         default:   
     2407        default:
    20912408            outErr = NS_ERROR_FAILURE;
    20922409            break;
     
    20992416  ProcessInfoRec info;
    21002417  OSErr err = noErr;
    2101  
     2418
    21022419  outPsn.highLongOfPSN = 0;
    21032420  outPsn.lowLongOfPSN  = kNoProcess;
    2104  
     2421
    21052422  while (PR_TRUE)
    21062423  {
     
    21162433    if (err != noErr)
    21172434      return err;
    2118    
     2435
    21192436    if (info.processSignature == aAppSig)
    21202437      return noErr;
     
    21472464    if (!sUnicodeNormalizer) {  // OS X 10.2 or earlier
    21482465        CopyUTF8toUTF16(aSrc, aResult);
    2149         return; 
     2466        return;
    21502467    }
    21512468
     
    21592476    if (!inStr) {
    21602477        CopyUTF8toUTF16(aSrc, aResult);
    2161         return; 
    2162     }
    2163      
    2164     ::CFStringAppendCString(inStr, inFlatSrc.get(), kCFStringEncodingUTF8); 
     2478        return;
     2479    }
     2480
     2481    ::CFStringAppendCString(inStr, inFlatSrc.get(), kCFStringEncodingUTF8);
    21652482
    21662483    sUnicodeNormalizer(inStr, kCFStringNormalizationFormC);
     
    21692486    const UniChar* chars = CFStringGetCharactersPtr(inStr);
    21702487
    2171     if (chars) 
     2488    if (chars)
    21722489        aResult.Assign(chars, length);
    21732490    else {
  • trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileOSX.h

    r1 r589  
    4242#include "nsILocalFileMac.h"
    4343#include "nsString.h"
     44#include "nsIHashable.h"
    4445
    4546class nsDirEnumerator;
     
    5657//*****************************************************************************
    5758
    58 class NS_COM nsLocalFile : public nsILocalFileMac
     59class NS_COM nsLocalFile : public nsILocalFileMac,
     60                           public nsIHashable
    5961{
    6062    friend class nsDirEnumerator;
     
    7173    NS_DECL_NSILOCALFILE
    7274    NS_DECL_NSILOCALFILEMAC
     75    NS_DECL_NSIHASHABLE
    7376
    7477public:
     
    8891    nsresult            GetFSRefInternal(FSRef& aFSSpec, PRBool bForceUpdateCache = PR_TRUE);
    8992    nsresult            GetPathInternal(nsACString& path);  // Returns path WRT mFollowLinks
     93    nsresult            EqualsInternal(nsISupports* inFile,
     94                                       PRBool aUpdateCache, PRBool *_retval);
    9095
    91     nsresult            MoveCopy(nsIFile* newParentDir, const nsAString &newName, PRBool isCopy, PRBool followLinks);
     96    nsresult            CopyInternal(nsIFile* newParentDir,
     97                                     const nsAString& newName,
     98                                     PRBool followLinks);
    9299
    93100    static PRInt64      HFSPlustoNSPRTime(const UTCDateTime& utcTime);
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp

    r1 r589  
    2121 *
    2222 * Contributor(s):
     23 *   Mark Mentovai <[email protected]>
    2324 *
    2425 * Alternatively, the contents of this file may be used under the terms of
     
    7980#ifdef __GNUC__            /* Gnu compiler. */
    8081  PRUint32 result;
    81   // Each param takes at most 2, 4-byte words
    82   // It doesn't matter if we push too many words, and calculating the exact
    83   // ammount takes time.
     82  /* Each param takes at most 2, 4-byte words
     83    It doesn't matter if we push too many words, and calculating the exact
     84     amount takes time. */
    8485  PRUint32 n = paramCount << 3;
    8586  void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack;
    86   int temp1, temp2, temp3;
    87  
     87  int temp1, temp2;
     88
     89  /* These are only significant when KEEP_STACK_16_BYTE_ALIGNED is
     90     defined.  Otherwise, they're just placeholders to keep the parameter
     91     indices the same for aligned and unaligned users in the inline asm
     92     block. */
     93  unsigned int saved_esp;
     94
    8895 __asm__ __volatile__(
     96#ifdef KEEP_STACK_16_BYTE_ALIGNED
     97    "movl  %%esp, %3\n\t"
     98#endif
    8999    "subl  %8, %%esp\n\t" /* make room for params */
     100#ifdef KEEP_STACK_16_BYTE_ALIGNED
     101    /* For the second CALL, there will be one parameter before the ones
     102       copied by invoke_copy_to_stack.  Make sure that the stack will be
     103       aligned for that CALL. */
     104    "subl  $4, %%esp\n\t"
     105    "andl  $0xfffffff0, %%esp\n\t"
     106    /* For the first CALL, there are three parameters.  Leave padding to
     107       ensure alignment. */
     108    "subl  $4, %%esp\n\t"
     109    /* The third parameter to invoke_copy_to_stack is the destination pointer.
     110       It needs to point into the parameter area prepared for the second CALL,
     111       leaving room for the |that| parameter.  This reuses |n|, which was
     112       the stack space to reserve, but that's OK because it's no longer needed
     113       if the stack is being kept aligned. */
     114    "leal  8(%%esp), %8\n\t"
     115    "pushl %8\n\t"
     116#else
    90117    "pushl %%esp\n\t"
     118#endif
    91119    "pushl %7\n\t"
    92120    "pushl %6\n\t"
    93     "call  *%0\n\t"       /* copy params */
     121    "call  *%9\n\t"       /* copy params */
     122#ifdef KEEP_STACK_16_BYTE_ALIGNED
     123    /* The stack is still aligned from the first CALL.  Keep it aligned for
     124       the next one by popping past the parameters from the first CALL and
     125       leaving space for the first (|that|) parameter for the second CALL. */
     126    "addl  $0x14, %%esp\n\t"
     127#else
    94128    "addl  $0xc, %%esp\n\t"
     129#endif
    95130    "movl  %4, %%ecx\n\t"
    96131#ifdef CFRONT_STYLE_THIS_ADJUST
     
    115150#endif
    116151    "call  *(%%edx)\n\t"    /* safe to not cleanup esp */
     152#ifdef KEEP_STACK_16_BYTE_ALIGNED
     153    "movl  %3, %%esp\n\t"
     154#else
    117155    "addl  $4, %%esp\n\t"
    118156    "addl  %8, %%esp"
     157#endif
    119158    : "=a" (result),        /* %0 */
    120159      "=c" (temp1),         /* %1 */
    121160      "=d" (temp2),         /* %2 */
    122       "=g" (temp3)          /* %3 */
     161#ifdef KEEP_STACK_16_BYTE_ALIGNED
     162      "=&g" (saved_esp)     /* %3 */
     163#else
     164      /* Don't waste a register, this isn't used if alignment is unimportant */
     165      "=m" (saved_esp)      /* %3 */
     166#endif
    123167    : "g" (that),           /* %4 */
    124168      "g" (methodIndex),    /* %5 */
    125169      "1" (paramCount),     /* %6 */
    126170      "2" (params),         /* %7 */
     171#ifdef KEEP_STACK_16_BYTE_ALIGNED
     172      /* Must be in a register, it's the target of an LEA instruction */
     173      "r" (n),              /* %8 */
     174#else
    127175      "g" (n),              /* %8 */
    128       "0" (fn_copy)         /* %3 */
     176#endif
     177      "0" (fn_copy)         /* %9 */
    129178    : "memory"
    130179    );
    131    
     180
    132181  return result;
    133182
     
    136185#endif /* __GNUC__ */
    137186
    138 }   
     187}
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp

    r1 r589  
    4040#include "xptcprivate.h"
    4141#include "xptc_platforms_unixish_x86.h"
     42/*#include "xptiprivate.h"*/
    4243
    4344static nsresult
     
    104105
    105106#ifdef __GNUC__         /* Gnu Compiler. */
     107
     108#ifdef KEEP_STACK_16_BYTE_ALIGNED
     109/* Make sure the stack is 16-byte aligned.  Do that by aligning to 16 bytes and
     110 * then subtracting 4 so the three subsequent pushes result in a 16-byte aligned
     111 * stack. */
     112#define ALIGN_STACK_DECL \
     113  unsigned int saved_esp;
     114
     115#define ALIGN_STACK_SAVE \
     116  "movl %%esp, %3\n\t"
     117
     118#define ALIGN_STACK_ALIGN \
     119  "addl $0x4, %%esp\n\t" \
     120  "andl $0xfffffff0, %%esp\n\t" \
     121  "subl $0x4, %%esp\n\t"
     122
     123#define STACK_RESTORE \
     124  "movl %3, %%esp\n"
     125
     126#define ALIGN_STACK_REGS_IN \
     127  , "=r"(saved_esp) /* 3 */
     128
     129#define ALIGN_STACK_REGS_OUT \
     130  , "3"(saved_esp)
     131
     132#else
     133#define ALIGN_STACK_DECL
     134#define ALIGN_STACK_SAVE
     135#define ALIGN_STACK_ALIGN
     136#define STACK_RESTORE \
     137  "addl $12, %%esp\n"
     138#define ALIGN_STACK_REGS_IN
     139#define ALIGN_STACK_REGS_OUT
     140#endif
     141
    106142#define STUB_ENTRY(n) \
    107143nsresult nsXPTCStubBase::Stub##n() \
     
    110146  int temp0, temp1; \
    111147  register nsresult result; \
     148  ALIGN_STACK_DECL \
    112149  __asm__ __volatile__( \
     150    ALIGN_STACK_SAVE \
     151    ALIGN_STACK_ALIGN \
    113152    "leal   0x0c(%%ebp), %%ecx\n\t"    /* args */ \
    114153    "pushl  %%ecx\n\t" \
     
    117156    "pushl  %%ecx\n\t" \
    118157    "call   *%%edx\n\t"                /* PrepareAndDispatch */ \
    119     "addl   $12, %%esp" \
     158    STACK_RESTORE                      /* "addl $12, %%esp" or restore saved */ \
    120159    : "=a" (result),    /* %0 */ \
    121160      "=&c" (temp0),    /* %1 */ \
    122161      "=d" (temp1)      /* %2 */ \
     162      ALIGN_STACK_REGS_IN \
    123163    : "2" (method)      /* %2 */ \
    124     : "memory" ); \
     164      ALIGN_STACK_REGS_OUT \
     165    : "memory" \
     166        ); \
    125167    return result; \
    126168}
  • trunk/src/libs/xpcom18a4/xpcom/tests/nsIFileTest.cpp

    r1 r589  
    11#include "nsILocalFile.h"
     2#if 0 /* too new */
     3#include "nsStringGlue.h"
     4#else
    25#include "nsString.h"
     6#endif
    37
    48#include <stdio.h>
     
    812#include "nsIServiceManager.h"
    913#include "nsIMemory.h"
    10 #include "nsXPIDLString.h"
     14
     15#include "nsComponentManagerUtils.h"
     16#include "nsCOMPtr.h"
    1117
    1218void Passed();
     
    6369    rv = file->GetNativePath(pathName);
    6470    VerifyResult(rv);
    65    
     71
    6672    printf("filepath: %s\n", pathName.get());
    6773}
     
    7076{
    7177    nsILocalFile* file = nsnull;
    72     nsresult rv = nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID,
    73                                               nsnull,
    74                                               NS_GET_IID(nsILocalFile),
    75                                               (void**)&file);
    76    
    77     if (NS_FAILED(rv) || (!file))
     78    nsresult rv = CallCreateInstance(NS_LOCAL_FILE_CONTRACTID, &file);
     79
     80
     81    if (NS_FAILED(rv) || (!file))
    7882    {
    7983        printf("create nsILocalFile failed\n");
     
    8892    rv = file->InitWithNativePath(nsDependentCString(creationPath));
    8993    VerifyResult(rv);
    90    
     94
    9195    printf("Getting Filename\n");
    9296    rv = file->GetNativeLeafName(leafName);
     
    105109    GetPaths(file);
    106110
    107    
     111
    108112    printf("Check For Existence\n");
    109113
     
    121125                  PRInt32 whatToCreate, PRInt32 perm)
    122126{
    123     nsCOMPtr<nsILocalFile> file;
    124     nsresult rv =
    125     nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID,
    126                                               nsnull,
    127                                               NS_GET_IID(nsILocalFile),
    128                                               (void **)getter_AddRefs(file));
    129 
    130     if (NS_FAILED(rv) || (!file))
     127    nsresult rv;
     128    nsCOMPtr<nsILocalFile> file =
     129        do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     130
     131    if (NS_FAILED(rv) || (!file))
    131132    {
    132133        printf("create nsILocalFile failed\n");
     
    139140    rv = file->InitWithNativePath(nsDependentCString(creationPath));
    140141    VerifyResult(rv);
    141  
     142
    142143    printf("Appending %s\n", appendPath);
    143144    rv = file->AppendRelativeNativePath(nsDependentCString(appendPath));
    144145    VerifyResult(rv);
    145    
     146
    146147    printf("Check For Existence\n");
    147148
     
    155156
    156157
    157     rv = file->Create(whatToCreate, perm); 
     158    rv = file->Create(whatToCreate, perm);
    158159    VerifyResult(rv);
    159160
     
    161162    VerifyResult(rv);
    162163
    163    
     164
    164165    if (!exists)
    165166    {
     
    167168        return;
    168169    }
    169    
    170 }   
     170
     171}
    171172
    172173void CreateUniqueTest(const char* creationPath, const char* appendPath,
    173174                 PRInt32 whatToCreate, PRInt32 perm)
    174175{
    175     nsCOMPtr<nsILocalFile> file;
    176     nsresult rv =
    177     nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID,
    178                                               nsnull,
    179                                               NS_GET_IID(nsILocalFile),
    180                                               (void **)getter_AddRefs(file));
    181 
    182     if (NS_FAILED(rv) || (!file))
     176    nsresult rv;
     177    nsCOMPtr<nsILocalFile> file =
     178        do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     179
     180    if (NS_FAILED(rv) || (!file))
    183181    {
    184182        printf("create nsILocalFile failed\n");
     
    191189    rv = file->InitWithNativePath(nsDependentCString(creationPath));
    192190    VerifyResult(rv);
    193  
     191
    194192    printf("Appending %s\n", appendPath);
    195193    rv = file->AppendNative(nsDependentCString(appendPath));
    196194    VerifyResult(rv);
    197    
     195
    198196    printf("Check For Existence\n");
    199197
     
    207205
    208206
    209     rv = file->CreateUnique(whatToCreate, perm); 
     207    rv = file->CreateUnique(whatToCreate, perm);
    210208    VerifyResult(rv);
    211209
     
    213211    VerifyResult(rv);
    214212
    215    
     213
    216214    if (!exists)
    217215    {
     
    219217        return;
    220218    }
    221    
    222 }   
     219
     220}
    223221
    224222
     
    226224CopyTest(const char *testFile, const char *targetDir)
    227225{
    228   nsCOMPtr<nsILocalFile> file;
    229   nsCOMPtr<nsILocalFile> dir;
    230 
    231226  printf("start copy test\n");
    232227
    233   nsresult rv =
    234     nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID, NULL,
    235                                        NS_GET_IID(nsILocalFile),
    236                                        (void**)getter_AddRefs(file));
    237    
    238   if (NS_FAILED(rv) || (!file))
     228  nsresult rv;
     229  nsCOMPtr<nsILocalFile> file =
     230      do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     231
     232  if (NS_FAILED(rv) || (!file))
    239233  {
    240234    printf("create nsILocalFile failed\n");
     
    244238  rv = file->InitWithNativePath(nsDependentCString(testFile));
    245239  VerifyResult(rv);
    246  
    247   rv = nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID, NULL,
    248                                           NS_GET_IID(nsILocalFile),
    249                                           (void**)getter_AddRefs(dir));
    250 
    251   if (NS_FAILED(rv) || (!dir))
     240
     241  nsCOMPtr<nsILocalFile> dir =
     242      do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     243
     244  if (NS_FAILED(rv) || (!dir))
    252245  {
    253246    printf("create nsILocalFile failed\n");
     
    263256  printf("end copy test\n");
    264257}
    265    
     258
    266259void
    267260DeletionTest(const char* creationPath, const char* appendPath, PRBool recursive)
    268261{
    269     nsCOMPtr<nsILocalFile> file;
    270     nsresult rv =
    271       nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID, NULL,
    272                                          NS_GET_IID(nsILocalFile),
    273                                          (void**)getter_AddRefs(file));
    274    
    275     if (NS_FAILED(rv) || (!file))
     262    nsresult rv;
     263    nsCOMPtr<nsILocalFile> file =
     264            do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     265
     266    if (NS_FAILED(rv) || (!file))
    276267    {
    277268        printf("create nsILocalFile failed\n");
     
    284275    rv = file->InitWithNativePath(nsDependentCString(creationPath));
    285276    VerifyResult(rv);
    286  
     277
    287278    printf("Appending %s\n", appendPath);
    288279    rv = file->AppendNative(nsDependentCString(appendPath));
    289280    VerifyResult(rv);
    290    
     281
    291282    printf("Check For Existance\n");
    292283
     
    299290        printf("no.\n");
    300291
    301     rv = file->Remove(recursive); 
     292    rv = file->Remove(recursive);
    302293    VerifyResult(rv);
    303294
    304295    rv = file->Exists(&exists);
    305296    VerifyResult(rv);
    306    
     297
    307298    if (exists)
    308299    {
     
    310301        return;
    311302    }
    312    
    313 }
    314 
    315 void 
     303
     304}
     305
     306void
    316307MoveTest(const char *testFile, const char *targetDir)
    317308{
     
    322313  nsresult rv;
    323314  nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
    324      
    325   if (!file) 
     315
     316  if (!file)
    326317  {
    327318    printf("create nsILocalFile failed\n");
     
    331322  rv = file->InitWithNativePath(nsDependentCString(testFile));
    332323  VerifyResult(rv);
    333  
     324
    334325  nsCOMPtr<nsILocalFile> dir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
    335  
    336   if (!dir) 
     326
     327  if (!dir)
    337328  {
    338329    printf("create nsILocalFile failed\n");
     
    352343}
    353344
    354 
     345// move up the number of directories in moveUpCount, then append "foo/bar"
     346void
     347NormalizeTest(const char *testPath, int moveUpCount,
     348              const char *expected)
     349{
     350  Banner("Normalize Test");
     351
     352  nsresult rv;
     353  nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
     354
     355  if (!file)
     356  {
     357    printf("create nsILocalFile failed\n");
     358    return;
     359  }
     360
     361  rv = file->InitWithNativePath(nsDependentCString(testPath));
     362  VerifyResult(rv);
     363
     364  nsCOMPtr<nsIFile> parent;
     365  nsAutoString path;
     366  for (int i=0; i < moveUpCount; i++)
     367  {
     368    rv = file->GetParent(getter_AddRefs(parent));
     369    VerifyResult(rv);
     370    rv = parent->GetPath(path);
     371    VerifyResult(rv);
     372    rv = file->InitWithPath(path);
     373    VerifyResult(rv);
     374  }
     375
     376  if (!parent) {
     377    printf("Getting parent failed!\n");
     378    return;
     379  }
     380
     381  rv = parent->Append(NS_LITERAL_STRING("foo"));
     382  VerifyResult(rv);
     383  rv = parent->Append(NS_LITERAL_STRING("bar"));
     384  VerifyResult(rv);
     385
     386  rv = parent->Normalize();
     387  VerifyResult(rv);
     388
     389  nsCAutoString newPath;
     390  rv = parent->GetNativePath(newPath);
     391  VerifyResult(rv);
     392
     393  nsCOMPtr<nsILocalFile>
     394    expectedFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
     395
     396  if (!expectedFile)
     397  {
     398    printf("create nsILocalFile failed\n");
     399    return;
     400  }
     401  rv = expectedFile->InitWithNativePath(nsDependentCString(expected));
     402  VerifyResult(rv);
     403
     404  rv = expectedFile->Normalize();
     405  VerifyResult(rv);
     406
     407  nsCAutoString expectedPath;
     408  rv = expectedFile->GetNativePath(expectedPath);
     409  VerifyResult(rv);
     410
     411  if (!newPath.Equals(expectedPath)) {
     412    printf("ERROR: Normalize() test Failed!\n");
     413    printf("     Got: %s\n", newPath.get());
     414    printf("Expected: %s\n", expectedPath);
     415  }
     416
     417  printf("end normalize test.\n");
     418}
    355419
    356420int main(void)
     
    361425    NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
    362426    registrar->AutoRegister(nsnull);
    363  
     427
    364428#if defined(XP_WIN) || defined(XP_OS2)
    365     InitTest("c:\\temp\\", "sub1/sub2/");
    366     InitTest("d:\\temp\\", "sub1\\sub2\\");
     429    InitTest("c:\\temp\\", "sub1/sub2/"); // expect failure
     430    InitTest("d:\\temp\\", "sub1\\sub2\\"); // expect failure
    367431
    368432    CreationTest("c:\\temp\\", "file.txt", nsIFile::NORMAL_FILE_TYPE, 0644);
     
    385449#else
    386450#ifdef XP_UNIX
    387     InitTest("/tmp/", "sub1/sub2/");
    388    
     451    InitTest("/tmp/", "sub1/sub2/"); // expect failure
     452
    389453    CreationTest("/tmp", "file.txt", nsIFile::NORMAL_FILE_TYPE, 0644);
    390454    DeletionTest("/tmp/", "file.txt", PR_FALSE);
    391    
     455
    392456    CreationTest("/tmp", "mumble/a/b/c/d/e/f/g/h/i/j/k/", nsIFile::DIRECTORY_TYPE, 0644);
    393457    DeletionTest("/tmp", "mumble", PR_TRUE);
    394     CopyTest("/tmp/test.txt", "/tmp/foo");
     458
     459    CreationTest("/tmp", "file", nsIFile::NORMAL_FILE_TYPE, 0644);
     460    CopyTest("/tmp/file", "/tmp/newDir");
     461    MoveTest("/tmp/file", "/tmp/newDir/anotherNewDir");
     462    DeletionTest("/tmp", "newDir", PR_TRUE);
     463
     464    CreationTest("/tmp", "qux/quux", nsIFile::NORMAL_FILE_TYPE, 0644);
     465    CreationTest("/tmp", "foo/bar", nsIFile::NORMAL_FILE_TYPE, 0644);
     466    NormalizeTest("/tmp/qux/quux/..", 1, "/tmp/foo/bar");
     467    DeletionTest("/tmp", "qux", PR_TRUE);
     468    DeletionTest("/tmp", "foo", PR_TRUE);
    395469
    396470#endif /* XP_UNIX */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette