Bug 458917 - Windows CE Cleanup. r/sr=stuart+bsmedberg
authorDoug Turner <dougt@meer.net>
Wed, 08 Oct 2008 20:51:54 -0700
changeset 20187 66d756c2c44d03c1876fc95a4f807d20d061d792
parent 20186 143e49ad94822ab330609585a76ab257d1634d93
child 20188 9a712f8bac315b43aa9cafc0d5568c0fb95ca002
push idunknown
push userunknown
push dateunknown
bugs458917
milestone1.9.1b2pre
Bug 458917 - Windows CE Cleanup. r/sr=stuart+bsmedberg
js/src/xpconnect/src/Makefile.in
layout/generic/nsSimplePageSequence.cpp
parser/htmlparser/public/nsIHTMLContentSink.h
profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
rdf/datasource/src/nsFileSystemDataSource.cpp
xpcom/build/dlldeps.cpp
xpcom/build/nsXPComInit.cpp
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsLocalFileWin.cpp
--- a/js/src/xpconnect/src/Makefile.in
+++ b/js/src/xpconnect/src/Makefile.in
@@ -157,22 +157,16 @@ endif
 ifdef XPC_IDISPATCH_SUPPORT
 DEFINES		+= -DXPC_IDISPATCH_SUPPORT
 ifdef XPC_COMOBJECT
 DEFINES		+= -DXPC_COMOBJECT
 endif
 
 endif
 
-# the windows ce compiler produces crap when compiling this
-# with any optimizations.  See bug 304714
-ifdef WINCE
-MOZ_OPTIMIZE_FLAGS=-Od
-endif
-
 ifeq ($(OS_ARCH),WINNT)
 ifndef GNU_CXX
 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
 # whole program optimization and precompiled headers are incompatible
 ifeq (,$(findstring GL,$(CXXFLAGS)))
 # use pre-compiled headers
 CXXFLAGS	+= -YX -Fp$(LIBRARY_NAME).pch
 # precompiled headers require write access to .pch which breaks -j builds
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -340,31 +340,30 @@ nsSimplePageSequenceFrame::Reflow(nsPres
       pf->SetPageNumInfo(pageNum, pageTot);
     }
     pageNum++;
   }
 
   // Create current Date/Time String
   if (!mDateFormatter)
     mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID);
-#ifndef WINCE
+
   NS_ENSURE_TRUE(mDateFormatter, NS_ERROR_FAILURE);
 
   nsAutoString formattedDateString;
   time_t ltime;
   time( &ltime );
   if (NS_SUCCEEDED(mDateFormatter->FormatTime(nsnull /* nsILocale* locale */,
                                               kDateFormatShort,
                                               kTimeFormatNoSeconds,
                                               ltime,
                                               formattedDateString))) {
     PRUnichar * uStr = ToNewUnicode(formattedDateString);
     SetDateTimeStr(uStr); // memory will be freed
   }
-#endif
 
   // Return our desired size
   // Adjustr the reflow size by PrintPreviewScale so the scrollbars end up the
   // correct size
   aDesiredSize.height  = y * PresContext()->GetPrintPreviewScale(); // includes page heights and dead space
   aDesiredSize.width   = (x + availSize.width + deadSpaceGap) * PresContext()->GetPrintPreviewScale();
 
   aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width,
--- a/parser/htmlparser/public/nsIHTMLContentSink.h
+++ b/parser/htmlparser/public/nsIHTMLContentSink.h
@@ -82,20 +82,18 @@
 #include "nsIContentSink.h"
 #include "nsHTMLTags.h"
 
 #define NS_IHTML_CONTENT_SINK_IID \
 { 0x73b5a072, 0x0f87, 0x4d07, \
   { 0xa8, 0x16, 0xe6, 0xac, 0x73, 0xa7, 0x04, 0x3c } }
 
 
-#if defined(XP_MAC) || defined(WINCE) 
+#if defined(XP_MAC) 
 #define MAX_REFLOW_DEPTH  75    //setting to 75 to prevent layout from crashing on mac. Bug 55095.
