]> granicus.if.org Git - icu/commitdiff
ICU-12992 return raw pointers not pointer wrappers
authorMarkus Scherer <markus.icu@gmail.com>
Fri, 3 Mar 2017 22:42:52 +0000 (22:42 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 3 Mar 2017 22:42:52 +0000 (22:42 +0000)
X-SVN-Rev: 39729

22 files changed:
icu4c/source/common/ucurr.cpp
icu4c/source/common/unicode/char16ptr.h
icu4c/source/common/unicode/unistr.h
icu4c/source/common/unistr.cpp
icu4c/source/extra/uconv/uconv.cpp
icu4c/source/i18n/collationfastlatinbuilder.h
icu4c/source/i18n/dtfmtsym.cpp
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/i18n/unicode/curramt.h
icu4c/source/i18n/unicode/currunit.h
icu4c/source/i18n/unicode/dtfmtsym.h
icu4c/source/i18n/unicode/numfmt.h
icu4c/source/i18n/unum.cpp
icu4c/source/test/intltest/dtfmtrtts.cpp
icu4c/source/test/intltest/dtfmttst.cpp
icu4c/source/test/intltest/intltest.cpp
icu4c/source/test/intltest/measfmttest.cpp
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/tsmthred.cpp
icu4c/source/test/intltest/ustrtest.cpp
icu4c/source/tools/genrb/reslist.cpp

index 8cc817ade9e5f941339bdabc1d52441a8510e59b..885ca3a922108b3e402d2290d243b2334a4abeb9 100644 (file)
@@ -1031,7 +1031,7 @@ collectCurrencyNames(const char* locale,
                 while ((symbol = iter.next()) != NULL) {
                     (*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
                     (*currencySymbols)[*total_currency_symbol_count].currencyName =
-                        const_cast<UChar*>(symbol->getBuffer().get());
+                        const_cast<UChar*>(symbol->getBuffer());
                     (*currencySymbols)[*total_currency_symbol_count].flag = 0;
                     (*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = symbol->length();
                 }
index d58426a0296f0228f5d74c2aad83ddb3daaa928f..1d75f694f31eb3f30e823068269fe4c59372af96 100644 (file)
@@ -76,6 +76,8 @@ public:
      * @draft ICU 59
      */
     operator char16_t *() const { return get(); }
+    // TODO: do we need output conversion and other operator overloads
+    // if we do not change return values to pointer wrappers?
     /**
      * uint16_t pointer access via type conversion (e.g., static_cast).
      * @draft ICU 59
index 4f1f824e9cbb8153fdecfc43f2ac6429112fce00..3de890666aa1bbc4ed74a2cc8b2b0c5be4d58e9a 100644 (file)
@@ -2859,7 +2859,7 @@ public:
    * @see getTerminatedBuffer()
    * @stable ICU 2.0
    */
-  Char16Ptr getBuffer(int32_t minCapacity);
+  char16_t *getBuffer(int32_t minCapacity);
 
   /**
    * Release a read/write buffer on a UnicodeString object with an
@@ -2913,7 +2913,7 @@ public:
    * @see getTerminatedBuffer()
    * @stable ICU 2.0
    */
-  inline ConstChar16Ptr getBuffer() const;
+  inline const char16_t *getBuffer() const;
 
   /**
    * Get a read-only pointer to the internal buffer,
@@ -2948,7 +2948,7 @@ public:
    * @see getBuffer()
    * @stable ICU 2.2
    */
-  ConstChar16Ptr getTerminatedBuffer();
+  const char16_t *getTerminatedBuffer();
 
   //========================================
   // Constructors
@@ -3940,7 +3940,7 @@ UnicodeString::isBufferWritable() const
       (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1));
 }
 
-inline ConstChar16Ptr
+inline const char16_t *
 UnicodeString::getBuffer() const {
   if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
     return nullptr;
index 3657d15e0f32508617a71c5c7219d3fdad29d010..29ea82df7f1ea05e87431fa19226f98b37f35bb3 100644 (file)
@@ -1218,7 +1218,7 @@ UnicodeString::unBogus() {
   }
 }
 
-ConstChar16Ptr
+const char16_t *
 UnicodeString::getTerminatedBuffer() {
   if(!isWritable()) {
     return nullptr;
@@ -1716,7 +1716,7 @@ UnicodeString::doHashCode() const
 // External Buffer
 //========================================
 
-Char16Ptr
+char16_t *
 UnicodeString::getBuffer(int32_t minCapacity) {
   if(minCapacity>=-1 && cloneArrayIfNeeded(minCapacity)) {
     fUnion.fFields.fLengthAndFlags|=kOpenGetBuffer;
index 6aad36b5a9c18cd8b51947445d54ccaf063188bd..3bc807c819d10528b32e8d036cf2d941f228c633 100644 (file)
@@ -290,7 +290,7 @@ static int printConverters(const char *pname, const char *lookfor,
 
             UnicodeString str(name, "");
             putchar('\t');
-            u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer().get(),
+            u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer(),
                 u_wmsg_errorName(err));
             goto error_cleanup;
         } else {
@@ -304,7 +304,7 @@ static int printConverters(const char *pname, const char *lookfor,
                 if (U_FAILURE(err)) {
                     UnicodeString str(name, "");
                     putchar('\t');
-                    u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer().get(),
+                    u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer(),
                         u_wmsg_errorName(err));
                     goto error_cleanup;
                 }
@@ -627,7 +627,7 @@ ConvertFile::convertFile(const char *pname,
             UnicodeString str2(strerror(errno), "");
             str2.append((UChar32) 0);
             initMsg(pname);
-            u_wmsg(stderr, "cantOpenInputF", str1.getBuffer().get(), str2.getBuffer().get());
+            u_wmsg(stderr, "cantOpenInputF", str1.getBuffer(), str2.getBuffer());
             return FALSE;
         }
         closeFile = TRUE;
@@ -672,10 +672,10 @@ ConvertFile::convertFile(const char *pname,
                 UChar linebuf[20], offsetbuf[20];
                 uprv_itou(linebuf, 20, parse.line, 10, 0);
                 uprv_itou(offsetbuf, 20, parse.offset, 10, 0);
-                u_wmsg(stderr, "cantCreateTranslitParseErr", str.getTerminatedBuffer().get(),
+                u_wmsg(stderr, "cantCreateTranslitParseErr", str.getTerminatedBuffer(),
                     u_wmsg_errorName(err), linebuf, offsetbuf);
             } else {
-                u_wmsg(stderr, "cantCreateTranslit", str.getTerminatedBuffer().get(),
+                u_wmsg(stderr, "cantCreateTranslit", str.getTerminatedBuffer(),
                     u_wmsg_errorName(err));
             }
 
@@ -698,7 +698,7 @@ ConvertFile::convertFile(const char *pname,
     if (U_FAILURE(err)) {
         UnicodeString str(fromcpage, "");
         initMsg(pname);
-        u_wmsg(stderr, "cantOpenFromCodeset", str.getTerminatedBuffer().get(),
+        u_wmsg(stderr, "cantOpenFromCodeset", str.getTerminatedBuffer(),
             u_wmsg_errorName(err));
         goto error_exit;
     }
@@ -713,7 +713,7 @@ ConvertFile::convertFile(const char *pname,
     if (U_FAILURE(err)) {
         UnicodeString str(tocpage, "");
         initMsg(pname);
-        u_wmsg(stderr, "cantOpenToCodeset", str.getTerminatedBuffer().get(),
+        u_wmsg(stderr, "cantOpenToCodeset", str.getTerminatedBuffer(),
             u_wmsg_errorName(err));
         goto error_exit;
     }
@@ -742,7 +742,7 @@ ConvertFile::convertFile(const char *pname,
         if (ferror(infile) != 0) {
             UnicodeString str(strerror(errno));
             initMsg(pname);
-            u_wmsg(stderr, "cantRead", str.getTerminatedBuffer().get());
+            u_wmsg(stderr, "cantRead", str.getTerminatedBuffer());
             goto error_exit;
         }
 
@@ -819,8 +819,8 @@ ConvertFile::convertFile(const char *pname,
 
                 initMsg(pname);
                 u_wmsg(stderr, "problemCvtToU",
-                        UnicodeString(pos, length, "").getTerminatedBuffer().get(),
-                        str.getTerminatedBuffer().get(),
+                        UnicodeString(pos, length, "").getTerminatedBuffer(),
+                        str.getTerminatedBuffer(),
                         u_wmsg_errorName(err));
 
                 willexit = TRUE;
@@ -1008,10 +1008,10 @@ ConvertFile::convertFile(const char *pname,
 
                     initMsg(pname);
                     u_wmsg(stderr, errtag,
-                            UnicodeString(pos, length, "").getTerminatedBuffer().get(),
-                            str.getTerminatedBuffer().get(),
+                            UnicodeString(pos, length, "").getTerminatedBuffer(),
+                            str.getTerminatedBuffer(),
                            u_wmsg_errorName(err));
-                    u_wmsg(stderr, "errorUnicode", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "errorUnicode", str.getTerminatedBuffer());
 
                     willexit = TRUE;
                     err = U_ZERO_ERROR; /* reset the error for the rest of the conversion. */
@@ -1026,7 +1026,7 @@ ConvertFile::convertFile(const char *pname,
                 if (wr != outlen) {
                     UnicodeString str(strerror(errno));
                     initMsg(pname);
-                    u_wmsg(stderr, "cantWrite", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "cantWrite", str.getTerminatedBuffer());
                     willexit = TRUE;
                 }
 
@@ -1075,7 +1075,7 @@ static void usage(const char *pname, int ecode) {
     UnicodeString upname(pname, (int32_t)(uprv_strlen(pname) + 1));
     UnicodeString mname(msg, msgLen + 1);
 
-    res = u_wmsg(fp, "usage", mname.getBuffer().get(), upname.getBuffer().get());
+    res = u_wmsg(fp, "usage", mname.getBuffer(), upname.getBuffer());
     if (!ecode) {
         if (!res) {
             fputc('\n', fp);
@@ -1184,7 +1184,7 @@ main(int argc, char **argv)
                     initMsg(pname);
                     UnicodeString str(*iter);
                     initMsg(pname);
-                    u_wmsg(stderr, "badBlockSize", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "badBlockSize", str.getTerminatedBuffer());
                     return 3;
                 }
             } else {
@@ -1212,7 +1212,7 @@ main(int argc, char **argv)
                 if (U_FAILURE(e) || !printName) {
                     UnicodeString str(*iter);
                     initMsg(pname);
-                    u_wmsg(stderr, "noSuchCodeset", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "noSuchCodeset", str.getTerminatedBuffer());
                     return 2;
                 }
             } else
@@ -1240,7 +1240,7 @@ main(int argc, char **argv)
                 } else {
                     UnicodeString str(*iter);
                     initMsg(pname);
-                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer());
                     return 4;
                 }
             } else {
@@ -1256,7 +1256,7 @@ main(int argc, char **argv)
                 } else {
                     UnicodeString str(*iter);
                     initMsg(pname);
-                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer());
                     return 4;
                 }
             } else {
@@ -1276,7 +1276,7 @@ main(int argc, char **argv)
                 } else {
                     UnicodeString str(*iter);
                     initMsg(pname);
-                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer().get());
+                    u_wmsg(stderr, "unknownCallback", str.getTerminatedBuffer());
                     return 4;
                 }
             } else {
@@ -1329,7 +1329,7 @@ main(int argc, char **argv)
             UnicodeString str2(strerror(errno), "");
             initMsg(pname);
             u_wmsg(stderr, "cantCreateOutputF",
-                str1.getBuffer().get(), str2.getBuffer().get());
+                str1.getBuffer(), str2.getBuffer());
             return 1;
         }
     } else {
index ad64d03b75fa5671bb776cc5b97435946ec60740..8b63b86815fdc65cfa7fa6904695bbb39ec66947 100644 (file)
@@ -37,7 +37,7 @@ public:
     UBool forData(const CollationData &data, UErrorCode &errorCode);
 
     const uint16_t *getTable() const {
-        return result.getBuffer();
+        return reinterpret_cast<const uint16_t *>(result.getBuffer());
     }
     int32_t lengthOfTable() const { return result.length(); }
 
index 960971980bc0a46004874ddb63ab3df85c9ef9f5..6dd4380a4df2913ddd1cc1df14a0140812a5a256 100644 (file)
@@ -1368,7 +1368,7 @@ DateFormatSymbols::setZoneStrings(const UnicodeString* const *strings, int32_t r
 
 //------------------------------------------------------
 
-ConstChar16Ptr U_EXPORT2
+const char16_t * U_EXPORT2
 DateFormatSymbols::getPatternUChars(void)
 {
     return gPatternChars;
index e84f9fdd8d289a4d079fc10d432757f6069ccaaa..ea9aed1a359cde0b2cdc13a688724d1995454d58 100644 (file)
@@ -1188,7 +1188,7 @@ void NumberFormat::setCurrency(const UChar* theCurrency, UErrorCode& ec) {
     }
 }
 
-ConstChar16Ptr NumberFormat::getCurrency() const {
+const char16_t* NumberFormat::getCurrency() const {
     return fCurrency;
 }
 
index 69a13450a684270fd4f663ad109778657574b3d8..3c0670446b38769957ac9623473ba77f2f7653ef 100644 (file)
@@ -3789,7 +3789,7 @@ SimpleDateFormat::toLocalizedPattern(UnicodeString& result,
                                      UErrorCode& status) const
 {
     translatePattern(fPattern, result,
-                     UnicodeString(DateFormatSymbols::getPatternUChars().get()),
+                     UnicodeString(DateFormatSymbols::getPatternUChars()),
                      fSymbols->fLocalPatternChars, status);
     return result;
 }
@@ -3811,7 +3811,7 @@ SimpleDateFormat::applyLocalizedPattern(const UnicodeString& pattern,
 {
     translatePattern(pattern, fPattern,
                      fSymbols->fLocalPatternChars,
-                     UnicodeString(DateFormatSymbols::getPatternUChars().get()), status);
+                     UnicodeString(DateFormatSymbols::getPatternUChars()), status);
 }
 
 //----------------------------------------------------------------------
index a645667d9d0c436dc6ef074f0f42e6e99abd5c34..e321df861d251fd52176229faa449ae8bfb52e5c 100644 (file)
@@ -115,14 +115,14 @@ class U_I18N_API CurrencyAmount: public Measure {
      * Return the ISO currency code of this object.
      * @stable ICU 3.0
      */
-    inline ConstChar16Ptr getISOCurrency() const;
+    inline const char16_t* getISOCurrency() const;
 };
 
 inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
     return (const CurrencyUnit&) getUnit();
 }
 
-inline ConstChar16Ptr CurrencyAmount::getISOCurrency() const {
+inline const char16_t* CurrencyAmount::getISOCurrency() const {
     return getCurrency().getISOCurrency();
 }
 
index cefea536eb03e58cf2440abeb82661b0bfa85806..fd0f9f2bcce085982be4ec26ccd4390385d754ed 100644 (file)
@@ -93,7 +93,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
      * Return the ISO currency code of this object.
      * @stable ICU 3.0
      */
-    inline ConstChar16Ptr getISOCurrency() const;
+    inline const char16_t* getISOCurrency() const;
 
  private:
     /**
@@ -102,7 +102,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
     char16_t isoCode[4];
 };
 
-inline ConstChar16Ptr CurrencyUnit::getISOCurrency() const {
+inline const char16_t* CurrencyUnit::getISOCurrency() const {
     return isoCode;
 }
 
index e5f4d5c36c898984eab0340e95fc419c6e26a6fb..0cf3ce20ac6f54263e4fc4323db64b5a25aea0e4 100644 (file)
@@ -566,7 +566,7 @@ public:
      * @return    the non-localized date-time pattern characters
      * @stable ICU 2.0
      */
-    static ConstChar16Ptr U_EXPORT2 getPatternUChars(void);
+    static const char16_t * U_EXPORT2 getPatternUChars(void);
 
     /**
      * Gets localized date-time pattern characters. For example: 'u', 't', etc.
index 6d83f43f520b6a02be1bc07e520cb65a6d49727d..b8dec36be644eb6b73c2433617691b1495f099cc 100644 (file)
@@ -940,7 +940,7 @@ public:
      * the currency in use, or a pointer to the empty string.
      * @stable ICU 2.6
      */
-    ConstChar16Ptr getCurrency() const;
+    const char16_t* getCurrency() const;
        
     /**
      * Set a particular UDisplayContext value in the formatter, such as
index 458a79c7fdec85b870ac913604b711cf4a35360d..b8d26612ff2f96c5c4c90b577e7e020f8b393648 100644 (file)
@@ -609,7 +609,7 @@ unum_getTextAttribute(const UNumberFormat*  fmt,
             break;
 
         case UNUM_CURRENCY_CODE:
-            res = UnicodeString(df->getCurrency().get());
+            res = UnicodeString(df->getCurrency());
             break;
 
         default:
index 32f4715df37d89b422076c5b5cc183794635b783..5bac60ed7dbb2ee341b6ffb8ea3a18f8eb473ff8 100644 (file)
@@ -121,9 +121,7 @@ void DateFormatRoundTripTest::TestCentury()
      */
     //if (date[1] != date[2] || result[0] != result[1]) {
     if (date[1] != date[2]) {
-        errln("Round trip failure: \"%S\" (%f), \"%S\" (%f)",
-              static_cast<const UChar *>(result[0].getBuffer()), date[1],
-              static_cast<const UChar *>(result[1].getBuffer()), date[2]);
+        errln("Round trip failure: \"%S\" (%f), \"%S\" (%f)", result[0].getBuffer(), date[1], result[1].getBuffer(), date[2]);
     }
 }
 
index f9461739257c3b51e612d050a0525eac141c16ec..63d127346dae960926b6255577a59e169f0dc865 100644 (file)
@@ -514,7 +514,7 @@ void DateFormatTest::TestFieldPosition() {
     // local pattern chars data is not longer loaded
     // from icu locale bundle
     assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf));
-    assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars().get());
+    assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars());
     assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT);
 #if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR
     assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS));
index bfefe3f857093ee88e4c3679da32f28d0ea9d621..ab5ce8c1272ca130354baa43bb81565f3b3bfd5f 100644 (file)
@@ -187,7 +187,7 @@ UnicodeString _toString(const Formattable& f) {
     case Formattable::kObject: {
         const CurrencyAmount* c = dynamic_cast<const CurrencyAmount*>(f.getObject());
         if (c != NULL) {
-            s = _toString(c->getNumber()) + " " + UnicodeString(c->getISOCurrency().get());
+            s = _toString(c->getNumber()) + " " + UnicodeString(c->getISOCurrency());
         } else {
             s = UnicodeString("Unknown UObject");
         }
index 10fa1c749504d0adbd8824efd383ff5a51ca643d..f34d8397c016d32a0f747101f9d33c8429aaab67 100644 (file)
@@ -1856,7 +1856,7 @@ void MeasureFormatTest::TestCurrencies() {
     u_uastrcpy(USD, "USD");
     UErrorCode status = U_ZERO_ERROR;
     CurrencyAmount USD_1(1.0, USD, status);
-    assertEquals("Currency Code", USD, USD_1.getISOCurrency().get());
+    assertEquals("Currency Code", USD, USD_1.getISOCurrency());
     CurrencyAmount USD_2(2.0, USD, status);
     CurrencyAmount USD_NEG_1(-1.0, USD, status);
     if (!assertSuccess("Error creating currencies", status)) {
index ea67aa2d47c51ae6754021fb4402f60cfd138bfc..a8553f57802c2e371dd1c74c0412d18586c3e929 100644 (file)
@@ -440,7 +440,7 @@ UBool NumberFormatTestDataDriven::isParseCurrencyPass(
         }
         return TRUE;
     }
-    UnicodeString currStr(currAmt->getISOCurrency().get());
+    UnicodeString currStr(currAmt->getISOCurrency());
     Formattable resultFormattable(currAmt->getNumber());
     UnicodeString resultStr(UnicodeString::fromUTF8(resultFormattable.getDecimalNumber(status)));
     if (tuple.output == "fail") {
@@ -3168,7 +3168,7 @@ void NumberFormatTest::expectParseCurrency(const NumberFormat &fmt, const UChar*
 
     uprv_strcpy(theOperation, theInfo);
     uprv_strcat(theOperation, ", check currency:");
-    assertEquals(theOperation, currency, currencyAmount->getISOCurrency().get());
+    assertEquals(theOperation, currency, currencyAmount->getISOCurrency());
 }
   
 
@@ -3763,14 +3763,14 @@ NumberFormatTest::TestCurrencyFormatForMixParsing() {
         } else if (result.getType() != Formattable::kObject ||
             (curramt = dynamic_cast<const CurrencyAmount*>(result.getObject())) == NULL ||
             curramt->getNumber().getDouble() != 1234.56 ||
-            UnicodeString(curramt->getISOCurrency().get()).compare(ISO_CURRENCY_USD)
+            UnicodeString(curramt->getISOCurrency()).compare(ISO_CURRENCY_USD)
         ) {
             errln("FAIL: getCurrencyFormat of default locale (en_US) failed roundtripping the number ");
             if (curramt->getNumber().getDouble() != 1234.56) {
                 errln((UnicodeString)"wong number, expect: 1234.56" + ", got: " + curramt->getNumber().getDouble());
             }
             if (curramt->getISOCurrency() != ISO_CURRENCY_USD) {
-                errln((UnicodeString)"wong currency, expect: USD" + ", got: " + curramt->getISOCurrency().get());
+                errln((UnicodeString)"wong currency, expect: USD" + ", got: " + curramt->getISOCurrency());
             }
         }
     }
index 5cff8ee51d0f94fd487ab197cb5814a6a9f2940a..036d5e1d3551237073dd0ded1c902f2dcef450df 100644 (file)
@@ -547,7 +547,7 @@ UBool ThreadSafeFormat::doStuff(int32_t offset, UnicodeString &appendErr, UError
     appendErr.append("fFormat currency != ")
       .append(kUSD)
       .append(", =")
-      .append(fFormat->getCurrency().get())
+      .append(fFormat->getCurrency())
       .append("! ");
     okay = FALSE;
   }
@@ -556,7 +556,7 @@ UBool ThreadSafeFormat::doStuff(int32_t offset, UnicodeString &appendErr, UError
     appendErr.append("gFormat currency != ")
       .append(kUSD)
       .append(", =")
-      .append(gSharedData->fFormat->getCurrency().get())
+      .append(gSharedData->fFormat->getCurrency())
       .append("! ");
     okay = FALSE;
   }
index d1f2bfe6ff685423c3eae865c5cfc6fd1a7eb569..cdd519b9bb67ad3615bb21b636a1dc0ebf17f6b8 100644 (file)
@@ -1086,7 +1086,7 @@ UnicodeStringTest::TestMiscellaneous()
     }
 
     // test releaseBuffer() with a NUL-terminated buffer
-    test1.getBuffer(20).get()[2]=0;
+    test1.getBuffer(20)[2]=0;
     test1.releaseBuffer(); // implicit -1
     if(test1.length()!=2 || test1.charAt(0)!=1 || test1.charAt(1) !=2) {
         errln("UnicodeString::releaseBuffer(-1) does not properly set the length of the UnicodeString");
@@ -1558,7 +1558,7 @@ UnicodeStringTest::TestBogus() {
     // writable alias to another string's buffer: very bad idea, just convenient for this test
     test3.setToBogus();
     if(!test3.isBogus() ||
-            test3.setTo(const_cast<UChar *>(test1.getBuffer().get()),
+            test3.setTo(const_cast<UChar *>(test1.getBuffer()),
                         test1.length(), test1.getCapacity()).isBogus() ||
             test3!=test1) {
         errln("bogus.setTo(writable alias) failed");
index 8c8ed4162dac59425c0d684c0a314df220472741..abeaf0e49fc99f294b2ef705fb7492b21484c770 100644 (file)
@@ -1031,7 +1031,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
             if (f16BitUnits.length() <= 1) {
                 // no pool strings to checksum
             } else if (U_IS_BIG_ENDIAN) {
-                checksum = computeCRC(reinterpret_cast<const char *>(f16BitUnits.getBuffer().get()),
+                checksum = computeCRC(reinterpret_cast<const char *>(f16BitUnits.getBuffer()),
                                       (uint32_t)f16BitUnits.length() * 2, checksum);
             } else {
                 // Swap to big-endian so we get the same checksum on all platforms
@@ -1039,7 +1039,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
                 UnicodeString s(f16BitUnits);
                 s.append((UChar)1);  // Ensure that we own this buffer.
                 assert(!s.isBogus());
-                uint16_t *p = const_cast<uint16_t *>(static_cast<const uint16_t *>(s.getBuffer()));
+                uint16_t *p = const_cast<uint16_t *>(reinterpret_cast<const uint16_t *>(s.getBuffer()));
                 for (int32_t count = f16BitUnits.length(); count > 0; --count) {
                     uint16_t x = *p;
                     *p++ = (uint16_t)((x << 8) | (x >> 8));