Fix a bug in native version of collectcatkeys (not the one used in

buildtools) that prevented it from working at all. This fixes #4840


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37185 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-06-21 10:10:36 +00:00
parent 14981b2126
commit e8f533b27b
+6 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2009, Haiku. * Copyright 2003-2010, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -64,11 +64,13 @@ bool
fetchStr(const char *&in, BString &str, bool lookForID) fetchStr(const char *&in, BString &str, bool lookForID)
{ {
int parLevel = 0; int parLevel = 0;
while (isspace(*in) || *in == '(') { while (isspace(*in) || *in == '(') {
if (*in == '(') if (*in == '(')
parLevel++; parLevel++;
in++; in++;
} }
if (*in == '"') { if (*in == '"') {
bool inString = true; bool inString = true;
bool quoted = false; bool quoted = false;
@@ -77,7 +79,7 @@ fetchStr(const char *&in, BString &str, bool lookForID)
{ {
// Collect string content until we find a quote marking end of // Collect string content until we find a quote marking end of
// string (skip escaped quotes) // string (skip escaped quotes)
while (*in != '"' || !quoted) while (*in != '"' || quoted)
{ {
str.Append(in,1); str.Append(in,1);
if (*in == '\\' && !quoted) if (*in == '\\' && !quoted)
@@ -251,6 +253,7 @@ main(int argc, char **argv)
usage(); usage();
} }
} }
if (!outputFile.Length() && inputFile) { if (!outputFile.Length() && inputFile) {
// generate default output-file from input-file by replacing // generate default output-file from input-file by replacing
// the extension with '.catkeys': // the extension with '.catkeys':
@@ -270,6 +273,7 @@ main(int argc, char **argv)
strerror(res)); strerror(res));
exit(-1); exit(-1);
} }
off_t sz; off_t sz;
inFile.GetSize(&sz); inFile.GetSize(&sz);
if (sz > 0) { if (sz > 0) {