Changes in protocols/twitter/twitter.c [33528bd:61e7e02]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r33528bd r61e7e02 469 469 g_regex_match(regex, msg, 0, &match_info); 470 470 while (g_match_info_matches(match_info)) { 471 gchar *url = g_match_info_fetch(match_info, 2); 471 gchar *s, *url; 472 473 url = g_match_info_fetch(match_info, 2); 472 474 url_len_diff += target_len - g_utf8_strlen(url, -1); 475 473 476 /* Add another character for https://t.co/... URLs */ 474 if ( g_match_info_fetch(match_info, 3) != NULL) {477 if ((s = g_match_info_fetch(match_info, 3))) { 475 478 url_len_diff += 1; 479 g_free(s); 476 480 } 477 481 g_free(url); … … 859 863 } 860 864 861 /* Parses a decimal or hex tweet ID, returns TRUE on success */862 static gboolean twitter_parse_id(char *string, int base, guint64 *id)863 {864 guint64 parsed;865 char *endptr;866 867 errno = 0;868 parsed = g_ascii_strtoull(string, &endptr, base);869 if (errno || endptr == string || *endptr != '\0') {870 return FALSE;871 }872 *id = parsed;873 return TRUE;874 }875 876 865 bee_user_t twitter_log_local_user; 877 866 … … 903 892 arg++; 904 893 } 905 if ( twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {894 if (parse_int64(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { 906 895 bu = td->log[id].bu; 907 896 id = td->log[id].id; 908 } else if ( twitter_parse_id(arg, 10, &id)) {897 } else if (parse_int64(arg, 10, &id)) { 909 898 /* Allow normal tweet IDs as well; not a very useful 910 899 feature but it's always been there. Just ignore
Note: See TracChangeset
for help on using the changeset viewer.