This commit is contained in:
tildearrow 2022-04-15 01:30:21 -05:00
parent 600c38543b
commit f9e9c6c179

View file

@ -1621,14 +1621,13 @@ int FurnaceGUI::load(String path) {
fclose(f); fclose(f);
return 1; return 1;
} }
unsigned char* file=new unsigned char[len];
if (fseek(f,0,SEEK_SET)<0) { if (fseek(f,0,SEEK_SET)<0) {
perror("size error"); perror("size error");
lastError=fmt::sprintf("on get size: %s",strerror(errno)); lastError=fmt::sprintf("on get size: %s",strerror(errno));
fclose(f); fclose(f);
delete[] file;
return 1; return 1;
} }
unsigned char* file=new unsigned char[len];
if (fread(file,1,(size_t)len,f)!=(size_t)len) { if (fread(file,1,(size_t)len,f)!=(size_t)len) {
perror("read error"); perror("read error");
lastError=fmt::sprintf("on read: %s",strerror(errno)); lastError=fmt::sprintf("on read: %s",strerror(errno));