Int overflow detection for fractions + fix

This is a set of functions for int overflow in ReducedFraction class
(from 
https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow?showComments=false ),
and a fix of crash on import of a big MIDI file.
Int type is kept, no larger types are used.

The test MIDI file http://musescore.org/en/node/23481
is now imported without any crash or overflow:
https://drive.google.com/file/d/0B5alKuFoSol2Q0RPUHN6ME5ha3M/edit?usp=sharing