It’s friday evening, so it may just be that I’m not thinking straight, but I think I’ve discovered a bug when writing an XmlElement on one line to a FileOutputStream.
Try the following code in a basic non-gui introjucer’d app:
[code]int main (int argc, char* argv[])
{
File outputFile("~test_file.txt");
ScopedPointer stream (outputFile.createOutputStream());
XmlElement element(“foobar”);
element.writeToStream(*stream, juce::String::empty, true, false);
return 0;
}[/code]
The key point here is that we are calling writeToStream with allOnOneLine set to true. This in turns calls XmlElement::writeElementAsText, with an indentation level of -1, which ultimately falls over when, in FileOutputStream::writeRepeatedByte with numBytes = -1, the program tries to :
memset (buffer + bytesInBuffer, byte, (size_t) numBytes);