Esempio n. 1
0
LocRecs parseLocRecs(const uint8_t* ptr, size_t size) {
  LocRecs recs;

  uint8_t  reserved8;
  uint16_t reserved16;

  always_assert(size >= 8);
  auto const end = ptr + size;

  readValue(ptr, recs.versionMajor);
  readValue(ptr, recs.versionMinor);
  always_assert(recs.versionMajor == 1 && "invalid version of locrecs");

  skipValue(ptr, reserved16);

  uint32_t numRecords;
  readValue(ptr, numRecords);

  always_assert(ptr + numRecords * 16 <= end && "locrecs out of bounds");
  for (uint32_t j = 0; j < numRecords; ++j) {
    LocRecs::LocationRecord record;
    readValue(ptr, record.address);
    readValue(ptr, record.id);
    readValue(ptr, record.size);
    skipValue(ptr, reserved8);
    skipValue(ptr, reserved16);
    recs.records[record.id].emplace_back(std::move(record));
  }

  return recs;
}
Esempio n. 2
0
File: Rjson.cpp Progetto: XoDeR/RE
		void parseArray(const char* json, JsonArray& array)
		{
			RIO_ASSERT_NOT_NULL(json);

			if (*json == '[')
			{
				json = getNext(json, '[');
				json = skipSpaces(json);

				if (*json == ']')
				{
					json = getNext(json, ']');
					return;
				}

				while (*json)
				{
					ArrayFn::pushBack(array, json);

					json = skipValue(json);
					json = skipSpaces(json);

					if (*json == ']')
					{
						json = getNext(json, ']');
						return;
					}

					json = skipSpaces(json);
				}
			}

			RIO_FATAL("Bad array");
		}
Esempio n. 3
0
LocRecs parseLocRecs(const uint8_t* ptr, size_t size) {
    LocRecs recs;

    uint8_t  reserved8;
    uint16_t reserved16;
    uint32_t reserved32;

    always_assert(size >= 8);
    auto const end = ptr + size;

    readValue(ptr, recs.versionMajor);
    readValue(ptr, recs.versionMinor);
    always_assert(recs.versionMajor == 1 && "invalid version of locrecs");

    skipValue(ptr, reserved16);

    uint32_t numFunctions;
    readValue(ptr, numFunctions);

    for (uint32_t i = 0; i < numFunctions; ++i) {
        always_assert(ptr + 16 <= end);
        LocRecs::FunctionRecord funcRec;
        readValue(ptr, funcRec.address);
        uint32_t numRecords;
        readValue(ptr, numRecords);
        skipValue(ptr, reserved32);

        always_assert(ptr + numRecords * 8 <= end);
        for (uint32_t j = 0; j < numRecords; ++j) {
            LocRecs::LocationRecord record;
            readValue(ptr, record.offset);
            readValue(ptr, record.id);
            readValue(ptr, record.size);
            skipValue(ptr, reserved8);
            funcRec.records[record.id].emplace_back(std::move(record));
        }
        recs.functionRecords.emplace(funcRec.address, std::move(funcRec));
    }

    return recs;
}
void
MetaAttribute::copyValueBytes(uint32 valueIndex, const ReadSection &rs, WriteSection &ws,
	uint32 &writeOffset) const
{
	uint32 numValues, valueOffset;
	unpackNumberOfValues(rs, numValues, valueOffset);

	// skip bytes before the desired value
	for (uint32 i = 0; i < valueIndex; i++)
		skipValue(rs, valueOffset);
		
	// copy the value bytes into the write section
	copyValue(rs, valueOffset, ws, writeOffset);
}
Esempio n. 5
0
File: Rjson.cpp Progetto: XoDeR/RE
		void parseObject(const char* json, JsonObject& object)
		{
			RIO_ASSERT_NOT_NULL(json);

			if (*json == '{')
			{
				json = getNext(json, '{');

				json = skipSpaces(json);

				if (*json == '}')
				{
					getNext(json, '}');
					return;
				}

				while (*json)
				{
					const char* keyBegin = *json == '"' ? (json + 1) : json;

					TempAllocator256 ta;
					DynamicString key(ta);
					json = parseKey(json, key);

					FixedString fixedSizeKey(keyBegin, key.getLength());

					json = skipSpaces(json);
					json = getNext(json, '=');
					json = skipSpaces(json);

					MapFn::set(object, fixedSizeKey, json);

					json = skipValue(json);
					json = skipSpaces(json);

					if (*json == '}')
					{
						getNext(json, '}');
						return;
					}

					json = skipSpaces(json);
				}
			}

			RIO_FATAL("Bad object");
		}
