Switch to unified view

a/libupnpp/smallut.cpp b/libupnpp/smallut.cpp
...
...
1175
    reason->append(errbuf);
1175
    reason->append(errbuf);
1176
#endif
1176
#endif
1177
}
1177
}
1178
1178
1179
1179
1180
static const char *vlang_to_code[] = {
1180
static std::unordered_map<string, string> lang_to_code {
1181
    "be", "cp1251",
1181
    {"be", "cp1251"},
1182
    "bg", "cp1251",
1182
    {"bg", "cp1251"},
1183
    "cs", "iso-8859-2",
1183
    {"cs", "iso-8859-2"},
1184
    "el", "iso-8859-7",
1184
    {"el", "iso-8859-7"},
1185
    "he", "iso-8859-8",
1185
    {"he", "iso-8859-8"},
1186
    "hr", "iso-8859-2",
1186
    {"hr", "iso-8859-2"},
1187
    "hu", "iso-8859-2",
1187
    {"hu", "iso-8859-2"},
1188
    "ja", "eucjp",
1188
    {"ja", "eucjp"},
1189
    "kk", "pt154",
1189
    {"kk", "pt154"},
1190
    "ko", "euckr",
1190
    {"ko", "euckr"},
1191
    "lt", "iso-8859-13",
1191
    {"lt", "iso-8859-13"},
1192
    "lv", "iso-8859-13",
1192
    {"lv", "iso-8859-13"},
1193
    "pl", "iso-8859-2",
1193
    {"pl", "iso-8859-2"},
1194
    "rs", "iso-8859-2",
1194
    {"rs", "iso-8859-2"},
1195
    "ro", "iso-8859-2",
1195
    {"ro", "iso-8859-2"},
1196
    "ru", "koi8-r",
1196
    {"ru", "koi8-r"},
1197
    "sk", "iso-8859-2",
1197
    {"sk", "iso-8859-2"},
1198
    "sl", "iso-8859-2",
1198
    {"sl", "iso-8859-2"},
1199
    "sr", "iso-8859-2",
1199
    {"sr", "iso-8859-2"},
1200
    "th", "iso-8859-11",
1200
    {"th", "iso-8859-11"},
1201
    "tr", "iso-8859-9",
1201
    {"tr", "iso-8859-9"},
1202
    "uk", "koi8-u",
1202
    {"uk", "koi8-u"},
1203
};
1203
};
1204
1205
static const string cstr_cp1252("CP1252");
1204
static const string cstr_cp1252("CP1252");
1206
1205
1207
string langtocode(const string& lang)
1206
string langtocode(const string& lang)
1208
{
1207
{
1209
    static std::unordered_map<string, string> lang_to_code;
1210
    if (lang_to_code.empty()) {
1211
        for (unsigned int i = 0;
1212
                i < sizeof(vlang_to_code) / sizeof(char *); i += 2) {
1213
            lang_to_code[vlang_to_code[i]] = vlang_to_code[i + 1];
1214
        }
1215
    }
1216
    std::unordered_map<string, string>::const_iterator it =
1217
        lang_to_code.find(lang);
1208
    const auto it = lang_to_code.find(lang);
1218
1209
1219
    // Use cp1252 by default...
1210
    // Use cp1252 by default...
1220
    if (it == lang_to_code.end()) {
1211
    if (it == lang_to_code.end()) {
1221
        return cstr_cp1252;
1212
        return cstr_cp1252;
1222
    }
1213
    }
...
...
1279
                    ((flags&SRE_NOSUB) ? REG_NOSUB : 0)) == 0) {
1270
                    ((flags&SRE_NOSUB) ? REG_NOSUB : 0)) == 0) {
1280
            ok = true;
1271
            ok = true;
1281
        } else {
1272
        } else {
1282
            ok = false;
1273
            ok = false;
1283
        }
1274
        }
1284
        matches.reserve(nmatch+1);
1275
        matches.resize(nmatch+1);
1285
    }
1276
    }
1286
    ~Internal() {
1277
    ~Internal() {
1287
        regfree(&expr);
1278
        regfree(&expr);
1288
    }
1279
    }
1289
    bool ok;
1280
    bool ok;