diff --git a/Core/Buffer.h b/Core/Buffer.h index c307cea3..697fd4e8 100644 --- a/Core/Buffer.h +++ b/Core/Buffer.h @@ -1,4 +1,4 @@ -#ifndef _Buffer_H_ +#ifndef _Buffer_H_ #define _Buffer_H_ #include "Type.h" diff --git a/Core/DateTime.cpp b/Core/DateTime.cpp index cfd75c81..17b62865 100644 --- a/Core/DateTime.cpp +++ b/Core/DateTime.cpp @@ -104,7 +104,7 @@ DateTime& DateTime::Parse(int seconds) DateTime& DateTime::ParseMs(Int64 ms) { - Parse(ms / 1000LL); + Parse((int)(ms / 1000LL)); Ms = ms % 1000LL; return *this; @@ -129,7 +129,7 @@ DateTime& DateTime::ParseDays(int days) days -= ytd; // 按最大每月31天估算,如果超过当月总天数,月份加一 - Month = (short)(days / 31 + 1); + Month = (byte)(days / 31 + 1); int mtd = MONTH_TO_DAYS(Year, Month + 1); if (days >= mtd) Month++; @@ -137,7 +137,7 @@ DateTime& DateTime::ParseDays(int days) mtd = MONTH_TO_DAYS(Year, Month); // 今年总天数减去月份天数,得到该月第几天 - Day = (short)(days - mtd + 1); + Day = (byte)(days - mtd + 1); return *this; } @@ -353,7 +353,7 @@ void DateTime::Show(bool newLine) const f短全部 M/d/yy HH:mm F长全部 yyyy-MM-dd HH:mm:ss */ -cstring DateTime::GetString(byte kind, char* str) +/*cstring DateTime::GetString(byte kind, char* str) { auto& st = *this; switch(kind) @@ -382,12 +382,12 @@ cstring DateTime::GetString(byte kind, char* str) } return str; -} +}*/ // 当前时间 DateTime DateTime::Now() { - DateTime dt(time(NULL)); + DateTime dt((int)time(NULL)); return dt; } diff --git a/Core/DateTime.h b/Core/DateTime.h index c3f91028..7f7631ae 100644 --- a/Core/DateTime.h +++ b/Core/DateTime.h @@ -74,7 +74,7 @@ public: f短全部 M/d/yy HH:mm F长全部 yyyy-MM-dd HH:mm:ss */ - cstring GetString(byte kind = 'F', char* str = nullptr); + //cstring GetString(byte kind = 'F', char* str = nullptr); // 当前时间 static DateTime Now(); diff --git a/Core/Random.cpp b/Core/Random.cpp index 91eb5b41..ff72fefc 100644 --- a/Core/Random.cpp +++ b/Core/Random.cpp @@ -8,7 +8,7 @@ /************************************************ Random ************************************************/ Random::Random() { - srand(time(NULL)); + srand((uint)time(NULL)); } Random::Random(uint seed) diff --git a/Core/String.cpp b/Core/String.cpp index 6a6b8dfa..c17ced84 100644 --- a/Core/String.cpp +++ b/Core/String.cpp @@ -661,7 +661,7 @@ float String::ToFloat() const { if(_Length == 0) return 0; - if(_Arr[_Length] == '\0') return atof(_Arr); + if(_Arr[_Length] == '\0') return (float)atof(_Arr); // 非零结尾字符串需要特殊处理 String s; diff --git a/Core/TimeSpan.cpp b/Core/TimeSpan.cpp index 147abe12..a34a93d1 100644 --- a/Core/TimeSpan.cpp +++ b/Core/TimeSpan.cpp @@ -7,7 +7,7 @@ /************************************************ TimeSpan ************************************************/ TimeSpan::TimeSpan(Int64 ms) { - _Seconds = ms / 1000; + _Seconds = (int)(ms / 1000); _Ms = ms % 1000; } diff --git a/Core/Type.h b/Core/Type.h index cacce0e2..f2ad3e95 100644 --- a/Core/Type.h +++ b/Core/Type.h @@ -55,10 +55,19 @@ public: //#define ArrayZero(arr) memset(arr, 0, sizeof(arr)) // 弱函数 -//#if defined(__CC_ARM) -// #define WEAK __weak -//#elif defined(__GNUC__) - #define WEAK __attribute__((weak)) -//#endif +#if defined(__CC_ARM) +#define WEAK __weak +#elif defined(__GNUC__) +#define WEAK __attribute__((weak)) +//#elif defined(_MSC_VER) +// #define WEAK __declspec(selectany) +#else +#define WEAK +#endif + +#if defined(_MSC_VER) +//#define itoa _itoa_s +//#define sprintf sprintf_s +#endif #endif