Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > media > main-backports-src > by-pkgid > 722cfb79b749133e9bf9829ecfbb4315 > files > 2

gwenview-1.4.2-8mdv2008.0.src.rpm

Index: imageutils/jpegcontent.cpp
===================================================================
--- imageutils/jpegcontent.cpp	(revisione 787661)
+++ imageutils/jpegcontent.cpp	(copia locale)
@@ -330,11 +330,16 @@
 	//         3 = centimeters
 	//         Other = reserved
 	const float INCHESPERMETER = (100. / 2.54); 
+	Exiv2::Rational r = it->toRational();
+	if (r.second == 0) {
+		// a rational with 0 as second will make hang toLong() conversion
+		r.second = 1;
+	}
 	switch (res) {
 	case 3:  // dots per cm 
-		return (it->toLong() * 100); 
+		return int(float(r.first) * 100 / float(r.second)); 
 	default:  // dots per inch 
-		return (it->toLong() * INCHESPERMETER); 
+		return int(float(r.first) * INCHESPERMETER / float(r.second)); 
 	}
 
 	return 0;