Bug 1060419 - make MediaEngineWebRTC.h use SprintfLiteral, r?froydnj draft
authorTom Tromey <tom@tromey.com>
Fri, 09 Dec 2016 10:10:42 -1000
changeset 486144 f1893ac08710b26bf29b5e1ac9edb52976737af4
parent 486143 da86bf49feb6bb10a0c7cce0f77e6acbbdfe960e
child 486145 dcce3412b5d009fd1399bd3bda6e552ee11f1104
push id45909
push userbmo:ttromey@mozilla.com
push dateFri, 17 Feb 2017 16:00:11 +0000
reviewersfroydnj
bugs1060419
milestone54.0a1
Bug 1060419 - make MediaEngineWebRTC.h use SprintfLiteral, r?froydnj MozReview-Commit-ID: AqpCZ3d8hCV
dom/media/webrtc/MediaEngineWebRTC.h
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -2,24 +2,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MEDIAENGINEWEBRTC_H_
 #define MEDIAENGINEWEBRTC_H_
 
 #include "prcvar.h"
 #include "prthread.h"
-#include "prprf.h"
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 
 #include "mozilla/dom/File.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/Monitor.h"
+#include "mozilla/Sprintf.h"
 #include "mozilla/UniquePtr.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsThreadUtils.h"
 #include "DOMMediaStream.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsComponentManagerUtils.h"
 #include "nsRefPtrHashtable.h"
@@ -145,17 +145,17 @@ class AudioInput
 {
 public:
   explicit AudioInput(webrtc::VoiceEngine* aVoiceEngine) : mVoiceEngine(aVoiceEngine) {};
   // Threadsafe because it's referenced from an MicrophoneSource, which can
   // had references to it on other threads.
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AudioInput)
 
   virtual int GetNumOfRecordingDevices(int& aDevices) = 0;
-  virtual int GetRecordingDeviceName(int aIndex, char aStrNameUTF8[128],
+  virtual int GetRecordingDeviceName(int aIndex, char (&aStrNameUTF8)[128],
                                      char aStrGuidUTF8[128]) = 0;
   virtual int GetRecordingDeviceStatus(bool& aIsAvailable) = 0;
   virtual void StartRecording(SourceMediaStream *aStream, AudioDataListener *aListener) = 0;
   virtual void StopRecording(SourceMediaStream *aStream) = 0;
   virtual int SetRecordingDevice(int aIndex) = 0;
 
 protected:
   // Protected destructor, to discourage deletion outside of Release():
@@ -236,29 +236,29 @@ public:
     if (dev_index != -1) {
       aID = mDevices->device[dev_index]->devid;
       return true;
     }
     return false;
 #endif
   }
 
-  int GetRecordingDeviceName(int aIndex, char aStrNameUTF8[128],
+  int GetRecordingDeviceName(int aIndex, char (&aStrNameUTF8)[128],
                              char aStrGuidUTF8[128])
   {
 #ifdef MOZ_WIDGET_ANDROID
     aStrNameUTF8[0] = '\0';
     aStrGuidUTF8[0] = '\0';
 #else
     int32_t devindex = DeviceIndex(aIndex);
     if (!mDevices || devindex < 0) {
       return 1;
     }
-    PR_snprintf(aStrNameUTF8, 128, "%s%s", aIndex == -1 ? "default: " : "",
-                mDevices->device[devindex]->friendly_name);
+    SprintfLiteral(aStrNameUTF8, "%s%s", aIndex == -1 ? "default: " : "",
+		   mDevices->device[devindex]->friendly_name);
     aStrGuidUTF8[0] = '\0';
 #endif
     return 0;
   }
 
   int GetRecordingDeviceStatus(bool& aIsAvailable)
   {
     // With cubeb, we only expose devices of type CUBEB_DEVICE_TYPE_INPUT,
@@ -340,17 +340,17 @@ public:
     ScopedCustomReleasePtr<webrtc::VoEHardware> ptrVoEHw;
     ptrVoEHw = webrtc::VoEHardware::GetInterface(mVoiceEngine);
     if (!ptrVoEHw)  {
       return 1;
     }
     return ptrVoEHw->GetNumOfRecordingDevices(aDevices);
   }
 
-  int GetRecordingDeviceName(int aIndex, char aStrNameUTF8[128],
+  int GetRecordingDeviceName(int aIndex, char (&aStrNameUTF8)[128],
                              char aStrGuidUTF8[128])
   {
     ScopedCustomReleasePtr<webrtc::VoEHardware> ptrVoEHw;
     ptrVoEHw = webrtc::VoEHardware::GetInterface(mVoiceEngine);
     if (!ptrVoEHw)  {
       return 1;
     }
     return ptrVoEHw->GetRecordingDeviceName(aIndex, aStrNameUTF8,