Support Windows line endings in manifest files again (regression introduced in revision 5229353383b0). With test!

This commit is contained in:
Benjamin Smedberg
2010-06-29 13:16:43 -04:00
parent fe7171a5f5
commit 468aa298a1
3 changed files with 25 additions and 3 deletions

View File

@@ -116,7 +116,11 @@ static const ManifestDirective kParsingTable[] = {
};
static const char kWhitespace[] = "\t ";
static const char kNewlines[] = "\r\n";
static bool IsNewline(char c)
{
return c == '\n' || c == '\r';
}
namespace {
struct AutoPR_smprintf_free
@@ -477,7 +481,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
// outer loop tokenizes by newline
while (*newline) {
while (*newline && '\n' == *newline) {
while (*newline && IsNewline(*newline)) {
++newline;
++line;
}
@@ -485,7 +489,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
break;
token = newline;
while (*newline && '\n' != *newline)
while (*newline && !IsNewline(*newline))
++newline;
if (*newline) {