OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
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 MSGFMT.CPP | 7 * File MSGFMT.CPP |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * | 10 * |
11 * Date Name Description | 11 * Date Name Description |
12 * 02/19/97 aliu Converted from java. | 12 * 02/19/97 aliu Converted from java. |
13 * 03/20/97 helena Finished first cut of implementation. | 13 * 03/20/97 helena Finished first cut of implementation. |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 779 |
780 int32_t argNumber = MessagePattern::validateArgumentName(formatName); | 780 int32_t argNumber = MessagePattern::validateArgumentName(formatName); |
781 if (argNumber < UMSGPAT_ARG_NAME_NOT_NUMBER) { | 781 if (argNumber < UMSGPAT_ARG_NAME_NOT_NUMBER) { |
782 status = U_ILLEGAL_ARGUMENT_ERROR; | 782 status = U_ILLEGAL_ARGUMENT_ERROR; |
783 return; | 783 return; |
784 } | 784 } |
785 for (int32_t partIndex = 0; | 785 for (int32_t partIndex = 0; |
786 (partIndex = nextTopLevelArgStart(partIndex)) >= 0 && U_SUCCESS(status); | 786 (partIndex = nextTopLevelArgStart(partIndex)) >= 0 && U_SUCCESS(status); |
787 ) { | 787 ) { |
788 if (argNameMatches(partIndex + 1, formatName, argNumber)) { | 788 if (argNameMatches(partIndex + 1, formatName, argNumber)) { |
789 if (&newFormat == NULL) { | 789 Format* new_format = newFormat.clone(); |
790 setCustomArgStartFormat(partIndex, NULL, status); | 790 if (new_format == NULL) { |
791 } else { | 791 status = U_MEMORY_ALLOCATION_ERROR; |
792 Format* new_format = newFormat.clone(); | 792 return; |
793 if (new_format == NULL) { | |
794 status = U_MEMORY_ALLOCATION_ERROR; | |
795 return; | |
796 } | |
797 setCustomArgStartFormat(partIndex, new_format, status); | |
798 } | 793 } |
| 794 setCustomArgStartFormat(partIndex, new_format, status); |
799 } | 795 } |
800 } | 796 } |
801 } | 797 } |
802 | 798 |
803 // ------------------------------------- | 799 // ------------------------------------- |
804 // Gets the format array. | 800 // Gets the format array. |
805 const Format** | 801 const Format** |
806 MessageFormat::getFormats(int32_t& cnt) const | 802 MessageFormat::getFormats(int32_t& cnt) const |
807 { | 803 { |
808 // This old API returns an array (which we hold) of Format* | 804 // This old API returns an array (which we hold) of Format* |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 delete rules; | 1966 delete rules; |
1971 rules = NULL; | 1967 rules = NULL; |
1972 } | 1968 } |
1973 | 1969 |
1974 | 1970 |
1975 U_NAMESPACE_END | 1971 U_NAMESPACE_END |
1976 | 1972 |
1977 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1973 #endif /* #if !UCONFIG_NO_FORMATTING */ |
1978 | 1974 |
1979 //eof | 1975 //eof |
OLD | NEW |