* xmlGetEncodingAlias: * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) * * Lookup an encoding name for the given alias. * * Returns NULL if not found, otherwise the original name */
| 949 | * Returns NULL if not found, otherwise the original name |
| 950 | */ |
| 951 | const char * |
| 952 | xmlGetEncodingAlias(const char *alias) { |
| 953 | int i; |
| 954 | char upper[100]; |
| 955 | |
| 956 | if (alias == NULL) |
| 957 | return(NULL); |
| 958 | |
| 959 | if (xmlCharEncodingAliases == NULL) |
| 960 | return(NULL); |
| 961 | |
| 962 | for (i = 0;i < 99;i++) { |
| 963 | upper[i] = (char) toupper((unsigned char) alias[i]); |
| 964 | if (upper[i] == 0) break; |
| 965 | } |
| 966 | upper[i] = 0; |
| 967 | |
| 968 | /* |
| 969 | * Walk down the list looking for a definition of the alias |
| 970 | */ |
| 971 | for (i = 0;i < xmlCharEncodingAliasesNb;i++) { |
| 972 | if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { |
| 973 | return(xmlCharEncodingAliases[i].name); |
| 974 | } |
| 975 | } |
| 976 | return(NULL); |
| 977 | } |
| 978 | |
| 979 | /** |
| 980 | * xmlAddEncodingAlias: |
no test coverage detected