Hello community,

here is the log from the commit of package json-c for openSUSE:Factory
checked in at Fri Aug 26 12:21:21 CEST 2011.



--------
New Changes file:

--- /dev/null   2010-08-26 16:28:41.000000000 +0200
+++ /mounts/work_src_done/STABLE/json-c/json-c.changes  2010-11-04 
18:22:35.000000000 +0100
@@ -0,0 +1,5 @@
+-------------------------------------------------------------------
+Thu Nov  4 17:22:27 UTC 2010 - [email protected]
+
+- initial pkg 0.9
+

calling whatdependson for head-i586


New:
----
  json-c-0.9-base.patch
  json-c-0.9-json_object_from_file.patch
  json-c-0.9-json_tokener.patch
  json-c-0.9-linkhash.patch
  json-c-0.9.tar.bz2
  json-c.changes
  json-c.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ json-c.spec ++++++
#
# spec file for package json-c
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define libname libjson
%define libsoname %{libname}0

Name:           json-c
Summary:        JSON implementation in C
Version:        0.9
Release:        1
License:        MIT
Group:          System/Libraries
Url:            http://oss.metaparadigm.com/%{name}
#Source0:       http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz
Source0:        %{name}-%{version}.tar.bz2
Patch0:         %{name}-0.9-base.patch
Patch1:         %{name}-0.9-json_object_from_file.patch
Patch2:         %{name}-0.9-json_tokener.patch
Patch3:         %{name}-0.9-linkhash.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkg-config

%description
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 JSON formatted strings back into the C
representation of JSON objects.

%package -n %{libsoname}

Summary:        JSON shared lib
Group:          System/Libraries

%description -n %{libsoname}
This package includes the JSON library.

%package -n %{libname}-devel

Summary:        Development headers and libraries for json-c 
Group:          Development/Libraries/C and C++
Requires:       %{libsoname} = %{version}

%description -n %{libname}-devel
This package includes header files and scripts needed for developers
using the json-c library

%package -n %{libname}-doc

Summary:        Dokumentation files
Group:          Documentation/Other
%if 0%{suse_version} >= 1120
BuildArch:      noarch
%endif

%description -n %{libname}-doc
This package includes alls docs 

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
autoreconf -fi
%configure --disable-static --with-pic
%{__make} %{?_smp_mflags}

%check
%{__make} %{?_smp_mflags} check

%install
make DESTDIR=$RPM_BUILD_ROOT install libdir=%{_libdir} mandir=%{_mandir}  

%post -n %{libsoname} -p /sbin/ldconfig

%postun -n %{libsoname} -p /sbin/ldconfig

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files -n %{libsoname}
%defattr(-,root,root)
%{_libdir}/%{libname}.so.*

%files -n %{libname}-devel
%defattr(-,root,root)
%{_libdir}/%{libname}.so
%{_libdir}/%{libname}.*a
%{_includedir}/json
%{_libdir}/pkgconfig/*.pc

%files -n %{libname}-doc
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README README.html doc

%changelog
++++++ json-c-0.9-base.patch ++++++
diff -Naur json-c-0.9.old//configure.in json-c-0.9//configure.in
--- json-c-0.9.old//configure.in        2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//configure.in    2009-12-16 00:23:24.000000000 +0000
@@ -1,7 +1,7 @@
 AC_PREREQ(2.52)
 
 # Process this file with autoconf to produce a configure script.
-AC_INIT([json-c], 0.9, [[email protected]])
+AC_INIT([json-c], [0.9], [[email protected]])
 
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
++++++ json-c-0.9-json_object_from_file.patch ++++++
diff -Naur json-c-0.9.old//json_util.c json-c-0.9//json_util.c
--- json-c-0.9.old//json_util.c 2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//json_util.c     2009-12-16 00:37:37.000000000 +0000
@@ -52,7 +52,7 @@
 #include "json_tokener.h"
 #include "json_util.h"
 
-struct json_object* json_object_from_file(char *filename)
+struct json_object* json_object_from_file(const char *filename)
 {
   struct printbuf *pb;
   struct json_object *obj;
diff -Naur json-c-0.9.old//json_util.h json-c-0.9//json_util.h
--- json-c-0.9.old//json_util.h 2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//json_util.h     2009-12-16 00:37:52.000000000 +0000
@@ -21,7 +21,7 @@
 #define JSON_FILE_BUF_SIZE 4096
 
 /* utility functions */
