merged in default ENGINE-781
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 31 Jul 2020 15:11:36 +0200
branchENGINE-781
changeset 49200b584b77b1f6
parent 4919 b16e57f30d89
parent 4916 b4573e87c783
child 4921 437276bbda01
merged in default
src/pEpEngine.h
test/Makefile
     1.1 --- a/.hgtags	Fri Jul 31 15:04:07 2020 +0200
     1.2 +++ b/.hgtags	Fri Jul 31 15:11:36 2020 +0200
     1.3 @@ -60,3 +60,5 @@
     1.4  9a265604e55b38ffd1a7e049a93538e9d8d097f3 Release_2.1.0-RC20
     1.5  d44d6d9024bf7b5c529f5342ad1735f491a68d97 Release_2.1.0-RC21
     1.6  c7bb048c3c5f4e3ad5a78832e77c5af0c8d04e3e Release_2.1.0-RC22
     1.7 +5fb3a71cf1c1bc3aac33f101e7efd806e269f32e Release_2.1.0-RC23
     1.8 +2be7ff8ffbbca72f6d32dd4f291612cfaa29de2c Release_2.1.0-RC24
     2.1 --- a/build-windows/libpEpasn1/libpEpasn1.vcxproj	Fri Jul 31 15:04:07 2020 +0200
     2.2 +++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj	Fri Jul 31 15:11:36 2020 +0200
     2.3 @@ -60,10 +60,6 @@
     2.4      <Link>
     2.5        <SubSystem>Windows</SubSystem>
     2.6      </Link>
     2.7 -    <PreBuildEvent>
     2.8 -      <Command>cd "$(ProjectDir)..\.." &amp;&amp; "$(ProjectDir)..\generate_code.cmd"</Command>
     2.9 -      <Message>Generating Code for pEp Sync</Message>
    2.10 -    </PreBuildEvent>
    2.11    </ItemDefinitionGroup>
    2.12    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.13      <ClCompile>
    2.14 @@ -81,10 +77,6 @@
    2.15        <EnableCOMDATFolding>true</EnableCOMDATFolding>
    2.16        <OptimizeReferences>true</OptimizeReferences>
    2.17      </Link>
    2.18 -    <PreBuildEvent>
    2.19 -      <Command>cd "$(ProjectDir)..\.." &amp;&amp; "$(ProjectDir)..\generate_code.cmd"</Command>
    2.20 -      <Message>Generating Code for pEp Sync</Message>
    2.21 -    </PreBuildEvent>
    2.22    </ItemDefinitionGroup>
    2.23    <ItemGroup>
    2.24      <Text Include="ReadMe.txt" />
    2.25 @@ -227,4 +219,8 @@
    2.26    </ItemGroup>
    2.27    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    2.28    <ImportGroup Label="ExtensionTargets" />
    2.29 +  <Target Name="BeforeRebuild">
    2.30 +    <Message Text="Generating Code for pEp Sync" />
    2.31 +    <Exec Command="CD &quot;$(ProjectDir)..\..&quot; &amp;&amp; &quot;$(ProjectDir)..\generate_code.cmd&quot;" />
    2.32 +  </Target>
    2.33  </Project>
    2.34 \ No newline at end of file
     3.1 --- a/src/Makefile	Fri Jul 31 15:04:07 2020 +0200
     3.2 +++ b/src/Makefile	Fri Jul 31 15:11:36 2020 +0200
     3.3 @@ -28,7 +28,7 @@
     3.4  ifeq ($(BUILD_ON),Darwin)
     3.5      ifeq ($(BUILD_FOR),Darwin)
     3.6          CFLAGS+= -DSQLITE_THREADSAFE=1
     3.7 -        LDLIBS+= -lz -liconv
     3.8 +        LDLIBS+= -lz -liconv -mmacosx-version-min=10.10
     3.9      else
    3.10          $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
    3.11      endif
     4.1 --- a/src/etpan_mime.c	Fri Jul 31 15:04:07 2020 +0200
     4.2 +++ b/src/etpan_mime.c	Fri Jul 31 15:11:36 2020 +0200
     4.3 @@ -548,6 +548,12 @@
     4.4      result->tm_mon = et->dt_month - 1;
     4.5      result->tm_year = et->dt_year - 1900;
     4.6      result->tm_gmtoff = 36L * (long) et->dt_zone;
     4.7 +
     4.8 +    // Normalize to UTC and then forget the offset.
     4.9 +    time_t t = timegm_with_gmtoff(result);
    4.10 +    gmtime_r(&t, result);
    4.11 +    result->tm_gmtoff = 0;
    4.12 +
    4.13      return result;
    4.14  }
    4.15  
     5.1 --- a/src/pEpEngine.h	Fri Jul 31 15:04:07 2020 +0200
     5.2 +++ b/src/pEpEngine.h	Fri Jul 31 15:11:36 2020 +0200
     5.3 @@ -25,7 +25,7 @@
     5.4  #define PEP_ENGINE_VERSION_MAJOR 2
     5.5  #define PEP_ENGINE_VERSION_MINOR 1
     5.6  #define PEP_ENGINE_VERSION_PATCH 0
     5.7 -#define PEP_ENGINE_VERSION_RC    23
     5.8 +#define PEP_ENGINE_VERSION_RC    25
     5.9  
    5.10  
    5.11  #define PEP_OWN_USERID "pEp_own_userId"
     6.1 --- a/src/platform_windows.cpp	Fri Jul 31 15:04:07 2020 +0200
     6.2 +++ b/src/platform_windows.cpp	Fri Jul 31 15:11:36 2020 +0200
     6.3 @@ -406,6 +406,7 @@
     6.4      if (!timeptr)
     6.5          return -1;
     6.6  
     6.7 +    timeptr->tm_gmtoff = 0;
     6.8      time_t result = _mkgmtime((struct tm *) timeptr);
     6.9      if (result == -1)
    6.10          return -1;
     7.1 --- a/src/timestamp.c	Fri Jul 31 15:04:07 2020 +0200
     7.2 +++ b/src/timestamp.c	Fri Jul 31 15:11:36 2020 +0200
     7.3 @@ -10,12 +10,21 @@
     7.4  #include <assert.h>
     7.5  
     7.6  
     7.7 -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts)
     7.8 +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts)
     7.9  {
    7.10 -    const time_t raw_time = timegm(ts);
    7.11 +    if (!ts)
    7.12 +        return -1;
    7.13 +
    7.14 +    timestamp *_ts = timestamp_dup(ts);
    7.15 +    if (!_ts)
    7.16 +        return -1;
    7.17 +
    7.18 +    const time_t raw_time = timegm(_ts);
    7.19      if(raw_time==-1)
    7.20          return -1;
    7.21 -    
    7.22 + 
    7.23 +    free_timestamp(_ts);
    7.24 +
    7.25      return raw_time - ts->tm_gmtoff;
    7.26  }
    7.27  
    7.28 @@ -44,11 +53,8 @@
    7.29      if (!src)
    7.30          return NULL;
    7.31  
    7.32 -    timestamp *dst = calloc(1, sizeof(timestamp));
    7.33 -    assert(dst);
    7.34 -    if (!dst)
    7.35 -        return NULL;
    7.36 +    timestamp *dst = (timestamp *) malloc(sizeof(timestamp));
    7.37 +    memcpy(dst, src, sizeof(timestamp));
    7.38  
    7.39 -    memcpy(dst, src, sizeof(timestamp));
    7.40      return dst;
    7.41  }
     8.1 --- a/src/timestamp.h	Fri Jul 31 15:04:07 2020 +0200
     8.2 +++ b/src/timestamp.h	Fri Jul 31 15:11:36 2020 +0200
     8.3 @@ -34,11 +34,11 @@
     8.4  // timegm_with_gmtoff() - convert the broken-out time into time_t, and respect tm_gmtoff
     8.5  //
     8.6  //  parameters:
     8.7 -//      timeptr(inout)     broken-out time; members will be "normalized" by this function.
     8.8 +//      timeptr(in)     broken-out time
     8.9  //
    8.10  //  return value:
    8.11  //      time_t that holds the usual "seconds since epoch"
    8.12 -DYNAMIC_API time_t timegm_with_gmtoff(timestamp* ts);
    8.13 +DYNAMIC_API time_t timegm_with_gmtoff(const timestamp* ts);
    8.14  
    8.15  
    8.16  // new_timestamp() - allocate a new timestamp
     9.1 --- a/test/Makefile	Fri Jul 31 15:04:07 2020 +0200
     9.2 +++ b/test/Makefile	Fri Jul 31 15:11:36 2020 +0200
     9.3 @@ -16,7 +16,7 @@
     9.4  OBJS:=$(addsuffix .o,$(basename $(SRCS)))
     9.5  DEPS:=$(OBJS:.o=.d)
     9.6  
     9.7 -LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB)
     9.8 +LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(GTEST_LDFLAGS)
     9.9  
    9.10  TARGET:=EngineTests
    9.11  
    9.12 @@ -63,7 +63,7 @@
    9.13  CXXFLAGS:=-I$(GTEST_INC_DIR) $(filter-out -DNDEBUG,$(CXXFLAGS))
    9.14  
    9.15  # FIXME Possibly missing incdirs: ASN1C_INC
    9.16 -CXXFLAGS+= -I./src -I../sync $(CPPUNIT_INC) $(INC_FLAGS) -Wno-deprecated -Wno-unused-variable
    9.17 +CXXFLAGS+= -I./src -I../sync $(INC_FLAGS) -Wno-deprecated -Wno-unused-variable
    9.18  
    9.19  ifeq ($(OPENPGP),GPG)
    9.20      CXXFLAGS+= -DUSE_GPG $(GPGME_INC)
    9.21 @@ -81,9 +81,6 @@
    9.22  ifdef NETPGP_LIB
    9.23      EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
    9.24  endif
    9.25 -ifdef CPPUNIT_LIB
    9.26 -    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(CPPUNIT_LIB)):
    9.27 -endif
    9.28  
    9.29  # Remove trailing ':'
    9.30  EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)