Changeset 4880
- Timestamp:
- Jan 31, 2008, 6:00:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0x/libtransmission/bencode.c
r4877 r4880 120 120 if( errno || ( endptr != end ) ) /* incomplete parse */ 121 121 err = TR_ERROR; 122 else if( val && *(const char*)begin=='0' ) /* the spec forbids leading zeroes*/122 else if( val && *(const char*)begin=='0' ) /* no leading zeroes! */ 123 123 err = TR_ERROR; 124 124 else { … … 226 226 */ 227 227 int 228 tr_bencParse( const void * buf_in,229 const void * bufend_in,228 tr_bencParse( const void * buf_in, 229 const void * bufend_in, 230 230 benc_val_t * top, 231 231 const uint8_t ** setme_end ) … … 248 248 benc_val_t * node; 249 249 250 if(( err = tr_bencParseInt( (const uint8_t*)buf, bufend, &end, &val )))250 if(( err = tr_bencParseInt( buf, bufend, &end, &val ))) 251 251 return err; 252 252 … … 567 567 568 568 static struct SaveNode* 569 nodeNew Simple( const benc_val_t * val )569 nodeNewLeaf( const benc_val_t * val ) 570 570 { 571 571 struct SaveNode * node; … … 585 585 case TYPE_INT: 586 586 case TYPE_STR: 587 return nodeNew Simple( val );587 return nodeNewLeaf( val ); 588 588 break; 589 589 case TYPE_LIST: … … 616 616 */ 617 617 static void 618 depthFirstWalk( const benc_val_t * top, struct WalkFuncs * walkFuncs, void * user_data ) 618 bencWalk( const benc_val_t * top, 619 struct WalkFuncs * walkFuncs, 620 void * user_data ) 619 621 { 620 622 tr_ptrArray * stack = tr_ptrArrayNew( ); … … 721 723 walkFuncs.listBeginFunc = saveListBeginFunc; 722 724 walkFuncs.containerEndFunc = saveContainerEndFunc; 723 724 depthFirstWalk( top, &walkFuncs, out ); 725 bencWalk( top, &walkFuncs, out ); 725 726 726 727 if( len != NULL ) … … 763 764 walkFuncs.listBeginFunc = freeContainerBeginFunc; 764 765 walkFuncs.containerEndFunc = freeDummyFunc; 765 depthFirstWalk( val, &walkFuncs, freeme );766 bencWalk( val, &walkFuncs, freeme ); 766 767 767 768 tr_ptrArrayFree( freeme, tr_free ); … … 847 848 walkPrint.out = stderr; 848 849 walkPrint.depth = 0; 849 depthFirstWalk( val, &walkFuncs, &walkPrint );850 } 850 bencWalk( val, &walkFuncs, &walkPrint ); 851 }
Note: See TracChangeset
for help on using the changeset viewer.