Skip to content

Commit

Permalink
Merge pull request #177 from kanurag94/png-patch
Browse files Browse the repository at this point in the history
Fix saving image on Mac in 4.1pre1
  • Loading branch information
kovzol authored Jun 28, 2020
2 parents 47aabbd + 32de523 commit db17a90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/ui-hlp/ui_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,9 @@ void uih_loadpngfile(struct uih_context *c, xio_constpath d)
uih_error(c, TR("Error", "Could not open image"));
return;
}
char filepath[4096];
int pathlength = strlen(d) + 16;
static char* filepath;
filepath = (char* )malloc(pathlength * sizeof (char));
strcpy(filepath, xio_getdirectory(d));
strcat(filepath, ".xaos_temp.xpf");
uih_loadfile(c, filepath);
Expand Down Expand Up @@ -661,7 +663,9 @@ void uih_savepngfile(struct uih_context *c, xio_constpath d)
return;
}
c->errstring = NULL;
char filepath[4096];
int pathlength = strlen(d) + 16;
static char* filepath;
filepath = (char* )malloc(pathlength * sizeof (char));
strcpy(filepath, xio_getdirectory(d));
strcat(filepath, ".xaos_temp.xpf");
uih_saveposfile(c, filepath);
Expand Down
8 changes: 6 additions & 2 deletions src/ui/image_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ int xtextcharw(struct image */*image*/, void *font, const char c)
const char *writepng(xio_constpath filename, const struct image *image)
{
QImage *qimage = reinterpret_cast<QImage **>(image->data)[image->currimage];
char filepath[4096];
int pathlength = strlen(filename) + 16;
static char* filepath;
filepath = (char* )malloc(pathlength * sizeof (char));
strcpy(filepath, xio_getdirectory(filename));
strcat(filepath, ".xaos_temp.xpf");
QFile f(filepath);
Expand Down Expand Up @@ -93,7 +95,9 @@ const char *readpng(xio_constpath filename)
if(xpf_chunk.isNull() || xpf_chunk.isEmpty()) {
return "Not valid image";
}
char filepath[4096];
int pathlength = strlen(filename) + 16;
static char* filepath;
filepath = (char* )malloc(pathlength * sizeof (char));
strcpy(filepath, xio_getdirectory(filename));
strcat(filepath, ".xaos_temp.xpf");
QFile f(filepath);
Expand Down

0 comments on commit db17a90

Please sign in to comment.