- Timestamp:
- 2015-03-10T07:27:25Z (10 years ago)
- Branches:
- master
- Children:
- 7320610
- Parents:
- e6f47fb
- git-author:
- dequis <dx@…> (06-03-15 08:27:06)
- git-committer:
- dequis <dx@…> (10-03-15 07:27:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
re6f47fb r8b91a1f 852 852 } 853 853 854 /* Parses a decimal or hex tweet ID, handling errors by returning 0*/855 static g uint64 twitter_parse_id(char *string, int base)854 /* Parses a decimal or hex tweet ID, returns TRUE on success */ 855 static gboolean twitter_parse_id(char *string, int base, guint64 *id) 856 856 { 857 857 guint64 parsed; … … 860 860 errno = 0; 861 861 parsed = g_ascii_strtoull(string, &endptr, base); 862 if (errno || endptr == string || *endptr == '\0') { 863 return 0; 864 } 865 return parsed; 862 if (errno || endptr == string || *endptr != '\0') { 863 return FALSE; 864 } 865 *id = parsed; 866 return TRUE; 866 867 } 867 868 … … 893 894 arg++; 894 895 } 895 if ( (id = twitter_parse_id(arg, 16)) && id < TWITTER_LOG_LENGTH) {896 if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { 896 897 bu = td->log[id].bu; 897 898 id = td->log[id].id; … … 900 901 bu = NULL; 901 902 } 902 } else if ( (id = twitter_parse_id(arg, 10))) {903 } else if (twitter_parse_id(arg, 10, &id)) { 903 904 /* Allow normal tweet IDs as well; not a very useful 904 905 feature but it's always been there. Just ignore
Note: See TracChangeset
for help on using the changeset viewer.