Esempio n. 6
0
File: Rjson.cpp Progetto: XoDeR/RE
		void parseObject(const char* json, Map<DynamicString, const char*>& object)
		{
			RIO_ASSERT_NOT_NULL(json);

			if (*json == '{')
			{
				json = getNext(json, '{');

				json = skipSpaces(json);

				if (*json == '}')
				{
					getNext(json, '}');
					return;
				}

				while (*json)
				{
					TempAllocator256 ta;
					DynamicString key(ta);
					json = parseKey(json, key);

					json = skipSpaces(json);
					json = getNext(json, '=');
					json = skipSpaces(json);

					MapFn::set(object, key, json);

					json = skipValue(json);
					json = skipSpaces(json);

					if (*json == '}')
					{
						getNext(json, '}');
						return;
					}

					json = skipSpaces(json);
				}
			}

			RIO_FATAL("Bad object");
		}
Esempio n. 7
0
File: Rjson.cpp Progetto: XoDeR/RE
		void parseRootObject(const char* json, Map<DynamicString, const char*>& object)
		{
			RIO_ASSERT_NOT_NULL(json);

			while (*json)
			{
				TempAllocator256 ta;
				DynamicString key(ta);
				json = parseKey(json, key);

				json = skipSpaces(json);
				json = getNext(json, '=');
				json = skipSpaces(json);

				MapFn::set(object, key, json);

				json = skipValue(json);
				json = skipSpaces(json);
			}
		}
