Changeset 13819


Ignore:
Timestamp:
Jan 21, 2013, 1:26:59 AM (8 years ago)
Author:
jordan
Message:

(libT) update our jsonsl snapshot

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/jsonsl.c

    r13615 r13819  
    148148
    149149JSONSL_API
    150 jsonsl_t jsonsl_new(size_t nlevels)
     150jsonsl_t jsonsl_new(int nlevels)
    151151{
    152152    struct jsonsl_st *jsn =
     
    164164void jsonsl_reset(jsonsl_t jsn)
    165165{
    166     size_t ii;
     166    unsigned int ii;
    167167    jsn->tok_last = 0;
    168168    jsn->can_insert = 1;
     
    682682        *(c+3) = origc;
    683683
    684         *outp = pctval;
     684        *outp = (char) pctval;
    685685        c += 2;
    686686        continue;
     
    793793jsonsl_jpr_match(jsonsl_jpr_t jpr,
    794794                   jsonsl_type_t parent_type,
    795                    size_t parent_level,
     795                   unsigned int parent_level,
    796796                   const char *key,
    797797                   size_t nkey)
     
    940940
    941941    if (parent_state->type == JSONSL_T_LIST) {
    942         nkey = parent_state->nelem;
     942        nkey = (size_t) parent_state->nelem;
    943943    }
    944944
     
    10141014    *err = JSONSL_ERROR_##e; \
    10151015    if (errat) { \
    1016         *errat = (const char*)(c+ (ssize_t)(offset)); \
     1016        *errat = (const char*)(c+ (ptrdiff_t)(offset)); \
    10171017    } \
    10181018    return 0;
  • trunk/libtransmission/jsonsl.h

    r13614 r13819  
    3838#include <stdio.h>
    3939#include <stdlib.h>
     40#include <stddef.h>
    4041#include <string.h>
    4142#include <sys/types.h>
     
    5556
    5657/* Stolen from http-parser.h, and possibly others */
    57 #if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
     58#if defined(_WIN32) && !defined(__MINGW32__)
    5859typedef __int8 int8_t;
    5960typedef unsigned __int8 uint8_t;
     
    6465typedef __int64 int64_t;
    6566typedef unsigned __int64 uint64_t;
    66 
     67#if !defined(_MSC_VER) || _MSC_VER<1400
    6768typedef unsigned int size_t;
    6869typedef int ssize_t;
     70#endif
    6971#else
    7072#include <stdint.h>
     
    237239
    238240/**
    239  * A state is a single level of the stack
     241 * A state is a single level of the stack.
     242 * Non-private data (i.e. the 'data' field, see the STATE_GENERIC section)
     243 * will remain in tact until the item is popped.
     244 *
     245 * As a result, it means a parent state object may be accessed from a child
     246 * object, (the parents fields will all be valid). This allows a user to create
     247 * an ad-hoc hierarchy on top of the JSON one.
     248 *
    240249 */
    241250struct jsonsl_state_st {
     
    261270
    262271    /**
    263      * The position at which any immediate child was last POPped
     272     * The position at which any immediate child was last POPped.
     273     * Note that this field is only set when the item is popped.
    264274     */
    265275    size_t pos_cur;
     
    271281     * level parameter (though the logic is not that simple)
    272282     */
    273     size_t level;
     283    unsigned int level;
    274284
    275285
     
    305315    /**
    306316     * Put anything you want here. if JSONSL_STATE_USER_FIELDS is here, then
    307      * the macro expansion happens here
     317     * the macro expansion happens here.
     318     *
     319     * You can use these fields to store hierarchical or 'tagging' information
     320     * for specific objects.
     321     *
     322     * See the documentation above for the lifetime of the state object (i.e.
     323     * if the private data points to allocated memory, it should be freed
     324     * when the object is popped, as the state object will be re-used)
    308325     */
    309326#ifndef JSONSL_STATE_GENERIC
     
    392409
    393410    /** This is the current level of the stack */
    394     size_t level;
     411    unsigned int level;
    395412
    396413    /**
     
    472489    char tok_last;
    473490    int can_insert;
    474     size_t levels_max;
     491    unsigned int levels_max;
    475492
    476493#ifndef JSONSL_NO_JPR
    477     unsigned int jpr_count;
     494    size_t jpr_count;
    478495    jsonsl_jpr_t *jprs;
    479496
     
    498515 */
    499516JSONSL_API
    500 jsonsl_t jsonsl_new(size_t nlevels);
     517jsonsl_t jsonsl_new(int nlevels);
    501518
    502519/**
     
    698715 * this should be the current index.
    699716 *
     717 * NOTE: The key of the child means any kind of associative data related to the
     718 * element. Thus: <<< { "foo" : [ >>,
     719 * the opening array's key is "foo".
     720 *
    700721 * @return a status constant. This indicates whether a match was excluded, possible,
    701722 * or successful.
     
    704725jsonsl_jpr_match_t jsonsl_jpr_match(jsonsl_jpr_t jpr,
    705726                                    jsonsl_type_t parent_type,
    706                                     size_t parent_level,
     727                                    unsigned int parent_level,
    707728                                    const char *key, size_t nkey);
    708729
Note: See TracChangeset for help on using the changeset viewer.