From: H.G. Muller Date: Sat, 10 Sep 2011 11:50:25 +0000 (+0200) Subject: Fix AppendComment X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9e48fa42bfc24291f84c50545488893df964b0d8;p=xboard.git Fix AppendComment The joining of two comments was not performed correctly if the second one had the braces yet to be added: the closing brace was not added in that case. --- diff --git a/backend.c b/backend.c index ae1eba1..7a892e5 100644 --- a/backend.c +++ b/backend.c @@ -14623,6 +14623,7 @@ if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces); if (len == 0) return; if (commentList[index] != NULL) { + Boolean addClosingBrace = addBraces; old = commentList[index]; oldlen = strlen(old); while(commentList[index][oldlen-1] == '\n') @@ -14639,7 +14640,7 @@ if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces); if(addBraces) strcat(commentList[index], addBraces == 2 ? "\n(" : "\n{\n"); else strcat(commentList[index], "\n"); strcat(commentList[index], text); - if(addBraces) strcat(commentList[index], addBraces == 2 ? ")\n" : "\n}\n"); + if(addClosingBrace) strcat(commentList[index], addClosingBrace == 2 ? ")\n" : "\n}\n"); else strcat(commentList[index], "\n"); } else { commentList[index] = (char *) malloc(len + 6); // perhaps wastes 4...