Esempio n. 8
0
ContentSecurityPolicy::ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL)
{
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidToggle, (ASCIILiteral("expected 0 or 1")));
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidSeparator, (ASCIILiteral("expected semicolon")));
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidEquals, (ASCIILiteral("expected equals sign")));
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidMode, (ASCIILiteral("invalid mode directive")));
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidReport, (ASCIILiteral("invalid report directive")));
    DEFINE_STATIC_LOCAL(String, failureReasonDuplicateMode, (ASCIILiteral("duplicate mode directive")));
    DEFINE_STATIC_LOCAL(String, failureReasonDuplicateReport, (ASCIILiteral("duplicate report directive")));
    DEFINE_STATIC_LOCAL(String, failureReasonInvalidDirective, (ASCIILiteral("unrecognized directive")));

    unsigned pos = 0;

    if (!skipWhiteSpace(header, pos, false))
        return ContentSecurityPolicy::ReflectedXSSUnset;

    if (header[pos] == '0')
        return ContentSecurityPolicy::AllowReflectedXSS;

    if (header[pos++] != '1') {
        failureReason = failureReasonInvalidToggle;
        return ContentSecurityPolicy::ReflectedXSSInvalid;
    }

    ContentSecurityPolicy::ReflectedXSSDisposition result = ContentSecurityPolicy::FilterReflectedXSS;
    bool modeDirectiveSeen = false;
    bool reportDirectiveSeen = false;

    while (1) {
        // At end of previous directive: consume whitespace, semicolon, and whitespace.
        if (!skipWhiteSpace(header, pos, false))
            return result;

        if (header[pos++] != ';') {
            failureReason = failureReasonInvalidSeparator;
            failurePosition = pos;
            return ContentSecurityPolicy::ReflectedXSSInvalid;
        }

        if (!skipWhiteSpace(header, pos, false))
            return result;

        // At start of next directive.
        if (skipToken(header, pos, "mode")) {
            if (modeDirectiveSeen) {
                failureReason = failureReasonDuplicateMode;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            modeDirectiveSeen = true;
            if (!skipEquals(header, pos)) {
                failureReason = failureReasonInvalidEquals;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            if (!skipToken(header, pos, "block")) {
                failureReason = failureReasonInvalidMode;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            result = ContentSecurityPolicy::BlockReflectedXSS;
        } else if (skipToken(header, pos, "report")) {
            if (reportDirectiveSeen) {
                failureReason = failureReasonDuplicateReport;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            reportDirectiveSeen = true;
            if (!skipEquals(header, pos)) {
                failureReason = failureReasonInvalidEquals;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            size_t startPos = pos;
            if (!skipValue(header, pos)) {
                failureReason = failureReasonInvalidReport;
                failurePosition = pos;
                return ContentSecurityPolicy::ReflectedXSSInvalid;
            }
            reportURL = header.substring(startPos, pos - startPos);
            failurePosition = startPos; // If later semantic check deems unacceptable.
        } else {
            failureReason = failureReasonInvalidDirective;
            failurePosition = pos;
            return ContentSecurityPolicy::ReflectedXSSInvalid;
        }
    }
}
Esempio n. 9
0
static void
process_cmdline(int argc, char **argv)
{
    int i, j, nextarg;
    char *optArg;
    char *optNext;
    PFILE dummy;		/* starts linked list of filenames */
    PFILE *tail = &dummy;
    size_t length;

    if (argc <= 1)
	usage();

    for (i = 1; i < argc && argv[i][0] == '-'; i = nextarg) {
	if (argv[i][1] == 0)	/* -  alone */
	{
	    if (!pfile_name)
		no_program();
	    break;		/* the for loop */
	}
	/* safe to look at argv[i][2] */

	/*
	 * Check for "long" options and decide how to handle them.
	 */
	if (strlen(argv[i]) > 2 && !strncmp(argv[i], "--", (size_t) 2)) {
	    if (!allow_long_options(argv[i])) {
		nextarg = i + 1;
		continue;
	    }
	}

	if (argv[i][2] == 0) {
	    if (i == argc - 1 && argv[i][1] != '-') {
		if (strchr("WFvf", argv[i][1])) {
		    errmsg(0, "option %s lacks argument", argv[i]);
		    mawk_exit(2);
		}
		bad_option(argv[i]);
	    }

	    optArg = argv[i + 1];
	    nextarg = i + 2;
	} else {		/* argument glued to option */
	    optArg = &argv[i][2];
	    nextarg = i + 1;
	}

	switch (argv[i][1]) {

	case 'W':
	    for (j = 0; j < (int) strlen(optArg); j = (int) (optNext - optArg)) {
		switch (parse_w_opt(optArg + j, &optNext)) {
		case W_VERSION:
		    print_version();
		    break;
#if USE_BINMODE
		case W_BINMODE:
		    if (haveValue(optNext)) {
			set_binmode(atoi(optNext + 1));
			optNext = skipValue(optNext);
		    } else {
			errmsg(0, "missing value for -W binmode");
			mawk_exit(2);
		    }
		    break;
#endif
		case W_DUMP:
		    dump_code_flag = 1;
		    break;

		case W_EXEC:
		    if (pfile_name) {
			errmsg(0, "-W exec is incompatible with -f");
			mawk_exit(2);
		    } else if (nextarg == argc) {
			no_program();
		    }
		    if (haveValue(optNext)) {
			pfile_name = optNext + 1;
			i = nextarg;
		    } else {
			pfile_name = argv[nextarg];
			i = nextarg + 1;
		    }
		    goto no_more_opts;

		case W_INTERACTIVE:
		    interactive_flag = 1;
		    setbuf(stdout, (char *) 0);
		    break;

		case W_POSIX_SPACE:
		    posix_space_flag = 1;
		    break;

		case W_RANDOM:
		    if (haveValue(optNext)) {
			int x = atoi(optNext + 1);
			CELL c[2];

			memset(c, 0, sizeof(c));
			c[1].type = C_DOUBLE;
			c[1].dval = (double) x;
			/* c[1] is input, c[0] is output */
			bi_srand(c + 1);
			optNext = skipValue(optNext);
		    } else {
			errmsg(0, "missing value for -W random");
			mawk_exit(2);
		    }
		    break;

		case W_SPRINTF:
		    if (haveValue(optNext)) {
			int x = atoi(optNext + 1);

			if (x > (int) sizeof(string_buff)) {
			    if (sprintf_buff != string_buff &&
				sprintf_buff != 0) {
				zfree(sprintf_buff,
				      (size_t) (sprintf_limit - sprintf_buff));
			    }
			    sprintf_buff = (char *) zmalloc((size_t) x);
			    sprintf_limit = sprintf_buff + x;
			}
			optNext = skipValue(optNext);
		    } else {
			errmsg(0, "missing value for -W sprintf");
			mawk_exit(2);
		    }
		    break;

		case W_HELP:
		    /* FALLTHRU */
		case W_USAGE:
		    usage();
		    /* NOTREACHED */
		    break;
		case W_UNKNOWN:
		    errmsg(0, "vacuous option: -W %s", optArg + j);
		    break;
		}
		while (*optNext == '=') {
		    errmsg(0, "unexpected option value %s", optArg + j);
		    optNext = skipValue(optNext);
		}
	    }
	    break;

	case 'v':
	    if (!is_cmdline_assign(optArg)) {
		errmsg(0, "improper assignment: -v %s", optArg);
		mawk_exit(2);
	    }
	    break;

	case 'F':

	    rm_escape(optArg, &length);		/* recognize escape sequences */
	    cell_destroy(FS);
	    FS->type = C_STRING;
	    FS->ptr = (PTR) new_STRING1(optArg, length);
	    cast_for_split(cellcpy(&fs_shadow, FS));
	    break;

	case '-':
	    if (argv[i][2] != 0) {
		bad_option(argv[i]);
	    }
	    i++;
	    goto no_more_opts;

	case 'f':
	    /* first file goes in pfile_name ; any more go
	       on a list */
	    if (!pfile_name)
		pfile_name = optArg;
	    else {
		tail = tail->link = ZMALLOC(PFILE);
		tail->fname = optArg;
	    }
	    break;

	default:
	    bad_option(argv[i]);
	}
    }

  no_more_opts:

    tail->link = (PFILE *) 0;
    pfile_list = dummy.link;

    if (pfile_name) {
	set_ARGV(argc, argv, i);
	scan_init((char *) 0);
    } else {			/* program on command line */
	if (i == argc)
	    no_program();
	set_ARGV(argc, argv, i + 1);

#if  defined(MSDOS) && ! HAVE_REARGV	/* reversed quotes */
	{
	    char *p;

	    for (p = argv[i]; *p; p++)
		if (*p == '\'')
		    *p = '\"';
	}
#endif
	scan_init(argv[i]);
/* #endif  */
    }
}
Esempio n. 10
0
void message::skip()
{
    skipValue(value);
}
UBool
BytesTrie::Iterator::next(UErrorCode &errorCode) {
    if(U_FAILURE(errorCode)) {
        return FALSE;
    }
    const uint8_t *pos=pos_;
    if(pos==NULL) {
        if(stack_->isEmpty()) {
            return FALSE;
        }
        // Pop the state off the stack and continue with the next outbound edge of
        // the branch node.
        int32_t stackSize=stack_->size();
        int32_t length=stack_->elementAti(stackSize-1);
        pos=bytes_+stack_->elementAti(stackSize-2);
        stack_->setSize(stackSize-2);
        str_->truncate(length&0xffff);
        length=(int32_t)((uint32_t)length>>16);
        if(length>1) {
            pos=branchNext(pos, length, errorCode);
            if(pos==NULL) {
                return TRUE;  // Reached a final value.
            }
        } else {
            str_->append((char)*pos++, errorCode);
        }
    }
    if(remainingMatchLength_>=0) {
        // We only get here if we started in a pending linear-match node
        // with more than maxLength remaining bytes.
        return truncateAndStop();
    }
    for(;;) {
        int32_t node=*pos++;
        if(node>=kMinValueLead) {
            // Deliver value for the byte sequence so far.
            UBool isFinal=(UBool)(node&kValueIsFinal);
            value_=readValue(pos, node>>1);
            if(isFinal || (maxLength_>0 && str_->length()==maxLength_)) {
                pos_=NULL;
            } else {
                pos_=skipValue(pos, node);
            }
            sp_.set(str_->data(), str_->length());
            return TRUE;
        }
        if(maxLength_>0 && str_->length()==maxLength_) {
            return truncateAndStop();
        }
        if(node<kMinLinearMatch) {
            if(node==0) {
                node=*pos++;
            }
            pos=branchNext(pos, node+1, errorCode);
            if(pos==NULL) {
                return TRUE;  // Reached a final value.
            }
        } else {
            // Linear-match node, append length bytes to str_.
            int32_t length=node-kMinLinearMatch+1;
            if(maxLength_>0 && str_->length()+length>maxLength_) {
                str_->append(reinterpret_cast<const char *>(pos),
                            maxLength_-str_->length(), errorCode);
                return truncateAndStop();
            }
            str_->append(reinterpret_cast<const char *>(pos), length, errorCode);
            pos+=length;
        }
    }
void INIFile::readfile(SDL_RWops * file)
{
	SectionRoot = new Section("",0,0);

	Section* curSection = SectionRoot;

	std::string completeLine;
	int lineNum = 0;
	bool SyntaxError = false;
	INIFileLine* curLine = NULL;
	INIFileLine* newINIFileLine;
	Section* newSection;
	Key* newKey;

	bool readfinished = false;

	while(!readfinished) {
		lineNum++;

		completeLine = "";
		unsigned char tmp;
		int readbytes;

		while(1) {
			readbytes = SDL_RWread(file,&tmp,1,1);
			if(readbytes <= 0) {
				readfinished = true;
				break;
			} else if(tmp == '\n') {
				break;
			} else if(tmp != '\r') {
				completeLine += tmp;
			}
		}

		const unsigned char* line = (const unsigned char*) completeLine.c_str();
		SyntaxError = false;
		int ret;

		ret = getNextChar(line,0);

		if(ret == -1) {
			// empty line or comment
			newINIFileLine = new INIFileLine(completeLine);

			if(curLine == NULL) {
				FirstLine = newINIFileLine;
				curLine = newINIFileLine;
			} else {
				curLine->nextLine = newINIFileLine;
				newINIFileLine->prevLine = curLine;
				curLine = newINIFileLine;
			}
		} else {

			if(line[ret] == '[') {
				// section line
				int sectionstart = ret+1;
				int sectionend = skipName(line,ret+1);

				if((line[sectionend] != ']') ||	(getNextChar(line,sectionend+1) != -1)) {
					SyntaxError = true;
				} else {
					// valid section line
					newSection = new Section(completeLine,sectionstart,sectionend-sectionstart);

					if(curLine == NULL) {
						FirstLine = newSection;
						curLine = newSection;
					} else {
						curLine->nextLine = newSection;
						newSection->prevLine = curLine;
						curLine = newSection;
					}

					InsertSection(newSection);
					curSection = newSection;
				}
			} else {

				// might be key/value line
				int keystart = ret;
				int keyend = skipKey(line,keystart);

				if(keystart == keyend) {
					SyntaxError = true;
				} else {
					ret = getNextChar(line,keyend);
					if((ret == -1) ||(line[ret] != '=')) {
						SyntaxError = true;
					} else {
						int valuestart = getNextChar(line,ret+1);
						if(valuestart == -1) {
							SyntaxError = true;
						} else {
							if(line[valuestart] == '"') {
								// now get the next '"'

								int valueend = getNextQuote(line,valuestart+1);

								if((valueend == -1) || (getNextChar(line,valueend+1) != -1)) {
									SyntaxError = true;
								} else {
									// valid key/value line
									newKey = new Key(completeLine,keystart,keyend-keystart,valuestart+1,valueend-valuestart-1);

									if(FirstLine == NULL) {
										FirstLine = newKey;
										curLine = newKey;
									} else {
										curLine->nextLine = newKey;
										newKey->prevLine = curLine;
										curLine = newKey;
									}

									curSection->InsertKey(newKey);
								}

							} else {
								int valueend = skipValue(line,valuestart);

								if(getNextChar(line,valueend) != -1) {
									SyntaxError = true;
								} else {
									// valid key/value line
									newKey = new Key(completeLine,keystart,keyend-keystart,valuestart,valueend-valuestart);

									if(FirstLine == NULL) {
										FirstLine = newKey;
										curLine = newKey;
									} else {
										curLine->nextLine = newKey;
										newKey->prevLine = curLine;
										curLine = newKey;
									}

									curSection->InsertKey(newKey);
								}
							}
						}
					}
				}

			}
		}

		if(SyntaxError == true) {
			if(completeLine.size() < 100) {
				// there are some buggy ini-files which have a lot of waste at the end of the file
				// and it makes no sense to print all this stuff out. just skip it
				std::cerr << "INIFile: Syntax-Error in line " << lineNum << ":" << completeLine << " !" << std::endl;
			}
			// save this line as a comment
			newINIFileLine = new INIFileLine(completeLine);

			if(curLine == NULL) {
				FirstLine = newINIFileLine;
				curLine = newINIFileLine;
			} else {
				curLine->nextLine = newINIFileLine;
				newINIFileLine->prevLine = curLine;
				curLine = newINIFileLine;
			}
		}



	}
}
Esempio n. 13
0
void IniFile::readFile()
{	
	if((SectionRoot = new SectionEntry("",0,0)) == nullptr)
    	    throw(std::bad_alloc());
	
	SectionEntry *curSectionEntry = SectionRoot;
		
	std::string completeLine;
	int lineNum = 0;
	bool SyntaxError = false;
	CommentEntry *curEntry = nullptr;
	CommentEntry *newCommentEntry;
	SectionEntry *newSectionEntry;
	KeyEntry *newKeyEntry;
	
	bool readfinished = false;
	
	while(!readfinished) {
		lineNum++;
		
		completeLine = "";
		uint8_t tmp;
		
		size_t size = _stream.sizeg();
		while(static_cast<uint32_t>(_stream.tellg()) < size-1) {
			tmp = _stream.get();
			if(static_cast<uint32_t>(_stream.tellg()) == size-1) {
				readfinished = true;
				break;
			} else if(tmp == '\n') {
				break;
			} else if(tmp != '\r') {
				completeLine += tmp;
			}
		}
		
		const uint8_t *line = reinterpret_cast<const uint8_t*>(completeLine.c_str());
		SyntaxError = false;
		int ret;

		ret = getNextChar(line,0);
		
		if(ret == -1) {
			// empty line or comment
			if((newCommentEntry = new CommentEntry(completeLine)) == nullptr)
		    	    throw(std::bad_alloc());
			
			if(curEntry == nullptr) {
				FirstLine = newCommentEntry;
				curEntry = newCommentEntry;
			} else {
				curEntry->nextEntry = newCommentEntry;
				newCommentEntry->prevEntry = curEntry;
				curEntry = newCommentEntry;
			}
		} else {
		
			if(line[ret] == '[') {
				// section line
				int sectionstart = ret+1;
				int sectionend = skipName(line,ret+1);
			
				if((line[sectionend] != ']') ||	(getNextChar(line,sectionend+1) != -1)) {
					SyntaxError = true;
				} else {
					// valid section line
					if((newSectionEntry = new SectionEntry(completeLine,sectionstart,sectionend-sectionstart)) == nullptr)
				    	    throw(std::bad_alloc());
			
					if(curEntry == nullptr) {
						FirstLine = newSectionEntry;
						curEntry = newSectionEntry;
					} else {
						curEntry->nextEntry = newSectionEntry;
						newSectionEntry->prevEntry = curEntry;
						curEntry = newSectionEntry;
					}
					
					InsertSection(newSectionEntry);
					curSectionEntry = newSectionEntry;
				}
			} else {
			
				// might be key/value line
				int keystart = ret;
				int keyend = skipKey(line,keystart);
				
				if(keystart == keyend) {
					SyntaxError = true;
				} else {
					ret = getNextChar(line,keyend);
					if((ret == -1) ||(line[ret] != '=')) {
						SyntaxError = true;
					} else {
						int valuestart = getNextChar(line,ret+1);
						int valueend;
						if(valuestart == -1) {
							SyntaxError = true;
						} else {
							if(line[valuestart] == '"') {
								// now get the next '"'
								
								valueend = getNextQuote(line,valuestart+1);
								
								if((valueend == -1) || (getNextChar(line,valueend+1) != -1)) {
									SyntaxError = true;
								} else {
									// valid key/value line
									if((newKeyEntry = new KeyEntry(completeLine,keystart,keyend-keystart,valuestart+1,valueend-valuestart-1)) == nullptr)
								    	    throw(std::bad_alloc());

									if(FirstLine == nullptr) {
										FirstLine = newKeyEntry;
										curEntry = newKeyEntry;
									} else {
										curEntry->nextEntry = newKeyEntry;
										newKeyEntry->prevEntry = curEntry;
										curEntry = newKeyEntry;
									}
					
									InsertKey(curSectionEntry,newKeyEntry);										
								}
								
							} else {
								valueend = skipValue(line,valuestart);
								
								if(getNextChar(line,valueend) != -1) {
									SyntaxError = true;
								} else {
									// valid key/value line
									if((newKeyEntry = new KeyEntry(completeLine,keystart,keyend-keystart,valuestart,valueend-valuestart)) == nullptr)
								    	    throw(std::bad_alloc());


									if(FirstLine == nullptr) {
										FirstLine = newKeyEntry;
										curEntry = newKeyEntry;
									} else {
										curEntry->nextEntry = newKeyEntry;
										newKeyEntry->prevEntry = curEntry;
										curEntry = newKeyEntry;
									}
					
									InsertKey(curSectionEntry,newKeyEntry);									
								}
							}
						}
					}
				}
				
			}
		}
		
		if(SyntaxError == true) {
			if(completeLine.size() < 100) {
				// there are some buggy ini-files which have a lot of waste at the end of the file
				// and it makes no sense to print all this stuff out. just skip it
			    std::cerr << "IniFile: Syntax-Error in line " << lineNum << ":" << completeLine << " !" << std::endl;
			}
			// save this line as a comment
			if((newCommentEntry = new CommentEntry(completeLine)) == nullptr)
		    	    throw(std::bad_alloc());
			
			if(curEntry == nullptr) {
				FirstLine = newCommentEntry;
				curEntry = newCommentEntry;
			} else {
				curEntry->nextEntry = newCommentEntry;
				newCommentEntry->prevEntry = curEntry;
				curEntry = newCommentEntry;
			}		
		}
		
		
		
	}
}