MSVC/video port. Fixing code to build on Linux (and Cygwin).

This commit is contained in:
Robin Mills 2012-09-20 04:18:42 +00:00
parent 6ca49acd13
commit 159b2d285b
5 changed files with 35 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exiv2lib", "exiv2lib\exiv2lib.vcproj", "{831EF580-92C8-4CA8-B0CE-3D906280A54D}"
ProjectSection(ProjectDependencies) = postProject
{09877CF4-83B6-44FE-A2E2-629AA5C8093E} = {09877CF4-83B6-44FE-A2E2-629AA5C8093E}
{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A} = {6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}
{8308C68D-E12B-4C71-96F4-7137F6BEB654} = {8308C68D-E12B-4C71-96F4-7137F6BEB654}
{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A} = {6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}
{09877CF4-83B6-44FE-A2E2-629AA5C8093E} = {09877CF4-83B6-44FE-A2E2-629AA5C8093E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exiv2", "exiv2\exiv2.vcproj", "{07293CAC-00DA-493E-90C9-5D010C2B1B53}"
@ -14,8 +14,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exiv2", "exiv2\exiv2.vcproj
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmpsdk", "xmpsdk\xmpsdk.vcproj", "{09877CF4-83B6-44FE-A2E2-629AA5C8093E}"
ProjectSection(ProjectDependencies) = postProject
{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A} = {6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}
{8308C68D-E12B-4C71-96F4-7137F6BEB654} = {8308C68D-E12B-4C71-96F4-7137F6BEB654}
{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A} = {6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat", "expat\expat.vcproj", "{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}"
@ -155,6 +155,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geotag", "geotag\geotag.vcproj", "{E3073076-4837-4DDB-89E5-5AC297C7481D}"
ProjectSection(ProjectDependencies) = postProject
{831EF580-92C8-4CA8-B0CE-3D906280A54D} = {831EF580-92C8-4CA8-B0CE-3D906280A54D}
{6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A} = {6C4C06A3-6F8F-4067-AA4C-D5F41E1FFF9A}
EndProjectSection
EndProject
Global

View File

@ -259,8 +259,12 @@ namespace Exiv2 {
return ret;
} // FileIo::Impl::stat
#if defined(__APPLE__)
void FileIo::Impl::copyXattrFrom(const FileIo& src)
{
#else
void FileIo::Impl::copyXattrFrom(const FileIo&)
#endif
{
#if defined(__APPLE__)
# if defined(EXV_UNICODE_PATH)
# error No xattr API for MacOS X with unicode support
@ -833,6 +837,7 @@ namespace Exiv2 {
return std::fseek(p_->fp_, offset, fileSeek);
}
#if defined(_MSC_VER)
int FileIo::seek( uint64_t offset, Position pos )
{
assert(p_->fp_ != 0);
@ -845,12 +850,13 @@ namespace Exiv2 {
}
if (p_->switchMode(Impl::opSeek) != 0) return 1;
#ifdef _MSC_VER
#ifdef _WIN64
return _fseeki64(p_->fp_, offset, fileSeek);
#else
return std::fseeko(p_->fp_, offset, fileSeek);
return std::fseek(p_->fp_,static_cast<long>(offset), fileSeek);
#endif
}
#endif
long FileIo::tell() const
{
@ -1141,6 +1147,7 @@ namespace Exiv2 {
return 0;
}
#if defined(_MSC_VER)
int MemIo::seek( uint64_t offset, Position pos )
{
uint64_t newIdx = 0;
@ -1151,11 +1158,12 @@ namespace Exiv2 {
case BasicIo::end: newIdx = p_->size_ + offset; break;
}
if (newIdx < 0 || newIdx > p_->size_) return 1;
if ( /*newIdx < 0 || */ newIdx > static_cast<uint64_t>(p_->size_) ) return 1;
p_->idx_ = static_cast<long>(newIdx); //not very sure about this. need more test!! - note by Shawn fly2xj@gmail.com //TODO
p_->eof_ = false;
return 0;
}
#endif
byte* MemIo::mmap(bool /*isWriteable*/)
{

View File

@ -170,7 +170,7 @@ namespace Exiv2 {
Nonzero if failure;
*/
virtual int seek(long offset, Position pos) = 0;
/*!
/*!
@brief Move the current IO position.
@param offset Number of bytes to move the position relative
to the starting position specified by \em pos
@ -178,13 +178,13 @@ namespace Exiv2 {
@return 0 if successful;<BR>
Nonzero if failure;
*/
#if defined(_MSC_VER)
virtual int seek(uint64_t offset, Position pos) = 0;
#if defined(_MSC_VER)// && defined(_WIN64)
int seek( int offset, Position pos)
{return seek(static_cast<long>(offset),pos);}
int seek(uint32_t offset, Position pos)
{return seek(static_cast<long>(offset),pos);}
int seek( int offset, Position pos)
{return seek(static_cast<long>(offset),pos);}
int seek(uint32_t offset, Position pos)
{return seek(static_cast<long>(offset),pos);}
#endif
/*!
@ -450,8 +450,10 @@ namespace Exiv2 {
@return 0 if successful;<BR>
Nonzero if failure;
*/
virtual int seek(uint64_t offset, Position pos);
/*!
#if defined(_MSC_VER)
virtual int seek(uint64_t offset, Position pos);
#endif
/*!
@brief Map the file into the process's address space. The file must be
open before mmap() is called. If the mapped area is writeable,
changes may not be written back to the underlying file until
@ -658,8 +660,9 @@ namespace Exiv2 {
@return 0 if successful;<BR>
Nonzero if failure;
*/
virtual int seek(long offset, Position pos);
/*!
virtual int seek(long offset, Position pos);
/*!
@brief Move the current IO position.
@param offset Number of bytes to move the IO position
relative to the starting position specified by \em pos
@ -667,8 +670,10 @@ namespace Exiv2 {
@return 0 if successful;<BR>
Nonzero if failure;
*/
#if defined(_MSC_VER)
virtual int seek(uint64_t offset, Position pos);
/*!
#endif
/*!
@brief Allow direct access to the underlying data buffer. The buffer
is not protected against write access in any way, the argument
is ignored.
@ -762,5 +767,4 @@ namespace Exiv2 {
#endif
} // namespace Exiv2
#endif // #ifndef BASICIO_HPP_

View File

@ -16,8 +16,9 @@ FOREACH(_currentfile ${XMPSRC})
ENDFOREACH(_currentfile ${XMPSRC})
IF( EXIV2_ENABLE_XMP AND EXIV2_ENABLE_LIBXMP )
ADD_LIBRARY( xmp STATIC ${XMPSRC} )
ADD_LIBRARY( xmp STATIC ${XMPSRC} ${EXPAT_LIBRARIES} )
GET_TARGET_PROPERTY( XMPLIB xmp LOCATION )
TARGET_LINK_LIBRARIES(xmp ${EXPAT_LIBRARIES})
# SET( XMPLIB ${XMPLIB} PARENT_SCOPE )
# INSTALL(TARGETS xmp ${INSTALL_TARGET_STANDARD_ARGS} )
ENDIF( EXIV2_ENABLE_XMP AND EXIV2_ENABLE_LIBXMP )