View Single Post
Old 09-23-2014, 08:16 AM   #19
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,711
Default

Quote:
Originally Posted by Alkamist View Post
Code:
    std::cout << myfile.tellg() << std::endl;
    delete[] mChunkID;
    delete[] mChunkSize;
    myfile.close();
    if (!strcmp(mChunkID, "RIFF")){} 
    else
      std::cerr << "Error: not a RIFF file" << std::endl;
You have undefined behavior there. (Which does NOT mean you will get a crash for sure, undefined behavior is much worse, anything can happen...) You delete the mChunkID buffer, yet call strcmp() on it after that.

I noticed you already used std::vectors elsewhere in your code, so why are you not using those instead of the nasty new-allocated buffers here too?
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote