From 4838122a7e57281b0f69e136d50f4ade552d2088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Fri, 5 Jun 2015 06:31:20 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@140 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- CMakeLists.txt | 5 ++++- src/core/piobject.h | 6 +++--- src/io/pibasetransfer.cpp | 2 +- src/io/pifile.cpp | 12 +++++++++--- src/math/pimathbase.h | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c64ba959..6870001d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,9 @@ endif () # Add library +if (${APPLE}) + add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) +endif (${APPLE}) if (${WIN32}) list(APPEND LIBS ws2_32 Iphlpapi Psapi) #execute_process(COMMAND "make_rc_win.bat" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_QUIET) @@ -153,7 +156,7 @@ if (${WIN32}) #set(${CMAKE_CXX_FLAGS} "-O2") endif () else () - set(${CMAKE_CXX_FLAGS} "-O2") + set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -O2") if (DEFINED ENV{QNX_HOST}) list(APPEND LIBS socket dl) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32") diff --git a/src/core/piobject.h b/src/core/piobject.h index 483a9759..5ce5c09f 100755 --- a/src/core/piobject.h +++ b/src/core/piobject.h @@ -176,9 +176,9 @@ #else -#define __STR(x) #x -#define __SSTR(x) __STR(x) -#define LOCATION __FILE__ ":" __SSTR(__LINE__) +#define _PI_STR(x) #x +#define _PI_SSTR(x) _PI_STR(x) +#define LOCATION __FILE__ ":" _PI_SSTR(__LINE__) #define PIOBJECT(name) \ diff --git a/src/io/pibasetransfer.cpp b/src/io/pibasetransfer.cpp index b80e3e3c..5bb2bcf9 100644 --- a/src/io/pibasetransfer.cpp +++ b/src/io/pibasetransfer.cpp @@ -94,7 +94,7 @@ void PIBaseTransfer::received(PIByteArray data) { } replies_cnt++; if (is_sending) { - if (h.id >= 0 && h.id < replies.size()) + if (h.id < replies.size()) replies[h.id] = pt; } if (is_receiving && h.id == 0) { diff --git a/src/io/pifile.cpp b/src/io/pifile.cpp index 8253f986..51e5b2ca 100755 --- a/src/io/pifile.cpp +++ b/src/io/pifile.cpp @@ -47,9 +47,15 @@ # define _stat_call_ stat # define _stat_link_ lstat #else -# define _fopen_call_ fopen64 -# define _fseek_call_ fseeko64 -# define _ftell_call_ ftello64 +# if defined(MAC_OS) +# define _fopen_call_ fopen +# define _fseek_call_ fseek +# define _ftell_call_ ftell +# else +# define _fopen_call_ fopen64 +# define _fseek_call_ fseeko64 +# define _ftell_call_ ftello64 +# endif # define _stat_struct_ struct stat64 # define _stat_call_ stat64 # define _stat_link_ lstat64 diff --git a/src/math/pimathbase.h b/src/math/pimathbase.h index 203ac62f..290ddb87 100644 --- a/src/math/pimathbase.h +++ b/src/math/pimathbase.h @@ -162,7 +162,7 @@ inline PIVector abs(const PIVector & v) { PIVector result; result.resize(v.size()); for (uint i = 0; i < v.size(); i++) - result[i] = abs(v[i]); + result[i] = fabs(v[i]); return result; }