conf parsing: do not truncate lines. Fixes GUI not displaying results with paths longer than around 1000 characters
This commit is contained in:
parent
f9857effb6
commit
c75b0ac0ce
1 changed files with 10 additions and 9 deletions
|
@ -41,19 +41,19 @@ using namespace std;
|
||||||
#define LOGDEB(X)
|
#define LOGDEB(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LL 1024
|
|
||||||
void ConfSimple::parseinput(istream &input)
|
void ConfSimple::parseinput(istream &input)
|
||||||
{
|
{
|
||||||
string submapkey;
|
string submapkey;
|
||||||
char cline[LL];
|
string cline;
|
||||||
bool appending = false;
|
bool appending = false;
|
||||||
string line;
|
string line;
|
||||||
bool eof = false;
|
bool eof = false;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
cline[0] = 0;
|
cline.clear();
|
||||||
input.getline(cline, LL-1);
|
std::getline(input, cline);
|
||||||
LOGDEB((stderr, "Parse:line: [%s] status %d\n", cline, int(status)));
|
LOGDEB((stderr, "Parse:line: [%s] status %d\n",
|
||||||
|
cline.c_str(), int(status)));
|
||||||
if (!input.good()) {
|
if (!input.good()) {
|
||||||
if (input.bad()) {
|
if (input.bad()) {
|
||||||
LOGDEB((stderr, "Parse: input.bad()\n"));
|
LOGDEB((stderr, "Parse: input.bad()\n"));
|
||||||
|
@ -68,10 +68,11 @@ void ConfSimple::parseinput(istream &input)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t ll = strlen(cline);
|
string::size_type pos = cline.find_last_not_of("\n\r");
|
||||||
while (ll > 0 && (cline[ll-1] == '\n' || cline[ll-1] == '\r')) {
|
if (pos == string::npos) {
|
||||||
cline[ll-1] = 0;
|
cline.clear();
|
||||||
ll--;
|
} else if (pos != cline.length()-1) {
|
||||||
|
cline.erase(pos+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue