diff -r 41300fa6a67c -r 2f34d5167611 tools/linguist/shared/translator.cpp --- a/tools/linguist/shared/translator.cpp Tue Feb 02 00:43:10 2010 +0200 +++ b/tools/linguist/shared/translator.cpp Fri Apr 16 15:50:13 2010 +0300 @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -44,6 +44,10 @@ #include "simtexth.h" #include +#ifdef Q_OS_WIN +#include // required for _setmode, to avoid _O_TEXT streams... +#include // for _O_BINARY +#endif #include #include @@ -207,6 +211,10 @@ QFile file; if (filename.isEmpty() || filename == QLatin1String("-")) { +#ifdef Q_OS_WIN + // QFile is broken for text files + ::_setmode(0, _O_BINARY); +#endif if (!file.open(stdin, QIODevice::ReadOnly)) { cd.appendError(QString::fromLatin1("Cannot open stdin!? (%1)") .arg(file.errorString())); @@ -243,6 +251,10 @@ { QFile file; if (filename.isEmpty() || filename == QLatin1String("-")) { +#ifdef Q_OS_WIN + // QFile is broken for text files + ::_setmode(1, _O_BINARY); +#endif if (!file.open(stdout, QIODevice::WriteOnly)) { cd.appendError(QString::fromLatin1("Cannot open stdout!? (%1)") .arg(file.errorString()));