Bug 1063413 - Do not pass a non-POD object to a variadic function in NativeFileWatcherWin.cpp. r=Yoric
authorJacek Caban <jacek@codeweavers.com>
Fri, 05 Sep 2014 13:27:22 +0200
changeset 203779 e5b1a648ba0160c384fe92e7c4f62e70ad68ed94
parent 203778 661a23ef4b31b3b8bf5aad49e2dad93045d83c7a
child 203780 d44797d191e545a52c2b07e6abe706fd58a3ff7f
push id48747
push userjacek@codeweavers.com
push dateFri, 05 Sep 2014 11:26:42 +0000
treeherdermozilla-inbound@e5b1a648ba01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1063413
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063413 - Do not pass a non-POD object to a variadic function in NativeFileWatcherWin.cpp. r=Yoric
toolkit/components/filewatcher/NativeFileWatcherWin.cpp
--- a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp
+++ b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp
@@ -257,17 +257,17 @@ private:
  * pending watch when shutting down the nsINativeFileWatcher service.
  */
 static PLDHashOperator
 WatchedPathsInfoHashtableTraverser(nsVoidPtrHashKey::KeyType key,
                                    WatchedResourceDescriptor* watchedResource,
                                    void* userArg)
 {
   FILEWATCHERLOG("NativeFileWatcherIOTask::DeactivateRunnableMethod - "
-                 "%S is still being watched.", watchedResource->mPath);
+                 "%S is still being watched.", watchedResource->mPath.get());
 
   return PL_DHASH_NEXT;
 }
 
 /**
  * This runnable is dispatched from the main thread to get the notifications of the
  * changes in the watched resources by continuously calling the blocking function
  * GetQueuedCompletionStatus. This function queries the status of the Completion I/O
@@ -500,17 +500,17 @@ NativeFileWatcherIOTask::RunInternal()
   // We need to keep watching for further changes.
   nsresult rv = AddDirectoryToWatchList(changedRes);
   if (NS_FAILED(rv)) {
     // We failed to watch the folder.
     if (rv == NS_ERROR_ABORT) {
       // Log that we also failed to dispatch the error callbacks.
       FILEWATCHERLOG(
         "NativeFileWatcherIOTask::Run - Failed to watch %s and"
-        " to dispatch the related error callbacks", changedRes->mPath);
+        " to dispatch the related error callbacks", changedRes->mPath.get());
       return rv;
     }
   }
 
   return NS_OK;
 }
 
 /**
@@ -611,17 +611,17 @@ NativeFileWatcherIOTask::AddPathRunnable
     } else if (dwError == ERROR_ACCESS_DENIED) {
       rv = NS_ERROR_FILE_ACCESS_DENIED;
     } else {
       rv = NS_ERROR_FAILURE;
     }
 
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::AddPathRunnableMethod - CreateFileW failed (error %x) for %S.",
-      dwError, wrappedParameters->mPath);
+      dwError, wrappedParameters->mPath.get());
 
     rv = ReportError(wrappedParameters->mErrorCallbackHandle, rv, dwError);
     if (NS_FAILED(rv)) {
       FILEWATCHERLOG(
         "NativeFileWatcherIOTask::AddPathRunnableMethod - "
         "Failed to dispatch the error callback (%x).",
         rv);
       return rv;
@@ -637,17 +637,17 @@ NativeFileWatcherIOTask::AddPathRunnable
 
   // Associate the file with the previously opened completion port.
   if (!CreateIoCompletionPort(resourceDesc->mResourceHandle, mIOCompletionPort,
                               (ULONG_PTR)resourceDesc->mResourceHandle.get(), 0)) {
     DWORD dwError = GetLastError();
 
     FILEWATCHERLOG("NativeFileWatcherIOTask::AddPathRunnableMethod"
                    " - CreateIoCompletionPort failed (error %x) for %S.",
-                   dwError, wrappedParameters->mPath);
+                   dwError, wrappedParameters->mPath.get());
 
     // This could fail because passed parameters could be invalid |HANDLE|s
     // i.e. mIOCompletionPort was unexpectedly closed or failed.
     nsresult rv =
       ReportError(wrappedParameters->mErrorCallbackHandle, NS_ERROR_UNEXPECTED, dwError);
     if (NS_FAILED(rv)) {
       FILEWATCHERLOG(
         "NativeFileWatcherIOTask::AddPathRunnableMethod - "
@@ -700,17 +700,17 @@ NativeFileWatcherIOTask::AddPathRunnable
   if (rv != NS_ERROR_ABORT) {
     // Just don't add the descriptor to the watch list.
     return NS_OK;
   }
 
   // We failed to dispatch the error callbacks as well.
   FILEWATCHERLOG(
     "NativeFileWatcherIOTask::AddPathRunnableMethod - Failed to watch %s and"
-    " to dispatch the related error callbacks", resourceDesc->mPath);
+    " to dispatch the related error callbacks", resourceDesc->mPath.get());
 
   return rv;
 }
 
 /**
  * Removes the path from the list of watched resources. Silently ignores the request
  * if the path was not being watched.
  *
@@ -772,32 +772,32 @@ NativeFileWatcherIOTask::RemovePathRunna
   MOZ_ASSERT(changeCallbackArray);
 
   bool removed =
     changeCallbackArray->RemoveElement(wrappedParameters->mChangeCallbackHandle);
   if (!removed) {
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::RemovePathRunnableMethod - Unable to remove the change "
       "callback from the change callback hash map for %S.",
-      wrappedParameters->mPath);
+      wrappedParameters->mPath.get());
     MOZ_CRASH();
   }
 
   ErrorCallbackArray* errorCallbackArray =
     mErrorCallbacksTable.Get(toRemove->mPath);
 
   MOZ_ASSERT(errorCallbackArray);
 
   removed =
     errorCallbackArray->RemoveElement(wrappedParameters->mErrorCallbackHandle);
   if (!removed) {
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::RemovePathRunnableMethod - Unable to remove the error "
       "callback from the error callback hash map for %S.",
-      wrappedParameters->mPath);
+      wrappedParameters->mPath.get());
     MOZ_CRASH();
   }
 
   // If there are still callbacks left, keep the descriptor.
   // We don't check for error callbacks since there's no point in keeping
   // the descriptor if there are no change callbacks but some error callbacks.
   if (changeCallbackArray->Length()) {
     // Dispatch the success callback.
@@ -1075,17 +1075,17 @@ NativeFileWatcherIOTask::AddDirectoryToW
     // network. The same error could be returned when trying to watch a file instead
     // of a directory.
     // It could return ERROR_NOACCESS if the buffer is not aligned on a DWORD boundary.
     DWORD dwError = GetLastError();
 
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::AddDirectoryToWatchList "
       " - ReadDirectoryChangesW failed (error %x) for %S.",
-      dwError, aDirectoryDescriptor->mPath);
+      dwError, aDirectoryDescriptor->mPath.get());
 
     nsresult rv =
       DispatchErrorCallbacks(aDirectoryDescriptor, NS_ERROR_FAILURE, dwError);
     if (NS_FAILED(rv)) {
       // That's really bad. We failed to watch the directory and failed to
       // dispatch the error callbacks.
       return NS_ERROR_ABORT;
     }
@@ -1202,25 +1202,25 @@ NativeFileWatcherIOTask::MakeResourcePat
       "NativeFileWatcherIOTask::MakeResourcePath - Failed to create a nsILocalFile instance.");
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv = localPath->InitWithPath(changedDescriptor->mPath);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::MakeResourcePath - Failed to init nsILocalFile with %S (%x).",
-      changedDescriptor->mPath, rv);
+      changedDescriptor->mPath.get(), rv);
     return rv;
   }
 
   rv = localPath->AppendRelativePath(resourceName);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
-      "NativeFileWatcherIOTask::MakeResourcePath - Failed to append %S to %S (%x).",
-      resourceName, changedDescriptor->mPath, rv);
+      "NativeFileWatcherIOTask::MakeResourcePath - Failed to append to %S (%x).",
+      changedDescriptor->mPath.get(), rv);
     return rv;
   }
 
   rv = localPath->GetPath(nativeResourcePath);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::MakeResourcePath - Failed to get native path from nsILocalFile (%x).",
       rv);