-                                //We will also change this for WinCE as it usually has a strict
-                                //memory upper limit (no vm, ~32mb)
 #else
 #define MAX_REFLOW_DEPTH  200   //windows and linux (etc) can do much deeper structures.
 #endif
 
 class nsIHTMLContentSink : public nsIContentSink 
 {
 public:
 
--- a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
+++ b/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
@@ -372,22 +372,19 @@ nsProfileDirServiceProvider::InitProfile
     if (NS_FAILED(rv)) {
         // if copying failed, lets just ensure that the profile directory exists.
         profileDirParent->AppendNative(profileDirName);
         rv = profileDirParent->Create(nsIFile::DIRECTORY_TYPE, 0700);
         if (NS_FAILED(rv))
             return rv;
     }
 
-#if !defined(WINCE)
     rv = profileDir->SetPermissions(0700);
     if (NS_FAILED(rv))
       return rv;
-#endif
-
   }
   else {
     PRBool isDir;
     rv = profileDir->IsDirectory(&isDir);
 
     if (NS_FAILED(rv))
       return rv;
     if (!isDir)
--- a/rdf/datasource/src/nsFileSystemDataSource.cpp
+++ b/rdf/datasource/src/nsFileSystemDataSource.cpp
@@ -947,17 +947,17 @@ FileSystemDataSource::GetVolumeList(nsIS
 
                 if (NS_FAILED(rv)) return rv;
                 volumes->AppendElement(vol);
             }
         }
     }
 #endif
 
-#if defined(XP_UNIX) || defined(XP_BEOS)
+#if defined(XP_UNIX) || defined(XP_BEOS) || defined(WINCE)
     mRDFService->GetResource(NS_LITERAL_CSTRING("file:///"), getter_AddRefs(vol));
     volumes->AppendElement(vol);
 #endif
 
 #ifdef XP_OS2
     ULONG ulDriveNo = 0;
     ULONG ulDriveMap = 0;
     char *url;
--- a/xpcom/build/dlldeps.cpp
+++ b/xpcom/build/dlldeps.cpp
@@ -94,17 +94,17 @@
 #include "nsXPCOMStrings.h"
 #include "nsStringBuffer.h"
 #include "nsCategoryCache.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollector.h"
 #include "nsThreadUtils.h"
 #include "nsTObserverArray.h"
 
-#if !defined(WINCE) && !defined(XP_OS2)
+#if !defined(XP_OS2)
 #include "nsWindowsRegKey.h"
 #endif
 
 class nsCStringContainer : private nsStringContainer_base { };
 class nsStringContainer : private nsStringContainer_base { };
 
 void XXXNeverCalled()
 {
@@ -276,17 +276,17 @@ void XXXNeverCalled()
       nsStringBuffer::FromString(y);
       b.ToString(0, x);
       b.ToString(0, y);
     }
 
     nsXPCOMCycleCollectionParticipant();
     nsCycleCollector_collect();
 
-#if !defined(WINCE) && !defined(XP_OS2)
+#if !defined(XP_OS2)
     NS_NewWindowsRegKey(nsnull);
 #endif
 
     NS_NewThread(nsnull, nsnull);
     NS_GetCurrentThread(nsnull);
     NS_GetCurrentThread();
     NS_GetMainThread(nsnull);
     NS_DispatchToCurrentThread(nsnull);
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -122,17 +122,17 @@ NS_DECL_CLASSINFO(nsStringInputStream)
 
 #ifdef GC_LEAK_DETECTOR
 #include "nsLeakDetector.h"
 #endif
 #include "nsRecyclingAllocator.h"
 
 #include "SpecialSystemDirectory.h"
 
-#if defined(XP_WIN) && !defined(WINCE)
+#if defined(XP_WIN)
 #include "nsWindowsRegKey.h"
 #endif
 
 #ifdef XP_MACOSX
 #include "nsMacUtilsImpl.h"
 #endif
 
 #include "nsSystemInfo.h"
@@ -433,17 +433,17 @@ static const nsModuleComponentInfo compo
 
     COMPONENT(RECYCLINGALLOCATOR, nsRecyclingAllocatorImplConstructor),
 
 #define NS_HASH_PROPERTY_BAG_CLASSNAME "Hashtable Property Bag"
     COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagConstructor),
 
     COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor),
 
