chromium/third_party/vulkan-loader/src/loader/cJSON.c

/*
  Copyright (c) 2009 Dave Gamble
  Copyright (c) 2015-2021 The Khronos Group Inc.
  Copyright (c) 2015-2021 Valve Corporation
  Copyright (c) 2015-2021 LunarG, Inc.

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

/* cJSON */
/* JSON parser in C. */

#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cJSON.h"

#include "allocation.h"
#include "loader.h"
#include "log.h"

static void *cJSON_malloc(const VkAllocationCallbacks *pAllocator, size_t size) {}

static void *cJSON_malloc_instance_scope(const VkAllocationCallbacks *pAllocator, size_t size) {}

static void cJSON_Free(const VkAllocationCallbacks *pAllocator, void *pMemory) {}

/*
// commented out as it is unused - static error code channel requires external locks to be used.
static const char *ep;

const char *cJSON_GetErrorPtr(void) { return ep; }
*/

static char *cJSON_strdup(const VkAllocationCallbacks *pAllocator, const char *str) {}

/* Internal constructor. */
static cJSON *cJSON_New_Item(const VkAllocationCallbacks *pAllocator) {}

/* Delete a cJSON structure. */
void loader_cJSON_Delete(cJSON *c) {}

/* Parse the input text to generate a number, and populate the result into item.
 */
static const char *parse_number(cJSON *item, const char *num) {}

static size_t pow2gt(size_t x) {}

printbuffer;

static char *ensure(const VkAllocationCallbacks *pAllocator, printbuffer *p, size_t needed) {}

static size_t cJSON_update(printbuffer *p) {}

/* Render the number nicely from the given item into a string. */
static char *print_number(cJSON *item, printbuffer *p) {}

static unsigned parse_hex4(const char *str) {}

/* Parse the input text into an unescaped cstring, and populate item. */
static const unsigned char firstByteMark[7] =;
static const char *parse_string(cJSON *item, const char *str, bool *out_of_memory) {}

/* Render the cstring provided to an escaped version that can be printed. */
static char *print_string_ptr(const VkAllocationCallbacks *pAllocator, const char *str, printbuffer *p) {}
/* Invoke print_string_ptr (which is useful) on an item. */
static char *print_string(cJSON *item, printbuffer *p) {}

/* Declare these prototypes. */
static const char *parse_value(cJSON *item, const char *value, bool *out_of_memory);
static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p);
static const char *parse_array(cJSON *item, const char *value, bool *out_of_memory);
static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p);
static const char *parse_object(cJSON *item, const char *value, bool *out_of_memory);
static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p);

/* Utility to jump whitespace and cr/lf */
static const char *skip(const char *in) {}

/* Parse an object - create a new root, and populate. */
static cJSON *cJSON_ParseWithOpts(const VkAllocationCallbacks *pAllocator, const char *value, const char **return_parse_end,
                                  int require_null_terminated, bool *out_of_memory) {}
/* Default options for cJSON_Parse */
static cJSON *cJSON_Parse(const VkAllocationCallbacks *pAllocator, const char *value, bool *out_of_memory) {}

/* Render a cJSON item/entity/structure to text. */
char *loader_cJSON_Print(cJSON *item) {}
char *loader_cJSON_PrintUnformatted(cJSON *item) {}

/* Parser core - when encountering text, process appropriately. */
static const char *parse_value(cJSON *item, const char *value, bool *out_of_memory) {}

/* Render a value to text. */
static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p) {}

/* Build an array from input text. */
static const char *parse_array(cJSON *item, const char *value, bool *out_of_memory) {}

/* Render an array to text */
static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) {}

/* Build an object from the text. */
static const char *parse_object(cJSON *item, const char *value, bool *out_of_memory) {}

/* Render an object to text. */
static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) {}

/* Get Array size/item / object item. */
int loader_cJSON_GetArraySize(cJSON *array) {}
cJSON *loader_cJSON_GetArrayItem(cJSON *array, int item) {}
cJSON *loader_cJSON_GetObjectItem(cJSON *object, const char *string) {}

VkResult loader_get_json(const struct loader_instance *inst, const char *filename, cJSON **json) {}

VkResult loader_parse_json_string_to_existing_str(const struct loader_instance *inst, cJSON *object, const char *key,
                                                  size_t out_str_len, char *out_string) {}

VkResult loader_parse_json_string(cJSON *object, const char *key, char **out_string) {}
VkResult loader_parse_json_array_of_strings(const struct loader_instance *inst, cJSON *object, const char *key,
                                            struct loader_string_list *string_list) {}