aboutsummaryrefslogtreecommitdiff
path: root/loader/cJSON.c
diff options
context:
space:
mode:
authorAntoine Labour <piman@chromium.org>2016-01-20 16:32:17 -0800
committerJon Ashburn <jon@lunarg.com>2016-01-21 08:49:34 -0700
commita7c940ed4d76a6e5b11d35408aa9a13afc074317 (patch)
tree855d0938a711543f09ea8934b96ec8226e1f0bd3 /loader/cJSON.c
parent48d23cc83dbd8966443c191ea031d2889df84bc5 (diff)
downloadusermoji-a7c940ed4d76a6e5b11d35408aa9a13afc074317.tar.xz
Make cJSON case-sensitive
Diffstat (limited to 'loader/cJSON.c')
-rw-r--r--loader/cJSON.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/loader/cJSON.c b/loader/cJSON.c
index 2f56f850..8ef06c86 100644
--- a/loader/cJSON.c
+++ b/loader/cJSON.c
@@ -36,13 +36,6 @@ static const char *ep;
const char *cJSON_GetErrorPtr(void) {return ep;}
-static int cJSON_strcasecmp(const char *s1,const char *s2)
-{
- if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
- for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0;
- return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
-}
-
static void *(*cJSON_malloc)(size_t sz) = malloc;
static void (*cJSON_free)(void *ptr) = free;
@@ -660,7 +653,7 @@ static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p)
/* Get Array size/item / object item. */
int cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;}
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;}
-cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
+cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && strcmp(c->string,string)) c=c->next; return c;}
/* Utility for array list handling. */
static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;}
@@ -677,7 +670,7 @@ void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item
cJSON *cJSON_DetachItemFromArray(cJSON *array,int which) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return 0;
if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;}
void cJSON_DeleteItemFromArray(cJSON *array,int which) {cJSON_Delete(cJSON_DetachItemFromArray(array,which));}
-cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;}
+cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && strcmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;}
void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));}
/* Replace array/object items with new ones. */
@@ -686,7 +679,7 @@ void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c
void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return;
newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem;
if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
-void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
+void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && strcmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
/* Create basic types: */
cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;return item;}