summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-26 12:54:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-26 12:54:57 +0000
commit471e272e199afbbfcda3107dcb59bbe9ceb995e8 (patch)
treee5cf7ccb1a93967d651db83399866c939e177349
parent0cf79792cb31326db8acd0849f5e9f8523da8eda (diff)
Fixed parsing error with comments that have tabs before them
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@914 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspircd_io.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index d412cee93..45709fcf9 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -141,7 +141,10 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
{
return "";
}
- // firstly clean up the line by stripping spaces from the start and end
+ // firstly clean up the line by stripping spaces from the start and end and converting tabs to spaces
+ for (int d = 0; d < strlen(buffer); d++)
+ if (buffer[d]) == 9)
+ buffer[d] = ' ';
while ((buffer[0] == ' ') && (strlen(buffer)>0)) buffer++;
while ((buffer[strlen(buffer)-1] == ' ') && (strlen(buffer)>0)) buffer[strlen(buffer)-1] = '\0';
// empty lines are syntactically valid
@@ -151,8 +154,6 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
return "";
for (int c = 0; c < strlen(buffer); c++)
{
- if (buffer[c] == 9)
- buffer[c] = ' ';
// convert all spaces that are OUTSIDE quotes into hardspace (0xA0) as this will make them easier to
// search and replace later :)
if ((!in_quotes) && (buffer[c] == ' '))
@@ -208,7 +209,7 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
}
}
// no quotes, and no equals. something freaky.
- if ((!number_of_quotes) || (!number_of_equals))
+ if ((!number_of_quotes) || (!number_of_equals) && (strlen(buffer)>2))
{
*errorstream << "Malformed tag at " << filename << ":" << linenumber << endl;
error = true;