Bug 1240436 - Part3: Remove NS_NewStringInputStream to prevent misuse. r=froydnj
authorStone Shih <sshih@mozilla.com>
Thu, 14 Apr 2016 18:55:50 +0800
changeset 331718 f851d6d56143c624a7cd1e77660b29fa3856812f
parent 331717 e9cdedc9c456d1380baec15475e48a9c98811682
child 331719 b72de5c5ac3363c5fe7dc94c74a13a1152720100
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1240436
milestone48.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 1240436 - Part3: Remove NS_NewStringInputStream to prevent misuse. r=froydnj
xpcom/io/nsStringStream.cpp
xpcom/io/nsStringStream.h
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -402,24 +402,16 @@ NS_NewByteInputStream(nsIInputStream** a
     return rv;
   }
 
   stream.forget(aStreamResult);
   return NS_OK;
 }
 
 nsresult
-NS_NewStringInputStream(nsIInputStream** aStreamResult,
-                        const nsAString& aStringToRead)
-{
-  NS_LossyConvertUTF16toASCII data(aStringToRead); // truncates high-order bytes
-  return NS_NewCStringInputStream(aStreamResult, data);
-}
-
-nsresult
 NS_NewCStringInputStream(nsIInputStream** aStreamResult,
                          const nsACString& aStringToRead)
 {
   NS_PRECONDITION(aStreamResult, "null out ptr");
 
   RefPtr<nsStringInputStream> stream = new nsStringInputStream();
 
   stream->SetData(aStringToRead);
--- a/xpcom/io/nsStringStream.h
+++ b/xpcom/io/nsStringStream.h
@@ -48,28 +48,16 @@
  * determined by scanning the buffer for the first null byte.
  */
 extern nsresult
 NS_NewByteInputStream(nsIInputStream** aStreamResult,
                       const char* aStringToRead, int32_t aLength = -1,
                       nsAssignmentType aAssignment = NS_ASSIGNMENT_DEPEND);
 
 /**
- * Factory method to get an nsInputStream from an nsAString.  Result will
- * implement nsIStringInputStream and nsISeekableStream.
- *
- * The given string data will be converted to a single-byte data buffer via
- * truncation (i.e., the high-order byte of each character will be discarded).
- * This could result in data-loss, so be careful when using this function.
- */
-extern nsresult
-NS_NewStringInputStream(nsIInputStream** aStreamResult,
-                        const nsAString& aStringToRead);
-
-/**
  * Factory method to get an nsInputStream from an nsACString.  Result will
  * implement nsIStringInputStream and nsISeekableStream.
  */
 extern nsresult
 NS_NewCStringInputStream(nsIInputStream** aStreamResult,
                          const nsACString& aStringToRead);
 
 #endif // nsStringStream_h__