diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /intl/uconv/nsReplacementToUnicode.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/uconv/nsReplacementToUnicode.cpp')
-rw-r--r-- | intl/uconv/nsReplacementToUnicode.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/intl/uconv/nsReplacementToUnicode.cpp b/intl/uconv/nsReplacementToUnicode.cpp new file mode 100644 index 000000000..c068003b3 --- /dev/null +++ b/intl/uconv/nsReplacementToUnicode.cpp @@ -0,0 +1,56 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +#include "nsReplacementToUnicode.h" + +nsReplacementToUnicode::nsReplacementToUnicode() + : mSeenByte(false) +{ +} + +NS_IMETHODIMP +nsReplacementToUnicode::Convert(const char* aSrc, + int32_t* aSrcLength, + char16_t* aDest, + int32_t* aDestLength) +{ + if (mSeenByte || !(*aSrcLength)) { + *aDestLength = 0; + return NS_PARTIAL_MORE_INPUT; + } + if (mErrBehavior == kOnError_Signal) { + mSeenByte = true; + *aSrcLength = 0; + *aDestLength = 0; + return NS_ERROR_ILLEGAL_INPUT; + } + if (!(*aDestLength)) { + *aSrcLength = -1; + return NS_PARTIAL_MORE_OUTPUT; + } + mSeenByte = true; + *aDest = 0xFFFD; + *aDestLength = 1; + return NS_PARTIAL_MORE_INPUT; +} + +NS_IMETHODIMP +nsReplacementToUnicode::GetMaxLength(const char* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) +{ + if (!mSeenByte && aSrcLength > 0) { + *aDestLength = 1; + } else { + *aDestLength = 0; + } + return NS_EXACT_LENGTH; +} + +NS_IMETHODIMP +nsReplacementToUnicode::Reset() +{ + mSeenByte = false; + return NS_OK; +} |