nsZipQueueItem-allowonstack
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 159 969d8d4050b8b7ebfb082c860b4a16df41348d52
permissions -rw-r--r--
State as of now

diff --git a/modules/libjar/zipwriter/src/nsZipWriter.cpp b/modules/libjar/zipwriter/src/nsZipWriter.cpp
--- a/modules/libjar/zipwriter/src/nsZipWriter.cpp
+++ b/modules/libjar/zipwriter/src/nsZipWriter.cpp
@@ -383,7 +383,7 @@ NS_IMETHODIMP nsZipWriter::AddEntryFile(
         item.mOperation = OPERATION_ADD;
         item.mZipEntry = aZipEntry;
         item.mCompression = aCompression;
-        rv = aFile->Clone(getter_AddRefs(item.mFile));
+        rv = aFile->Clone(&item.mFile);
         NS_ENSURE_SUCCESS(rv, rv);
         if (!mQueue.AppendElement(item))
             return NS_ERROR_OUT_OF_MEMORY;
@@ -862,7 +862,7 @@ inline nsresult nsZipWriter::BeginProces
 
         if (!isdir) {
             // Set up for fall through to stream reader
-            rv = NS_NewLocalFileInputStream(getter_AddRefs(aItem->mStream),
+            rv = NS_NewLocalFileInputStream(&aItem->mStream,
                                             aItem->mFile);
             NS_ENSURE_SUCCESS(rv, rv);
         }
diff --git a/modules/libjar/zipwriter/src/nsZipWriter.h b/modules/libjar/zipwriter/src/nsZipWriter.h
--- a/modules/libjar/zipwriter/src/nsZipWriter.h
+++ b/modules/libjar/zipwriter/src/nsZipWriter.h
@@ -60,11 +60,16 @@ struct nsZipQueueItem
 struct nsZipQueueItem
 {
 public:
+    nsZipQueueItem() : mFile(nsnull), mChannel(nsnull), mStream(nsnull) { }
+
     PRUint32 mOperation;
     nsCString mZipEntry;
-    nsCOMPtr<nsIFile> mFile;
-    nsCOMPtr<nsIChannel> mChannel;
-    nsCOMPtr<nsIInputStream> mStream;
+
+    // XXXbsmedberg: need write barriers on mFile/mChannel/mStream when this
+    // is actually a GC class (nsZipWriter.mQueue)
+    nsIFile* mFile;
+    nsIChannel* mChannel;
+    nsIInputStream* mStream;
     PRTime mModTime;
     PRInt32 mCompression;
 };
@@ -92,7 +97,7 @@ private:
     nsCOMPtr<nsISupports> mProcessContext;
     nsCOMPtr<nsIOutputStream> mStream;
     nsCOMArray<nsZipHeader> mHeaders;
-    nsTArray<nsZipQueueItem> mQueue;
+    nsTArray<nsZipQueueItem, GCAllocator> mQueue;
     nsDataHashtable<nsCStringHashKey, PRInt32> mEntryHash;
     nsCString mComment;