Open HankLloydRight opened 1 year ago
The file is processed line-by-line which enables IniFile
to work with only a small amount of RAM. The parser expects that a buffer contains an entire line. I've not tried but I expect that the change you suggested would be equivalent to splitting the line by inserting a newline character, it won't truncate lines that are too long.
I don't see any point in truncating lines that are too long for the buffer. It is reasonable to assume that all provided key/value pairs are important. So either the file is valid and can be parsed, or else it is not valid.
If you need to support longer line lengths then you need to increase the buffer size.
If you need to support longer line lengths then you need to increase the buffer size.
I'm thinking more for comment lines which can be safely ignored and has the chance of a user typing too much.
I guess what I'm asking is it possible for the Ini file validation check to ignore lines that just comments? But continue to check actual key/value pairs for the pre-set buffer length limit.
So end-users who are modifying the ini files can type whatever comments they want without fear of going over a pre-set buffer length (say 100 bytes) and inadvertently invalidating the ini file.
thanks.
Hello,
If I change line 423 in IniFile.cpp from:
return errorBufferTooSmall;
toreturn errorNoError;
Would that result in the validate function not returning an error but instead just truncating lines that are too long (instead of returning an invalid file error)?
What's your reasoning behind invalidating the entire file if any lines are longer than the buffer length instead of just silently (or not silently) truncating them?
My thinking is if an end-user inadvertently has one line go over inibufferlen, the entire file is rejected, instead of just the offending line(s).
Thank you.