File tree Expand file tree Collapse file tree
plugins/zynaddsubfx/zynaddsubfx/src/Misc Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555#include < sstream>
5656#include < cstdarg>
5757#include < zlib.h>
58- #include " lmmsconfig.h"
5958#include " ../globals.h"
6059#include " Util.h"
6160
61+ // Include LMMS headers
62+ #include " lmmsconfig.h"
63+ #include " IoHelper.h"
64+
6265
6366struct XmlData
6467{
@@ -193,11 +196,12 @@ int QtXmlWrapper::dosavefile(const char *filename,
193196 int compression,
194197 const char *xmldata) const
195198{
199+ FILE *file = F_OPEN_UTF8 (std::string (filename), " w" );
200+ if (file == NULL ) {
201+ return -1 ;
202+ }
203+
196204 if (compression == 0 ) {
197- FILE *file;
198- file = fopen (filename, " w" );
199- if (file == NULL )
200- return -1 ;
201205 fputs (xmldata, file);
202206 fclose (file);
203207 }
@@ -210,7 +214,7 @@ int QtXmlWrapper::dosavefile(const char *filename,
210214 snprintf (options, 10 , " wb%d" , compression);
211215
212216 gzFile gzfile;
213- gzfile = gzopen (filename , options);
217+ gzfile = gzdopen ( fileToDescriptor (file) , options);
214218 if (gzfile == NULL )
215219 return -1 ;
216220 gzputs (gzfile, xmldata);
@@ -313,7 +317,8 @@ int QtXmlWrapper::loadXMLfile(const std::string &filename)
313317char *QtXmlWrapper::doloadfile (const std::string &filename) const
314318{
315319 char *xmldata = NULL ;
316- gzFile gzfile = gzopen (filename.c_str (), " rb" );
320+
321+ gzFile gzfile = gzdopen (fileToDescriptor (F_OPEN_UTF8 (filename, " rb" )), " rb" );
317322
318323 if (gzfile != NULL ) { // The possibly compressed file opened
319324 std::stringstream strBuf; // reading stream
You can’t perform that action at this time.
0 commit comments