|
|
@ -209,18 +209,20 @@ namespace Exiv2 {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// http://dev.exiv2.org/boards/3/topics/1912?r=1915
|
|
|
|
// http://dev.exiv2.org/boards/3/topics/1912?r=1915
|
|
|
|
if ( std::tolower(is.peek()) == 'f' ) {
|
|
|
|
if ( std::tolower(is.peek()) == 'f' ) {
|
|
|
|
char F;
|
|
|
|
char F = 0;
|
|
|
|
float f;
|
|
|
|
float f = 0.f;
|
|
|
|
is >> F >> f ;
|
|
|
|
is >> F >> f ;
|
|
|
|
f = 2.0f * std::log(f) / std::log(2.0f) ;
|
|
|
|
f = 2.0f * std::log(f) / std::log(2.0f) ;
|
|
|
|
r = Exiv2::floatToRationalCast(f);
|
|
|
|
r = Exiv2::floatToRationalCast(f);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
int32_t nominator;
|
|
|
|
int32_t nominator = 0;
|
|
|
|
int32_t denominator;
|
|
|
|
int32_t denominator = 0;
|
|
|
|
char c('\0');
|
|
|
|
char c('\0');
|
|
|
|
is >> nominator >> c >> denominator;
|
|
|
|
is >> nominator >> c >> denominator;
|
|
|
|
if (c != '/') is.setstate(std::ios::failbit);
|
|
|
|
if (c != '/')
|
|
|
|
if (is) r = std::make_pair(nominator, denominator);
|
|
|
|
is.setstate(std::ios::failbit);
|
|
|
|
|
|
|
|
if (is)
|
|
|
|
|
|
|
|
r = std::make_pair(nominator, denominator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return is;
|
|
|
|
return is;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -233,19 +235,22 @@ namespace Exiv2 {
|
|
|
|
std::istream& operator>>(std::istream& is, URational& r)
|
|
|
|
std::istream& operator>>(std::istream& is, URational& r)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// http://dev.exiv2.org/boards/3/topics/1912?r=1915
|
|
|
|
// http://dev.exiv2.org/boards/3/topics/1912?r=1915
|
|
|
|
|
|
|
|
/// \todo This implementation seems to be duplicated for the Rational type. Try to remove duplication
|
|
|
|
if ( std::tolower(is.peek()) == 'f' ) {
|
|
|
|
if ( std::tolower(is.peek()) == 'f' ) {
|
|
|
|
char F;
|
|
|
|
char F = 0;
|
|
|
|
float f;
|
|
|
|
float f = 0.f;
|
|
|
|
is >> F >> f ;
|
|
|
|
is >> F >> f ;
|
|
|
|
f = 2.0f * std::log(f) / std::log(2.0f) ;
|
|
|
|
f = 2.0f * std::log(f) / std::log(2.0f) ;
|
|
|
|
r = Exiv2::floatToRationalCast(f);
|
|
|
|
r = Exiv2::floatToRationalCast(f);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
uint32_t nominator;
|
|
|
|
uint32_t nominator = 0;
|
|
|
|
uint32_t denominator;
|
|
|
|
uint32_t denominator = 0;
|
|
|
|
char c('\0');
|
|
|
|
char c('\0');
|
|
|
|
is >> nominator >> c >> denominator;
|
|
|
|
is >> nominator >> c >> denominator;
|
|
|
|
if (c != '/') is.setstate(std::ios::failbit);
|
|
|
|
if (c != '/')
|
|
|
|
if (is) r = std::make_pair(nominator, denominator);
|
|
|
|
is.setstate(std::ios::failbit);
|
|
|
|
|
|
|
|
if (is)
|
|
|
|
|
|
|
|
r = std::make_pair(nominator, denominator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return is;
|
|
|
|
return is;
|
|
|
|
}
|
|
|
|
}
|
|
|
|