From 6cdf5615a2729df486def3fae2e6f548a34fb83b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 7 Apr 2010 15:10:28 +0000 Subject: Cache updates, mainly helper typedefs to make it easier to work with a cache without knowing everything about it's keytype and whatnot. Minor fixes to the csv end-of-line handling. --- src/cache.h | 1 + src/csvreader.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cache.h b/src/cache.h index 7b82541..987443c 100644 --- a/src/cache.h +++ b/src/cache.h @@ -193,6 +193,7 @@ namespace Bu typedef Bu::Hash CidHash; public: + typedef keytype Key; Cache( Calc *pCalc, Store *pStore ) : pCalc( pCalc ), pStore( pStore ) diff --git a/src/csvreader.cpp b/src/csvreader.cpp index c63fe06..ef7a326 100644 --- a/src/csvreader.cpp +++ b/src/csvreader.cpp @@ -43,6 +43,9 @@ Bu::StrArray Bu::CsvReader::readLine() Bu::FString sLine = sIn.readLine(); + if( !sLine.isSet() ) + return Bu::StrArray(); + Bu::FString::iterator i = sLine.begin(); aVals.append( sDecode( i ) ); @@ -52,6 +55,8 @@ Bu::StrArray Bu::CsvReader::readLine() if( *i == ',' ) { i++; + if( !i ) + break; aVals.append( sDecode( i ) ); } else @@ -81,7 +86,11 @@ Bu::FString Bu::CsvReader::decodeExcel( Bu::FString::iterator &i ) if( *i == '\"' ) { i++; - if( *i == '\"' ) + if( !i ) + { + return sRet; + } + else if( *i == '\"' ) { sRet += *i; } -- cgit v1.2.3