Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 217876 | Differences between
and this patch

Collapse All | Expand All

(-)gdal-1.5.1~/ogr/ogrsf_frmts/geojson/jsonc/arraylist.c (-1 / +3 lines)
Lines 23-28 Link Here
23
#include "bits.h"
23
#include "bits.h"
24
#include "arraylist.h"
24
#include "arraylist.h"
25
25
26
#include <cpl_port.h> /* MIN and MAX macros */ 
27
26
struct array_list*
28
struct array_list*
27
array_list_new(array_list_free_fn *free_fn)
29
array_list_new(array_list_free_fn *free_fn)
28
{
30
{
Lines 62-68 Link Here
62
  int new_size;
64
  int new_size;
63
65
64
  if(max < this->size) return 0;
66
  if(max < this->size) return 0;
65
  new_size = max(this->size << 1, max);
67
  new_size = MAX(this->size << 1, max);
66
  if(!(t = realloc(this->array, new_size*sizeof(void*)))) return -1;
68
  if(!(t = realloc(this->array, new_size*sizeof(void*)))) return -1;
67
  this->array = t;
69
  this->array = t;
68
  (void)memset(this->array + this->size, 0, (new_size-this->size)*sizeof(void*));
70
  (void)memset(this->array + this->size, 0, (new_size-this->size)*sizeof(void*));
(-)gdal-1.5.1~/ogr/ogrsf_frmts/geojson/jsonc/bits.h (-8 lines)
Lines 12-25 Link Here
12
#ifndef _bits_h_
12
#ifndef _bits_h_
13
#define _bits_h_
13
#define _bits_h_
14
14
15
#ifndef min
16
#define min(a,b) ((a) < (b) ? (a) : (b))
17
#endif
18
19
#ifndef max
20
#define max(a,b) ((a) > (b) ? (a) : (b))
21
#endif
22
23
#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
15
#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
24
#define error_ptr(error) ((void*)error)
16
#define error_ptr(error) ((void*)error)
25
#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
17
#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
(-)gdal-1.5.1~/ogr/ogrsf_frmts/geojson/jsonc/json_tokener.c (-4 / +5 lines)
Lines 23-28 Link Here
23
#include "json_object.h"
23
#include "json_object.h"
24
#include "json_tokener.h"
24
#include "json_tokener.h"
25
25
26
#include <cpl_port.h> /* MIN and MAX macros */ 
26
27
27
#if !HAVE_STRNCASECMP && defined(_MSC_VER)
28
#if !HAVE_STRNCASECMP && defined(_MSC_VER)
28
  /* MSC has the version as _strnicmp */
29
  /* MSC has the version as _strnicmp */
Lines 106-112 Link Here
106
{
107
{
107
  if(str) {
108
  if(str) {
108
    size_t len = strlen(str);
109
    size_t len = strlen(str);
109
    size_t nn = min(len,n);
110
    size_t nn = MIN(len,n);
110
    char* s = (char*)malloc(sizeof(char) * (nn + 1));
111
    char* s = (char*)malloc(sizeof(char) * (nn + 1));
111
112
112
    if(s) {
113
    if(s) {
Lines 230-236 Link Here
230
    case json_tokener_state_null:
231
    case json_tokener_state_null:
231
      printbuf_memappend(tok->pb, &c, 1);
232
      printbuf_memappend(tok->pb, &c, 1);
232
      if(strncasecmp(json_null_str, tok->pb->buf,
233
      if(strncasecmp(json_null_str, tok->pb->buf,
233
		     min(tok->st_pos+1, strlen(json_null_str))) == 0) {
234
		     MIN(tok->st_pos+1, strlen(json_null_str))) == 0) {
234
	if(tok->st_pos == strlen(json_null_str)) {
235
	if(tok->st_pos == strlen(json_null_str)) {
235
	  current = NULL;
236
	  current = NULL;
236
	  saved_state = json_tokener_state_finish;
237
	  saved_state = json_tokener_state_finish;
Lines 351-357 Link Here
351
    case json_tokener_state_boolean:
352
    case json_tokener_state_boolean:
352
      printbuf_memappend(tok->pb, &c, 1);
353
      printbuf_memappend(tok->pb, &c, 1);
353
      if(strncasecmp(json_true_str, tok->pb->buf,
354
      if(strncasecmp(json_true_str, tok->pb->buf,
354
		     min(tok->st_pos+1, strlen(json_true_str))) == 0) {
355
		     MIN(tok->st_pos+1, strlen(json_true_str))) == 0) {
355
	if(tok->st_pos == strlen(json_true_str)) {
356
	if(tok->st_pos == strlen(json_true_str)) {
356
	  current = json_object_new_boolean(1);
357
	  current = json_object_new_boolean(1);
357
	  saved_state = json_tokener_state_finish;
358
	  saved_state = json_tokener_state_finish;
Lines 359-365 Link Here
359
	  goto redo_char;
360
	  goto redo_char;
360
	}
361
	}
361
      } else if(strncasecmp(json_false_str, tok->pb->buf,
362
      } else if(strncasecmp(json_false_str, tok->pb->buf,
362
			    min(tok->st_pos+1, strlen(json_false_str))) == 0) {
363
			    MIN(tok->st_pos+1, strlen(json_false_str))) == 0) {
363
	if(tok->st_pos == strlen(json_false_str)) {
364
	if(tok->st_pos == strlen(json_false_str)) {
364
	  current = json_object_new_boolean(0);
365
	  current = json_object_new_boolean(0);
365
	  saved_state = json_tokener_state_finish;
366
	  saved_state = json_tokener_state_finish;
(-)gdal-1.5.1~/ogr/ogrsf_frmts/geojson/jsonc/printbuf.c (-1 / +3 lines)
Lines 28-33 Link Here
28
28
29
#include "cpl_string.h"
29
#include "cpl_string.h"
30
30
31
#include <cpl_port.h> /* MIN and MAX macros */ 
32
31
struct printbuf* printbuf_new()
33
struct printbuf* printbuf_new()
32
{
34
{
33
  struct printbuf *p;
35
  struct printbuf *p;
Lines 47-53 Link Here
47
{
49
{
48
  char *t;
50
  char *t;
49
  if(p->size - p->bpos <= size) {
51
  if(p->size - p->bpos <= size) {
50
    int new_size = max(p->size * 2, p->bpos + size + 8);
52
    int new_size = MAX(p->size * 2, p->bpos + size + 8);
51
#ifdef PRINTBUF_DEBUG
53
#ifdef PRINTBUF_DEBUG
52
    mc_debug("printbuf_memappend: realloc "
54
    mc_debug("printbuf_memappend: realloc "
53
	     "bpos=%d wrsize=%d old_size=%d new_size=%d\n",
55
	     "bpos=%d wrsize=%d old_size=%d new_size=%d\n",

Return to bug 217876