Fix resizing the string buffer.

Issue=117 TRAC #15793 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@605 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent ae345807
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 604
#define BUILD_REVISION 605
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -182,12 +182,13 @@ static int AddString(StringTable *stable, const char *s)
char *str;
len = (int) strlen(s);
if (stable->nextFree + len + 1 >= stable->size) {
while (stable->nextFree + len + 1 >= stable->size) {
assert(stable->size < 1000000);
str = (char *) malloc(stable->size*2);
memcpy(str, stable->strings, stable->size);
free(stable->strings);
stable->strings = str;
stable->size = stable->size*2;
}
loc = stable->nextFree;
strcpy(&stable->strings[loc], s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment