Browse Source

* fix pointer arithmetic bug for error pointer check in is_error() macro

* fix type passed to printbuf_memappend in json_tokener
  * update autotools bootstrap instructions in README
    Michael Clark <michael@metaparadigm.com>


git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@6 327403b1-1117-474d-bef2-5cb71233fd97
tags/json-c-0.10-20120530
Michael Clark 18 years ago
parent
commit
7b899b6dc5
6 changed files with 21 additions and 10 deletions
  1. +6
    -0
      ChangeLog
  2. +3
    -2
      README
  3. +1
    -1
      README.html
  4. +6
    -2
      bits.h
  5. +1
    -1
      configure.in
  6. +4
    -4
      json_tokener.c

+ 6
- 0
ChangeLog View File

@@ -1,3 +1,9 @@
0.3
* fix pointer arithmetic bug for error pointer check in is_error() macro
* fix type passed to printbuf_memappend in json_tokener
* update autotools bootstrap instructions in README
Michael Clark <michael@metaparadigm.com>

0.2 0.2
* printbuf.c - C. Watford (christopher.watford@gmail.com) * printbuf.c - C. Watford (christopher.watford@gmail.com)
Added a Win32/Win64 compliant implementation of vasprintf Added a Win32/Win64 compliant implementation of vasprintf


+ 3
- 2
README View File

@@ -2,9 +2,10 @@ Building on Unix with gcc and autotools


If checking out from CVS: If checking out from CVS:


cp /usr/share/libtool/ltmain.sh .
aclocal-1.6 aclocal-1.6
automake-1.6 --add-missing
libtoolize --copy
autoheader
automake-1.6 --add-missing --copy
autoconf autoconf


Then configure, make, make install Then configure, make, make install


+ 1
- 1
README.html View File

@@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<h2>JSON-C - A JSON implementation in C</h2> <h2>JSON-C - A JSON implementation in C</h2>
<p>Latest release: <a href="json-c-0.2.tar.gz">json-c-0.2.tar.gz</a></p>
<p>Latest release: <a href="json-c-0.3.tar.gz">json-c-0.3.tar.gz</a></p>
<p>JSON-C implements a reference counting object model that allows you to easily <p>JSON-C implements a reference counting object model that allows you to easily
construct JSON objects in C, output them as JSON formatted strings and parse construct JSON objects in C, output them as JSON formatted strings and parse
JSON formatted strings back into the C representation of JSON objects.</p> JSON formatted strings back into the C representation of JSON objects.</p>


+ 6
- 2
bits.h View File

@@ -1,5 +1,5 @@
/* /*
* $Id: bits.h,v 1.4 2005/06/14 22:41:51 mclark Exp $
* $Id: bits.h,v 1.7 2005/07/15 02:40:44 mclark Exp $
* *
* Copyright Metaparadigm Pte. Ltd. 2004. * Copyright Metaparadigm Pte. Ltd. 2004.
* Michael Clark <michael@metaparadigm.com> * Michael Clark <michael@metaparadigm.com>
@@ -48,6 +48,10 @@


#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) #define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
#define error_ptr(error) ((void*)error) #define error_ptr(error) ((void*)error)
#define is_error(ptr) ((ptrdiff_t)ptr < (ptrdiff_t)-4000L)
#ifdef _MSC_VER
#define is_error(ptr) ((UINT_PTR)ptr > (UINT_PTR)-4000L)
#else
#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
#endif


#endif #endif

+ 1
- 1
configure.in View File

@@ -1,7 +1,7 @@
AC_PREREQ(2.52) AC_PREREQ(2.52)


# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT([JSON C Library], 0.2, [michael@metaparadigm.com], [json-c])
AC_INIT([JSON C Library], 0.3, [michael@metaparadigm.com], [json-c])


AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)




+ 4
- 4
json_tokener.c View File

@@ -1,5 +1,5 @@
/* /*
* $Id: json_tokener.c,v 1.14 2005/06/14 22:41:51 mclark Exp $
* $Id: json_tokener.c,v 1.15 2005/07/15 03:19:43 mclark Exp $
* *
* Copyright Metaparadigm Pte. Ltd. 2004. * Copyright Metaparadigm Pte. Ltd. 2004.
* Michael Clark <michael@metaparadigm.com> * Michael Clark <michael@metaparadigm.com>
@@ -273,16 +273,16 @@ static struct json_object* json_tokener_do_parse(struct json_tokener *this)
hexdigit(*(this->source + start_offset + 3)); hexdigit(*(this->source + start_offset + 3));
if (ucs_char < 0x80) { if (ucs_char < 0x80) {
utf_out[0] = ucs_char; utf_out[0] = ucs_char;
printbuf_memappend(this->pb, utf_out, 1);
printbuf_memappend(this->pb, (char*)utf_out, 1);
} else if (ucs_char < 0x800) { } else if (ucs_char < 0x800) {
utf_out[0] = 0xc0 | (ucs_char >> 6); utf_out[0] = 0xc0 | (ucs_char >> 6);
utf_out[1] = 0x80 | (ucs_char & 0x3f); utf_out[1] = 0x80 | (ucs_char & 0x3f);
printbuf_memappend(this->pb, utf_out, 2);
printbuf_memappend(this->pb, (char*)utf_out, 2);
} else { } else {
utf_out[0] = 0xe0 | (ucs_char >> 12); utf_out[0] = 0xe0 | (ucs_char >> 12);
utf_out[1] = 0x80 | ((ucs_char >> 6) & 0x3f); utf_out[1] = 0x80 | ((ucs_char >> 6) & 0x3f);
utf_out[2] = 0x80 | (ucs_char & 0x3f); utf_out[2] = 0x80 | (ucs_char & 0x3f);
printbuf_memappend(this->pb, utf_out, 3);
printbuf_memappend(this->pb, (char*)utf_out, 3);
} }
start_offset = this->pos; start_offset = this->pos;
state = saved_state; state = saved_state;


Loading…
Cancel
Save