Changeset 5869


Ignore:
Timestamp:
May 21, 2008, 2:19:49 PM (14 years ago)
Author:
charles
Message:

(rpc) refresh our snapshot of Jean Gressmann's JSON parser

Location:
trunk/libtransmission
Files:
2 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/Makefile.am

    r5860 r5869  
    1717    inout.c \
    1818    json.c \
    19     JSON_checker.c \
     19    JSON_parser.c \
    2020    list.c \
    2121    makemeta.c \
     
    5858    inout.h \
    5959    json.h \
    60     JSON_checker.h \
     60    JSON_parser.h \
    6161    list.h \
    6262    makemeta.h \
  • trunk/libtransmission/json.c

    r5860 r5869  
    1818#include <event.h> /* evbuffer */
    1919
    20 #include "JSON_checker.h"
     20#include "JSON_parser.h"
    2121
    2222#include "transmission.h"
     
    128128    const char * buf = vbuf;
    129129    const void * bufend = buf + len;
    130     struct JSON_checker_struct * checker;
     130    struct JSON_config_struct config;
     131    struct JSON_parser_struct * checker;
    131132    struct json_benc_data data;
     133
     134    init_JSON_config( &config );
     135    config.callback = callback;
     136    config.callback_ctx = &data;
     137    config.depth = -1;
    132138
    133139    data.key = NULL;
     
    135141    data.stack = tr_ptrArrayNew( );
    136142
    137     checker = new_JSON_checker( -1, callback, &data, 0 );
    138     while( ( buf != bufend ) && JSON_checker_char( checker, *buf ) )
     143    checker = new_JSON_parser( &config );
     144    while( ( buf != bufend ) && JSON_parser_char( checker, *buf ) )
    139145        ++buf;
    140146    if( buf != bufend )
     
    144150        *setme_end = (const uint8_t*) buf;
    145151
    146     delete_JSON_checker( checker );
     152    delete_JSON_parser( checker );
    147153    tr_ptrArrayFree( data.stack, NULL );
    148154    return err;
Note: See TracChangeset for help on using the changeset viewer.