Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix file name encoding issues with ZynAddSubFX on Windows
  • Loading branch information
PhysSong committed Jul 5, 2018
commit 9d0aae2708aed2fc0a18b16f31fef05f2496fd26
19 changes: 12 additions & 7 deletions plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@
#include <sstream>
#include <cstdarg>
#include <zlib.h>
#include "lmmsconfig.h"
#include "../globals.h"
#include "Util.h"

// Include LMMS headers
#include "lmmsconfig.h"
#include "IoHelper.h"


struct XmlData
{
Expand Down Expand Up @@ -193,11 +196,12 @@ int QtXmlWrapper::dosavefile(const char *filename,
int compression,
const char *xmldata) const
{
FILE *file = F_OPEN_UTF8(std::string(filename), "w");
if(file == NULL) {
return -1;
}

if(compression == 0) {
FILE *file;
file = fopen(filename, "w");
if(file == NULL)
return -1;
fputs(xmldata, file);
fclose(file);
}
Expand All @@ -210,7 +214,7 @@ int QtXmlWrapper::dosavefile(const char *filename,
snprintf(options, 10, "wb%d", compression);

gzFile gzfile;
gzfile = gzopen(filename, options);
gzfile = gzdopen(fileToDescriptor(file), options);
if(gzfile == NULL)
return -1;
gzputs(gzfile, xmldata);
Expand Down Expand Up @@ -313,7 +317,8 @@ int QtXmlWrapper::loadXMLfile(const std::string &filename)
char *QtXmlWrapper::doloadfile(const std::string &filename) const
{
char *xmldata = NULL;
gzFile gzfile = gzopen(filename.c_str(), "rb");

gzFile gzfile = gzdopen(fileToDescriptor(F_OPEN_UTF8(filename, "rb")), "rb");

if(gzfile != NULL) { //The possibly compressed file opened
std::stringstream strBuf; //reading stream
Expand Down