]> granicus.if.org Git - graphviz/commitdiff
Make sure \\ is not generated when doing line breaks
authorerg <devnull@localhost>
Mon, 3 Jan 2011 23:01:57 +0000 (23:01 +0000)
committererg <devnull@localhost>
Mon, 3 Jan 2011 23:01:57 +0000 (23:01 +0000)
lib/cgraph/write.c
lib/graph/graphio.c

index b6bf2ec78e934200363b9b58b499498ae6cd2c30..031dc41a218ba3fc1a8a172dca0a6328a376d8f5 100644 (file)
@@ -101,14 +101,14 @@ static char *_agstrcanon(char *arg, char *buf)
        uc = *(unsigned char *) s++;
        cnt++;
        
-        if (uc && backslash_pending && !((is_number_char(p[-1]) || isalpha(p[-1])) && (is_number_char(uc) || isalpha(uc)))) {
+        if (uc && backslash_pending && !((is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (is_number_char(uc) || isalpha(uc)))) {
             *p++ = '\\';
             *p++ = '\n';
             needs_quotes = TRUE;
             backslash_pending = FALSE;
            cnt = 0;
         } else if (uc && (cnt >= MAX_OUTPUTLINE)) {
-            if (!((is_number_char(p[-1]) || isalpha(p[-1])) && (is_number_char(uc) || isalpha(uc)))) {
+            if (!((is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (is_number_char(uc) || isalpha(uc)))) {
                *p++ = '\\';
                *p++ = '\n';
                needs_quotes = TRUE;
index 1a54e15025d3dcb28dc1ea1c93bf18e2f0a255d4..48ea3e41bd2b4f6b78a7957c8a8aba066677f3a7 100644 (file)
@@ -129,13 +129,13 @@ _agstrcanon (char* arg, char* buf)
        *p++ = (char) uc;
        uc = *(unsigned char *) s++;
        cnt++;
-        if (uc && backslash_pending && !((_is_number_char(p[-1]) || isalpha(p[-1])) && (_is_number_char(uc) || isalpha(uc)))) {
+        if (uc && backslash_pending && !((_is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (_is_number_char(uc) || isalpha(uc)))) {
             *p++ = '\\';
             *p++ = '\n';
             has_special = TRUE;
             backslash_pending = FALSE;
         } else if (uc && cnt % SMALLBUF == 0) {
-            if (!((_is_number_char(p[-1]) || isalpha(p[-1])) && (_is_number_char(uc) || isalpha(uc)))) {
+            if (!((_is_number_char(p[-1]) || isalpha(p[-1]) || (p[-1] == '\\')) && (_is_number_char(uc) || isalpha(uc)))) {
                *p++ = '\\';
                *p++ = '\n';
                has_special = TRUE;