[serialization] Change file signature to something non-ASCII.

Based on feedback by Doug. This signature is fairly arbitrary: it's the
UTF-8 encoding of U+2828 SPARKLES, followed by the number 14 to represent
2014. (Hopefully the format will have stabilized by 2014.)

(Why not 0x00 or 0x01 for the last byte? Because it's more likely we'll
collide with someone else being cute. Why not 0x0D / 13? Because that's
\r and could conceivably appear in real Unicode text. No one uses 0x0E
these days.)

Swift SVN r5134
This commit is contained in:
Jordan Rose
2013-05-09 22:58:08 +00:00
parent 1d2dfdb498
commit b8cf3497a2
3 changed files with 3 additions and 4 deletions

View File

@@ -104,8 +104,7 @@ Module *SerializedModuleLoader::loadModule(
}
assert(inputFile);
if (inputFile->getBufferSize() < 4 ||
!inputFile->getBuffer().startswith(serialization::Signature)) {
if (!inputFile->getBuffer().startswith(serialization::SIGNATURE)) {
// FIXME: Diagnose malformed module? Right now we silently skip it and
// continue searching.
return nullptr;