-#if defined(XP_WIN) && !defined(WINCE)
+#if defined(XP_WIN)
     COMPONENT(WINDOWSREGKEY, nsWindowsRegKeyConstructor),
 #endif
 
 #ifdef XP_MACOSX
     COMPONENT(MACUTILSIMPL, nsMacUtilsImplConstructor),
 #endif
 
     COMPONENT(SYSTEMINFO, nsSystemInfoConstructor),
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -119,17 +119,17 @@ typedef HRESULT (WINAPI* nsGetKnownFolde
 
 static nsGetKnownFolderPath gGetKnownFolderPath = NULL;
 
 static HINSTANCE gShell32DLLInst = NULL;
 #endif
 
 NS_COM void StartupSpecialSystemDirectory()
 {
-#if defined (XP_WIN) && !defined (WINCE)
+#if defined (XP_WIN)
     // SHGetKnownFolderPath is only available on Windows Vista
     // so that we need to use GetProcAddress to get the pointer.
     gShell32DLLInst = LoadLibrary("Shell32.dll");
     if(gShell32DLLInst)
     {
         gGetKnownFolderPath = (nsGetKnownFolderPath) 
             GetProcAddress(gShell32DLLInst, "SHGetKnownFolderPath");
     }
@@ -517,31 +517,25 @@ GetSpecialSystemDirectory(SystemDirector
 #else
         return NS_NewNativeLocalFile(nsDependentCString("/"), 
                                      PR_TRUE, 
                                      aFile);
 
 #endif
             
         case OS_TemporaryDirectory:
-#if defined (XP_WIN) && !defined (WINCE)
-        {
+#if defined (XP_WIN)
+            {
             DWORD len = ::GetTempPathW(MAX_PATH, path);
             if (len == 0)
                 break;
             return NS_NewLocalFile(nsDependentString(path, len), 
                                    PR_TRUE, 
                                    aFile);
         }
-#elif defined (WINCE)
-        {
-            return NS_NewNativeLocalFile(NS_LITERAL_CSTRING("\\Temp"), 
-                                         PR_TRUE, 
-                                         aFile);
-        }
 #elif defined(XP_OS2)
         {
             char *tPath = PR_GetEnv("TMP");
             if (!tPath || !*tPath) {
                 tPath = PR_GetEnv("TEMP");
                 if (!tPath || !*tPath) {
                     // if an OS/2 system has neither TMP nor TEMP defined
                     // then it is severely broken, so this will never happen.
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -80,21 +80,17 @@
 #define ESSENTIAL_FILES   NS_LITERAL_CSTRING("Essential Files")
 #elif defined(XP_WIN) || defined(XP_OS2)
 #define APP_REGISTRY_NAME NS_LITERAL_CSTRING("registry.dat")
 #else
 #define APP_REGISTRY_NAME NS_LITERAL_CSTRING("appreg")
 #endif
 
 // define default product directory
-#ifdef WINCE
-#define DEFAULT_PRODUCT_DIR NS_LITERAL_CSTRING("Mozilla")
-#else
 #define DEFAULT_PRODUCT_DIR NS_LITERAL_CSTRING(MOZ_USER_DIR)
-#endif
 
 // Locally defined keys used by nsAppDirectoryEnumerator
 #define NS_ENV_PLUGINS_DIR          "EnvPlugins"    // env var MOZ_PLUGIN_PATH
 #define NS_USER_PLUGINS_DIR         "UserPlugins"
 
 #ifdef XP_MACOSX
 #define NS_MACOSX_USER_PLUGIN_DIR   "OSXUserPlugins"
 #define NS_MACOSX_LOCAL_PLUGIN_DIR  "OSXLocalPlugins"
@@ -345,25 +341,16 @@ NS_METHOD nsAppFileLocationProvider::Get
     rv = localDirMac->InitWithFSRef(&fsRef);
     if (NS_FAILED(rv)) return rv;
 #elif defined(XP_OS2)
     nsCOMPtr<nsIProperties> directoryService = 
              do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
     rv = directoryService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir));
     if (NS_FAILED(rv)) return rv;
-#elif defined(WINCE)
-    nsCOMPtr<nsIProperties> directoryService = 
-             do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
-    if (NS_FAILED(rv)) return rv;
-
-    directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir));
-    if (localDir)
-        rv = localDir->AppendNative(NS_LITERAL_CSTRING("profile"));
-    if (NS_FAILED(rv)) return rv;
 #elif defined(XP_WIN)
     nsCOMPtr<nsIProperties> directoryService = 
              do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
     const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR;
     rv = directoryService->Get(prop, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir));
     if (NS_SUCCEEDED(rv))
         rv = localDir->Exists(&exists);
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 
+: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -90,16 +90,17 @@
 // _mbsstr isn't declared in w32api headers but it's there in the libs
 #ifdef __MINGW32__
 extern "C" {
 unsigned char *_mbsstr( const unsigned char *str,
                         const unsigned char *substr );
 }
 #endif
 
+#ifndef WINCE
 class nsDriveEnumerator : public nsISimpleEnumerator
 {
 public:
     nsDriveEnumerator();
     virtual ~nsDriveEnumerator();
     NS_DECL_ISUPPORTS
     NS_DECL_NSISIMPLEENUMERATOR
     nsresult Init();
@@ -111,17 +112,16 @@ private:
      */
     nsCString mDrives;
     const char *mLetter;
 };
 
 //----------------------------------------------------------------------------
 // short cut resolver
 //----------------------------------------------------------------------------
-#ifndef WINCE
 class ShortcutResolver
 {
 public:
     ShortcutResolver();
     // nonvirtual since we're not subclassed
     ~ShortcutResolver();
 
     nsresult Init();
@@ -222,16 +222,17 @@ static nsresult NS_CreateShortcutResolve
     return gResolver->Init();
 }
 
 static void NS_DestroyShortcutResolver()
 {
     delete gResolver;
     gResolver = nsnull;
 }
+
 #endif
 
 
 //-----------------------------------------------------------------------------
 // static helper functions
 //-----------------------------------------------------------------------------
 
 // certainly not all the error that can be
@@ -2574,29 +2575,31 @@ nsLocalFile::SetFollowLinks(PRBool aFoll
 
 
 NS_IMETHODIMP
 nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator * *entries)
 {
     nsresult rv;
 
     *entries = nsnull;
+#ifndef WINCE
     if (mWorkingPath.EqualsLiteral("\\\\.")) {
         nsDriveEnumerator *drives = new nsDriveEnumerator;
         if (!drives)
             return NS_ERROR_OUT_OF_MEMORY;
         NS_ADDREF(drives);
         rv = drives->Init();
         if (NS_FAILED(rv)) {
             NS_RELEASE(drives);
             return rv;
         }
         *entries = drives;
         return NS_OK;
     }
+#endif
 
     PRBool isDir;
     rv = IsDirectory(&isDir);
     if (NS_FAILED(rv))
         return rv;
     if (!isDir)
         return NS_ERROR_FILE_NOT_DIRECTORY;
 
@@ -2607,16 +2610,17 @@ nsLocalFile::GetDirectoryEntries(nsISimp
     rv = dirEnum->Init(this);
     if (NS_FAILED(rv))
     {
         NS_RELEASE(dirEnum);
         return rv;
     }
 
     *entries = dirEnum;
+
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::GetPersistentDescriptor(nsACString &aPersistentDescriptor)
 {
     CopyUTF16toUTF8(mWorkingPath, aPersistentDescriptor);
     return NS_OK;
@@ -2956,72 +2960,59 @@ nsLocalFile::GlobalInit()
 void
 nsLocalFile::GlobalShutdown()
 {
 #ifndef WINCE
     NS_DestroyShortcutResolver();
 #endif
 }
 
+#ifndef WINCE
 NS_IMPL_ISUPPORTS1(nsDriveEnumerator, nsISimpleEnumerator)
 
 nsDriveEnumerator::nsDriveEnumerator()
  : mLetter(0)
 {
 }
 
 nsDriveEnumerator::~nsDriveEnumerator()
 {
 }
 
 nsresult nsDriveEnumerator::Init()
 {
-#ifdef WINCE
-    return NS_OK;
-#else
     /* If the length passed to GetLogicalDriveStrings is smaller
      * than the length of the string it would return, it returns
      * the length required for the string. */
     DWORD length = GetLogicalDriveStrings(0, 0);
     /* The string is null terminated */
     if (!EnsureStringLength(mDrives, length+1))
         return NS_ERROR_OUT_OF_MEMORY;
     if (!GetLogicalDriveStrings(length, mDrives.BeginWriting()))
         return NS_ERROR_FAILURE;
     mLetter = mDrives.get();
     return NS_OK;
-#endif
 }
 
 NS_IMETHODIMP nsDriveEnumerator::HasMoreElements(PRBool *aHasMore)
 {
-#ifdef WINCE
-    *aHasMore = FALSE;
-#else
     *aHasMore = *mLetter != '\0';
-#endif
     return NS_OK;
 }
 
 NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext)
 {
-#ifdef WINCE
-    nsILocalFile *file;
-    nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("\\"), PR_FALSE, &file);
-    *aNext = file;
-#else
     /* GetLogicalDrives stored in mLetter is a concatenation
      * of null terminated strings, followed by a null terminator. */
     if (!*mLetter) {
         *aNext = nsnull;
         return NS_OK;
     }
     NS_ConvertASCIItoUTF16 drive(mLetter);
     mLetter += drive.Length() + 1;
     nsILocalFile *file;
-    nsresult rv = 
-        NS_NewLocalFile(drive, PR_FALSE, &file);
+    nsresult rv = NS_NewLocalFile(drive, PR_FALSE, &file);
 
     *aNext = file;
-#endif
     return rv;
 }
-
+#endif
+