From 9b720e072a477c053b5aaaa4a950c9246ebd3bc1 Mon Sep 17 00:00:00 2001 From: tickduan <417921451@qq.com> Date: Thu, 8 Jul 2021 16:55:54 +0800 Subject: [PATCH] compatible windows os --- deps/SZ/sz/include/ByteToolkit.h | 3 +-- deps/SZ/sz/include/dictionary.h | 1 - deps/SZ/sz/include/sz.h | 1 - deps/SZ/sz/src/conf.c | 8 +------- deps/SZ/sz/src/dataCompression.c | 1 - deps/SZ/sz/src/dictionary.c | 1 - deps/SZ/sz/src/sz.c | 20 +++++++++++++++++--- deps/SZ/sz/src/sz_double.c | 1 - deps/SZ/sz/src/sz_float.c | 1 - 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/deps/SZ/sz/include/ByteToolkit.h b/deps/SZ/sz/include/ByteToolkit.h index 898c90610a..d35fbcf809 100644 --- a/deps/SZ/sz/include/ByteToolkit.h +++ b/deps/SZ/sz/include/ByteToolkit.h @@ -26,8 +26,7 @@ short getExponent_float(float value); short getPrecisionReqLength_float(float precision); short getExponent_double(double value); short getPrecisionReqLength_double(double precision); -unsigned char numberOfLeadingZeros_Int(int i); -unsigned char numberOfLeadingZeros_Long(long i); + float bytesToFloat(unsigned char* bytes); void floatToBytes(unsigned char *b, float num); double bytesToDouble(unsigned char* bytes); diff --git a/deps/SZ/sz/include/dictionary.h b/deps/SZ/sz/include/dictionary.h index 0cf326ade2..ba5bf2f349 100644 --- a/deps/SZ/sz/include/dictionary.h +++ b/deps/SZ/sz/include/dictionary.h @@ -21,7 +21,6 @@ #include #include #include -#include /*--------------------------------------------------------------------------- New types diff --git a/deps/SZ/sz/include/sz.h b/deps/SZ/sz/include/sz.h index d3ffdbf366..9f06c9c553 100644 --- a/deps/SZ/sz/include/sz.h +++ b/deps/SZ/sz/include/sz.h @@ -12,7 +12,6 @@ #include #include -#include /* For gettimeofday(), in microseconds */ #include /* For time(), in seconds */ #include "pub.h" #include "CompressElement.h" diff --git a/deps/SZ/sz/src/conf.c b/deps/SZ/sz/src/conf.c index 732cf58d6d..6501f728a1 100644 --- a/deps/SZ/sz/src/conf.c +++ b/deps/SZ/sz/src/conf.c @@ -138,7 +138,7 @@ int SZ_ReadConf(const char* sz_cfgFile) { // default option - if(sz_cfgFile == NULL || access(sz_cfgFile, F_OK) != 0) + if(sz_cfgFile == NULL) { dataEndianType = LITTLE_ENDIAN_DATA; setDefaulParams(exe_params, confparams_cpr); @@ -146,12 +146,6 @@ int SZ_ReadConf(const char* sz_cfgFile) { return SZ_SUCCESS; } - if (access(sz_cfgFile, F_OK) != 0) - { - printf("[SZ] Configuration file NOT accessible.\n"); - return SZ_FAILED; - } - //printf("[SZ] Reading SZ configuration file (%s) ...\n", sz_cfgFile); ini = iniparser_load(sz_cfgFile); if (ini == NULL) diff --git a/deps/SZ/sz/src/dataCompression.c b/deps/SZ/sz/src/dataCompression.c index 64d89e1e5c..3c32878bb4 100644 --- a/deps/SZ/sz/src/dataCompression.c +++ b/deps/SZ/sz/src/dataCompression.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "sz.h" #include "DynamicByteArray.h" #include "DynamicIntArray.h" diff --git a/deps/SZ/sz/src/dictionary.c b/deps/SZ/sz/src/dictionary.c index 3f0f5cfa63..242dea2e21 100644 --- a/deps/SZ/sz/src/dictionary.c +++ b/deps/SZ/sz/src/dictionary.c @@ -18,7 +18,6 @@ #include #include #include -#include /** Maximum value size for integers and doubles. */ #define MAXVALSZ 1024 diff --git a/deps/SZ/sz/src/sz.c b/deps/SZ/sz/src/sz.c index 92fd7c27cf..dcec9670ea 100644 --- a/deps/SZ/sz/src/sz.c +++ b/deps/SZ/sz/src/sz.c @@ -11,7 +11,6 @@ #include #include #include -#include #include "sz.h" #include "CompressElement.h" #include "DynamicByteArray.h" @@ -21,6 +20,7 @@ #include "conf.h" #include "utility.h" + //#include "CurveFillingCompressStorage.h" unsigned char versionNumber = DATA_FROMAT_VER1; @@ -170,14 +170,27 @@ void modulePath(char *buf, int size) pos[1]=0; } +#ifdef WINDOWS +int gettimeofday(struct timeval *tv, struct timezone *tz) { + time_t t; + t = time(NULL); + SYSTEMTIME st; + GetLocalTime(&st); + + tv->tv_sec = (long)t; + tv->tv_usec = st.wMilliseconds * 1000; + + return 0; +} +#else +#include +#endif struct timeval startTime; struct timeval endTime; /* Start and end times */ struct timeval costStart; /*only used for recording the cost*/ double totalCost = 0; - - void cost_start() { totalCost = 0; @@ -201,3 +214,4 @@ void show_rate(int in_len, int out_len) float rate=100*(float)out_len/(float)in_len; printf(" in_len=%d out_len=%d compress rate=%.4f%%\n", in_len, out_len, rate); } + diff --git a/deps/SZ/sz/src/sz_double.c b/deps/SZ/sz/src/sz_double.c index b24f2cb9c1..e04c6f0205 100644 --- a/deps/SZ/sz/src/sz_double.c +++ b/deps/SZ/sz/src/sz_double.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include "sz.h" #include "CompressElement.h" diff --git a/deps/SZ/sz/src/sz_float.c b/deps/SZ/sz/src/sz_float.c index ef2fd8d504..466e4ee002 100644 --- a/deps/SZ/sz/src/sz_float.c +++ b/deps/SZ/sz/src/sz_float.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include "sz.h" #include "CompressElement.h" -- GitLab