Giter Club home page Giter Club logo

libjson's Issues

unknown option (-soname) when compiling on OS X

When compiling (make) on OS X, the option -soname doesn't exist:

ld: unknown option: -soname

Changing -soname to -install_name in the Makefile fixes it, but I'm not sure how best to account for that case without breaking other platforms.

Designated array initializers are not supported in MSVC and causes the build to fail

(Continuing the discussion from issue #3)

which part of the actions_map table MSVC is complaining about ? is it the function pointer or the array initilizer that it thinks is non-constant ?

I'm not entirely sure that I've got the terminology exactly right, but MSVC does not implement what I think might be called designated array initializers:

int a[3] = {
    [1] = 5,
    [0] = 7
};

The [1] =-part throws MSVC completely off. This seems incredible, since this syntax is a part of C99, but MSVC does not claim to implement C99 :(

Currently, they are trying to implement C++0x, and anything from C99 that's included in C++0x will be ported to the C-compiler. Unfortunately this syntax has not been included and is not on the roadmap for MSVC.


I'd be happy to help getting libjson working on MSVC, but I'm not entirely sure what might be the best solution for this exact problem. Any thoughts?

-Wsign-compare warnings

Hi,

I get the following warnings when compiling with -Wsign-compare:

json.c: In function ‘json_print_args’:
json.c:965:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (length == -1)
               ^~
jsonlint.c: In function ‘printchannel’:
jsonlint.c:48:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (ret != length)
          ^~
jsonlint.c: In function ‘process_file’:
jsonlint.c:96:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (i = 0; i < processed; i++) {
                 ^

Mac OS support

Hi.

libjjson does not build on Mac OS. Problem is that in mac os gcc there are no soname option.

License not defined for this project

Hi, I want to reuse your likely open-source json parser in the my closed-souce program. I wanted to check whether your license allows me to do that but suddenly found out there's no any license at all. Please indicate which license is applicable. If you are not aware baout details of the open-sorce licenses, you probably need to read here more - https://opensource.org/licenses
I recommed new BSD 3-clause license or MIT licsnse - this allows code to be compiled into program statically, on the constast LGPL allows only dynamic linking of the closed-source and open-souce code.
Please indicate your choise of license by addin file with license text to repository. Thank you in advance...

Segmentation fault

Hi there

I fuzzed libjson with American Fuzzy Lop (http://lcamtuf.coredump.cx/afl/ , for no real reason at all, I was just looking for libraries to test AFL). I was running jsonlint with:

jsonlint --tree inputfile

The inputfile with the following content will crash jsonlint (segmentation fault):

[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[][[[[[[[[[[[[[[

Best regards,
floyd

Free memory of custom dom in jsonlint.c

I found that the jsonlint sample did not free the memory for the DOM tree. The following is my implementation. This may be needed to show proper use of the API in real application.

static void tree_free(json_val_t* v) {
    switch (v->type) {
    case JSON_OBJECT_BEGIN:
        for (int i = 0; i < v->length; i++) {
            tree_free(v->u.object[i]->val);
            free(v->u.object[i]->key);
            free(v->u.object[i]);
        }
        free(v->u.object);
        break;

    case JSON_ARRAY_BEGIN:
        for (int i = 0; i < v->length; i++)
            tree_free(v->u.array[i]);
        free(v->u.array);
        break;

    default:
        free(v->u.data);
        break;
    }
    free(v);
}

int main(int argc, char **argv)
{
    // ...
        if (use_tree) {
            json_val_t *root_structure;
            ret = do_tree(&config, argv[i], &root_structure);
            if (ret)
                exit(ret);
            if (!verify)
                print_tree(root_structure, output);
            tree_free(root_structure);  // <--
        }
    // ...
} 

more easy and API for json-dom.(zhaozg fork)

HI,
Small, clever, good performace, event driven, and I like it.
json string to struct is good, so i do some work to enhance c struct to json string.

I fork at https://github.com/zhaozg/libjson, add jsondom.c and jsondom.h code, some hack on json-dom api.
Hope this will make you think about a more easy way for construct json-dom from c api.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.