зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1418415 - Read and write analysis files in binary mode. r=mccr8
This is necessary because: (a) the JSONFormatter emits a \n newline for each analysis line (b) we truncate the file to the expected length after writing it (c) on Windows writing the file in text mode replaces \n with \r\n and invalidates our computed "expected length" Differential Revision: https://phabricator.services.mozilla.com/D10353 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
266ef73c96
Коммит
160df1fcad
|
@ -62,7 +62,7 @@ AutoLockFile::AutoLockFile(const std::string &Filename) {
|
|||
|
||||
WaitForSingleObject(Handle, INFINITE);
|
||||
|
||||
FileDescriptor = _open(Filename.c_str(), _O_RDWR | _O_CREAT, 0666);
|
||||
FileDescriptor = _open(Filename.c_str(), _O_RDWR | _O_CREAT | _O_BINARY, 0666);
|
||||
}
|
||||
|
||||
AutoLockFile::~AutoLockFile() {
|
||||
|
|
|
@ -489,7 +489,7 @@ public:
|
|||
// there. This ensures that header files that are included multiple times
|
||||
// in different ways are analyzed completely.
|
||||
char Buffer[65536];
|
||||
FILE *Fp = Lock.openFile("r");
|
||||
FILE *Fp = Lock.openFile("rb");
|
||||
if (!Fp) {
|
||||
fprintf(stderr, "Unable to open input file %s\n", Filename.c_str());
|
||||
exit(1);
|
||||
|
@ -509,7 +509,7 @@ public:
|
|||
|
||||
// Overwrite the output file with the merged data. Since we have the lock,
|
||||
// this will happen atomically.
|
||||
Fp = Lock.openFile("w");
|
||||
Fp = Lock.openFile("wb");
|
||||
if (!Fp) {
|
||||
fprintf(stderr, "Unable to open output file %s\n", Filename.c_str());
|
||||
exit(1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче