Bug 1228482 - use nsAutoString instead of handling raw strings, r=gijs
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 27 Nov 2015 14:02:30 +0000
changeset 274454 b7675a900e870fc0fa135f3a27d0b2eac0429305
parent 274453 451be287fbc941247b6219d278904fba8c191d54
child 274455 a3745c645a77b34a5ce94c547de32c756f809e3b
push id68588
push usergijskruitbosch@gmail.com
push dateFri, 27 Nov 2015 14:44:01 +0000
treeherdermozilla-inbound@b7675a900e87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1228482
milestone45.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 1228482 - use nsAutoString instead of handling raw strings, r=gijs
browser/components/migration/nsEdgeReadingListExtractor.cpp
--- a/browser/components/migration/nsEdgeReadingListExtractor.cpp
+++ b/browser/components/migration/nsEdgeReadingListExtractor.cpp
@@ -8,16 +8,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsIConsoleService.h"
 #include "nsIMutableArray.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
 #include "nsWindowsMigrationUtils.h"
+#include "nsStringGlue.h"
 
 #define NS_HANDLE_JET_ERROR(err) { \
   if (err < JET_errSuccess) {	\
     rv = ConvertJETError(err); \
     goto CloseDB; \
   } \
 }
 
@@ -197,18 +198,17 @@ nsEdgeReadingListExtractor::ConvertJETEr
       return NS_ERROR_FILE_INVALID_PATH;
     case JET_errFileNotFound:
       return NS_ERROR_FILE_NOT_FOUND;
     case JET_errDatabaseDirtyShutdown:
       return NS_ERROR_FILE_CORRUPTED;
     default: {
       nsCOMPtr<nsIConsoleService>
         consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
-      static const char16ptr_t
-        kFormat = MOZ_UTF16("Unexpected JET error from ESE database: %ld");
-      wchar_t msg[80];
-      swprintf(msg, mozilla::ArrayLength(msg), kFormat, aError);
-      consoleService->LogStringMessage(char16ptr_t(msg));
+      nsAutoString msg;
+      msg.AppendLiteral("Unexpected JET error from ESE database: ");
+      msg.AppendInt(aError);
+      consoleService->LogStringMessage(msg.get());
       return NS_ERROR_FAILURE;
     }
   }
 }