gthumb r2216 - in trunk: . libgthumb
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2216 - in trunk: . libgthumb
- Date: Fri, 25 Jan 2008 15:55:42 +0000 (GMT)
Author: mjc
Date: Fri Jan 25 15:55:42 2008
New Revision: 2216
URL: http://svn.gnome.org/viewvc/gthumb?rev=2216&view=rev
Log:
2008-01-25 Michael J. Chudobiak <mjc svn gnome org>
* libgthumb/gth-exiv2-utils.cpp:
Provide both decimal and fractional representations of numeric
exif values, if the raw value is fractional.
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 15:55:42 2008
@@ -331,14 +331,14 @@
/* Exiv2 sometimes reports numeric values in a fractional
form, like "28/5". This function converts such fractions
to a more user-friendly decimal form (e.g., 5.6). */
-string improve(string value) {
+string improve (string value) {
if (value.find('/') != value.npos) {
vector<string> res;
int cut;
while( (cut = value.find_first_of(" ")) != value.npos ) {
if(cut > 0) {
- res.push_back(value.substr(0,cut));
+ res.push_back(value.substr(0,cut));
}
value = value.substr(cut+1);
}
@@ -350,7 +350,7 @@
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 << " ";
+ stream << (float)a/(float)b << " (" << res[i] << ") ";
else stream << res[i] << " ";
}
value = stream.str() + value;
@@ -474,7 +474,7 @@
stringstream short_name;
short_name << md->groupName() << "." << md->tagName();
- metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), value.str().c_str(), cat, 0);
+ metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), improve(value.str()).c_str(), cat, 0);
}
}
#endif
@@ -519,7 +519,7 @@
stringstream short_name;
short_name << md->groupName() << "." << md->tagName();
- metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), value.str().c_str(), cat, 0);
+ metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), improve(value.str()).c_str(), cat, 0);
}
}
Exiv2::XmpParser::terminate();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]