Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Correct handle of load from CSV with quotes, fixes #60

Merged
merged 1 commit into from
Jul 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Source/ZenLib/ZtringListList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
while (i<l)
{
//Quote
if (i+Quote_Size<l)
if (i+Quote_Size<=l)
{
bool IsQuote=true;
for (size_t j=0; j<Quote_Size; j++)
Expand All @@ -312,7 +312,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
if (IsQuote)
{
//Double quote
if (i+Quote_Size*2<l)
if (i+Quote_Size*2<=l)
{
IsQuote=false;
for (size_t j=0; j<Quote_Size; j++)
Expand All @@ -338,7 +338,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
if (!q)
{
//Carriage return
if (i+Separator0_Size<l)
if (i+Separator0_Size<=l)
{
bool IsSeparator0=true;
for (size_t j=0; j<Separator0_Size; j++)
Expand All @@ -359,7 +359,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
}

//Carriage return
if (i+Separator1_Size<l)
if (i+Separator1_Size<=l)
{
bool IsSeparator1=true;
for (size_t j=0; j<Separator1_Size; j++)
Expand All @@ -380,7 +380,12 @@ void ZtringListList::Write(const Ztring &ToWrite)
}

if (y>=size())
{
size_t PreviousSize=size();
resize(y+1);
for (size_t j=0; j<=y; j++)
operator[](j).Separator_Set(0, Separator[1]);
}
ZtringList& Line=operator[](y);
if (x>=Line.size())
Line.resize(x+1);
Expand Down