Changeset 10533
- Timestamp:
- Apr 27, 2010, 3:58:25 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/blocklist.c
r9868 r10533 11 11 */ 12 12 13 #include <ctype.h> /* isprint() */ 13 14 #include <stdio.h> 14 #include <stdlib.h> /* free */15 #include <stdlib.h> /* free() */ 15 16 #include <string.h> 16 17 … … 235 236 FILE * out; 236 237 char * line; 237 int lineCount = 0; 238 int inCount = 0; 239 int outCount = 0; 238 240 const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" ); 239 241 … … 263 265 while( !fggets( &line, in ) ) 264 266 { 267 const char * pch; 265 268 char * rangeBegin; 266 269 char * rangeEnd; … … 268 271 tr_address addr; 269 272 struct tr_ip_range range; 273 274 ++inCount; 275 276 for( pch=line; pch && *pch; ++pch ) 277 if( !isprint( *pch ) ) 278 break; 279 if( !pch || *pch ) { 280 tr_err( "skipping line #%d which contains nonprintable characters\n", inCount ); 281 free( line ); 282 continue; 283 } 270 284 271 285 rangeBegin = strrchr( line, ':' ); … … 297 311 } 298 312 299 ++ lineCount;313 ++outCount; 300 314 } 301 315 302 316 { 303 317 char * base = tr_basename( b->filename ); 304 tr_inf( _( "Blocklist \"%1$s\" updated with %2$'d entries" ), base, lineCount );318 tr_inf( _( "Blocklist \"%1$s\" updated with %2$'d entries" ), base, outCount ); 305 319 tr_free( base ); 306 320 } … … 312 326 blocklistLoad( b ); 313 327 314 return lineCount;315 } 316 328 return outCount; 329 } 330
Note: See TracChangeset
for help on using the changeset viewer.