-extern struct json_object* json_object_from_file(char *filename);
+extern struct json_object* json_object_from_file(const char *filename);
 extern int json_object_to_file(char *filename, struct json_object *obj);
 
 #ifdef __cplusplus
++++++ json-c-0.9-json_tokener.patch ++++++
diff -Naur json-c-0.9.old//json_tokener.c json-c-0.9//json_tokener.c
--- json-c-0.9.old//json_tokener.c      2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//json_tokener.c  2009-12-16 00:52:40.000000000 +0000
@@ -58,6 +58,11 @@
   "expected comment",
 };
 
+/* Stuff for decoding unicode sequences */
+#define IS_HIGH_SURROGATE(uc) (((uc) & 0xFC00) == 0xD800)
+#define IS_LOW_SURROGATE(uc)  (((uc) & 0xFC00) == 0xDC00)
+#define DECODE_SURROGATE_PAIR(hi,lo) ((((hi) & 0x3FF) << 10) + ((lo) & 0x3FF) 
+ 0x10000)
+static unsigned char utf8_replacement_char[3] = { 0xEF, 0xBF, 0xBD };
 
 struct json_tokener* json_tokener_new(void)
 {
@@ -398,40 +403,94 @@
       break;
 
     case json_tokener_state_escape_unicode:
-            /* Note that the following code is inefficient for handling large
-       * chunks of extended chars, calling printbuf_memappend() once
-       * for each multi-byte character of input.
-       * This is a good area for future optimization.
-       */
        {
-         /* Advance until we change state */
+         unsigned int got_hi_surrogate = 0;
+         /* Handle a 4-byte sequence, or two sequences if a surrogate pair */
          while(1) {
            if(strchr(json_hex_chars, c)) {
              tok->ucs_char += ((unsigned int)hexdigit(c) << 
((3-tok->st_pos++)*4));
              if(tok->st_pos == 4) {
-               unsigned char utf_out[3];
+                if (got_hi_surrogate) {
+                 if (IS_LOW_SURROGATE(tok->ucs_char)) {
+                    /* Recalculate the ucs_char, then fall thru to process 
normally */
+                    tok->ucs_char = DECODE_SURROGATE_PAIR(got_hi_surrogate, 
tok->ucs_char);
+                  } else {
+                    /* Hi surrogate was not followed by a low surrogate */
+                    /* Replace the hi and process the rest normally */
+                   printbuf_memappend_fast(tok->pb, 
(char*)utf8_replacement_char, 3);
+                  }
+                  got_hi_surrogate = 0;
+                }
+               unsigned char unescaped_utf[4];
                if (tok->ucs_char < 0x80) {
-                 utf_out[0] = tok->ucs_char;
-                 printbuf_memappend_fast(tok->pb, (char*)utf_out, 1);
+                 unescaped_utf[0] = tok->ucs_char;
+                 printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 1);
                } else if (tok->ucs_char < 0x800) {
-                 utf_out[0] = 0xc0 | (tok->ucs_char >> 6);
-                 utf_out[1] = 0x80 | (tok->ucs_char & 0x3f);
-                 printbuf_memappend_fast(tok->pb, (char*)utf_out, 2);
+                 unescaped_utf[0] = 0xc0 | (tok->ucs_char >> 6);
+                 unescaped_utf[1] = 0x80 | (tok->ucs_char & 0x3f);
+                 printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 2);
+               } else if (IS_HIGH_SURROGATE(tok->ucs_char)) {
+                  /* Got a high surrogate.  Remember it and look for the
+                   * the beginning of another sequence, which should be the
+                   * low surrogate.
+                   */
+                  got_hi_surrogate = tok->ucs_char;
+                  /* Not at end, and the next two chars should be "\u" */
+                  if ((tok->char_offset+1 != len) &&
+                      (tok->char_offset+2 != len) &&
+                      (str[1] == '\\') &&
+                      (str[2] == 'u'))
+                  {
+                   ADVANCE_CHAR(str, tok);
+                   ADVANCE_CHAR(str, tok);
+
+                    /* Advance to the first char of the next sequence and
+                     * continue processing with the next sequence.
+                     */
+                   if (!ADVANCE_CHAR(str, tok) || !POP_CHAR(c, tok)) {
+                     printbuf_memappend_fast(tok->pb, 
(char*)utf8_replacement_char, 3);
+                     goto out;
+                    }
+                   tok->ucs_char = 0;
+                    tok->st_pos = 0;
+                    continue; /* other json_tokener_state_escape_unicode */
+                  } else {
+                    /* Got a high surrogate without another sequence following
+                     * it.  Put a replacement char in for the hi surrogate
+                     * and pretend we finished.
+                     */
+                   printbuf_memappend_fast(tok->pb, 
(char*)utf8_replacement_char, 3);
+                  }
+               } else if (IS_LOW_SURROGATE(tok->ucs_char)) {
+                  /* Got a low surrogate not preceded by a high */
+                 printbuf_memappend_fast(tok->pb, 
(char*)utf8_replacement_char, 3);
+                } else if (tok->ucs_char < 0x10000) {
+                 unescaped_utf[0] = 0xe0 | (tok->ucs_char >> 12);
+                 unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
+                 unescaped_utf[2] = 0x80 | (tok->ucs_char & 0x3f);
+                 printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 3);
+               } else if (tok->ucs_char < 0x110000) {
+                 unescaped_utf[0] = 0xf0 | ((tok->ucs_char >> 18) & 0x07);
+                 unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 12) & 0x3f);
+                 unescaped_utf[2] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
+                 unescaped_utf[3] = 0x80 | (tok->ucs_char & 0x3f);
+                 printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 4);
                } else {
-                 utf_out[0] = 0xe0 | (tok->ucs_char >> 12);
-                 utf_out[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
-                 utf_out[2] = 0x80 | (tok->ucs_char & 0x3f);
-                 printbuf_memappend_fast(tok->pb, (char*)utf_out, 3);
-               }
+                  /* Don't know what we got--insert the replacement char */
+                 printbuf_memappend_fast(tok->pb, 
(char*)utf8_replacement_char, 3);
+                }
                state = saved_state;
                break;
              }
            } else {
              tok->err = json_tokener_error_parse_string;
              goto out;
-                 }
-         if (!ADVANCE_CHAR(str, tok) || !POP_CHAR(c, tok))
+           }
+         if (!ADVANCE_CHAR(str, tok) || !POP_CHAR(c, tok)) {
+            if (got_hi_surrogate) /* Clean up any pending chars */
+             printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3);
            goto out;
+         }
        }
       }
       break;
++++++ json-c-0.9-linkhash.patch ++++++
diff -Naur json-c-0.9.old//linkhash.c json-c-0.9//linkhash.c
--- json-c-0.9.old//linkhash.c  2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//linkhash.c      2009-12-16 00:40:09.000000000 +0000
@@ -158,13 +158,15 @@
 {
        unsigned long h = t->hash_fn(k);
        unsigned long n = h % t->size;
+       int count = 0;
 
        t->lookups++;
-       while( 1 ) {
+       while( count < t->size ) {
                if(t->table[n].k == LH_EMPTY) return NULL;
                if(t->table[n].k != LH_FREED &&
                   t->equal_fn(t->table[n].k, k)) return &t->table[n];
                if(++n == t->size) n = 0;
+               count++;
        }
        return NULL;
 }

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to