diff --git a/src/value.cpp b/src/value.cpp index 1748bcfd..7f243022 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -20,14 +20,14 @@ */ /* File: value.cpp - Version: $Name: $ $Revision: 1.6 $ + Version: $Name: $ $Revision: 1.7 $ Author(s): Andreas Huggel (ahu) History: 26-Jan-04, ahu: created 11-Feb-04, ahu: isolated as a component */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.6 $ $RCSfile: value.cpp,v $") +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.7 $ $RCSfile: value.cpp,v $") // ***************************************************************************** // included header files @@ -120,19 +120,19 @@ namespace Exiv2 { int tmp; value_.clear(); while (is >> tmp) { - value_ += (char)tmp; + value_ += static_cast(tmp); } } long DataValue::copy(char* buf, ByteOrder byteOrder) const { // byteOrder not needed - return value_.copy(buf, value_.size()); + return static_cast(value_.copy(buf, value_.size())); } long DataValue::size() const { - return value_.size(); + return static_cast(value_.size()); } DataValue* DataValue::clone() const @@ -144,7 +144,8 @@ namespace Exiv2 { { std::string::size_type end = value_.size(); for (std::string::size_type i = 0; i != end; ++i) { - os << (int)(unsigned char)value_[i] << " "; + os << static_cast(static_cast(value_[i])) + << " "; } return os; } @@ -172,12 +173,12 @@ namespace Exiv2 { long AsciiValue::copy(char* buf, ByteOrder byteOrder) const { // byteOrder not needed - return value_.copy(buf, value_.size()); + return static_cast(value_.copy(buf, value_.size())); } long AsciiValue::size() const { - return value_.size(); + return static_cast(value_.size()); } AsciiValue* AsciiValue::clone() const diff --git a/src/value.hpp b/src/value.hpp index b3ea9a23..767e9ac4 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -21,7 +21,7 @@ /*! @file value.hpp @brief Value interface and concrete subclasses - @version $Name: $ $Revision: 1.9 $ + @version $Name: $ $Revision: 1.10 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 09-Jan-04, ahu: created @@ -90,7 +90,7 @@ namespace Exiv2 { //! @name Accessors //@{ //! Return the type identifier (Exif data format type). - TypeId typeId() const { return TypeId(type_); } + TypeId typeId() const { return type_; } /*! @brief Return the value as a string. Implemented in terms of write(std::ostream& os) const of the concrete class. @@ -183,7 +183,7 @@ namespace Exiv2 { Value& operator=(const Value& rhs); private: - uint16 type_; //!< Type of the data + TypeId type_; //!< Type of the data }; // class Value @@ -379,7 +379,7 @@ namespace Exiv2 { //! @name Accessors //@{ virtual long copy(char* buf, ByteOrder byteOrder) const; - virtual long count() const { return value_.size(); } + virtual long count() const { return static_cast(value_.size()); } virtual long size() const; virtual ValueType* clone() const; virtual std::ostream& write(std::ostream& os) const; @@ -581,7 +581,7 @@ namespace Exiv2 { template long ValueType::size() const { - return TypeInfo::typeSize(typeId()) * value_.size(); + return static_cast(TypeInfo::typeSize(typeId()) * value_.size()); } template @@ -623,19 +623,19 @@ namespace Exiv2 { template inline float ValueType::toFloat(long n) const { - return value_[n]; + return static_cast(value_[n]); } // Specialization for rational template<> inline float ValueType::toFloat(long n) const { - return (float)value_[n].first / value_[n].second; + return static_cast(value_[n].first / value_[n].second); } // Specialization for unsigned rational template<> inline float ValueType::toFloat(long n) const { - return (float)value_[n].first / value_[n].second; + return static_cast(value_[n].first / value_[n].second); } // Default implementation template @@ -655,7 +655,7 @@ namespace Exiv2 { { return Rational(value_[n].first, value_[n].second); } - + } // namespace Exiv2 #endif // #ifndef VALUE_HPP_