gthumb r2217 - in trunk: . libgthumb



Author: mjc
Date: Fri Jan 25 16:03:12 2008
New Revision: 2217
URL: http://svn.gnome.org/viewvc/gthumb?rev=2217&view=rev

Log:
2008-01-25  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/gth-exiv2-utils.cpp:
        Do not show fractional representation if denominator = 1.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/gth-exiv2-utils.cpp

Modified: trunk/libgthumb/gth-exiv2-utils.cpp
==============================================================================
--- trunk/libgthumb/gth-exiv2-utils.cpp	(original)
+++ trunk/libgthumb/gth-exiv2-utils.cpp	Fri Jan 25 16:03:12 2008
@@ -349,8 +349,15 @@
 		stringstream stream;
 		for (int i(0); i < res.size(); ++i) {
 			int a, b;
-			if (sscanf ( res[i].c_str(), "%d/%d", &a, &b) == 2)
-				stream << (float)a/(float)b << " (" << res[i] << ") "; 
+			if (sscanf ( res[i].c_str(), "%d/%d", &a, &b) == 2) {
+				// Convert fractional data like 123/246 to a decimal
+				// value like 0.5.
+				stream << (float)a/(float)b << " ";
+				if (b != 1) 
+					// Include the original fraction, unless the
+					// denominator was "1".
+					stream << "(" << res[i] << ") "; 
+			}
 			else stream << res[i] << " ";
 		}
 		value = stream.str() + value;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]