Changeset 7e84168
- Timestamp:
- 2013-06-22T21:50:15Z (11 years ago)
- Branches:
- master
- Children:
- ea166fe
- Parents:
- 2f9027c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nick.c
r2f9027c r7e84168 120 120 while( fmt && *fmt && ret->len < MAX_NICK_LENGTH ) 121 121 { 122 char *part = NULL, chop = '\0', *asc = NULL; 122 char *part = NULL, chop = '\0', *asc = NULL, *s; 123 int len = INT_MAX; 123 124 124 125 if( *fmt != '%' ) … … 143 144 fmt += 2; 144 145 } 146 else if( isdigit( *fmt ) ) 147 { 148 len = 0; 149 /* Grab a number. */ 150 while( isdigit( *fmt ) ) 151 len = len * 10 + ( *(fmt++) - '0' ); 152 } 145 153 else if( g_strncasecmp( fmt, "nick", 4 ) == 0 ) 146 154 { … … 202 210 "UTF-8", "", NULL, NULL, NULL ); 203 211 212 if( chop && ( s = strchr( part, chop ) ) ) 213 len = MIN( len, s - part ); 214 204 215 if( part ) 205 g_string_append( ret, part ); 216 { 217 if( len < INT_MAX ) 218 g_string_append_len( ret, part, len ); 219 else 220 g_string_append( ret, part ); 221 } 206 222 g_free( asc ); 207 223 }
Note: See TracChangeset
for help on using the changeset viewer.