Diff
Not logged in

Differences From:

File src/blob.c part of check-in [033ad72c71] - Fixed bug in blob_write_to_file, added missing argument to fossil_panic. by aku on 2007-08-28 07:12:09. [view]

To:

File src/blob.c part of check-in [f030c0aea7] - Fix multiple bugs in the comment parser of the commit command. Allow blank lines in comments. by drh on 2007-08-30 19:46:06. [view]

@@ -344,9 +344,11 @@
 
 /*
 ** Extract a single line of text from pFrom beginning at the current
 ** cursor location and use that line of text to initialize pTo.
-** Return the number of bytes in the line.
+** pTo will include the terminating \n.  Return the number of bytes
+** in the line including the \n at the end.  0 is returned at
+** end-of-file.
 **
 ** The cursor of pFrom is left pointing at the first byte past the
 ** \n that terminated the line.
 **
@@ -356,15 +358,15 @@
 int blob_line(Blob *pFrom, Blob *pTo){
   char *aData = pFrom->aData;
   int n = pFrom->nUsed;
   int i = pFrom->iCursor;
-  /* Do not skip blank lines
-  ** while( i<n && aData[i]=='\n' ){ i++; }
-  ** pFrom->iCursor = i;
-  */
+
   while( i<n && aData[i]!='\n' ){ i++; }
-  blob_extract(pFrom, i-pFrom->iCursor, pTo);
-  if( i<n && aData[i]=='\n' ){ pFrom->iCursor++; }
+  if( i<n ){
+    assert( aData[i]=='\n' );
+    i++;
+  }
+  blob_extract(pFrom, i-pFrom->iCursor, pTo);
   return pTo->nUsed;
 }
 
 /*