mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Config: remove flawed qstring_data_copy and add toUtf8() macro
This commit is contained in:
parent
357691bad5
commit
389ef2aea9
@ -34,6 +34,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
#include "Config.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define QT_TO_UTF8(str) str.toUtf8().constData()
|
||||
|
||||
Config* Config::_instance = new Config();
|
||||
|
||||
Config::Config() :
|
||||
@ -62,9 +64,9 @@ Config::Config() :
|
||||
config_set_default_bool(obsConfig,
|
||||
SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
|
||||
config_set_default_string(obsConfig,
|
||||
SECTION_NAME, PARAM_SECRET, qstring_data_copy(Secret));
|
||||
SECTION_NAME, PARAM_SECRET, QT_TO_UTF8(Secret));
|
||||
config_set_default_string(obsConfig,
|
||||
SECTION_NAME, PARAM_SALT, qstring_data_copy(Salt));
|
||||
SECTION_NAME, PARAM_SALT, QT_TO_UTF8(Salt));
|
||||
}
|
||||
|
||||
mbedtls_entropy_init(&entropy);
|
||||
@ -104,9 +106,9 @@ void Config::Save() {
|
||||
|
||||
config_set_bool(obsConfig, SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
|
||||
config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET,
|
||||
qstring_data_copy(Secret));
|
||||
QT_TO_UTF8(Secret));
|
||||
config_set_string(obsConfig, SECTION_NAME, PARAM_SALT,
|
||||
qstring_data_copy(Salt));
|
||||
QT_TO_UTF8(Salt));
|
||||
|
||||
config_save(obsConfig);
|
||||
}
|
||||
|
@ -28,13 +28,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
|
||||
Q_DECLARE_METATYPE(OBSScene);
|
||||
|
||||
const char* qstring_data_copy(QString value) {
|
||||
QByteArray stringData = value.toUtf8();
|
||||
const char* constStringData = new const char[stringData.size()]();
|
||||
memcpy((void*)constStringData, stringData.constData(), stringData.size());
|
||||
return constStringData;
|
||||
}
|
||||
|
||||
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
|
||||
if (!strings)
|
||||
return obs_data_array_create();
|
||||
|
@ -32,8 +32,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
#include <obs-module.h>
|
||||
#include <util/config-file.h>
|
||||
|
||||
const char* qstring_data_copy(QString value);
|
||||
|
||||
class Utils {
|
||||
public:
|
||||
static obs_data_array_t* StringListToArray(char** strings, char* key);
|
||||
|
@ -22,7 +22,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
#include "../Config.h"
|
||||
#include "../WSServer.h"
|
||||
#include "settings-dialog.h"
|
||||
#include "ui_settings-dialog.h"
|
||||
|
||||
#define CHANGE_ME "changeme"
|
||||
|
||||
|
@ -21,9 +21,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SettingsDialog;
|
||||
}
|
||||
#include "ui_settings-dialog.h"
|
||||
|
||||
class SettingsDialog : public QDialog
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user