mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
add instrument read error messages
This commit is contained in:
parent
28a0f8775f
commit
17ca6402d3
1 changed files with 6 additions and 0 deletions
|
@ -4299,30 +4299,36 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
||||||
warnings="";
|
warnings="";
|
||||||
FILE* f=ps_fopen(path,"rb");
|
FILE* f=ps_fopen(path,"rb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
|
lastError=strerror(errno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
if (fseek(f,0,SEEK_END)!=0) {
|
if (fseek(f,0,SEEK_END)!=0) {
|
||||||
|
lastError=strerror(errno);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
len=ftell(f);
|
len=ftell(f);
|
||||||
if (len<0) {
|
if (len<0) {
|
||||||
|
lastError=strerror(errno);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (len==0) {
|
if (len==0) {
|
||||||
|
lastError=strerror(errno);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fseek(f,0,SEEK_SET)!=0) {
|
if (fseek(f,0,SEEK_SET)!=0) {
|
||||||
|
lastError=strerror(errno);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buf=new unsigned char[len];
|
buf=new unsigned char[len];
|
||||||
if (fread(buf,1,len,f)!=(size_t)len) {
|
if (fread(buf,1,len,f)!=(size_t)len) {
|
||||||
logW("did not read entire instrument file buffer!\n");
|
logW("did not read entire instrument file buffer!\n");
|
||||||
|
lastError="did not read entire instrument file!";
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue