Ticket #32: libyaml_visual_cpp.patch
| File libyaml_visual_cpp.patch, 3.2 KB (added by anonymous, 7 years ago) |
|---|
-
api.c
1 1 2 2 #include "yaml_private.h" 3 3 4 #include "config.h" 5 6 typedef unsigned char byte; 7 4 8 /* 5 9 * Get the library version. 6 10 */ … … 78 82 79 83 if (!new_start) return 0; 80 84 81 memset( new_start + (*end - *start), 0, *end - *start);85 memset((byte*)new_start + (*end - *start), 0, *end - *start); 82 86 83 *pointer = new_start + (*pointer - *start);84 *end = new_start + (*end - *start)*2;85 *start = new_start;87 *pointer = (byte*)new_start + (*pointer - *start); 88 *end = (byte*)new_start + (*end - *start)*2; 89 *start = (byte*)new_start; 86 90 87 91 return 1; 88 92 } … … 117 121 YAML_DECLARE(int) 118 122 yaml_stack_extend(void **start, void **top, void **end) 119 123 { 120 void *new_start = yaml_realloc( *start, (*end -*start)*2);124 void *new_start = yaml_realloc((byte*)*start, ((byte*)*end - (byte*)*start)*2); 121 125 122 126 if (!new_start) return 0; 123 127 124 *top = new_start + (*top -*start);125 *end = new_start + (*end -*start)*2;126 *start = new_start;128 *top = (byte*)new_start + ((byte*)*top - (byte*)*start); 129 *end = (byte*)new_start + ((byte*)*end - (byte*)*start)*2; 130 *start = (byte*)new_start; 127 131 128 132 return 1; 129 133 } … … 138 142 /* Check if we need to resize the queue. */ 139 143 140 144 if (*start == *head && *tail == *end) { 141 void *new_start = yaml_realloc( *start, (*end -*start)*2);145 void *new_start = yaml_realloc((byte*)*start, ((byte*)*end - (byte*)*start)*2); 142 146 143 147 if (!new_start) return 0; 144 148 145 *head = new_start + (*head -*start);146 *tail = new_start + (*tail -*start);147 *end = new_start + (*end -*start)*2;148 *start = new_start;149 *head = (byte*)new_start + ((byte*)*head - (byte*)*start); 150 *tail = (byte*)new_start + ((byte*)*tail - (byte*)*start); 151 *end = (byte*)new_start + ((byte*)*end - (byte*)*start)*2; 152 *start = (byte*)new_start; 149 153 } 150 154 151 155 /* Check if we need to move the queue at the beginning of the buffer. */ 152 156 153 157 if (*tail == *end) { 154 158 if (*head != *tail) { 155 memmove( *start, *head, *tail -*head);159 memmove((byte*)*start, (byte*)*head, (byte*)*tail - (byte*)*head); 156 160 } 157 *tail -= *head -*start;161 (byte*)*tail -= (byte*)*head - (byte*)*start; 158 162 *head = *start; 159 163 } 160 164 -
scanner.c
1118 1118 1119 1119 if (parser->simple_key_allowed) 1120 1120 { 1121 yaml_simple_key_t simple_key = { 1, required, 1121 /* 1122 yaml_simple_key_t simple_key = { 1123 1, 1124 required, 1122 1125 parser->tokens_parsed + parser->tokens.tail - parser->tokens.head, 1123 parser->mark }; 1126 parser->mark };*/ 1127 yaml_simple_key_t simple_key; 1128 simple_key.possible = 1; 1129 simple_key.required = required; 1130 simple_key.token_number = parser->tokens_parsed + parser->tokens.tail - parser->tokens.head; 1131 simple_key.mark = parser->mark; 1124 1132 1125 1133 if (!yaml_parser_remove_simple_key(parser)) return 0; 1126 1134
