Changeset 73f0a01
- Timestamp:
- 2015-05-31T02:31:24Z (9 years ago)
- Branches:
- master
- Children:
- 2ca933c
- Parents:
- 6e21525
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
r6e21525 r73f0a01 751 751 return end - string; 752 752 } 753 754 /* Parses a guint64 from string, returns TRUE on success */ 755 gboolean parse_int64(char *string, int base, guint64 *number) 756 { 757 guint64 parsed; 758 char *endptr; 759 760 errno = 0; 761 parsed = g_ascii_strtoull(string, &endptr, base); 762 if (errno || endptr == string || *endptr != '\0') { 763 return FALSE; 764 } 765 *number = parsed; 766 return TRUE; 767 } 768 -
lib/misc.h
r6e21525 r73f0a01 149 149 G_MODULE_EXPORT char *get_rfc822_header(const char *text, const char *header, int len); 150 150 G_MODULE_EXPORT int truncate_utf8(char *string, int maxlen); 151 G_MODULE_EXPORT gboolean parse_int64(char *string, int base, guint64 *number); 151 152 152 153 #endif -
protocols/twitter/twitter.c
r6e21525 r73f0a01 859 859 } 860 860 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 bee_user_t twitter_log_local_user;877 878 861 /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID 879 862 * into a twitter tweet ID. … … 903 886 arg++; 904 887 } 905 if ( twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {888 if (parse_int64(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { 906 889 bu = td->log[id].bu; 907 890 id = td->log[id].id; 908 } else if ( twitter_parse_id(arg, 10, &id)) {891 } else if (parse_int64(arg, 10, &id)) { 909 892 /* Allow normal tweet IDs as well; not a very useful 910 893 feature but it's always been there. Just ignore
Note: See TracChangeset
for help on using the changeset viewer.