| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * Copyright (C) 1997-2013, International Business Machines Corporation and | 3 * Copyright (C) 1997-2014, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
| 5 ******************************************************************************* | 5 ******************************************************************************* |
| 6 * | 6 * |
| 7 * File TIMEZONE.CPP | 7 * File TIMEZONE.CPP |
| 8 * | 8 * |
| 9 * Modification History: | 9 * Modification History: |
| 10 * | 10 * |
| 11 * Date Name Description | 11 * Date Name Description |
| 12 * 12/05/96 clhuang Creation. | 12 * 12/05/96 clhuang Creation. |
| 13 * 04/21/97 aliu General clean-up and bug fixing. | 13 * 04/21/97 aliu General clean-up and bug fixing. |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 | 1286 |
| 1287 UnicodeString& | 1287 UnicodeString& |
| 1288 TimeZone::getCustomID(const UnicodeString& id, UnicodeString& normalized, UError
Code& status) { | 1288 TimeZone::getCustomID(const UnicodeString& id, UnicodeString& normalized, UError
Code& status) { |
| 1289 normalized.remove(); | 1289 normalized.remove(); |
| 1290 if (U_FAILURE(status)) { | 1290 if (U_FAILURE(status)) { |
| 1291 return normalized; | 1291 return normalized; |
| 1292 } | 1292 } |
| 1293 int32_t sign, hour, min, sec; | 1293 int32_t sign, hour, min, sec; |
| 1294 if (parseCustomID(id, sign, hour, min, sec)) { | 1294 if (parseCustomID(id, sign, hour, min, sec)) { |
| 1295 formatCustomID(hour, min, sec, (sign < 0), normalized); | 1295 formatCustomID(hour, min, sec, (sign < 0), normalized); |
| 1296 } else { |
| 1297 status = U_ILLEGAL_ARGUMENT_ERROR; |
| 1296 } | 1298 } |
| 1297 return normalized; | 1299 return normalized; |
| 1298 } | 1300 } |
| 1299 | 1301 |
| 1300 UBool | 1302 UBool |
| 1301 TimeZone::parseCustomID(const UnicodeString& id, int32_t& sign, | 1303 TimeZone::parseCustomID(const UnicodeString& id, int32_t& sign, |
| 1302 int32_t& hour, int32_t& min, int32_t& sec) { | 1304 int32_t& hour, int32_t& min, int32_t& sec) { |
| 1303 static const int32_t kParseFailed = -99999; | 1305 static const int32_t kParseFailed = -99999; |
| 1304 | 1306 |
| 1305 NumberFormat* numberFormat = 0; | 1307 NumberFormat* numberFormat = 0; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 return winid; | 1533 return winid; |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 // canonicalize the input ID | 1536 // canonicalize the input ID |
| 1535 UnicodeString canonicalID; | 1537 UnicodeString canonicalID; |
| 1536 UBool isSystemID = FALSE; | 1538 UBool isSystemID = FALSE; |
| 1537 | 1539 |
| 1538 getCanonicalID(id, canonicalID, isSystemID, status); | 1540 getCanonicalID(id, canonicalID, isSystemID, status); |
| 1539 if (U_FAILURE(status) || !isSystemID) { | 1541 if (U_FAILURE(status) || !isSystemID) { |
| 1540 // mapping data is only applicable to tz database IDs | 1542 // mapping data is only applicable to tz database IDs |
| 1543 if (status == U_ILLEGAL_ARGUMENT_ERROR) { |
| 1544 // getWindowsID() sets an empty string where |
| 1545 // getCanonicalID() sets a U_ILLEGAL_ARGUMENT_ERROR. |
| 1546 status = U_ZERO_ERROR; |
| 1547 } |
| 1541 return winid; | 1548 return winid; |
| 1542 } | 1549 } |
| 1543 | 1550 |
| 1544 UResourceBundle *mapTimezones = ures_openDirect(NULL, "windowsZones", &statu
s); | 1551 UResourceBundle *mapTimezones = ures_openDirect(NULL, "windowsZones", &statu
s); |
| 1545 ures_getByKey(mapTimezones, "mapTimezones", mapTimezones, &status); | 1552 ures_getByKey(mapTimezones, "mapTimezones", mapTimezones, &status); |
| 1546 | 1553 |
| 1547 if (U_FAILURE(status)) { | 1554 if (U_FAILURE(status)) { |
| 1548 return winid; | 1555 return winid; |
| 1549 } | 1556 } |
| 1550 | 1557 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 return id; | 1667 return id; |
| 1661 } | 1668 } |
| 1662 #endif /* U_HIDE_DRAFT_API */ | 1669 #endif /* U_HIDE_DRAFT_API */ |
| 1663 | 1670 |
| 1664 | 1671 |
| 1665 U_NAMESPACE_END | 1672 U_NAMESPACE_END |
| 1666 | 1673 |
| 1667 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1674 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| 1668 | 1675 |
| 1669 //eof | 1676 //eof |
| OLD | NEW |