Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 639566
Collapse All | Expand All

(-)mozjs-24.2.0-orig/js/src/builtin/Intl.cpp (-12 / +12 lines)
Lines 998-1004 Link Here
998
    if (!chars2)
998
    if (!chars2)
999
        return false;
999
        return false;
1000
1000
1001
    UCollationResult uresult = ucol_strcoll(coll, chars1, length1, chars2, length2);
1001
    UCollationResult uresult = ucol_strcoll(coll, reinterpret_cast<const UChar*>(chars1), length1, reinterpret_cast<const UChar*>(chars2), length2);
1002
1002
1003
    int32_t res;
1003
    int32_t res;
1004
    switch (uresult) {
1004
    switch (uresult) {
Lines 1333-1339 Link Here
1333
        currency = value.toString();
1333
        currency = value.toString();
1334
        MOZ_ASSERT(currency->length() == 3, "IsWellFormedCurrencyCode permits only length-3 strings");
1334
        MOZ_ASSERT(currency->length() == 3, "IsWellFormedCurrencyCode permits only length-3 strings");
1335
        // uCurrency remains owned by currency.
1335
        // uCurrency remains owned by currency.
1336
        uCurrency = JS_GetStringCharsZ(cx, currency);
1336
        uCurrency = reinterpret_cast<const UChar*>(JS_GetStringCharsZ(cx, currency));
1337
        if (!uCurrency)
1337
        if (!uCurrency)
1338
            return NULL;
1338
            return NULL;
1339
1339
Lines 1440-1451 Link Here
1440
    if (!chars.resize(INITIAL_STRING_BUFFER_SIZE))
1440
    if (!chars.resize(INITIAL_STRING_BUFFER_SIZE))
1441
        return false;
1441
        return false;
1442
    UErrorCode status = U_ZERO_ERROR;
1442
    UErrorCode status = U_ZERO_ERROR;
1443
    int size = unum_formatDouble(nf, x, chars.begin(), INITIAL_STRING_BUFFER_SIZE, NULL, &status);
1443
    int size = unum_formatDouble(nf, x, reinterpret_cast<UChar*>(chars.begin()), INITIAL_STRING_BUFFER_SIZE, NULL, &status);
1444
    if (status == U_BUFFER_OVERFLOW_ERROR) {
1444
    if (status == U_BUFFER_OVERFLOW_ERROR) {
1445
        if (!chars.resize(size))
1445
        if (!chars.resize(size))
1446
            return false;
1446
            return false;
1447
        status = U_ZERO_ERROR;
1447
        status = U_ZERO_ERROR;
1448
        unum_formatDouble(nf, x, chars.begin(), size, NULL, &status);
1448
        unum_formatDouble(nf, x, reinterpret_cast<UChar*>(chars.begin()), size, NULL, &status);
1449
    }
1449
    }
1450
    if (U_FAILURE(status)) {
1450
    if (U_FAILURE(status)) {
1451
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1451
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
Lines 1800-1806 Link Here
1800
    if (!skeleton)
1800
    if (!skeleton)
1801
        return false;
1801
        return false;
1802
    SkipRoot skip(cx, &skeleton);
1802
    SkipRoot skip(cx, &skeleton);
1803
    uint32_t skeletonLen = u_strlen(skeleton);
1803
    uint32_t skeletonLen = u_strlen(reinterpret_cast<const UChar*>(skeleton));
1804
1804
1805
    UErrorCode status = U_ZERO_ERROR;
1805
    UErrorCode status = U_ZERO_ERROR;
1806
    UDateTimePatternGenerator *gen = udatpg_open(icuLocale(locale.ptr()), &status);
1806
    UDateTimePatternGenerator *gen = udatpg_open(icuLocale(locale.ptr()), &status);
Lines 1810-1816 Link Here
1810
    }
1810
    }
1811
    ScopedICUObject<UDateTimePatternGenerator> toClose(gen, udatpg_close);
1811
    ScopedICUObject<UDateTimePatternGenerator> toClose(gen, udatpg_close);
1812
1812
1813
    int32_t size = udatpg_getBestPattern(gen, skeleton, skeletonLen, NULL, 0, &status);
1813
    int32_t size = udatpg_getBestPattern(gen, reinterpret_cast<const UChar*>(skeleton), skeletonLen, NULL, 0, &status);
1814
    if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
1814
    if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
1815
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1815
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1816
        return false;
1816
        return false;
Lines 1820-1832 Link Here
1820
        return false;
1820
        return false;
1821
    pattern[size] = '\0';
1821
    pattern[size] = '\0';
1822
    status = U_ZERO_ERROR;
1822
    status = U_ZERO_ERROR;
1823
    udatpg_getBestPattern(gen, skeleton, skeletonLen, pattern, size, &status);
1823
    udatpg_getBestPattern(gen, reinterpret_cast<const UChar*>(skeleton), skeletonLen, pattern, size, &status);
1824
    if (U_FAILURE(status)) {
1824
    if (U_FAILURE(status)) {
1825
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1825
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1826
        return false;
1826
        return false;
1827
    }
1827
    }
1828
1828
1829
    RootedString str(cx, JS_NewUCStringCopyZ(cx, pattern));
1829
    RootedString str(cx, JS_NewUCStringCopyZ(cx, reinterpret_cast<const jschar*>(pattern.get())));
1830
    if (!str)
1830
    if (!str)
1831
        return false;
1831
        return false;
1832
    args.rval().setString(str);
1832
    args.rval().setString(str);
Lines 1874-1880 Link Here
1874
        if (!JSObject::getProperty(cx, internals, internals, cx->names().timeZone, &value))
1874
        if (!JSObject::getProperty(cx, internals, internals, cx->names().timeZone, &value))
1875
            return NULL;
1875
            return NULL;
1876
        if (!value.isUndefined()) {
1876
        if (!value.isUndefined()) {
1877
            uTimeZone = JS_GetStringCharsZ(cx, value.toString());
1877
            uTimeZone = reinterpret_cast<const UChar*>(JS_GetStringCharsZ(cx, value.toString()));
1878
            if (!uTimeZone)
1878
            if (!uTimeZone)
1879
                return NULL;
1879
                return NULL;
1880
            uTimeZoneLength = u_strlen(uTimeZone);
1880
            uTimeZoneLength = u_strlen(uTimeZone);
Lines 1882-1888 Link Here
1882
    }
1882
    }
1883
    if (!JSObject::getProperty(cx, internals, internals, cx->names().pattern, &value))
1883
    if (!JSObject::getProperty(cx, internals, internals, cx->names().pattern, &value))
1884
        return NULL;
1884
        return NULL;
1885
    uPattern = JS_GetStringCharsZ(cx, value.toString());
1885
    uPattern = reinterpret_cast<const UChar*>(JS_GetStringCharsZ(cx, value.toString()));
1886
    if (!uPattern)
1886
    if (!uPattern)
1887
        return NULL;
1887
        return NULL;
1888
    uPatternLength = u_strlen(uPattern);
1888
    uPatternLength = u_strlen(uPattern);
Lines 1921-1932 Link Here
1921
    if (!chars.resize(INITIAL_STRING_BUFFER_SIZE))
1921
    if (!chars.resize(INITIAL_STRING_BUFFER_SIZE))
1922
        return false;
1922
        return false;
1923
    UErrorCode status = U_ZERO_ERROR;
1923
    UErrorCode status = U_ZERO_ERROR;
1924
    int size = udat_format(df, x, chars.begin(), INITIAL_STRING_BUFFER_SIZE, NULL, &status);
1924
    int size = udat_format(df, x, reinterpret_cast<UChar*>(chars.begin()), INITIAL_STRING_BUFFER_SIZE, NULL, &status);
1925
    if (status == U_BUFFER_OVERFLOW_ERROR) {
1925
    if (status == U_BUFFER_OVERFLOW_ERROR) {
1926
        if (!chars.resize(size))
1926
        if (!chars.resize(size))
1927
            return false;
1927
            return false;
1928
        status = U_ZERO_ERROR;
1928
        status = U_ZERO_ERROR;
1929
        udat_format(df, x, chars.begin(), size, NULL, &status);
1929
        udat_format(df, x, reinterpret_cast<UChar*>(chars.begin()), size, NULL, &status);
1930
    }
1930
    }
1931
    if (U_FAILURE(status)) {
1931
    if (U_FAILURE(status)) {
1932
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);
1932
        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INTERNAL_INTL_ERROR);

Return to bug 639566