Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MediaArea/ZenLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMaxime Gervais <gervais.maxime@gmail.com>2018-06-22 00:30:16 +0300
committerMaxime Gervais <gervais.maxime@gmail.com>2018-06-22 01:10:08 +0300
commit62b81bc0862b4cd9a5c6f5c7e48b9d83ce7774e1 (patch)
tree17634069e0ac7ca1f4c0fb7c86f1849b94dff33a /Source
parent375483cedea8ebb0d4dd6d967f1662118167e162 (diff)
Android support
Signed-off-by: Maxime Gervais <gervais.maxime@gmail.com>
Diffstat (limited to 'Source')
-rw-r--r--Source/ZenLib/Dir.cpp2
-rw-r--r--Source/ZenLib/File.cpp4
-rw-r--r--Source/ZenLib/Ztring.cpp8
3 files changed, 10 insertions, 4 deletions
diff --git a/Source/ZenLib/Dir.cpp b/Source/ZenLib/Dir.cpp
index be45b1a..8091311 100644
--- a/Source/ZenLib/Dir.cpp
+++ b/Source/ZenLib/Dir.cpp
@@ -368,6 +368,7 @@ ZtringList Dir::GetAllFileNames(const Ztring &Dir_Name_, dirlist_t Options)
//Close it
closedir(Dir);
}
+ #if !defined(__ANDROID_API__) || __ANDROID_API__ >= 28
else
{
glob_t globbuf;
@@ -377,6 +378,7 @@ ZtringList Dir::GetAllFileNames(const Ztring &Dir_Name_, dirlist_t Options)
ToReturn.push_back(Ztring().From_Local(globbuf.gl_pathv[Pos]));
}
}
+ #endif
#endif
#endif //ZENLIB_USEWX
diff --git a/Source/ZenLib/File.cpp b/Source/ZenLib/File.cpp
index f2f93ee..0e2ba60 100644
--- a/Source/ZenLib/File.cpp
+++ b/Source/ZenLib/File.cpp
@@ -804,6 +804,7 @@ bool File::Truncate (int64u Offset)
return false; //Not supported
#else //defined(WINDOWS)
//Need to close the file, use truncate, reopen it
+ #if !defined(__ANDROID_API__) || __ANDROID_API__ >= 21
if (Offset==(int64u)-1)
Offset=Position_Get();
Ztring File_Name_Sav=File_Name;
@@ -813,6 +814,9 @@ bool File::Truncate (int64u Offset)
return false;
GoTo(0, FromEnd);
return true;
+ #else
+ return false; //Not supported
+ #endif
#endif //!defined(WINDOWS)
#elif defined WINDOWS
#ifdef WINDOWS_UWP
diff --git a/Source/ZenLib/Ztring.cpp b/Source/ZenLib/Ztring.cpp
index d249771..6734b65 100644
--- a/Source/ZenLib/Ztring.cpp
+++ b/Source/ZenLib/Ztring.cpp
@@ -589,11 +589,11 @@ Ztring& Ztring::From_Local (const char* S)
else
clear();
#else //WINDOWS
- size_t Size=mbstowcs(NULL, S, 0);
+ size_t Size=mbsrtowcs(NULL, &S, 0, NULL);
if (Size!=0 && Size!=(size_t)-1)
{
wchar_t* WideString=new wchar_t[Size+1];
- Size=mbstowcs(WideString, S, Size);
+ Size=mbsrtowcs(WideString, &S, Size, NULL);
WideString[Size]=L'\0';
assign (WideString);
delete[] WideString; //WideString=NULL;
@@ -1698,8 +1698,8 @@ std::string Ztring::To_Local () const
std::string AnsiString;
for (size_t Pos=0; Pos<size(); Pos++)
{
- int Result_Size=wctomb(Result, operator[](Pos));
- if (Result_Size>=0)
+ size_t Result_Size=wcrtomb(Result, operator[](Pos), 0);
+ if (Result_Size && Result_Size!=(size_t)-1)
AnsiString.append(Result, Result_Size);
else
AnsiString+='?';