JanX2/cCSVParse — pull request #3 by rsanchezsaez (2013-05-15 14:26:36+00:00)
Title: Fixed parser bug when last reading buffer character is an opening quote.

The parser breaks when the last character of the *text_p buffer is an opening quotation mark.

I have a CSV with rows like this:

73,General,Foo,bar,morebar,"1,3,5,4,2",Foo1,© Blah blah,Foo2,© Blah blah,Foo3,© Blah blah,Foo4,© Blah blah,Foo5,© Blah blah,73,NO,

(Notice the empty cell after the last element.)

I have discovered that the parser stops working if the last row in the buffer ends up looking like this:

73,General,Foo,bar,morebar,"

In this case the last output row is 73. The parser gets confused by an incorrect quote count, and doesn't output rows 74+. This can be resolved by adding the following after line 274 in parseCSV.m

text_p = buffer_p; // Line 274
quoteCount = 0; // This line fixes the bug

I am not 100% sure that this fix doesn't have any side effects, and I don't have time to thoroughly check everything. It seems to work fine for me.