diff --git a/build-windows/libpEpasn1/libpEpasn1.vcxproj b/build-windows/libpEpasn1/libpEpasn1.vcxproj index 7bd8f91d..b63f687d 100644 --- a/build-windows/libpEpasn1/libpEpasn1.vcxproj +++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj @@ -60,10 +60,6 @@ Windows - - cd "$(ProjectDir)..\.." && "$(ProjectDir)..\generate_code.cmd" - Generating Code for pEp Sync - @@ -81,10 +77,6 @@ true true - - cd "$(ProjectDir)..\.." && "$(ProjectDir)..\generate_code.cmd" - Generating Code for pEp Sync - @@ -227,4 +219,8 @@ + + + + \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index 4eb4f3c2..16df3b30 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,7 +28,7 @@ endif ifeq ($(BUILD_ON),Darwin) ifeq ($(BUILD_FOR),Darwin) CFLAGS+= -DSQLITE_THREADSAFE=1 - LDLIBS+= -lz -liconv + LDLIBS+= -lz -liconv -mmacosx-version-min=10.10 else $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON)) endif diff --git a/src/etpan_mime.c b/src/etpan_mime.c index 7f68eb07..cea42004 100644 --- a/src/etpan_mime.c +++ b/src/etpan_mime.c @@ -548,6 +548,12 @@ timestamp * etpantime_to_timestamp(const struct mailimf_date_time *et) result->tm_mon = et->dt_month - 1; result->tm_year = et->dt_year - 1900; result->tm_gmtoff = 36L * (long) et->dt_zone; + + // Normalize to UTC and then forget the offset. + time_t t = timegm_with_gmtoff(result); + gmtime_r(&t, result); + result->tm_gmtoff = 0; + return result; } diff --git a/src/pEpEngine.h b/src/pEpEngine.h index f4736789..b348df37 100644 --- a/src/pEpEngine.h +++ b/src/pEpEngine.h @@ -25,7 +25,7 @@ extern "C" { #define PEP_ENGINE_VERSION_MAJOR 2 #define PEP_ENGINE_VERSION_MINOR 1 #define PEP_ENGINE_VERSION_PATCH 0 -#define PEP_ENGINE_VERSION_RC 23 +#define PEP_ENGINE_VERSION_RC 25 #define PEP_OWN_USERID "pEp_own_userId" diff --git a/src/platform_windows.cpp b/src/platform_windows.cpp index 6d7321d3..10a7fbc3 100644 --- a/src/platform_windows.cpp +++ b/src/platform_windows.cpp @@ -406,6 +406,7 @@ DYNAMIC_API time_t timegm(timestamp *timeptr) if (!timeptr) return -1; + timeptr->tm_gmtoff = 0; time_t result = _mkgmtime((struct tm *) timeptr); if (result == -1) return -1; diff --git a/src/timestamp.c b/src/timestamp.c index 688221b3..3e9f6e60 100644 --- a/src/timestamp.c +++ b/src/timestamp.c @@ -10,12 +10,21 @@ #include -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts) +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts) { - const time_t raw_time = timegm(ts); + if (!ts) + return -1; + + timestamp *_ts = timestamp_dup(ts); + if (!_ts) + return -1; + + const time_t raw_time = timegm(_ts); if(raw_time==-1) return -1; - + + free_timestamp(_ts); + return raw_time - ts->tm_gmtoff; } @@ -44,11 +53,8 @@ DYNAMIC_API timestamp * timestamp_dup(const timestamp *src) if (!src) return NULL; - timestamp *dst = calloc(1, sizeof(timestamp)); - assert(dst); - if (!dst) - return NULL; - + timestamp *dst = (timestamp *) malloc(sizeof(timestamp)); memcpy(dst, src, sizeof(timestamp)); + return dst; } diff --git a/src/timestamp.h b/src/timestamp.h index 87538155..8989d4de 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -34,11 +34,11 @@ typedef struct tm timestamp; // timegm_with_gmtoff() - convert the broken-out time into time_t, and respect tm_gmtoff // // parameters: -// timeptr(inout) broken-out time; members will be "normalized" by this function. +// timeptr(in) broken-out time // // return value: // time_t that holds the usual "seconds since epoch" -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts); +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts); // new_timestamp() - allocate a new timestamp diff --git a/test/Makefile b/test/Makefile index fa5f973f..fff580de 100644 --- a/test/Makefile +++ b/test/Makefile @@ -16,7 +16,7 @@ SRCS:=$(wildcard src/*.cc) $(wildcard src/*/*.cc) OBJS:=$(addsuffix .o,$(basename $(SRCS))) DEPS:=$(OBJS:.o=.d) -LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB) +LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(GTEST_LDFLAGS) TARGET:=EngineTests @@ -63,7 +63,7 @@ endif CXXFLAGS:=-I$(GTEST_INC_DIR) $(filter-out -DNDEBUG,$(CXXFLAGS)) # FIXME Possibly missing incdirs: ASN1C_INC -CXXFLAGS+= -I./src -I../sync $(CPPUNIT_INC) $(INC_FLAGS) -Wno-deprecated -Wno-unused-variable +CXXFLAGS+= -I./src -I../sync $(INC_FLAGS) -Wno-deprecated -Wno-unused-variable ifeq ($(OPENPGP),GPG) CXXFLAGS+= -DUSE_GPG $(GPGME_INC) @@ -81,9 +81,6 @@ endif ifdef NETPGP_LIB EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)): endif -ifdef CPPUNIT_LIB - EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(CPPUNIT_LIB)): -endif # Remove trailing ':' EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)