Patch: Forum Topic 1177. Thanks very much to James for providing this.

This commit is contained in:
Robin Mills 2013-04-17 04:14:05 +00:00
parent 3967abf862
commit a7d516b072
8 changed files with 72 additions and 9 deletions

View File

@ -53,7 +53,8 @@ OPTION( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests"
OPTION( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF )
IF( MINGW OR UNIX )
ADD_DEFINITIONS(-Wall
IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" )
ADD_DEFINITIONS(-Wall
-Wcast-align
-Wpointer-arith
-Wformat-security
@ -61,6 +62,7 @@ IF( MINGW OR UNIX )
-Woverloaded-virtual
-W
)
ENDIF()
ENDIF( MINGW OR UNIX )

View File

@ -246,3 +246,20 @@ typedef int pid_t;
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
# pragma warning(disable : 4996 4251)
#endif
/*
If you're using Solaris and the Solaris Studio compiler, then you really
do need to use -library=stdcxx4 along with these inclusions below
*/
#if defined(OS_SOLARIS)
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <math.h>
#if defined(__cplusplus)
#include <ios>
#include <fstream>
#endif
#endif

View File

@ -246,3 +246,20 @@
#else
# define EXIV2API
#endif /* ! EXV_HAVE_DLL */
/*
If you're using Solaris and the Solaris Studio compiler, then you really
do need to use -library=stdcxx4 along with these inclusions below
*/
#if defined(OS_SOLARIS)
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <math.h>
#if defined(__cplusplus)
#include <ios>
#include <fstream>
#endif
#endif

View File

@ -404,17 +404,22 @@ int timeZoneAdjust()
{
time_t now = time(NULL);
struct tm local = *localtime(&now) ;
int offset;
#if defined(_MSC_VER)
TIME_ZONE_INFORMATION TimeZoneInfo;
GetTimeZoneInformation( &TimeZoneInfo );
int offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60);
offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60);
#elif defined(__CYGWIN__)
struct tm lcopy = *localtime(&now);
time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy, so don't use local
int offset = (int) ( ((long signed int) gmt) - ((long signed int) now) ) ;
offset = (int) ( ((long signed int) gmt) - ((long signed int) now) ) ;
#elif defined(OS_SOLARIS)
time_t local_tt = (int) mktime(&local);
time_t time_gmt = (int) mktime(gmtime(&now));
offset = time_gmt - local_tt;
#else
int offset = local.tm_gmtoff ;
offset = local.tm_gmtoff ;
#endif
#if 0

View File

@ -457,7 +457,7 @@ namespace Exiv2 {
int64_t temp = 0;
for(int i = size-1; i >= 0; i--) {
temp = temp + static_cast<int64_t>(buf[i]*(pow(256.0, size-i-1)));
temp = temp + static_cast<int64_t>(buf[i]*(pow(256.0, (double)size-i-1)));
}
// Todo: remove debug output
// std::cerr << "size = " << size << ", val = " << temp << std::hex << " (0x" << temp << std::dec << ")";

View File

@ -1,4 +1,4 @@
// ***************************************************************** -*- C++ -*-
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2012 Andreas Huggel <ahuggel@gmx.net>
*
@ -559,7 +559,7 @@ namespace Exiv2 {
#ifdef _MSC_VER
temp = temp + static_cast<int64_t>(buf.pData_[i]*(pow(static_cast<float>(256), n-i-1)));
#else
temp = temp + buf.pData_[i]*(pow(256,n-i-1));
temp = temp + buf.pData_[i]*(pow((float)256,n-i-1));
#endif
return temp;
@ -577,7 +577,7 @@ namespace Exiv2 {
#if _MSC_VER
temp = temp + static_cast<uint64_t>(buf.pData_[i]*(pow(static_cast<float>(256), n-i-1)));
#else
temp = temp + buf.pData_[i]*(pow(256,n-i-1));
temp = temp + buf.pData_[i]*(pow((float)256,n-i-1));
#endif
return temp;

View File

@ -55,7 +55,8 @@
#ifndef __clang__
#define EXIV2_RCSID(id) \
namespace { \
// namespace { \
{ \
inline const char* getRcsId(const char*) { return id ; } \
const char* rcsId = getRcsId(rcsId); \
}

View File

@ -27,7 +27,11 @@
// macros with 0 or 1 values.
/* 20-Oct-07, ahu: Determine the platform, set the above defines accordingly. */
#if !defined(_FILE_OFFSET_BITS)
#define _FILE_OFFSET_BITS 64
#endif
#if defined __CYGWIN32__ && !defined __CYGWIN__
/* For backwards compatibility with Cygwin b19 and
earlier, we define __CYGWIN__ here, so that
@ -139,3 +143,20 @@
// =================================================================================================
#endif // __XMP_Environment_h__
/*
If you're using Solaris and the Solaris Studio compiler, then you really
do need to use -library=stdcxx4 along with these inclusions below
*/
#if defined(OS_SOLARIS)
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <math.h>
#if defined(__cplusplus)
#include <ios>
#include <fstream>
#endif
#endif