-/* cluster mcc's, based on the list
- * http://en.wikipedia.org/wiki/Mobile_country_code
- */
-static int
-effective_mcc (gint mcc)
-{
- switch (mcc) {
- case 405: return 404; /* india */
- case 441: return 440; /* japan */
- case 235: return 234; /* united kingdom */
- case 311:
- case 312:
- case 313:
- case 314:
- case 315:
- case 316: return 310; /* united states */
- default: return mcc;
- }
-}
-
-
-/* each line is of the form:
- xxx logical_id
-
- NOTE: this function is NOT re-entrant, the out-param country
- are static strings that should NOT be freed. and will change when
- calling this function again
-
- also note, this function will return the "effective mcc", which
- is the normalized mcc for a country - ie. even if the there
- are multiple entries for the United States with various mccs,
- this function will always return 310, even if the real mcc parsed
- would be 314. see the 'effective_mcc' function above.
-*/
-static int
-parse_mcc_mapping_line (const char* line, char** country)
-{
- char mcc[4]; /* the mcc code, always 3 bytes*/
- gchar *iter, *tab, *final;
-
- if (!line) {
- *country = NULL;
- return 0;
- }
-
- /* Go to the first tab (Country separator) */
- tab = g_utf8_strrchr (line, -1, '\t');
- *country = g_utf8_find_next_char (tab, NULL);
-
- /* Replace by end of string */
- final = g_utf8_strrchr (tab, g_utf8_strlen (tab, 100) + 1, '\n');
- *final = '\0';
-
- /* Get MCC code */
- mcc[0] = g_utf8_get_char (line);
- iter = g_utf8_find_next_char (line, NULL);
- mcc[1] = g_utf8_get_char (iter);
- iter = g_utf8_find_next_char (iter, NULL);
- mcc[2] = g_utf8_get_char (iter);
- mcc[3] = '\0';