diff options
author | Chris Xiong <chirs241097@gmail.com> | 2017-02-01 17:48:03 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2017-02-01 17:48:03 +0800 |
commit | eddc629bd637ec5d9260849d095b6951a437360d (patch) | |
tree | 98fd45c4b4e2ed3bdcc213722de76df0decd3b18 /core | |
parent | 8a0d671e1a77c58142d0cbe82f40ee64bcae2be5 (diff) | |
download | QMidiPlayer-eddc629bd637ec5d9260849d095b6951a437360d.tar.xz |
Make packaging qmidiplayer less painful.
Add mime info.
Do not throw integers.
Fix incorrect font paths in Arch Linux.
Diffstat (limited to 'core')
-rw-r--r-- | core/qmpmidiread.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp index a8bdabb..dc58ecc 100644 --- a/core/qmpmidiread.cpp +++ b/core/qmpmidiread.cpp @@ -18,7 +18,7 @@ void CMidiFile::error(int fatal,const char* format,...) va_list ap; va_start(ap,format);vfprintf(stderr,format,ap);va_end(ap); fprintf(stderr," at %#lx\n",ftell(f)); - if(fatal)throw 2; + if(fatal)throw std::runtime_error("fatal error"); } uint32_t CMidiFile::readSW() { @@ -209,7 +209,7 @@ int CMidiFile::chunkReader(int hdrXp) char hdr[6]; if(!fgets(hdr,5,f))error(1,"E: Unexpected EOF."); if(hdrXp) - if(strncmp(hdr,"MThd",4)){error(1,"E: Wrong MIDI header.");throw 1;} + if(strncmp(hdr,"MThd",4)){error(1,"E: Wrong MIDI header.");throw std::runtime_error("Wrong MIDI header");} else return headerChunkReader(),0; else if(strncmp(hdr,"MTrk",4)) @@ -236,14 +236,14 @@ CMidiFile::CMidiFile(const char* fn,CMidiPlayer* par) memcpy(eventReaderCBuserdata,par->eventReaderCBuserdata,sizeof(eventReaderCBuserdata)); try { - if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),2); + if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),std::runtime_error("File doesn't exist")); chunkReader(1); for(uint32_t i=0;i<trk;i+=chunkReader(0)); fclose(f); std::sort(eventList.begin(),eventList.end(),cmp); par->maxtk=eventList[eventList.size()-1]->time; } - catch(int&){fprintf(stderr,"E: %s is not a supported file.\n",fn);valid=0;} + catch(std::runtime_error&){fprintf(stderr,"E: %s is not a supported file.\n",fn);valid=0;} } CMidiFile::~CMidiFile() { |