fixed corrupted multi line comments, when a blank line (containing only white spaces) is present in the comment

Wed, 10 Feb 2016 12:34:31 +0100

author
universe
date
Wed, 10 Feb 2016 12:34:31 +0100
changeset 31
50ae611a785c
parent 30
0bfd4d6f086a
child 32
10389d866a4d

fixed corrupted multi line comments, when a blank line (containing only white spaces) is present in the comment

src/ccodegen.c file | annotate | diff | comparison | revisions
test/ctestfile.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/ccodegen.c	Fri May 29 14:32:02 2015 +0200
     1.2 +++ b/src/ccodegen.c	Wed Feb 10 12:34:31 2016 +0100
     1.3 @@ -51,18 +51,14 @@
     1.4                                      dp += sizeof(str)-1
     1.5  
     1.6  void cparseline(char *src, char *dest, highlighter_t *hltr) {
     1.7 -    size_t sp = 0, dp = 0;
     1.8 -    /* indent */
     1.9 -    while (isspace(src[sp])) {
    1.10 -        dest[dp++] = src[sp++];
    1.11 -    }
    1.12  
    1.13      memset(hltr->word, 0, WORDBUF_SIZE);
    1.14 -    size_t wp = 0, ifp = 0;
    1.15 +    size_t wp = 0, ifp = 0, sp = 0, dp = 0;
    1.16      int isstring = 0, iscomment = 0, isinclude = 0, parseinclude = 0;
    1.17      char quote = '\0';
    1.18      int isescaping = 0;
    1.19 -
    1.20 +    
    1.21 +    /* continue a multi line comment highlighting */
    1.22      if (hltr->iscommentml) {
    1.23          iscomment = 1;
    1.24          memcpy_const(dest, dp, "<span class=\"c2html-comment\">");
     2.1 --- a/test/ctestfile.c	Fri May 29 14:32:02 2015 +0200
     2.2 +++ b/test/ctestfile.c	Wed Feb 10 12:34:31 2016 +0100
     2.3 @@ -48,6 +48,8 @@
     2.4  #include "webdav.h"
     2.5  
     2.6  
     2.7 +/* -------------------- This is a testing file. -------------------------- */
     2.8 +/*
     2.9  time_t util_parse_creationdate(char *str) {
    2.10      // example: 2012-11-29T21:35:35Z
    2.11      if(!str) {
    2.12 @@ -56,7 +58,7 @@
    2.13      // TODO
    2.14      return 0;
    2.15  }
    2.16 -
    2.17 +*/
    2.18  time_t util_parse_lastmodified(char *str) {
    2.19      // example: Thu, 29 Nov 2012 21:35:35 GMT
    2.20      if(!str) {
    2.21 @@ -308,6 +310,8 @@
    2.22      return ret_str;
    2.23  }
    2.24  
    2.25 +/* commented out for testing reasons */
    2.26 +/*
    2.27  char* util_decrypt_str(DavSession *sn, char *str, char *key) {
    2.28      DavKey *k = dav_context_get_key(sn->context, key);
    2.29      if(!k) {
    2.30 @@ -320,7 +324,7 @@
    2.31      free(dec_str);
    2.32      return ret_str;
    2.33  }
    2.34 -
    2.35 +*/
    2.36  char* util_random_str() {
    2.37      unsigned char *str = malloc(25);
    2.38      str[24] = '\0';

mercurial