From 2be68603c97a3532bbf5039dc791e0c604336ed1 Mon Sep 17 00:00:00 2001 From: dzzie Date: Tue, 15 Dec 2015 08:12:42 -0500 Subject: [PATCH] buffer optimization: long comments do not trigger errorBufferTooSmall --- IniFile.cpp | 37 +++++++++++++++++++++++++++++++++++++ IniFile.h | 1 + readme.txt | 6 ++++-- test/test.ini | 3 +++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/IniFile.cpp b/IniFile.cpp index 59a9102..ea434e5 100644 --- a/IniFile.cpp +++ b/IniFile.cpp @@ -2,6 +2,11 @@ #include +//for testing in MS VC +#ifdef _MSC_VER +#define strcasecmp _stricmp +#endif + const uint8_t IniFile::maxFilenameLen = INI_FILE_MAX_FILENAME_LEN; IniFile::IniFile(const char* filename, uint8_t mode, @@ -310,6 +315,30 @@ bool IniFile::getMACAddress(const char* section, const char* key, return true; } +IniFile::error_t IniFile::readUntilNewLine(File &file, char *buffer, size_t len, uint32_t &pos){ + + char b; + + //first check to see if a new line already exists in our buffer.. + for(int i=0; i