Skip to content

Commit

Permalink
Merge branch '3.7' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.7
  • Loading branch information
erilong committed Oct 13, 2015
2 parents ce30258 + aa64a39 commit ad9be7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions symmetric-client-clib-test/src/util/MapTest.c
Expand Up @@ -96,7 +96,8 @@ void SymMapTest_test3() {
}

unsigned short SymMapTest_stringListContains(SymList * list, char * string) {
for (int i = 0; i < list->size; i++) {
int i;
for (i = 0; i < list->size; i++) {
if (strcmp(list->get(list, i), string) == 0) {
return 1;
}
Expand All @@ -106,7 +107,8 @@ unsigned short SymMapTest_stringListContains(SymList * list, char * string) {
}

unsigned short SymMapTest_entryListContainsKey(SymList * entryList, char * string) {
for (int i = 0; i < entryList->size; i++) {
int i;
for (i = 0; i < entryList->size; i++) {
if (strcmp(((SymMapEntry*)entryList->get(entryList, i))->key, string) == 0) {
return 1;
}
Expand All @@ -116,7 +118,8 @@ unsigned short SymMapTest_entryListContainsKey(SymList * entryList, char * strin
}

unsigned short SymMapTest_entryListContainsValue(SymList * entryList, char * string) {
for (int i = 0; i < entryList->size; i++) {
int i;
for (i = 0; i < entryList->size; i++) {
if (strcmp(((SymMapEntry*)entryList->get(entryList, i))->value, string) == 0) {
return 1;
}
Expand Down Expand Up @@ -158,7 +161,8 @@ void SymMapTest_testValuesMultiValue() {
SymMapTest_test_createStringMap(KEY_COUNT, keys, values, 100)
};

for (int i = 0; i < 4; i++) {
int i;
for (i = 0; i < 4; i++) {
SymMap *map = maps[i];
SymList *valueList = map->values(map);

Expand Down Expand Up @@ -209,7 +213,8 @@ void SymMapTest_testEntriesMultiValue() {
SymMapTest_test_createStringMap(KEY_COUNT, keys, values, 100)
};

for (int i = 0; i < 4; i++) {
int i;
for (i = 0; i < 4; i++) {
SymMap *map = maps[i];
SymList *entryList = map->entries(map);

Expand Down Expand Up @@ -265,7 +270,8 @@ void SymMapTest_testKeysMultiValue() {
SymMapTest_test_createStringMap(KEY_COUNT, keys, values, 100)
};

for (int i = 0; i < 4; i++) {
int i;
for (i = 0; i < 4; i++) {
SymMap *map = maps[i];
SymStringArray *keyList = map->keys(map);

Expand Down
4 changes: 3 additions & 1 deletion symmetric-client-clib/src/util/StringBuilder.c
Expand Up @@ -46,7 +46,9 @@ SymStringBuilder * SymStringBuilder_appendfv(SymStringBuilder *this, const char
int sizeNeeded = vsnprintf(NULL, 0, fmt, copy);
va_end(copy);

char *str = malloc(sizeNeeded);
// +1 to make allowance for the terminating NULL.
// Fixes segfault on some platforms (e.g. Linux).
char *str = malloc(sizeNeeded+1);
vsprintf(str, fmt, arglist);

SymStringBuilder_appendn(this, str, sizeNeeded);
Expand Down

0 comments on commit ad9be7f

Please sign in to comment.