ConfigMgr: properly write configuration file if it contains non-ASCII chars

There has been a problem UTF-8 characters in the configuration file
since 2006 (!), as the length of the data to be written was mis-
calculated. We can omit the specification of the data length at all
when just passing a QByteArray object to QFile::write().

Fixes setup dialog appearing each start if one of the configured paths
in the setup dialog contains non-ASCII characters.

Closes #3348920, #3017409, #2812054.
This commit is contained in:
Tobias Doerffel
2011-07-02 13:29:22 +02:00
parent 7b31be67ac
commit 4d473a36fb

View File

@@ -1,10 +1,8 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* config_mgr.cpp - implementation of class configManager
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* Copyright (c) 2005-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -24,7 +22,6 @@
*
*/
#include <QtXml/QDomElement>
#include <QtCore/QDir>
#include <QtCore/QFile>
@@ -454,10 +451,8 @@ void configManager::saveConfigFile()
return;
}
outfile.write( xml.toUtf8().constData(), xml.length() );
outfile.write( xml.toUtf8() );
outfile.close();
}
#endif