summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-03-15 20:30:59 +0100
committerJorge Ruesga <jorge@ruesga.com>2013-03-15 20:30:59 +0100
commita3919532f10d7af52af8b645c536e5b76fd20db5 (patch)
tree5acec3cb410a623d61d433df35b81ffab09de3a4
parent755c335580361c20d92e32d6a4a1e294e872b304 (diff)
downloadandroid_external_unrar-a3919532f10d7af52af8b645c536e5b76fd20db5.tar.gz
android_external_unrar-a3919532f10d7af52af8b645c536e5b76fd20db5.tar.bz2
android_external_unrar-a3919532f10d7af52af8b645c536e5b76fd20db5.zip
UnRAR - Add support for Bionic (Android)
- Added Android.mk build system and common Android files - Added ifdefs for bionic unsupported features: * Exception handling * Unicode * Volumes * Crypt Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r--Android.mk26
-rw-r--r--Android.patch6572
-rw-r--r--CleanSpec.mk49
-rw-r--r--README-Android16
-rw-r--r--TODO4
-rw-r--r--src/arccmt.cpp19
-rw-r--r--src/archive.cpp21
-rw-r--r--src/archive.hpp18
-rw-r--r--src/arcread.cpp12
-rw-r--r--src/cmddata.cpp135
-rw-r--r--src/cmddata.hpp17
-rw-r--r--src/consio.cpp62
-rw-r--r--src/consio.hpp13
-rw-r--r--src/crypt.cpp14
-rw-r--r--src/crypt.hpp4
-rw-r--r--src/errhnd.cpp83
-rw-r--r--src/errhnd.hpp23
-rw-r--r--src/extinfo.cpp9
-rw-r--r--src/extinfo.hpp6
-rw-r--r--src/extract.cpp164
-rw-r--r--src/extract.hpp4
-rw-r--r--src/filcreat.cpp48
-rw-r--r--src/filcreat.hpp7
-rw-r--r--src/file.cpp110
-rw-r--r--src/file.hpp15
-rw-r--r--src/filefn.cpp79
-rw-r--r--src/filefn.hpp32
-rw-r--r--src/filestr.cpp16
-rw-r--r--src/filestr.hpp2
-rw-r--r--src/find.cpp26
-rw-r--r--src/find.hpp10
-rw-r--r--src/list.cpp23
-rw-r--r--src/match.cpp14
-rw-r--r--src/match.hpp2
-rw-r--r--src/os.hpp2
-rw-r--r--src/pathfn.cpp161
-rw-r--r--src/pathfn.hpp58
-rw-r--r--src/rar.hpp2
-rw-r--r--src/recvol.cpp81
-rw-r--r--src/recvol.hpp5
-rw-r--r--src/scantree.cpp44
-rw-r--r--src/scantree.hpp4
-rw-r--r--src/secpassword.cpp36
-rw-r--r--src/secpassword.hpp13
-rw-r--r--src/strfn.cpp35
-rw-r--r--src/strfn.hpp16
-rw-r--r--src/strlist.cpp79
-rw-r--r--src/strlist.hpp20
-rw-r--r--src/ulinks.cpp4
-rw-r--r--src/uowners.cpp16
-rw-r--r--src/volume.cpp44
-rw-r--r--src/volume.hpp4
52 files changed, 8174 insertions, 105 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..8f111b1
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,26 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := src/rar.cpp src/strlist.cpp src/strfn.cpp src/pathfn.cpp src/savepos.cpp \
+ src/smallfn.cpp src/global.cpp src/file.cpp src/filefn.cpp src/filcreat.cpp \
+ src/archive.cpp src/arcread.cpp src/system.cpp src/isnt.cpp src/crypt.cpp \
+ src/crc.cpp src/rawread.cpp src/encname.cpp src/resource.cpp src/match.cpp \
+ src/timefn.cpp src/rdwrfn.cpp src/consio.cpp src/options.cpp src/ulinks.cpp \
+ src/errhnd.cpp src/rarvm.cpp src/secpassword.cpp src/rijndael.cpp \
+ src/getbits.cpp src/sha1.cpp src/extinfo.cpp src/volume.cpp src/recvol.cpp \
+ src/rs.cpp src/list.cpp src/find.cpp src/unpack.cpp src/cmddata.cpp \
+ src/filestr.cpp src/scantree.cpp src/extract.cpp
+
+LOCAL_C_INCLUDES := src
+
+LOCAL_CFLAGS := -O2 -Wall -DUNRAR -D__BIONIC__ \
+ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNOVOLUME -DRAR_NOCRYPT
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_MODULE := unrar
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+
+include $(BUILD_EXECUTABLE)
+
diff --git a/Android.patch b/Android.patch
new file mode 100644
index 0000000..2ea553b
--- /dev/null
+++ b/Android.patch
@@ -0,0 +1,6572 @@
+diff -crB orig/arccmt.cpp src/arccmt.cpp
+*** orig/arccmt.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/arccmt.cpp 2013-03-11 23:47:27.126169000 +0100
+***************
+*** 1,6 ****
+--- 1,10 ----
+ bool IsAnsiComment(const char *Data,int Size);
+
++ #ifndef __BIONIC__
+ bool Archive::GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW)
++ #else
++ bool Archive::GetComment(Array<byte> *CmtData)
++ #endif
+ {
+ if (!MainComment)
+ return(false);
+***************
+*** 28,34 ****
+--- 32,42 ----
+ {
+ // Current (RAR 3.0+) version of archive comment.
+ Seek(SFXSize+SIZEOF_MARKHEAD+NewMhd.HeadSize,SEEK_SET);
++ #ifndef __BIONIC__
+ return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData,CmtDataW)!=0);
++ #else
++ return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData)!=0);
++ #endif
+ }
+ #ifndef SFX_MODULE
+ // Old style (RAR 2.9) comment header embedded into the main
+***************
+*** 125,137 ****
+ return(CmtData->Size()>0);
+ }
+
+!
+ size_t Archive::ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW)
+ {
+ bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE;
+ if (!ReadSubData(CmtData,NULL))
+ return(0);
+ size_t CmtSize=CmtData->Size();
+ if (Unicode)
+ {
+ CmtSize/=2;
+--- 133,149 ----
+ return(CmtData->Size()>0);
+ }
+
+! #ifndef __BIONIC__
+ size_t Archive::ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW)
++ #else
++ size_t Archive::ReadCommentData(Array<byte> *CmtData)
++ #endif
+ {
+ bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE;
+ if (!ReadSubData(CmtData,NULL))
+ return(0);
+ size_t CmtSize=CmtData->Size();
++ #ifndef __BIONIC__
+ if (Unicode)
+ {
+ CmtSize/=2;
+***************
+*** 159,164 ****
+--- 171,177 ----
+ CmtData->Alloc(CmtSize);
+ CmtDataW->Alloc(wcslen(CmtDataW->Addr()));
+ }
++ #endif
+ return(CmtSize);
+ }
+
+***************
+*** 169,175 ****
+--- 182,192 ----
+ if (Cmd->DisableComment)
+ return;
+ Array<byte> CmtBuf;
++ #ifndef __BIONIC__
+ if (GetComment(&CmtBuf,NULL))
++ #else
++ if (GetComment(&CmtBuf))
++ #endif
+ {
+ size_t CmtSize=CmtBuf.Size();
+ char *ChPtr=(char *)memchr(&CmtBuf[0],0x1A,CmtSize);
+diff -crB orig/archive.cpp src/archive.cpp
+*** orig/archive.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/archive.cpp 2013-03-11 23:41:09.898157000 +0100
+***************
+*** 42,48 ****
+--- 42,50 ----
+ *SubDataSalt=0;
+ #endif
+ *FirstVolumeName=0;
++ #ifndef __BIONIC__
+ *FirstVolumeNameW=0;
++ #endif
+
+ Splitting=false;
+ NewArchive=false;
+***************
+*** 66,82 ****
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+ void Archive::CheckOpen(const char *Name,const wchar *NameW)
+ {
+ TOpen(Name,NameW);
+ CheckArc(false);
+ }
+ #endif
+
+!
+ bool Archive::WCheckOpen(const char *Name,const wchar *NameW)
+ {
+ if (!WOpen(Name,NameW))
+ return(false);
+ if (!IsArchive(false))
+ {
+--- 68,99 ----
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void Archive::CheckOpen(const char *Name,const wchar *NameW)
++ #else
++ void Archive::CheckOpen(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ TOpen(Name,NameW);
++ #else
++ TOpen(Name);
++ #endif
+ CheckArc(false);
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ bool Archive::WCheckOpen(const char *Name,const wchar *NameW)
++ #else
++ bool Archive::WCheckOpen(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (!WOpen(Name,NameW))
++ #else
++ if (!WOpen(Name))
++ #endif
+ return(false);
+ if (!IsArchive(false))
+ {
+***************
+*** 250,256 ****
+--- 267,275 ----
+ if (!Volume || !NotFirstVolume)
+ {
+ strcpy(FirstVolumeName,FileName);
++ #ifndef __BIONIC__
+ wcscpy(FirstVolumeNameW,FileNameW);
++ #endif
+ }
+
+ return(true);
+diff -crB orig/archive.hpp src/archive.hpp
+*** orig/archive.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/archive.hpp 2013-03-11 23:41:16.334157000 +0100
+***************
+*** 13,19 ****
+--- 13,21 ----
+ ARCSIGN_TYPE IsSignature(const byte *D,size_t Size);
+ void UpdateLatestTime(FileHeader *CurBlock);
+ void ConvertNameCase(char *Name);
++ #ifndef __BIONIC__
+ void ConvertNameCase(wchar *Name);
++ #endif
+ void ConvertUnknownHeader();
+ size_t ReadOldHeader();
+ void UnexpEndArcMsg();
+***************
+*** 48,60 ****
+--- 50,72 ----
+ size_t SearchSubBlock(const char *Type);
+ int ReadBlock(int BlockType);
+ void WriteBlock(int BlockType,BaseBlock *wb=NULL);
++ #ifndef __BIONIC__
+ int PrepareNamesToWrite(char *Name,wchar *NameW,char *DestName,byte *DestNameW);
++ #else
++ int PrepareNamesToWrite(char *Name,char *DestName);
++ #endif
+ void SetLhdSize();
+ size_t ReadHeader();
+ void CheckArc(bool EnableBroken);
++ #ifndef __BIONIC__
+ void CheckOpen(const char *Name,const wchar *NameW=NULL);
+ bool WCheckOpen(const char *Name,const wchar *NameW=NULL);
+ bool GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW);
++ #else
++ void CheckOpen(const char *Name);
++ bool WCheckOpen(const char *Name);
++ bool GetComment(Array<byte> *CmtData);
++ #endif
+ void ViewComment();
+ void ViewFileComment();
+ void SetLatestTime(RarTime *NewTime);
+***************
+*** 68,74 ****
+--- 80,90 ----
+ void AddSubData(byte *SrcData,size_t DataSize,File *SrcFile,const char *Name,bool AllowSplit);
+ bool ReadSubData(Array<byte> *UnpData,File *DestFile);
+ int GetHeaderType() {return(CurHeaderType);};
++ #ifndef __BIONIC__
+ size_t ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW);
++ #else
++ size_t ReadCommentData(Array<byte> *CmtData);
++ #endif
+ void WriteCommentData(byte *Data,size_t DataSize,bool FileComment);
+ RAROptions* GetRAROptions() {return(Cmd);}
+ void SetSilentOpen(bool Mode) {SilentOpen=Mode;}
+***************
+*** 114,120 ****
+--- 130,138 ----
+ bool NewArchive;
+
+ char FirstVolumeName[NM];
++ #ifndef __BIONIC__
+ wchar FirstVolumeNameW[NM];
++ #endif
+ };
+
+
+diff -crB orig/arcread.cpp src/arcread.cpp
+*** orig/arcread.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/arcread.cpp 2013-03-13 02:15:36.731182000 +0100
+***************
+*** 99,105 ****
+--- 99,109 ----
+ ErrHandler.Exit(RARX_USERBREAK);
+ }
+ #else
++ #ifndef __BIONIC__
+ if (!GetPassword(PASSWORD_ARCHIVE,FileName,FileNameW,&Cmd->Password))
++ #else
++ if (!GetPassword(PASSWORD_ARCHIVE,FileName,&Cmd->Password))
++ #endif
+ {
+ Close();
+ ErrHandler.Exit(RARX_USERBREAK);
+***************
+*** 236,241 ****
+--- 240,246 ----
+ else
+ if (hd->HeadType==FILE_HEAD)
+ {
++ #ifndef __BIONIC__
+ if (hd->Flags & LHD_UNICODE)
+ {
+ EncodeFileName NameCoder;
+***************
+*** 258,267 ****
+--- 263,275 ----
+ }
+ else
+ *hd->FileNameW=0;
++ #endif
+ #ifndef SFX_MODULE
+ ConvertNameCase(hd->FileName);
++ #ifndef __BIONIC__
+ ConvertNameCase(hd->FileNameW);
+ #endif
++ #endif
+ ConvertUnknownHeader();
+ }
+ if (hd->Flags & LHD_SALT)
+***************
+*** 325,333 ****
+--- 333,343 ----
+ if (!EncBroken)
+ {
+ #ifndef SHELL_EXT
++ #ifndef __BIONIC__
+ Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName));
+ Alarm();
+ #endif
++ #endif
+ }
+ }
+ }
+***************
+*** 547,552 ****
+--- 557,563 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ void Archive::ConvertNameCase(wchar *Name)
+ {
+ if (Cmd->ConvertNames==NAMES_UPPERCASE)
+***************
+*** 555,560 ****
+--- 566,572 ----
+ wcslower(Name);
+ }
+ #endif
++ #endif
+
+
+ bool Archive::IsArcDir()
+diff -crB orig/cmddata.cpp src/cmddata.cpp
+*** orig/cmddata.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/cmddata.cpp 2013-03-15 20:09:22.971140375 +0100
+***************
+*** 20,28 ****
+--- 20,32 ----
+ Close();
+
+ *Command=0;
++ #ifndef __BIONIC__
+ *CommandW=0;
++ #endif
+ *ArcName=0;
++ #ifndef __BIONIC__
+ *ArcNameW=0;
++ #endif
+ FileLists=false;
+ NoMoreSwitches=false;
+
+***************
+*** 127,133 ****
+--- 131,141 ----
+ }
+ #else
+ for (int I=1;I<argc;I++)
++ #ifndef __BIONIC__
+ ParseArg(argv[I],NULL);
++ #else
++ ParseArg(argv[I]);
++ #endif
+ #endif
+ ParseDone();
+ }
+***************
+*** 135,154 ****
+
+
+ #ifndef SFX_MODULE
+ void CommandData::ParseArg(char *Arg,wchar *ArgW)
+ {
+ if (IsSwitch(*Arg) && !NoMoreSwitches)
+ if (Arg[1]=='-')
+ NoMoreSwitches=true;
+ else
+ ProcessSwitch(Arg+1,(ArgW!=NULL && *ArgW!=0 ? ArgW+1:NULL));
+ else
+ if (*Command==0)
+ {
+ strncpyz(Command,Arg,ASIZE(Command));
+ if (ArgW!=NULL)
+ wcsncpy(CommandW,ArgW,ASIZE(CommandW));
+!
+
+ #ifndef GUI
+ *Command=etoupper(*Command);
+--- 143,171 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ void CommandData::ParseArg(char *Arg,wchar *ArgW)
++ #else
++ void CommandData::ParseArg(char *Arg)
++ #endif
+ {
+ if (IsSwitch(*Arg) && !NoMoreSwitches)
+ if (Arg[1]=='-')
+ NoMoreSwitches=true;
+ else
++ #ifndef __BIONIC__
+ ProcessSwitch(Arg+1,(ArgW!=NULL && *ArgW!=0 ? ArgW+1:NULL));
++ #else
++ ProcessSwitch(Arg+1);
++ #endif
+ else
+ if (*Command==0)
+ {
+ strncpyz(Command,Arg,ASIZE(Command));
++ #ifndef __BIONIC__
+ if (ArgW!=NULL)
+ wcsncpy(CommandW,ArgW,ASIZE(CommandW));
+! #endif
+
+ #ifndef GUI
+ *Command=etoupper(*Command);
+***************
+*** 160,174 ****
+--- 177,198 ----
+ #endif
+ }
+ else
++ #ifndef __BIONIC__
+ if (*ArcName==0 && *ArcNameW==0)
++ #else
++ if (*ArcName==0)
++ #endif
+ {
+ strncpyz(ArcName,Arg,ASIZE(ArcName));
++ #ifndef __BIONIC__
+ if (ArgW!=NULL)
+ wcsncpyz(ArcNameW,ArgW,ASIZE(ArcNameW));
++ #endif
+ }
+ else
+ {
+ bool EndSeparator; // If last character is the path separator.
++ #ifndef __BIONIC__
+ if (ArgW!=NULL)
+ {
+ size_t Length=wcslen(ArgW);
+***************
+*** 177,186 ****
+--- 201,213 ----
+ }
+ else
+ {
++ #endif
+ size_t Length=strlen(Arg);
+ char EndChar=Length==0 ? 0:Arg[Length-1];
+ EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar);
++ #ifndef __BIONIC__
+ }
++ #endif
+
+ char CmdChar=etoupper(*Command);
+ bool Add=strchr("AFUM",CmdChar)!=NULL;
+***************
+*** 188,205 ****
+--- 215,246 ----
+ if (EndSeparator && !Add)
+ {
+ strncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
++ #ifndef __BIONIC__
+ if (ArgW!=NULL)
+ wcsncpyz(ExtrPathW,ArgW,ASIZE(ExtrPathW));
++ #endif
+ }
+ else
+ if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS))
++ #ifndef __BIONIC__
+ FileArgs->AddString(Arg,ArgW);
++ #else
++ FileArgs->AddString(Arg);
++ #endif
+ else
+ {
+ FindData FileData;
++ #ifndef __BIONIC__
+ bool Found=FindFile::FastFind(Arg,ArgW,&FileData);
++ #else
++ bool Found=FindFile::FastFind(Arg,&FileData);
++ #endif
+ if ((!Found || ListMode==RCLM_ACCEPT_LISTS) &&
++ #ifndef __BIONIC__
+ ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg,ArgW))
++ #else
++ ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg))
++ #endif
+ {
+ FileLists=true;
+
+***************
+*** 213,220 ****
+--- 254,265 ----
+ Charset=RCH_OEM;
+ #endif
+
++ #ifndef __BIONIC__
+ wchar *WideArgName=(ArgW!=NULL && *ArgW!=0 ? ArgW+1:NULL);
+ ReadTextFile(Arg+1,WideArgName,FileArgs,false,true,Charset,true,true,true);
++ #else
++ ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true,true);
++ #endif
+
+ }
+ else
+***************
+*** 222,235 ****
+--- 267,286 ----
+ {
+ strncpyz(ExtrPath,Arg,ASIZE(ExtrPath)-1);
+ AddEndSlash(ExtrPath);
++ #ifndef __BIONIC__
+ if (ArgW!=NULL)
+ {
+ wcsncpyz(ExtrPathW,ArgW,ASIZE(ExtrPathW)-1);
+ AddEndSlash(ExtrPathW);
+ }
++ #endif
+ }
+ else
++ #ifndef __BIONIC__
+ FileArgs->AddString(Arg,ArgW);
++ #else
++ FileArgs->AddString(Arg);
++ #endif
+ }
+ }
+ }
+***************
+*** 297,303 ****
+--- 348,358 ----
+ void CommandData::ReadConfig()
+ {
+ StringList List;
++ #ifndef __BIONIC__
+ if (ReadTextFile(DefConfigName,NULL,&List,true))
++ #else
++ if (ReadTextFile(DefConfigName,&List,true))
++ #endif
+ {
+ char *Str;
+ while ((Str=List.GetString())!=NULL)
+***************
+*** 335,344 ****
+
+
+ #if !defined(SFX_MODULE)
+ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
+ {
+!
+ bool WidePresent=SwitchW!=NULL && *SwitchW!=0; // If 'true', SwitchW is not empty.
+
+ switch(etoupper(Switch[0]))
+ {
+--- 390,406 ----
+
+
+ #if !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
++ #else
++ void CommandData::ProcessSwitch(const char *Switch)
++ #endif
+ {
+! #ifndef __BIONIC__
+ bool WidePresent=SwitchW!=NULL && *SwitchW!=0; // If 'true', SwitchW is not empty.
++ #else
++ bool WidePresent=false;
++ #endif
+
+ switch(etoupper(Switch[0]))
+ {
+***************
+*** 494,501 ****
+--- 556,565 ----
+ break;
+ case 'P':
+ strcpy(ArcPath,Switch+2);
++ #ifndef __BIONIC__
+ if (WidePresent)
+ wcscpy(ArcPathW,SwitchW+2);
++ #endif
+ break;
+ case 'S':
+ SyncFiles=true;
+***************
+*** 608,614 ****
+--- 672,682 ----
+ Charset=RCH_OEM;
+ #endif
+
++ #ifndef __BIONIC__
+ ReadTextFile(Switch+2,NULL,Args,false,true,Charset,true,true,true);
++ #else
++ ReadTextFile(Switch+2,Args,false,true,Charset,true,true,true);
++ #endif
+ }
+ else
+ Args->AddString(Switch+1);
+***************
+*** 654,666 ****
+--- 722,743 ----
+ case 'P':
+ if (Switch[1]==0)
+ {
++ #ifndef __BIONIC__
+ GetPassword(PASSWORD_GLOBAL,NULL,NULL,&Password);
++ #else
++ GetPassword(PASSWORD_GLOBAL,NULL,&Password);
++ #endif
+ eprintf("\n");
+ }
+ else
+ {
++ #ifndef __BIONIC__
+ wchar PlainPsw[MAXPASSWORD];
+ CharToWide(Switch+1,PlainPsw,ASIZE(PlainPsw));
++ #else
++ char PlainPsw[MAXPASSWORD];
++ strncpyz(PlainPsw,Switch+1,ASIZE(PlainPsw));
++ #endif
+ PlainPsw[ASIZE(PlainPsw)-1]=0;
+ Password.Set(PlainPsw);
+ cleandata(PlainPsw,ASIZE(PlainPsw));
+***************
+*** 672,679 ****
+--- 749,761 ----
+ EncryptHeaders=true;
+ if (Switch[2]!=0)
+ {
++ #ifndef __BIONIC__
+ wchar PlainPsw[MAXPASSWORD];
+ CharToWide(Switch+2,PlainPsw,ASIZE(PlainPsw));
++ #else
++ char PlainPsw[MAXPASSWORD];
++ strncpyz(PlainPsw,Switch+1,ASIZE(PlainPsw));
++ #endif
+ PlainPsw[ASIZE(PlainPsw)-1]=0;
+ Password.Set(PlainPsw);
+ cleandata(PlainPsw,ASIZE(PlainPsw));
+***************
+*** 681,693 ****
+--- 763,783 ----
+ else
+ if (!Password.IsSet())
+ {
++ #ifndef __BIONIC__
+ GetPassword(PASSWORD_GLOBAL,NULL,NULL,&Password);
++ #else
++ GetPassword(PASSWORD_GLOBAL,NULL,&Password);
++ #endif
+ eprintf("\n");
+ }
+ }
+ break;
+ case 'Z':
++ #ifndef __BIONIC__
+ if (Switch[1]==0 && (!WidePresent || SwitchW[1]==0))
++ #else
++ if (Switch[1]==0)
++ #endif
+ {
+ #ifndef GUI // stdin is not supported by WinRAR.
+ // If comment file is not specified, we read data from stdin.
+***************
+*** 697,704 ****
+--- 787,796 ----
+ else
+ {
+ strncpyz(CommentFile,Switch+1,ASIZE(CommentFile));
++ #ifndef __BIONIC__
+ if (WidePresent)
+ wcsncpyz(CommentFileW,SwitchW+1,ASIZE(CommentFileW));
++ #endif
+ }
+ break;
+ case 'M':
+***************
+*** 1231,1237 ****
+--- 1323,1333 ----
+
+ int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType)
+ {
++ #ifndef __BIONIC__
+ if (strlen(NewLhd.FileName)>=NM || wcslen(NewLhd.FileNameW)>=NM)
++ #else
++ if (strlen(NewLhd.FileName)>=NM)
++ #endif
+ return(0);
+ bool Dir=(NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY;
+ if (ExclCheck(NewLhd.FileName,Dir,false,true))
+***************
+*** 1247,1255 ****
+--- 1343,1356 ----
+ char *ArgName;
+ wchar *ArgNameW;
+ FileArgs->Rewind();
++ #ifndef __BIONIC__
+ for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++)
++ #else
++ for (int StringCount=1;FileArgs->GetString(&ArgName);StringCount++)
++ #endif
+ {
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL && *ArgNameW!=0;
+ if (Unicode)
+ {
+***************
+*** 1277,1282 ****
+--- 1378,1384 ----
+ continue;
+ }
+ #endif
++ #endif
+ if (CmpName(ArgName,NewLhd.FileName,MatchType))
+ {
+ if (ExactMatch!=NULL)
+***************
+*** 1308,1324 ****
+--- 1410,1438 ----
+ if (strchr("AFUMD",*Command)==NULL)
+ {
+ if (GenerateArcName)
++ #ifndef __BIONIC__
+ GenerateArchiveName(ArcName,ArcNameW,ASIZE(ArcName),GenerateMask,false);
++ #else
++ GenerateArchiveName(ArcName,ASIZE(ArcName),GenerateMask,false);
++ #endif
+
+ StringList ArcMasks;
+ ArcMasks.AddString(ArcName);
+ ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS);
+ FindData FindData;
+ while (Scan.GetNext(&FindData)==SCAN_SUCCESS)
++ #ifndef __BIONIC__
+ AddArcName(FindData.Name,FindData.NameW);
++ #else
++ AddArcName(FindData.Name);
++ #endif
+ }
+ else
++ #ifndef __BIONIC__
+ AddArcName(ArcName,NULL);
++ #else
++ AddArcName(ArcName);
++ #endif
+ #endif
+
+ switch(Command[0])
+***************
+*** 1348,1362 ****
+ #endif
+
+
+ void CommandData::AddArcName(const char *Name,const wchar *NameW)
+ {
+ ArcNames->AddString(Name,NameW);
+ }
+
+!
+ bool CommandData::GetArcName(char *Name,wchar *NameW,int MaxSize)
+ {
+ if (!ArcNames->GetString(Name,NameW,NM))
+ return(false);
+ return(true);
+ }
+--- 1462,1491 ----
+ #endif
+
+
++ #ifndef __BIONIC__
+ void CommandData::AddArcName(const char *Name,const wchar *NameW)
++ #else
++ void CommandData::AddArcName(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ ArcNames->AddString(Name,NameW);
++ #else
++ ArcNames->AddString(Name);
++ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool CommandData::GetArcName(char *Name,wchar *NameW,int MaxSize)
++ #else
++ bool CommandData::GetArcName(char *Name,int MaxSize)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (!ArcNames->GetString(Name,NameW,NM))
++ #else
++ if (!ArcNames->GetString(Name,NM))
++ #endif
+ return(false);
+ return(true);
+ }
+diff -crB orig/cmddata.hpp src/cmddata.hpp
+*** orig/cmddata.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/cmddata.hpp 2013-03-12 01:20:29.178343000 +0100
+***************
+*** 10,16 ****
+--- 10,20 ----
+ {
+ private:
+ void ProcessSwitchesString(char *Str);
++ #ifndef __BIONIC__
+ void ProcessSwitch(const char *Switch,const wchar *SwitchW=NULL);
++ #else
++ void ProcessSwitch(const char *Switch);
++ #endif
+ void BadSwitch(const char *Switch);
+ bool ExclCheckArgs(StringList *Args,bool Dir,char *CheckName,bool CheckFullPath,int MatchMode);
+ uint GetExclAttr(const char *Str);
+***************
+*** 27,33 ****
+--- 31,41 ----
+
+ void PreprocessCommandLine(int argc, char *argv[]);
+ void ParseCommandLine(int argc, char *argv[]);
++ #ifndef __BIONIC__
+ void ParseArg(char *Arg,wchar *ArgW);
++ #else
++ void ParseArg(char *Arg);
++ #endif
+ void ParseDone();
+ void ParseEnvVar();
+ void ReadConfig();
+***************
+*** 42,58 ****
+--- 50,75 ----
+ bool AnyFiltersActive();
+ int IsProcessFile(FileHeader &NewLhd,bool *ExactMatch=NULL,int MatchType=MATCH_WILDSUBPATH);
+ void ProcessCommand();
++ #ifndef __BIONIC__
+ void AddArcName(const char *Name,const wchar *NameW);
+ bool GetArcName(char *Name,wchar *NameW,int MaxSize);
++ #else
++ void AddArcName(const char *Name);
++ bool GetArcName(char *Name,int MaxSize);
++ #endif
+ bool CheckWinSize();
+
+ int GetRecoverySize(const char *Str,int DefSize);
+
+ char Command[NM+16];
++ #ifndef __BIONIC__
+ wchar CommandW[NM+16];
++ #endif
+
+ char ArcName[NM];
++ #ifndef __BIONIC__
+ wchar ArcNameW[NM];
++ #endif
+
+ StringList *FileArgs;
+ StringList *ExclArgs;
+diff -crB orig/consio.cpp src/consio.cpp
+*** orig/consio.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/consio.cpp 2013-03-15 20:10:23.911141182 +0100
+***************
+*** 4,9 ****
+--- 4,13 ----
+ #include "log.cpp"
+ #endif
+
++ #ifdef __BIONIC__
++ #include <termios.h>
++ #endif
++
+ static int KbdAnsi(char *Addr,int Size);
+
+ #if !defined(GUI) && !defined(SILENT)
+***************
+*** 121,127 ****
+--- 125,135 ----
+
+ #ifndef SILENT
+ #ifndef GUI
++ #ifndef __BIONIC__
+ void GetPasswordText(wchar *Str,uint MaxLength)
++ #else
++ void GetPasswordText(char *Str,uint MaxLength)
++ #endif
+ {
+ if (MaxLength==0)
+ return;
+***************
+*** 146,153 ****
+--- 154,167 ----
+ #else
+ strncpyz(StrA,getpass(""),ASIZE(StrA));
+ #endif
++
++ #ifndef __BIONIC__
+ CharToWide(StrA,Str,MaxLength);
++ #else
++ strncpyz(Str,StrA,MaxLength);
++ #endif
+ cleandata(StrA,sizeof(StrA));
++
+ #endif
+ Str[MaxLength-1]=0;
+ RemoveLF(Str);
+***************
+*** 152,164 ****
+--- 166,213 ----
+ Str[MaxLength-1]=0;
+ RemoveLF(Str);
+ }
++
++ #if !defined(_EMX) && !defined(_BEOS) && !defined(__sparc) && !defined(sparc) && !defined (__VMS)
++ #ifdef __BIONIC__
++ const char *getpass(const char *prompt) {
++ struct termios oflags, nflags;
++ static char password[64];
++
++ // disabling echo
++ tcgetattr(fileno(stdin), &oflags);
++ nflags = oflags;
++ nflags.c_lflag &= ~ECHO;
++ nflags.c_lflag |= ECHONL;
++
++ if (tcsetattr(fileno(stdin), TCSANOW, &nflags) != 0) {
++ return "\0";
++ }
++
++ mprintf("%s", prompt);
++ fgets(password, sizeof(password), stdin);
++ password[strlen(password) - 1] = 0;
++
++ // restore terminal
++ if (tcsetattr(fileno(stdin), TCSANOW, &oflags) != 0) {
++ return "\0";
++ }
++
++ return password;
++ }
++ #endif
++ #endif
++
+ #endif
+ #endif
+
+
+ #ifndef SILENT
++ #ifndef __BIONIC__
+ bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,
+ SecPassword *Password)
++ #else
++ bool GetPassword(PASSWORD_TYPE Type,const char *FileName, SecPassword *Password)
++ #endif
+ {
+ Alarm();
+ while (true)
+***************
+*** 177,193 ****
+ strcat(PromptStr,NameOnly);
+ }
+ eprintf("\n%s: ",PromptStr);
+!
+ wchar PlainPsw[MAXPASSWORD];
+ GetPasswordText(PlainPsw,ASIZE(PlainPsw));
+ if (*PlainPsw==0 && Type==PASSWORD_GLOBAL)
+ return(false);
+ if (Type==PASSWORD_GLOBAL)
+ {
+ eprintf(St(MReAskPsw));
+ wchar CmpStr[MAXPASSWORD];
+ GetPasswordText(CmpStr,ASIZE(CmpStr));
+ if (*CmpStr==0 || wcscmp(PlainPsw,CmpStr)!=0)
+ {
+ eprintf(St(MNotMatchPsw));
+ cleandata(PlainPsw,sizeof(PlainPsw));
+--- 226,253 ----
+ strcat(PromptStr,NameOnly);
+ }
+ eprintf("\n%s: ",PromptStr);
+! #ifndef __BIONIC__
+ wchar PlainPsw[MAXPASSWORD];
++ #else
++ char PlainPsw[MAXPASSWORD];
++ #endif
+ GetPasswordText(PlainPsw,ASIZE(PlainPsw));
+ if (*PlainPsw==0 && Type==PASSWORD_GLOBAL)
+ return(false);
+ if (Type==PASSWORD_GLOBAL)
+ {
+ eprintf(St(MReAskPsw));
++ #ifndef __BIONIC__
+ wchar CmpStr[MAXPASSWORD];
++ #else
++ char CmpStr[MAXPASSWORD];
++ #endif
+ GetPasswordText(CmpStr,ASIZE(CmpStr));
++ #ifndef __BIONIC__
+ if (*CmpStr==0 || wcscmp(PlainPsw,CmpStr)!=0)
++ #else
++ if (*CmpStr==0 || strcmp(PlainPsw,CmpStr)!=0)
++ #endif
+ {
+ eprintf(St(MNotMatchPsw));
+ cleandata(PlainPsw,sizeof(PlainPsw));
+diff -crB orig/consio.hpp src/consio.hpp
+*** orig/consio.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/consio.hpp 2013-03-12 00:04:37.062201000 +0100
+***************
+*** 13,21 ****
+--- 13,29 ----
+ void mprintf(const char *fmt,...);
+ void eprintf(const char *fmt,...);
+ void Alarm();
++ #ifndef __BIONIC__
+ void GetPasswordText(wchar *Str,uint MaxLength);
+ bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,SecPassword *Password);
++ #else
++ void GetPasswordText(char *Str,uint MaxLength);
++ bool GetPassword(PASSWORD_TYPE Type,const char *FileName,SecPassword *Password);
++ #endif
+ int Ask(const char *AskStr);
++ #ifdef __BIONIC__
++ const char *getpass(const char *prompt);
++ #endif
+ #endif
+
+ void OutComment(char *Comment,size_t Size);
+***************
+*** 29,36 ****
+--- 37,49 ----
+ inline void eprintf(const char *fmt,...) {}
+ #endif
+ inline void Alarm() {}
++ #ifndef __BIONIC__
+ inline void GetPasswordText(wchar *Str,uint MaxLength) {}
+ inline bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,SecPassword *Password) {return(false);}
++ #else
++ inline void GetPasswordText(char *Str,uint MaxLength) {}
++ inline bool GetPassword(PASSWORD_TYPE Type,const char *FileName,SecPassword *Password) {return(false);}
++ #endif
+ inline int Ask(const char *AskStr) {return(0);}
+ #endif
+
+diff -crB orig/crypt.cpp src/crypt.cpp
+*** orig/crypt.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/crypt.cpp 2013-03-12 00:27:55.142245000 +0100
+***************
+*** 189,195 ****
+--- 189,199 ----
+ {
+ if (!Password->IsSet())
+ return;
++ #ifndef __BIONIC__
+ wchar PlainPsw[MAXPASSWORD];
++ #else
++ char PlainPsw[MAXPASSWORD];
++ #endif
+ Password->Get(PlainPsw,ASIZE(PlainPsw));
+ if (OldOnly)
+ {
+***************
+*** 200,206 ****
+--- 204,214 ----
+ memset(Psw,0,sizeof(Psw));
+
+ // We need to use ASCII password for older encryption algorithms.
++ #ifndef __BIONIC__
+ WideToChar(PlainPsw,Psw,ASIZE(Psw));
++ #else
++ strncpyz(Psw,PlainPsw,ASIZE(Psw));
++ #endif
+ Psw[ASIZE(Psw)-1]=0;
+
+ size_t PswLength=strlen(Psw);
+***************
+*** 243,251 ****
+--- 251,265 ----
+
+ if (!Cached)
+ {
++ #ifndef __BIONIC__
+ byte RawPsw[2*MAXPASSWORD+SALT_SIZE];
+ WideToRaw(PlainPsw,RawPsw);
+ size_t RawLength=2*wcslen(PlainPsw);
++ #else
++ byte RawPsw[MAXPASSWORD+SALT_SIZE];
++ strncpyz((char*)RawPsw,PlainPsw,ASIZE((char*)RawPsw));
++ size_t RawLength=strlen(PlainPsw);
++ #endif
+ if (Salt!=NULL)
+ {
+ memcpy(RawPsw+RawLength,Salt,SALT_SIZE);
+diff -crB orig/crypt.hpp src/crypt.hpp
+*** orig/crypt.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/crypt.hpp 2013-03-12 00:12:51.194216000 +0100
+***************
+*** 9,15 ****
+--- 9,19 ----
+ #ifndef _SFX_RTL_
+ CryptKeyCacheItem()
+ {
++ #ifndef __BIONIC__
+ Password.Set(L"");
++ #else
++ Password.Set("");
++ #endif
+ }
+
+ ~CryptKeyCacheItem()
+diff -crB orig/errhnd.cpp src/errhnd.cpp
+*** orig/errhnd.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/errhnd.cpp 2013-03-12 00:39:28.066266000 +0100
+***************
+*** 25,32 ****
+ Throw(RARX_MEMORY);
+ }
+
+!
+ void ErrorHandler::OpenError(const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ OpenErrorMsg(FileName);
+--- 25,35 ----
+ Throw(RARX_MEMORY);
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::OpenError(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::OpenError(const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ OpenErrorMsg(FileName);
+***************
+*** 34,41 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::CloseError(const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ if (!UserBreak)
+--- 37,47 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::CloseError(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::CloseError(const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ if (!UserBreak)
+***************
+*** 49,67 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::ReadError(const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ ReadErrorMsg(NULL,NULL,FileName,FileNameW);
+ #endif
+ #if !defined(SILENT) || defined(RARDLL)
+ Throw(RARX_FATAL);
+ #endif
+ }
+
+!
+ bool ErrorHandler::AskRepeatRead(const char *FileName,const wchar *FileNameW)
+ {
+ #if !defined(SILENT) && !defined(SFX_MODULE) && !defined(_WIN_CE)
+ if (!Silent)
+--- 55,83 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::ReadError(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::ReadError(const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
++ #ifndef __BIONIC__
+ ReadErrorMsg(NULL,NULL,FileName,FileNameW);
++ #else
++ ReadErrorMsg(NULL,FileName);
++ #endif
+ #endif
+ #if !defined(SILENT) || defined(RARDLL)
+ Throw(RARX_FATAL);
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool ErrorHandler::AskRepeatRead(const char *FileName,const wchar *FileNameW)
++ #else
++ bool ErrorHandler::AskRepeatRead(const char *FileName)
++ #endif
+ {
+ #if !defined(SILENT) && !defined(SFX_MODULE) && !defined(_WIN_CE)
+ if (!Silent)
+***************
+*** 75,85 ****
+ return(false);
+ }
+
+!
+ void ErrorHandler::WriteError(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ WriteErrorMsg(ArcName,ArcNameW,FileName,FileNameW);
+ #endif
+ #if !defined(SILENT) || defined(RARDLL)
+ Throw(RARX_WRITE);
+--- 91,108 ----
+ return(false);
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::WriteError(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::WriteError(const char *ArcName,const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
++ #ifndef __BIONIC__
+ WriteErrorMsg(ArcName,ArcNameW,FileName,FileNameW);
++ #else
++ WriteErrorMsg(ArcName,FileName);
++ #endif
+ #endif
+ #if !defined(SILENT) || defined(RARDLL)
+ Throw(RARX_WRITE);
+***************
+*** 100,107 ****
+ }
+ #endif
+
+!
+ bool ErrorHandler::AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull)
+ {
+ #if !defined(SILENT) && !defined(_WIN_CE)
+ if (!Silent)
+--- 123,133 ----
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ bool ErrorHandler::AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull)
++ #else
++ bool ErrorHandler::AskRepeatWrite(const char *FileName,bool DiskFull)
++ #endif
+ {
+ #if !defined(SILENT) && !defined(_WIN_CE)
+ if (!Silent)
+***************
+*** 115,122 ****
+ return(false);
+ }
+
+!
+ void ErrorHandler::SeekError(const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ if (!UserBreak)
+--- 141,151 ----
+ return(false);
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::SeekError(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::SeekError(const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ if (!UserBreak)
+***************
+*** 147,160 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::OpenErrorMsg(const char *FileName,const wchar *FileNameW)
+ {
+! OpenErrorMsg(NULL,NULL,FileName,FileNameW);
+ }
+
+!
+ void ErrorHandler::OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ if (FileName!=NULL)
+--- 176,195 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::OpenErrorMsg(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::OpenErrorMsg(const char *FileName)
++ #endif
+ {
+! OpenErrorMsg(NULL,FileName);
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::OpenErrorMsg(const char *ArcName,const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ if (FileName!=NULL)
+***************
+*** 164,177 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::CreateErrorMsg(const char *FileName,const wchar *FileNameW)
+ {
+ CreateErrorMsg(NULL,NULL,FileName,FileNameW);
+ }
+
+!
+ void ErrorHandler::CreateErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ if (FileName!=NULL)
+--- 199,222 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::CreateErrorMsg(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::CreateErrorMsg(const char *FileName)
++ #endif
+ {
++ #ifndef __BIONIC__
+ CreateErrorMsg(NULL,NULL,FileName,FileNameW);
++ #else
++ CreateErrorMsg(NULL,FileName);
++ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::CreateErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::CreateErrorMsg(const char *ArcName,const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ if (FileName!=NULL)
+***************
+*** 188,194 ****
+--- 233,243 ----
+
+
+ // Check the path length and display the error message if it is too long.
++ #ifndef __BIONIC__
+ void ErrorHandler::CheckLongPathErrMsg(const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::CheckLongPathErrMsg(const char *FileName)
++ #endif
+ {
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined (SILENT) && defined(MAX_PATH)
+ if (GetLastError()==ERROR_PATH_NOT_FOUND)
+***************
+*** 210,217 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ ErrMsg(ArcName,St(MErrRead),FileName);
+--- 259,269 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::ReadErrorMsg(const char *ArcName,const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ ErrMsg(ArcName,St(MErrRead),FileName);
+***************
+*** 219,226 ****
+ #endif
+ }
+
+!
+ void ErrorHandler::WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+ {
+ #ifndef SILENT
+ ErrMsg(ArcName,St(MErrWrite),FileName);
+--- 271,281 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ErrorHandler::WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
++ #else
++ void ErrorHandler::WriteErrorMsg(const char *ArcName,const char *FileName)
++ #endif
+ {
+ #ifndef SILENT
+ ErrMsg(ArcName,St(MErrWrite),FileName);
+diff -crB orig/errhnd.hpp src/errhnd.hpp
+*** orig/errhnd.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/errhnd.hpp 2013-03-11 01:43:20.606412000 +0100
+***************
+*** 2,9 ****
+--- 2,11 ----
+ #define _RAR_ERRHANDLER_
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ #define ALLOW_EXCEPTIONS
+ #endif
++ #endif
+
+ enum RAR_EXIT // RAR exit code.
+ {
+***************
+*** 35,40 ****
+--- 37,43 ----
+ ErrorHandler();
+ void Clean();
+ void MemoryError();
++ #ifndef __BIONIC__
+ void OpenError(const char *FileName,const wchar *FileNameW);
+ void CloseError(const char *FileName,const wchar *FileNameW);
+ void ReadError(const char *FileName,const wchar *FileNameW);
+***************
+*** 43,50 ****
+--- 46,64 ----
+ void WriteErrorFAT(const char *FileName,const wchar *FileNameW);
+ bool AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull);
+ void SeekError(const char *FileName,const wchar *FileNameW);
++ #else
++ void OpenError(const char *FileName);
++ void CloseError(const char *FileName);
++ void ReadError(const char *FileName);
++ bool AskRepeatRead(const char *FileName);
++ void WriteError(const char *ArcName,const char *FileName);
++ void WriteErrorFAT(const char *FileName);
++ bool AskRepeatWrite(const char *FileName,bool DiskFull);
++ void SeekError(const char *FileName);
++ #endif
+ void GeneralErrMsg(const char *Msg);
+ void MemoryErrorMsg();
++ #ifndef __BIONIC__
+ void OpenErrorMsg(const char *FileName,const wchar *FileNameW=NULL);
+ void OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
+ void CreateErrorMsg(const char *FileName,const wchar *FileNameW=NULL);
+***************
+*** 52,57 ****
+--- 66,80 ----
+ void CheckLongPathErrMsg(const char *FileName,const wchar *FileNameW);
+ void ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
+ void WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
++ #else
++ void OpenErrorMsg(const char *FileName);
++ void OpenErrorMsg(const char *ArcName,const char *FileName);
++ void CreateErrorMsg(const char *FileName);
++ void CreateErrorMsg(const char *ArcName,const char *FileName);
++ void CheckLongPathErrMsg(const char *FileName);
++ void ReadErrorMsg(const char *ArcName,const char *FileName);
++ void WriteErrorMsg(const char *ArcName,const char *FileName);
++ #endif
+ void Exit(RAR_EXIT ExitCode);
+ void SetErrorCode(RAR_EXIT Code);
+ RAR_EXIT GetErrorCode() {return(ExitCode);}
+diff -crB orig/extinfo.cpp src/extinfo.cpp
+*** orig/extinfo.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/extinfo.cpp 2013-03-13 01:45:30.363125000 +0100
+***************
+*** 17,23 ****
+--- 17,27 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
++ #else
++ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name)
++ #endif
+ {
+ switch(Arc.SubBlockHead.SubType)
+ {
+***************
+*** 52,59 ****
+ }
+ #endif
+
+!
+ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
+ {
+ #if defined(_EMX) && !defined(_DJGPP)
+ if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_OS2EA))
+--- 56,66 ----
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
++ #else
++ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name)
++ #endif
+ {
+ #if defined(_EMX) && !defined(_DJGPP)
+ if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_OS2EA))
+diff -crB orig/extinfo.hpp src/extinfo.hpp
+*** orig/extinfo.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/extinfo.hpp 2013-03-13 01:43:28.599122000 +0100
+***************
+*** 1,8 ****
+ #ifndef _RAR_EXTINFO_
+ #define _RAR_EXTINFO_
+
+!
+ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
+ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
+
+ #endif
+--- 1,12 ----
+ #ifndef _RAR_EXTINFO_
+ #define _RAR_EXTINFO_
+
+! #ifndef __BIONIC__
+ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
+ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
++ #else
++ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name);
++ void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name);
++ #endif
+
+ #endif
+diff -crB orig/extract.cpp src/extract.cpp
+*** orig/extract.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/extract.cpp 2013-03-15 20:12:25.467146568 +0100
+***************
+*** 3,15 ****
+--- 3,23 ----
+ CmdExtract::CmdExtract()
+ {
+ *ArcName=0;
++ #ifndef __BIONIC__
+ *ArcNameW=0;
++ #endif
+
+ *DestFileName=0;
++ #ifndef __BIONIC__
+ *DestFileNameW=0;
++ #endif
+
+ TotalFileCount=0;
++ #ifndef __BIONIC__
+ Password.Set(L"");
++ #else
++ Password.Set("");
++ #endif
+ Unp=new Unpack(&DataIO);
+ Unp->Init();
+ }
+***************
+*** 27,38 ****
+--- 35,55 ----
+ DataIO.SetCurrentCommand(*Cmd->Command);
+
+ FindData FD;
++ #ifndef __BIONIC__
+ while (Cmd->GetArcName(ArcName,ArcNameW,ASIZE(ArcName)))
+ if (FindFile::FastFind(ArcName,ArcNameW,&FD))
++ #else
++ while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
++ if (FindFile::FastFind(ArcName,&FD))
++ #endif
+ DataIO.TotalArcSize+=FD.Size;
+
+ Cmd->ArcNames->Rewind();
++ #ifndef __BIONIC__
+ while (Cmd->GetArcName(ArcName,ArcNameW,ASIZE(ArcName)))
++ #else
++ while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
++ #endif
+ {
+ while (true)
+ {
+***************
+*** 48,54 ****
+--- 65,75 ----
+ if (Code!=EXTRACT_ARC_REPEAT)
+ break;
+ }
++ #ifndef __BIONIC__
+ if (FindFile::FastFind(ArcName,ArcNameW,&FD))
++ #else
++ if (FindFile::FastFind(ArcName,&FD))
++ #endif
+ DataIO.ProcessedArcSize+=FD.Size;
+ }
+
+***************
+*** 103,109 ****
+--- 124,134 ----
+ EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd)
+ {
+ Archive Arc(Cmd);
++ #ifndef __BIONIC__
+ if (!Arc.WOpen(ArcName,ArcNameW))
++ #else
++ if (!Arc.WOpen(ArcName))
++ #endif
+ {
+ ErrHandler.SetErrorCode(RARX_OPEN);
+ return(EXTRACT_ARC_NEXT);
+***************
+*** 133,139 ****
+--- 158,168 ----
+ // and current volume is not first in set and first volume is present
+ // and specified too, let's skip the current volume.
+ if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
++ #ifndef __BIONIC__
+ Cmd->ArcNames->Search(FirstVolName,NULL,false))
++ #else
++ Cmd->ArcNames->Search(FirstVolName,false))
++ #endif
+ return(EXTRACT_ARC_NEXT);
+ }
+ #endif
+***************
+*** 149,164 ****
+--- 178,203 ----
+ wchar NextNameW[NM];
+
+ strcpy(NextName,Arc.FileName);
++ #ifndef __BIONIC__
+ wcscpy(NextNameW,Arc.FileNameW);
++ #endif
+
+ while (true)
+ {
+ // First volume is already added to DataIO.TotalArcSize
+ // in initial TotalArcSize calculation in DoExtract.
+ // So we skip it and start from second volume.
++ #ifndef __BIONIC__
+ NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
++ #else
++ NextVolumeName(NextName,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
++ #endif
+ struct FindData FD;
++ #ifndef __BIONIC__
+ if (FindFile::FastFind(NextName,NextNameW,&FD))
++ #else
++ if (FindFile::FastFind(NextName,&FD))
++ #endif
+ VolumeSetSize+=FD.Size;
+ else
+ break;
+***************
+*** 202,209 ****
+--- 241,253 ----
+ // of current volume and all volumes after it and add the size
+ // of new (first) volume.
+ FindData OldArc,NewArc;
++ #ifndef __BIONIC__
+ if (FindFile::FastFind(Arc.FileName,Arc.FileNameW,&OldArc) &&
+ FindFile::FastFind(ArcName,ArcNameW,&NewArc))
++ #else
++ if (FindFile::FastFind(Arc.FileName,&OldArc) &&
++ FindFile::FastFind(ArcName,&NewArc))
++ #endif
+ DataIO.TotalArcSize-=VolumeSetSize+OldArc.Size-NewArc.Size;
+ return(EXTRACT_ARC_REPEAT);
+ }
+***************
+*** 241,247 ****
+--- 285,295 ----
+ SignatureFound=true;
+ #if !defined(SFX_MODULE) && !defined(_WIN_CE)
+ if (HeadType==SUB_HEAD && PrevExtracted)
++ #ifndef __BIONIC__
+ SetExtraInfo(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL);
++ #else
++ SetExtraInfo(Cmd,Arc,DestFileName);
++ #endif
+ #endif
+ if (HeadType==NEWSUB_HEAD)
+ {
+***************
+*** 249,255 ****
+--- 297,307 ----
+ SignatureFound=true;
+ #if !defined(NOSUBBLOCKS) && !defined(_WIN_CE)
+ if (PrevExtracted)
++ #ifndef __BIONIC__
+ SetExtraInfoNew(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL);
++ #else
++ SetExtraInfoNew(Cmd,Arc,DestFileName);
++ #endif
+ #endif
+ }
+ if (HeadType==ENDARC_HEAD)
+***************
+*** 297,303 ****
+--- 349,359 ----
+ if (ExactMatch)
+ {
+ Cmd->FileArgs->Rewind();
++ #ifndef __BIONIC__
+ if (Cmd->FileArgs->GetString(Cmd->ArcPath,NULL,sizeof(Cmd->ArcPath),MatchNumber-1))
++ #else
++ if (Cmd->FileArgs->GetString(Cmd->ArcPath,sizeof(Cmd->ArcPath),MatchNumber-1))
++ #endif
+ *PointToName(Cmd->ArcPath)=0;
+ }
+ }
+***************
+*** 305,316 ****
+--- 361,377 ----
+ if (ExactMatch && !EqualNames)
+ AllMatchesExact=false;
+
++ #ifndef __BIONIC__
+ #ifdef UNICODE_SUPPORTED
+ bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled();
+ #else
+ bool WideName=false;
+ #endif
++ #else
++ bool WideName=false;
++ #endif
+
++ #ifndef __BIONIC__
+ #ifdef _APPLE
+ if (WideName)
+ {
+***************
+*** 335,340 ****
+--- 396,402 ----
+ strcpy(ArcFileName,Name);
+ }
+ #endif
++ #endif
+
+ ConvertPath(ArcFileName,ArcFileName);
+
+***************
+*** 347,355 ****
+--- 409,425 ----
+ {
+ if (Cmd->VersionControl==0)
+ ExactMatch=false;
++ #ifndef __BIONIC__
+ int Version=ParseVersionFileName(ArcFileName,ArcFileNameW,false);
++ #else
++ int Version=ParseVersionFileName(ArcFileName,false);
++ #endif
+ if (Cmd->VersionControl-1==Version)
++ #ifndef __BIONIC__
+ ParseVersionFileName(ArcFileName,ArcFileNameW,true);
++ #else
++ ParseVersionFileName(ArcFileName,true);
++ #endif
+ else
+ ExactMatch=false;
+ }
+***************
+*** 368,377 ****
+--- 438,453 ----
+
+ bool NewNumbering=(Arc.NewMhd.Flags & MHD_NEWNUMBERING)!=0;
+ VolNameToFirstName(ArcName,ArcName,NewNumbering);
++ #ifndef __BIONIC__
+ if (*ArcNameW!=0)
+ VolNameToFirstName(ArcNameW,ArcNameW,NewNumbering);
++ #endif
+
++ #ifndef __BIONIC__
+ if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName,ArcNameW))
++ #else
++ if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName))
++ #endif
+ {
+ // If first volume name does not match the current name and if
+ // such volume name really exists, let's unpack from this first volume.
+***************
+*** 384,390 ****
+--- 460,470 ----
+ ReconstructDone=true;
+
+ RecVolumes RecVol;
++ #ifndef __BIONIC__
+ if (RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true))
++ #else
++ if (RecVol.Restore(Cmd,Arc.FileName,true))
++ #endif
+ {
+ Repeat=true;
+ return(false);
+***************
+*** 455,461 ****
+--- 535,545 ----
+ Password=Cmd->Password;
+
+ #else
++ #ifndef __BIONIC__
+ if (!GetPassword(PASSWORD_FILE,ArcFileName,ArcFileNameW,&Password))
++ #else
++ if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
++ #endif
+ {
+ PasswordCancelled=true;
+ return(false);
+***************
+*** 472,478 ****
+--- 556,566 ----
+ case -1:
+ ErrHandler.Exit(RARX_USERBREAK);
+ case 2:
++ #ifndef __BIONIC__
+ if (!GetPassword(PASSWORD_FILE,ArcFileName,ArcFileNameW,&Password))
++ #else
++ if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
++ #endif
+ {
+ return(false);
+ }
+***************
+*** 485,494 ****
+--- 573,584 ----
+ #endif
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ if (*Cmd->ExtrPath==0 && *Cmd->ExtrPathW!=0)
+ WideToChar(Cmd->ExtrPathW,DestFileName);
+ else
+ #endif
++ #endif
+ strcpy(DestFileName,Cmd->ExtrPath);
+
+
+***************
+*** 548,553 ****
+--- 638,644 ----
+ }
+ }
+
++ #ifndef __BIONIC__
+ #ifndef SFX_MODULE
+ if (!WideName && *Cmd->ExtrPathW!=0)
+ {
+***************
+*** 603,615 ****
+--- 694,711 ----
+ }
+ else
+ *DestFileNameW=0;
++ #endif
+
+ ExtrFile=!SkipSolid && !EmptyName && (Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0;
+
+ if ((Cmd->FreshFiles || Cmd->UpdateFiles) && (Command=='E' || Command=='X'))
+ {
+ struct FindData FD;
++ #ifndef __BIONIC__
+ if (FindFile::FastFind(DestFileName,DestNameW,&FD))
++ #else
++ if (FindFile::FastFind(DestFileName,&FD))
++ #endif
+ {
+ if (FD.mtime >= Arc.NewLhd.mtime)
+ {
+***************
+*** 698,720 ****
+--- 794,834 ----
+ #endif
+ return(true);
+ }
++ #ifndef __BIONIC__
+ MKDIR_CODE MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
++ #else
++ MKDIR_CODE MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
++ #endif
+ bool DirExist=false;
+ if (MDCode!=MKDIR_SUCCESS)
+ {
++ #ifndef __BIONIC__
+ DirExist=FileExist(DestFileName,DestNameW);
+ if (DirExist && !IsDir(GetFileAttr(DestFileName,DestNameW)))
++ #else
++ DirExist=FileExist(DestFileName);
++ if (DirExist && !IsDir(GetFileAttr(DestFileName)))
++ #endif
+ {
+ // File with name same as this directory exists. Propose user
+ // to overwrite it.
+ bool UserReject;
++ #ifndef __BIONIC__
+ FileCreate(Cmd,NULL,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime);
++ #else
++ FileCreate(Cmd,NULL,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime);
++ #endif
+ DirExist=false;
+ }
+ if (!DirExist)
+ {
++ #ifndef __BIONIC__
+ CreatePath(DestFileName,DestNameW,true);
+ MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
++ #else
++ CreatePath(DestFileName,true);
++ MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
++ #endif
+ }
+ }
+ if (MDCode==MKDIR_SUCCESS)
+***************
+*** 729,741 ****
+--- 843,863 ----
+ if (DirExist)
+ {
+ if (!Cmd->IgnoreGeneralAttr)
++ #ifndef __BIONIC__
+ SetFileAttr(DestFileName,DestNameW,Arc.NewLhd.FileAttr);
++ #else
++ SetFileAttr(DestFileName,Arc.NewLhd.FileAttr);
++ #endif
+ PrevExtracted=true;
+ }
+ else
+ {
+ Log(Arc.FileName,St(MExtrErrMkDir),DestFileName);
++ #ifndef __BIONIC__
+ ErrHandler.CheckLongPathErrMsg(DestFileName,DestNameW);
++ #else
++ ErrHandler.CheckLongPathErrMsg(DestFileName);
++ #endif
+ ErrHandler.SysErrMsg();
+ #ifdef RARDLL
+ Cmd->DllError=ERAR_ECREATE;
+***************
+*** 749,758 ****
+--- 871,887 ----
+ (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT())
+ SetFileCompression(DestFileName,DestNameW,true);
+ #endif
++ #ifndef __BIONIC__
+ SetDirTime(DestFileName,DestNameW,
+ Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
+ Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
+ Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
++ #else
++ SetDirTime(DestFileName,
++ Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
++ Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
++ Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
++ #endif
+ }
+ return(true);
+ }
+***************
+*** 769,799 ****
+--- 898,951 ----
+ bool UserReject;
+ // Specify "write only" mode to avoid OpenIndiana NAS problems
+ // with SetFileTime and read+write files.
++ #ifndef __BIONIC__
+ if (!FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
++ #else
++ if (!FileCreate(Cmd,&CurFile,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
++ #endif
+ {
+ ExtrFile=false;
+ if (!UserReject)
+ {
++ #ifndef __BIONIC__
+ ErrHandler.CreateErrorMsg(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
++ #else
++ ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
++ #endif
+ ErrHandler.SetErrorCode(RARX_CREATE);
+ #ifdef RARDLL
+ Cmd->DllError=ERAR_ECREATE;
+ #endif
++ #ifndef __BIONIC__
+ if (!IsNameUsable(DestFileName) && (!WideName || !IsNameUsable(DestNameW)))
++ #else
++ if (!IsNameUsable(DestFileName))
++ #endif
+ {
+ Log(Arc.FileName,St(MCorrectingName));
+ char OrigName[ASIZE(DestFileName)];
++ #ifndef __BIONIC__
+ wchar OrigNameW[ASIZE(DestFileNameW)];
++ #endif
+ strncpyz(OrigName,DestFileName,ASIZE(OrigName));
++ #ifndef __BIONIC__
+ wcsncpyz(OrigNameW,NullToEmpty(DestNameW),ASIZE(OrigNameW));
++ #endif
+
+ MakeNameUsable(DestFileName,true);
+
++ #ifndef __BIONIC__
+ if (WideName)
+ MakeNameUsable(DestNameW,true);
++ #endif
+
++ #ifndef __BIONIC__
+ CreatePath(DestFileName,DestNameW,true);
+ if (FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
++ #else
++ CreatePath(DestFileName,true);
++ if (FileCreate(Cmd,&CurFile,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
++ #endif
+ {
+ #ifndef SFX_MODULE
+ Log(Arc.FileName,St(MRenaming),OrigName,DestFileName);
+***************
+*** 801,807 ****
+--- 953,963 ----
+ ExtrFile=true;
+ }
+ else
++ #ifndef __BIONIC__
+ ErrHandler.CreateErrorMsg(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
++ #else
++ ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
++ #endif
+ }
+ }
+ }
+***************
+*** 823,829 ****
+--- 979,989 ----
+ if (!TestMode && Command!='P' && CurFile.IsDevice())
+ {
+ Log(Arc.FileName,St(MInvalidName),DestFileName);
++ #ifndef __BIONIC__
+ ErrHandler.WriteError(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
++ #else
++ ErrHandler.WriteError(Arc.FileName,DestFileName);
++ #endif
+ }
+ TotalFileCount++;
+ }
+***************
+*** 989,995 ****
+--- 1149,1159 ----
+ Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
+ Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
+ if (!Cmd->IgnoreGeneralAttr)
++ #ifndef __BIONIC__
+ SetFileAttr(CurFile.FileName,CurFile.FileNameW,Arc.NewLhd.FileAttr);
++ #else
++ SetFileAttr(CurFile.FileName,Arc.NewLhd.FileAttr);
++ #endif
+ PrevExtracted=true;
+ }
+ }
+diff -crB orig/extract.hpp src/extract.hpp
+*** orig/extract.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/extract.hpp 2013-03-12 00:45:29.214278000 +0100
+***************
+*** 26,38 ****
+--- 26,42 ----
+ bool AnySolidDataUnpackedWell;
+
+ char ArcName[NM];
++ #ifndef __BIONIC__
+ wchar ArcNameW[NM];
++ #endif
+
+ SecPassword Password;
+ bool PasswordAll;
+ bool PrevExtracted;
+ char DestFileName[NM];
++ #ifndef __BIONIC__
+ wchar DestFileNameW[NM];
++ #endif
+ bool PasswordCancelled;
+ public:
+ CmdExtract();
+diff -crB orig/filcreat.cpp src/filcreat.cpp
+*** orig/filcreat.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filcreat.cpp 2013-03-11 23:35:49.706147000 +0100
+***************
+*** 1,15 ****
+--- 1,25 ----
+ #include "rar.hpp"
+
++ #ifndef __BIONIC__
+ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
+ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize,
+ uint FileTime,bool WriteOnly)
++ #else
++ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,
++ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize,
++ uint FileTime,bool WriteOnly)
++ #endif
+ {
+ if (UserReject!=NULL)
+ *UserReject=false;
+ #if defined(_WIN_ALL) && !defined(_WIN_CE)
+ bool ShortNameChanged=false;
+ #endif
++ #ifndef __BIONIC__
+ while (FileExist(Name,NameW))
++ #else
++ while (FileExist(Name))
++ #endif
+ {
+ #if defined(_WIN_ALL) && !defined(_WIN_CE)
+ if (!ShortNameChanged)
+***************
+*** 26,33 ****
+--- 36,45 ----
+ {
+ if (Name!=NULL && *Name!=0)
+ WideToChar(WideName,Name);
++ #ifndef __BIONIC__
+ if (NameW!=NULL && *NameW!=0)
+ wcscpy(NameW,WideName);
++ #endif
+ continue;
+ }
+ }
+***************
+*** 45,51 ****
+--- 57,67 ----
+ // Must be before Cmd->AllYes check or -y switch would override -or.
+ if (Mode==OVERWRITE_AUTORENAME)
+ {
++ #ifndef __BIONIC__
+ if (!GetAutoRenamedName(Name,NameW))
++ #else
++ if (!GetAutoRenamedName(Name))
++ #endif
+ Mode=OVERWRITE_DEFAULT;
+ continue;
+ }
+***************
+*** 62,69 ****
+--- 78,87 ----
+ if (Mode==OVERWRITE_DEFAULT || Mode==OVERWRITE_FORCE_ASK)
+ {
+ char NewName[NM];
++ #ifndef __BIONIC__
+ wchar NewNameW[NM];
+ *NewNameW=0;
++ #endif
+ eprintf(St(MFileExists),Name);
+ int Choice=Ask(St(MYesNoAllRenQ));
+ if (Choice==1)
+***************
+*** 113,123 ****
+--- 131,143 ----
+ else
+ strcpy(Name,NewName);
+
++ #ifndef __BIONIC__
+ if (NameW!=NULL)
+ if (PointToName(NewNameW)==NewNameW)
+ wcscpy(PointToName(NameW),NewNameW);
+ else
+ wcscpy(NameW,NewNameW);
++ #endif
+ continue;
+ }
+ if (Choice==6)
+***************
+*** 125,145 ****
+--- 145,183 ----
+ }
+ }
+ uint FileMode=WriteOnly ? FMF_WRITE|FMF_SHAREREAD:FMF_UPDATE|FMF_SHAREREAD;
++ #ifndef __BIONIC__
+ if (NewFile!=NULL && NewFile->Create(Name,NameW,FileMode))
++ #else
++ if (NewFile!=NULL && NewFile->Create(Name,FileMode))
++ #endif
+ return(true);
++ #ifndef __BIONIC__
+ PrepareToDelete(Name,NameW);
+ CreatePath(Name,NameW,true);
+ return(NewFile!=NULL ? NewFile->Create(Name,NameW,FileMode):DelFile(Name,NameW));
++ #else
++ PrepareToDelete(Name);
++ CreatePath(Name,true);
++ return(NewFile!=NULL ? NewFile->Create(Name,FileMode):DelFile(Name));
++ #endif
+ }
+
+
++ #ifndef __BIONIC__
+ bool GetAutoRenamedName(char *Name,wchar *NameW)
++ #else
++ bool GetAutoRenamedName(char *Name)
++ #endif
+ {
+ char NewName[NM];
++ #ifndef __BIONIC__
+ wchar NewNameW[NM];
+
+ if (Name!=NULL && strlen(Name)>ASIZE(NewName)-10 ||
+ NameW!=NULL && wcslen(NameW)>ASIZE(NewNameW)-10)
++ #else
++ if (Name!=NULL && strlen(Name)>ASIZE(NewName)-10)
++ #endif
+ return(false);
+ char *Ext=NULL;
+ if (Name!=NULL && *Name!=0)
+***************
+*** 148,153 ****
+--- 186,192 ----
+ if (Ext==NULL)
+ Ext=Name+strlen(Name);
+ }
++ #ifndef __BIONIC__
+ wchar *ExtW=NULL;
+ if (NameW!=NULL && *NameW!=0)
+ {
+***************
+*** 155,174 ****
+--- 194,222 ----
+ if (ExtW==NULL)
+ ExtW=NameW+wcslen(NameW);
+ }
++ #endif
+ *NewName=0;
++ #ifndef __BIONIC__
+ *NewNameW=0;
++ #endif
+ for (int FileVer=1;;FileVer++)
+ {
+ if (Name!=NULL && *Name!=0)
+ sprintf(NewName,"%.*s(%d)%s",int(Ext-Name),Name,FileVer,Ext);
++ #ifndef __BIONIC__
+ if (NameW!=NULL && *NameW!=0)
+ sprintfw(NewNameW,ASIZE(NewNameW),L"%.*s(%d)%s",int(ExtW-NameW),NameW,FileVer,ExtW);
+ if (!FileExist(NewName,NewNameW))
++ #else
++ if (!FileExist(NewName))
++ #endif
+ {
+ if (Name!=NULL && *Name!=0)
+ strcpy(Name,NewName);
++ #ifndef __BIONIC__
+ if (NameW!=NULL && *NameW!=0)
+ wcscpy(NameW,NewNameW);
++ #endif
+ break;
+ }
+ if (FileVer>=1000000)
+diff -crB orig/filcreat.hpp src/filcreat.hpp
+*** orig/filcreat.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filcreat.hpp 2013-03-11 23:28:59.038135000 +0100
+***************
+*** 1,10 ****
+--- 1,17 ----
+ #ifndef _RAR_FILECREATE_
+ #define _RAR_FILECREATE_
+
++ #ifndef __BIONIC__
+ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
+ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize=INT64NDF,
+ uint FileTime=0,bool WriteOnly=false);
+ bool GetAutoRenamedName(char *Name,wchar *NameW);
++ #else
++ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,
++ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize=INT64NDF,
++ uint FileTime=0,bool WriteOnly=false);
++ bool GetAutoRenamedName(char *Name);
++ #endif
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE)
+ bool UpdateExistingShortName(wchar *Name);
+diff -crB orig/file.cpp src/file.cpp
+*** orig/file.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/file.cpp 2013-03-11 02:08:05.042458000 +0100
+***************
+*** 7,13 ****
+--- 7,15 ----
+ {
+ hFile=BAD_HANDLE;
+ *FileName=0;
++ #ifndef __BIONIC__
+ *FileNameW=0;
++ #endif
+ NewFile=false;
+ LastWrite=false;
+ HandleType=FILE_HANDLENORMAL;
+***************
+*** 45,52 ****
+ SrcFile.SkipClose=true;
+ }
+
+!
+ bool File::Open(const char *Name,const wchar *NameW,uint Mode)
+ {
+ ErrorType=FILE_SUCCESS;
+ FileHandle hNewFile;
+--- 47,57 ----
+ SrcFile.SkipClose=true;
+ }
+
+! #ifndef __BIONIC__
+ bool File::Open(const char *Name,const wchar *NameW,uint Mode)
++ #else
++ bool File::Open(const char *Name,uint Mode)
++ #endif
+ {
+ ErrorType=FILE_SUCCESS;
+ FileHandle hNewFile;
+***************
+*** 110,123 ****
+--- 115,132 ----
+ // with overlapped buffers. While we do not call this function with
+ // really overlapped buffers yet, we do call it with Name equal to
+ // FileName like Arc.Open(Arc.FileName,Arc.FileNameW,...).
++ #ifndef __BIONIC__
+ if (NameW!=NULL)
+ memmove(FileNameW,NameW,(wcslen(NameW)+1)*sizeof(*NameW));
+ else
+ *FileNameW=0;
++ #endif
+ if (Name!=NULL)
+ memmove(FileName,Name,strlen(Name)+1);
++ #ifndef __BIONIC__
+ else
+ WideToChar(NameW,FileName);
++ #endif
+ AddFileToList(hFile);
+ }
+ return(Success);
+***************
+*** 125,148 ****
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+ void File::TOpen(const char *Name,const wchar *NameW)
+ {
+ if (!WOpen(Name,NameW))
+ ErrHandler.Exit(RARX_OPEN);
+ }
+ #endif
+
+!
+ bool File::WOpen(const char *Name,const wchar *NameW)
+ {
+ if (Open(Name,NameW))
+ return(true);
+ ErrHandler.OpenErrorMsg(Name,NameW);
+ return(false);
+ }
+
+!
+ bool File::Create(const char *Name,const wchar *NameW,uint Mode)
+ {
+ // OpenIndiana based NAS and CIFS shares fail to set the file time if file
+ // was created in read+write mode and some data was written and not flushed
+--- 134,179 ----
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void File::TOpen(const char *Name,const wchar *NameW)
++ #else
++ void File::TOpen(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (!WOpen(Name,NameW))
++ #else
++ if (!WOpen(Name))
++ #endif
+ ErrHandler.Exit(RARX_OPEN);
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ bool File::WOpen(const char *Name,const wchar *NameW)
++ #else
++ bool File::WOpen(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (Open(Name,NameW))
++ #else
++ if (Open(Name))
++ #endif
+ return(true);
++ #ifndef __BIONIC__
+ ErrHandler.OpenErrorMsg(Name,NameW);
++ #else
++ ErrHandler.OpenErrorMsg(Name);
++ #endif
+ return(false);
+ }
+
+! #ifndef __BIONIC__
+ bool File::Create(const char *Name,const wchar *NameW,uint Mode)
++ #else
++ bool File::Create(const char *Name,uint Mode)
++ #endif
+ {
+ // OpenIndiana based NAS and CIFS shares fail to set the file time if file
+ // was created in read+write mode and some data was written and not flushed
+***************
+*** 164,177 ****
+--- 195,212 ----
+ NewFile=true;
+ HandleType=FILE_HANDLENORMAL;
+ SkipClose=false;
++ #ifndef __BIONIC__
+ if (NameW!=NULL)
+ wcscpy(FileNameW,NameW);
+ else
+ *FileNameW=0;
++ #endif
+ if (Name!=NULL)
+ strcpy(FileName,Name);
++ #ifndef __BIONIC__
+ else
+ WideToChar(NameW,FileName);
++ #endif
+ AddFileToList(hFile);
+ return(hFile!=BAD_HANDLE);
+ }
+***************
+*** 190,209 ****
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+ void File::TCreate(const char *Name,const wchar *NameW,uint Mode)
+ {
+ if (!WCreate(Name,NameW,Mode))
+ ErrHandler.Exit(RARX_FATAL);
+ }
+ #endif
+
+!
+ bool File::WCreate(const char *Name,const wchar *NameW,uint Mode)
+ {
+ if (Create(Name,NameW,Mode))
+ return(true);
+ ErrHandler.SetErrorCode(RARX_CREATE);
+ ErrHandler.CreateErrorMsg(Name,NameW);
+ return(false);
+ }
+
+--- 225,263 ----
+
+
+ #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void File::TCreate(const char *Name,const wchar *NameW,uint Mode)
++ #else
++ void File::TCreate(const char *Name,uint Mode)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (!WCreate(Name,NameW,Mode))
++ #else
++ if (!WCreate(Name,Mode))
++ #endif
+ ErrHandler.Exit(RARX_FATAL);
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ bool File::WCreate(const char *Name,const wchar *NameW,uint Mode)
++ #else
++ bool File::WCreate(const char *Name,uint Mode)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (Create(Name,NameW,Mode))
++ #else
++ if (Create(Name,Mode))
++ #endif
+ return(true);
+ ErrHandler.SetErrorCode(RARX_CREATE);
++ #ifndef __BIONIC__
+ ErrHandler.CreateErrorMsg(Name,NameW);
++ #else
++ ErrHandler.CreateErrorMsg(Name);
++ #endif
+ return(false);
+ }
+
+***************
+*** 233,239 ****
+--- 287,297 ----
+ }
+ hFile=BAD_HANDLE;
+ if (!Success && AllowExceptions)
++ #ifndef __BIONIC__
+ ErrHandler.CloseError(FileName,FileNameW);
++ #else
++ ErrHandler.CloseError(FileName);
++ #endif
+ }
+ CloseCount++;
+ return(Success);
+***************
+*** 258,282 ****
+ Close();
+ if (!AllowDelete)
+ return(false);
+ return(DelFile(FileName,FileNameW));
+ }
+
+!
+ bool File::Rename(const char *NewName,const wchar *NewNameW)
+ {
+ // we do not need to rename if names are already same
+ bool Success=strcmp(FileName,NewName)==0;
+ if (Success && *FileNameW!=0 && *NullToEmpty(NewNameW)!=0)
+ Success=wcscmp(FileNameW,NewNameW)==0;
+
+ if (!Success)
+ Success=RenameFile(FileName,FileNameW,NewName,NewNameW);
+
+ if (Success)
+ {
+ // renamed successfully, storing the new name
+ strcpy(FileName,NewName);
+ wcscpy(FileNameW,NullToEmpty(NewNameW));
+ }
+ return(Success);
+ }
+--- 316,355 ----
+ Close();
+ if (!AllowDelete)
+ return(false);
++ #ifndef __BIONIC__
+ return(DelFile(FileName,FileNameW));
++ #else
++ return(DelFile(FileName));
++ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool File::Rename(const char *NewName,const wchar *NewNameW)
++ #else
++ bool File::Rename(const char *NewName)
++ #endif
+ {
+ // we do not need to rename if names are already same
+ bool Success=strcmp(FileName,NewName)==0;
++ #ifndef __BIONIC__
+ if (Success && *FileNameW!=0 && *NullToEmpty(NewNameW)!=0)
+ Success=wcscmp(FileNameW,NewNameW)==0;
++ #endif
+
+ if (!Success)
++ #ifndef __BIONIC__
+ Success=RenameFile(FileName,FileNameW,NewName,NewNameW);
++ #else
++ Success=RenameFile(FileName,NewName);
++ #endif
+
+ if (Success)
+ {
+ // renamed successfully, storing the new name
+ strcpy(FileName,NewName);
++ #ifndef __BIONIC__
+ wcscpy(FileNameW,NullToEmpty(NewNameW));
++ #endif
+ }
+ return(Success);
+ }
+***************
+*** 338,344 ****
+--- 411,422 ----
+ if (FreeSize>Size && FilePos-Size<=0xffffffff && FilePos+Size>0xffffffff)
+ ErrHandler.WriteErrorFAT(FileName,FileNameW);
+ #endif
++
++ #ifndef __BIONIC__
+ if (ErrHandler.AskRepeatWrite(FileName,FileNameW,false))
++ #else
++ if (ErrHandler.AskRepeatWrite(FileName,false))
++ #endif
+ {
+ #ifndef _WIN_ALL
+ clearerr(hFile);
+***************
+*** 347,353 ****
+--- 425,435 ----
+ Seek(Tell()-Written,SEEK_SET);
+ continue;
+ }
++ #ifndef __BIONIC__
+ ErrHandler.WriteError(NULL,NULL,FileName,FileNameW);
++ #else
++ ErrHandler.WriteError(NULL,FileName);
++ #endif
+ }
+ break;
+ }
+***************
+*** 382,390 ****
+--- 464,478 ----
+ }
+ else
+ {
++ #ifndef __BIONIC__
+ if (HandleType==FILE_HANDLENORMAL && ErrHandler.AskRepeatRead(FileName,FileNameW))
+ continue;
+ ErrHandler.ReadError(FileName,FileNameW);
++ #else
++ if (HandleType==FILE_HANDLENORMAL && ErrHandler.AskRepeatRead(FileName))
++ continue;
++ ErrHandler.ReadError(FileName);
++ #endif
+ }
+ }
+ break;
+***************
+*** 440,446 ****
+--- 528,538 ----
+ void File::Seek(int64 Offset,int Method)
+ {
+ if (!RawSeek(Offset,Method) && AllowExceptions)
++ #ifndef __BIONIC__
+ ErrHandler.SeekError(FileName,FileNameW);
++ #else
++ ErrHandler.SeekError(FileName);
++ #endif
+ }
+
+
+***************
+*** 475,481 ****
+--- 567,577 ----
+ {
+ if (hFile==BAD_HANDLE)
+ if (AllowExceptions)
++ #ifndef __BIONIC__
+ ErrHandler.SeekError(FileName,FileNameW);
++ #else
++ ErrHandler.SeekError(FileName);
++ #endif
+ else
+ return(-1);
+ #ifdef _WIN_ALL
+***************
+*** 483,489 ****
+--- 579,589 ----
+ uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT);
+ if (LowDist==0xffffffff && GetLastError()!=NO_ERROR)
+ if (AllowExceptions)
++ #ifndef __BIONIC__
+ ErrHandler.SeekError(FileName,FileNameW);
++ #else
++ ErrHandler.SeekError(FileName);
++ #endif
+ else
+ return(-1);
+ return(INT32TO64(HighDist,LowDist));
+diff -crB orig/filefn.cpp src/filefn.cpp
+*** orig/filefn.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filefn.cpp 2013-03-15 20:14:02.767148742 +0100
+***************
+*** 1,6 ****
+--- 1,10 ----
+ #include "rar.hpp"
+
++ #ifndef __BIONIC__
+ MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr)
++ #else
++ MKDIR_CODE MakeDir(const char *Name,bool SetAttr,uint Attr)
++ #endif
+ {
+ #ifdef _WIN_ALL
+ BOOL RetCode;
+***************
+*** 36,42 ****
+--- 40,50 ----
+ #endif
+ {
+ if (SetAttr)
++ #ifndef __BIONIC__
+ SetFileAttr(Name,NameW,Attr);
++ #else
++ SetFileAttr(Name,Attr);
++ #endif
+ return(MKDIR_SUCCESS);
+ }
+ return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
+***************
+*** 78,84 ****
+--- 86,96 ----
+ strncpy(DirName,Path,s-Path);
+ DirName[s-Path]=0;
+
++ #ifndef __BIONIC__
+ if (MakeDir(DirName,NULL,true,DirAttr)==MKDIR_SUCCESS)
++ #else
++ if (MakeDir(DirName,true,DirAttr)==MKDIR_SUCCESS)
++ #endif
+ {
+ #ifndef GUI
+ mprintf(St(MCreatDir),DirName);
+***************
+*** 91,102 ****
+ }
+ if (!SkipLastName)
+ if (!IsPathDiv(*PointToLastChar(Path)))
+ if (MakeDir(Path,NULL,true,DirAttr)!=MKDIR_SUCCESS)
+ Success=false;
+ return(Success);
+ }
+
+!
+ bool CreatePath(const wchar *Path,bool SkipLastName)
+ {
+ if (Path==NULL || *Path==0)
+--- 103,118 ----
+ }
+ if (!SkipLastName)
+ if (!IsPathDiv(*PointToLastChar(Path)))
++ #ifndef __BIONIC__
+ if (MakeDir(Path,NULL,true,DirAttr)!=MKDIR_SUCCESS)
++ #else
++ if (MakeDir(Path,true,DirAttr)!=MKDIR_SUCCESS)
++ #endif
+ Success=false;
+ return(Success);
+ }
+
+! #ifndef __BIONIC__
+ bool CreatePath(const wchar *Path,bool SkipLastName)
+ {
+ if (Path==NULL || *Path==0)
+***************
+*** 157,165 ****
+--- 173,186 ----
+ return(CreatePath(Path,SkipLastName));
+ return(false);
+ }
++ #endif
+
+
++ #ifndef __BIONIC__
+ void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta)
++ #else
++ void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta)
++ #endif
+ {
+ #ifdef _WIN_ALL
+ if (!WinNT())
+***************
+*** 305,312 ****
+
+
+
+!
+ bool FileExist(const char *Name,const wchar *NameW)
+ {
+ #ifdef _WIN_ALL
+ if (WinNT() && NameW!=NULL && *NameW!=0)
+--- 326,336 ----
+
+
+
+! #ifndef __BIONIC__
+ bool FileExist(const char *Name,const wchar *NameW)
++ #else
++ bool FileExist(const char *Name)
++ #endif
+ {
+ #ifdef _WIN_ALL
+ if (WinNT() && NameW!=NULL && *NameW!=0)
+***************
+*** 317,344 ****
+ return(access(Name,0)==0);
+ #else
+ FindData FD;
+ return(FindFile::FastFind(Name,NameW,&FD));
+ #endif
+ }
+
+!
+ bool FileExist(const wchar *Name)
+ {
+ return FileExist(NULL,Name);
+ }
+
+!
+ bool WildFileExist(const char *Name,const wchar *NameW)
+ {
+ if (IsWildcard(Name,NameW))
+ {
+ FindFile Find;
+ Find.SetMask(Name);
+ Find.SetMaskW(NameW);
+ FindData fd;
+ return(Find.Next(&fd));
+ }
+ return(FileExist(Name,NameW));
+ }
+
+
+--- 341,386 ----
+ return(access(Name,0)==0);
+ #else
+ FindData FD;
++ #ifndef __BIONIC__
+ return(FindFile::FastFind(Name,NameW,&FD));
++ #else
++ return(FindFile::FastFind(Name,&FD));
++ #endif
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool FileExist(const wchar *Name)
+ {
+ return FileExist(NULL,Name);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ bool WildFileExist(const char *Name,const wchar *NameW)
++ #else
++ bool WildFileExist(const char *Name)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (IsWildcard(Name,NameW))
++ #else
++ if (IsWildcard(Name))
++ #endif
+ {
+ FindFile Find;
+ Find.SetMask(Name);
++ #ifndef __BIONIC__
+ Find.SetMaskW(NameW);
++ #endif
+ FindData fd;
+ return(Find.Next(&fd));
+ }
++ #ifndef __BIONIC__
+ return(FileExist(Name,NameW));
++ #else
++ return(FileExist(Name));
++ #endif
+ }
+
+
+***************
+*** 395,402 ****
+ #endif
+ }
+
+!
+ void PrepareToDelete(const char *Name,const wchar *NameW)
+ {
+ #if defined(_WIN_ALL) || defined(_EMX)
+ SetFileAttr(Name,NameW,0);
+--- 437,447 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void PrepareToDelete(const char *Name,const wchar *NameW)
++ #else
++ void PrepareToDelete(const char *Name)
++ #endif
+ {
+ #if defined(_WIN_ALL) || defined(_EMX)
+ SetFileAttr(Name,NameW,0);
+***************
+*** 407,414 ****
+ #endif
+ }
+
+!
+ uint GetFileAttr(const char *Name,const wchar *NameW)
+ {
+ #ifdef _WIN_ALL
+ if (WinNT() && NameW!=NULL && *NameW!=0)
+--- 452,462 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ uint GetFileAttr(const char *Name,const wchar *NameW)
++ #else
++ uint GetFileAttr(const char *Name)
++ #endif
+ {
+ #ifdef _WIN_ALL
+ if (WinNT() && NameW!=NULL && *NameW!=0)
+***************
+*** 429,436 ****
+ #endif
+ }
+
+!
+ bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr)
+ {
+ bool Success;
+ #ifdef _WIN_ALL
+--- 477,487 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr)
++ #else
++ bool SetFileAttr(const char *Name,uint Attr)
++ #endif
+ {
+ bool Success;
+ #ifdef _WIN_ALL
+***************
+*** 508,529 ****
+ }
+ #endif
+
+!
+ bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW)
+ {
+ return(rename(SrcName,DestName)==0);
+ }
+
+!
+ bool DelFile(const char *Name)
+ {
+ return(DelFile(Name,NULL));
+ }
+
+
+!
+!
+ bool DelFile(const char *Name,const wchar *NameW)
+ {
+ return(Name!=NULL && remove(Name)==0);
+ }
+--- 559,586 ----
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW)
++ #else
++ bool RenameFile(const char *SrcName,const char *DestName)
++ #endif
+ {
+ return(rename(SrcName,DestName)==0);
+ }
+
+! #ifndef __BIONIC__
+ bool DelFile(const char *Name)
+ {
+ return(DelFile(Name,NULL));
+ }
++ #endif
+
+
+! #ifndef __BIONIC__
+ bool DelFile(const char *Name,const wchar *NameW)
++ #else
++ bool DelFile(const char *Name)
++ #endif
+ {
+ return(Name!=NULL && remove(Name)==0);
+ }
+diff -crB orig/filefn.hpp src/filefn.hpp
+*** orig/filefn.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filefn.hpp 2013-03-11 02:23:56.942488000 +0100
+***************
+*** 3,23 ****
+
+ enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH};
+
+ MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr);
+ bool CreatePath(const char *Path,bool SkipLastName);
+ bool CreatePath(const wchar *Path,bool SkipLastName);
+ bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName);
+ void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta);
+ bool IsRemovable(const char *Name);
+
+ #ifndef SFX_MODULE
+ int64 GetFreeDisk(const char *Name);
+ #endif
+
+!
+ bool FileExist(const char *Name,const wchar *NameW=NULL);
+ bool FileExist(const wchar *Name);
+ bool WildFileExist(const char *Name,const wchar *NameW=NULL);
+ bool IsDir(uint Attr);
+ bool IsUnreadable(uint Attr);
+ bool IsLabel(uint Attr);
+--- 3,35 ----
+
+ enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH};
+
++ #ifndef __BIONIC__
+ MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr);
++ #else
++ MKDIR_CODE MakeDir(const char *Name,bool SetAttr,uint Attr);
++ #endif
+ bool CreatePath(const char *Path,bool SkipLastName);
++ #ifndef __BIONIC__
+ bool CreatePath(const wchar *Path,bool SkipLastName);
+ bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName);
+ void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta);
++ #else
++ void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta);
++ #endif
+ bool IsRemovable(const char *Name);
+
+ #ifndef SFX_MODULE
+ int64 GetFreeDisk(const char *Name);
+ #endif
+
+! #ifndef __BIONIC__
+ bool FileExist(const char *Name,const wchar *NameW=NULL);
+ bool FileExist(const wchar *Name);
+ bool WildFileExist(const char *Name,const wchar *NameW=NULL);
++ #else
++ bool FileExist(const char *Name);
++ bool WildFileExist(const char *Name);
++ #endif
+ bool IsDir(uint Attr);
+ bool IsUnreadable(uint Attr);
+ bool IsLabel(uint Attr);
+***************
+*** 25,42 ****
+--- 37,72 ----
+ void SetSFXMode(const char *FileName);
+ void EraseDiskContents(const char *FileName);
+ bool IsDeleteAllowed(uint FileAttr);
++ #ifndef __BIONIC__
+ void PrepareToDelete(const char *Name,const wchar *NameW=NULL);
+ uint GetFileAttr(const char *Name,const wchar *NameW=NULL);
+ bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr);
++ #else
++ void PrepareToDelete(const char *Name);
++ uint GetFileAttr(const char *Name);
++ bool SetFileAttr(const char *Name,uint Attr);
++ #endif
+
+ enum CALCCRC_SHOWMODE {CALCCRC_SHOWNONE,CALCCRC_SHOWTEXT,CALCCRC_SHOWALL};
+ uint CalcFileCRC(File *SrcFile,int64 Size=INT64NDF,CALCCRC_SHOWMODE ShowMode=CALCCRC_SHOWNONE);
+
++ #ifndef __BIONIC__
+ bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW);
++ #else
++ bool RenameFile(const char *SrcName,const char *DestName);
++ #endif
+ bool DelFile(const char *Name);
++ #ifndef __BIONIC__
+ bool DelFile(const char *Name,const wchar *NameW);
++ #else
++ bool DelFile(const char *Name);
++ #endif
+ bool DelDir(const char *Name);
++ #ifndef __BIONIC__
+ bool DelDir(const char *Name,const wchar *NameW);
++ #else
++ bool DelDir(const char *Name);
++ #endif
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE)
+ bool SetFileCompression(char *Name,wchar *NameW,bool State);
+diff -crB orig/file.hpp src/file.hpp
+*** orig/file.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/file.hpp 2013-03-11 02:09:16.522460000 +0100
+***************
+*** 66,72 ****
+--- 66,74 ----
+ bool OpenShared; // Set by 'Archive' class.
+ public:
+ char FileName[NM];
++ #ifndef __BIONIC__
+ wchar FileNameW[NM];
++ #endif
+
+ FILE_ERRORTYPE ErrorType;
+
+***************
+*** 75,90 ****
+--- 77,105 ----
+ File();
+ virtual ~File();
+ void operator = (File &SrcFile);
++ #ifndef __BIONIC__
+ bool Open(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_READ);
+ void TOpen(const char *Name,const wchar *NameW=NULL);
+ bool WOpen(const char *Name,const wchar *NameW=NULL);
+ bool Create(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+ void TCreate(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+ bool WCreate(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
++ #else
++ bool Open(const char *Name,uint Mode=FMF_READ);
++ void TOpen(const char *Name);
++ bool WOpen(const char *Name);
++ bool Create(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
++ void TCreate(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
++ bool WCreate(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
++ #endif
+ bool Close();
+ void Flush();
+ bool Delete();
++ #ifndef __BIONIC__
+ bool Rename(const char *NewName,const wchar *NewNameW=NULL);
++ #else
++ bool Rename(const char *NewName);
++ #endif
+ void Write(const void *Data,size_t Size);
+ int Read(void *Data,size_t Size);
+ int DirectRead(void *Data,size_t Size);
+diff -crB orig/filestr.cpp src/filestr.cpp
+*** orig/filestr.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filestr.cpp 2013-03-13 01:29:10.579095000 +0100
+***************
+*** 4,10 ****
+--- 4,12 ----
+
+ bool ReadTextFile(
+ const char *Name,
++ #ifndef __BIONIC__
+ const wchar *NameW,
++ #endif
+ StringList *List,
+ bool Config,
+ bool AbortOnError,
+***************
+*** 21,28 ****
+--- 23,32 ----
+ else
+ strcpy(FileName,Name);
+
++ #ifndef __BIONIC__
+ wchar FileNameW[NM];
+ *FileNameW=0;
++ #endif
+
+ #ifdef _WIN_ALL
+ if (NameW!=NULL)
+***************
+*** 33,41 ****
+--- 37,53 ----
+ #endif
+
+ File SrcFile;
++ #ifndef __BIONIC__
+ if (FileName!=NULL && *FileName!=0 || FileNameW!=NULL && *FileNameW!=0)
++ #else
++ if (FileName!=NULL && *FileName!=0)
++ #endif
+ {
++ #ifndef __BIONIC__
+ bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName,FileNameW):SrcFile.Open(FileName,FileNameW,0);
++ #else
++ bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName):SrcFile.Open(FileName,0);
++ #endif
+
+ if (!OpenCode)
+ {
+***************
+*** 58,63 ****
+--- 70,76 ----
+
+ memset(&Data[DataSize],0,5);
+
++ #ifndef __BIONIC__
+ if (SrcCharset==RCH_UNICODE ||
+ SrcCharset==RCH_DEFAULT && IsUnicode((byte *)&Data[0],DataSize))
+ {
+***************
+*** 137,142 ****
+--- 150,156 ----
+ }
+ else
+ {
++ #endif
+ char *CurStr=&Data[0];
+ while (*CurStr!=0)
+ {
+***************
+*** 192,198 ****
+--- 206,214 ----
+ while (*CurStr=='\r' || *CurStr=='\n')
+ CurStr++;
+ }
++ #ifndef __BIONIC__
+ }
++ #endif
+ return(true);
+ }
+
+diff -crB orig/filestr.hpp src/filestr.hpp
+*** orig/filestr.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/filestr.hpp 2013-03-13 01:06:03.471052000 +0100
+***************
+*** 3,9 ****
+--- 3,11 ----
+
+ bool ReadTextFile(
+ const char *Name,
++ #ifndef __BIONIC__
+ const wchar *NameW,
++ #endif
+ StringList *List,
+ bool Config,
+ bool AbortOnError=false,
+diff -crB orig/find.cpp src/find.cpp
+*** orig/find.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/find.cpp 2013-03-13 00:47:01.171017000 +0100
+***************
+*** 3,9 ****
+--- 3,11 ----
+ FindFile::FindFile()
+ {
+ *FindMask=0;
++ #ifndef __BIONIC__
+ *FindMaskW=0;
++ #endif
+ FirstCall=true;
+ #ifdef _WIN_ALL
+ hFind=INVALID_HANDLE_VALUE;
+***************
+*** 28,39 ****
+ void FindFile::SetMask(const char *FindMask)
+ {
+ strcpy(FindFile::FindMask,NullToEmpty(FindMask));
+ if (*FindMaskW==0)
+ CharToWide(FindMask,FindMaskW);
+ FirstCall=true;
+ }
+
+!
+ void FindFile::SetMaskW(const wchar *FindMaskW)
+ {
+ if (FindMaskW==NULL)
+--- 30,43 ----
+ void FindFile::SetMask(const char *FindMask)
+ {
+ strcpy(FindFile::FindMask,NullToEmpty(FindMask));
++ #ifndef __BIONIC__
+ if (*FindMaskW==0)
+ CharToWide(FindMask,FindMaskW);
++ #endif
+ FirstCall=true;
+ }
+
+! #ifndef __BIONIC__
+ void FindFile::SetMaskW(const wchar *FindMaskW)
+ {
+ if (FindMaskW==NULL)
+***************
+*** 43,49 ****
+ WideToChar(FindMaskW,FindMask);
+ FirstCall=true;
+ }
+!
+
+ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
+ {
+--- 47,53 ----
+ WideToChar(FindMaskW,FindMask);
+ FirstCall=true;
+ }
+! #endif
+
+ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
+ {
+***************
+*** 94,100 ****
+--- 98,108 ----
+ return(false);
+ }
+ strcat(FullName,ent->d_name);
++ #ifndef __BIONIC__
+ if (!FastFind(FullName,NULL,fd,GetSymLink))
++ #else
++ if (!FastFind(FullName,fd,GetSymLink))
++ #endif
+ {
+ ErrHandler.OpenErrorMsg(FullName);
+ continue;
+***************
+*** 103,108 ****
+--- 111,118 ----
+ break;
+ }
+ }
++
++ #ifndef __BIONIC__
+ *fd->NameW=0;
+ #ifdef _APPLE
+ if (!LowAscii(fd->Name))
+***************
+*** 112,117 ****
+--- 122,128 ----
+ CharToWide(fd->Name,fd->NameW);
+ #endif
+ #endif
++ #endif
+ fd->Flags=0;
+ fd->IsDir=IsDir(fd->FileAttr);
+ FirstCall=false;
+***************
+*** 121,132 ****
+ return(true);
+ }
+
+!
+ bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink)
+ {
+ fd->Error=false;
+ #ifndef _UNIX
+ if (IsWildcard(FindMask,FindMaskW))
+ return(false);
+ #endif
+ #ifdef _WIN_ALL
+--- 132,150 ----
+ return(true);
+ }
+
+! #ifndef __BIONIC__
+ bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink)
++ #else
++ bool FindFile::FastFind(const char *FindMask,FindData *fd,bool GetSymLink)
++ #endif
+ {
+ fd->Error=false;
+ #ifndef _UNIX
++ #ifndef __BIONIC__
+ if (IsWildcard(FindMask,FindMaskW))
++ #else
++ if (IsWildcard(FindMask))
++ #endif
+ return(false);
+ #endif
+ #ifdef _WIN_ALL
+***************
+*** 169,174 ****
+--- 187,193 ----
+ fd->FileTime=fd->mtime.GetDos();
+ strcpy(fd->Name,FindMask);
+
++ #ifndef __BIONIC__
+ *fd->NameW=0;
+ #ifdef _APPLE
+ if (!LowAscii(fd->Name))
+***************
+*** 178,183 ****
+--- 197,203 ----
+ CharToWide(fd->Name,fd->NameW);
+ #endif
+ #endif
++ #endif
+ fd->Flags=0;
+ fd->IsDir=IsDir(fd->FileAttr);
+ return(true);
+diff -crB orig/find.hpp src/find.hpp
+*** orig/find.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/find.hpp 2013-03-13 00:42:15.587007000 +0100
+***************
+*** 8,14 ****
+--- 8,16 ----
+ struct FindData
+ {
+ char Name[NM];
++ #ifndef __BIONIC__
+ wchar NameW[NM];
++ #endif
+ int64 Size;
+ uint FileAttr;
+ uint FileTime;
+***************
+*** 34,40 ****
+--- 36,44 ----
+ #endif
+
+ char FindMask[NM];
++ #ifndef __BIONIC__
+ wchar FindMaskW[NM];
++ #endif
+ bool FirstCall;
+ #ifdef _WIN_ALL
+ HANDLE hFind;
+***************
+*** 45,53 ****
+--- 49,63 ----
+ FindFile();
+ ~FindFile();
+ void SetMask(const char *FindMask);
++ #ifndef __BIONIC__
+ void SetMaskW(const wchar *FindMaskW);
++ #endif
+ bool Next(FindData *fd,bool GetSymLink=false);
++ #ifndef __BIONIC__
+ static bool FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink=false);
++ #else
++ static bool FastFind(const char *FindMask,FindData *fd,bool GetSymLink=false);
++ #endif
+ };
+
+ #endif
+diff -crB orig/list.cpp src/list.cpp
+*** orig/list.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/list.cpp 2013-03-13 02:08:51.387169000 +0100
+***************
+*** 15,29 ****
+--- 15,40 ----
+ bool Verbose=(*Cmd->Command=='V');
+
+ char ArcName[NM];
++ #ifndef __BIONIC__
+ wchar ArcNameW[NM];
++ #endif
++
+
++ #ifndef __BIONIC__
+ while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
++ #else
++ while (Cmd->GetArcName(ArcName,sizeof(ArcName)))
++ #endif
+ {
+ Archive Arc(Cmd);
+ #ifdef _WIN_ALL
+ Arc.RemoveSequentialFlag();
+ #endif
++ #ifndef __BIONIC__
+ if (!Arc.WOpen(ArcName,ArcNameW))
++ #else
++ if (!Arc.WOpen(ArcName))
++ #endif
+ continue;
+ bool FileMatched=true;
+ while (1)
+***************
+*** 195,200 ****
+--- 206,212 ----
+ char *Name=hd.FileName;
+
+ #ifdef UNICODE_SUPPORTED
++ #ifndef __BIONIC__
+ char ConvertedName[NM];
+ if ((hd.Flags & LHD_UNICODE)!=0 && *hd.FileNameW!=0 && UnicodeEnabled())
+ {
+***************
+*** 202,207 ****
+--- 214,220 ----
+ Name=ConvertedName;
+ }
+ #endif
++ #endif
+
+ if (Bare)
+ {
+***************
+*** 367,373 ****
+--- 380,390 ----
+ (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0 && !Cmd->DisableComment)
+ {
+ Array<byte> CmtData;
++ #ifndef __BIONIC__
+ size_t ReadSize=Arc.ReadCommentData(&CmtData,NULL);
++ #else
++ size_t ReadSize=Arc.ReadCommentData(&CmtData);
++ #endif
+ if (ReadSize!=0)
+ {
+ mprintf(St(MFileComment));
+***************
+*** 377,382 ****
+--- 394,400 ----
+ if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM) &&
+ (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0)
+ {
++ #ifndef __BIONIC__
+ size_t DestSize=Arc.SubHead.SubData.Size()/2;
+ wchar DestNameW[NM];
+ char DestName[NM];
+***************
+*** 387,391 ****
+--- 405,414 ----
+ WideToChar(DestNameW,DestName);
+ mprintf("\n %s",DestName);
+ }
++ #else
++ size_t DestSize=Arc.SubHead.SubData.Size();
++ char DestName[NM];
++ strncpyz(DestName,(const char *)&Arc.SubHead.SubData[0],ASIZE(DestName));
++ #endif
+ }
+ }
+diff -crB orig/match.cpp src/match.cpp
+*** orig/match.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/match.cpp 2013-03-12 00:30:22.482249000 +0100
+***************
+*** 1,12 ****
+--- 1,18 ----
+ #include "rar.hpp"
+
+ static bool match(const char *pattern,const char *string,bool ForceCase);
++ #ifndef __BIONIC__
+ static bool match(const wchar *pattern,const wchar *string,bool ForceCase);
++ #endif
+
+ static int mstricompc(const char *Str1,const char *Str2,bool ForceCase);
++ #ifndef __BIONIC__
+ static int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase);
++ #endif
+ static int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase);
++ #ifndef __BIONIC__
+ static int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase);
++ #endif
+
+ inline uint toupperc(byte ch,bool ForceCase)
+ {
+***************
+*** 93,98 ****
+--- 99,105 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ bool CmpName(const wchar *Wildcard,const wchar *Name,int CmpMode)
+ {
+ bool ForceCase=(CmpMode&MATCH_FORCECASESENSITIVE)!=0;
+***************
+*** 150,155 ****
+--- 157,163 ----
+ return(match(Name1,Name2,ForceCase));
+ }
+ #endif
++ #endif
+
+
+ bool match(const char *pattern,const char *string,bool ForceCase)
+***************
+*** 204,209 ****
+--- 212,218 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ bool match(const wchar *pattern,const wchar *string,bool ForceCase)
+ {
+ for (;; ++string)
+***************
+*** 254,259 ****
+--- 263,269 ----
+ }
+ }
+ #endif
++ #endif
+
+
+ int mstricompc(const char *Str1,const char *Str2,bool ForceCase)
+***************
+*** 265,270 ****
+--- 275,281 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase)
+ {
+ if (ForceCase)
+***************
+*** 272,277 ****
+--- 283,289 ----
+ return(wcsicompc(Str1,Str2));
+ }
+ #endif
++ #endif
+
+
+ int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase)
+***************
+*** 287,292 ****
+--- 299,305 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase)
+ {
+ if (ForceCase)
+***************
+*** 298,300 ****
+--- 311,314 ----
+ #endif
+ }
+ #endif
++ #endif
+diff -crB orig/match.hpp src/match.hpp
+*** orig/match.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/match.hpp 2013-03-12 00:29:04.458247000 +0100
+***************
+*** 30,35 ****
+--- 30,37 ----
+ #define MATCH_FORCECASESENSITIVE 0x80000000
+
+ bool CmpName(const char *Wildcard,const char *Name,int CmpMode);
++ #ifndef __BIONIC__
+ bool CmpName(const wchar *Wildcard,const wchar *Name,int CmpMode);
++ #endif
+
+ #endif
+diff -crB orig/os.hpp src/os.hpp
+*** orig/os.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/os.hpp 2013-03-12 01:24:09.402350000 +0100
+***************
+*** 155,161 ****
+--- 155,163 ----
+ #endif
+ #include <pwd.h>
+ #include <grp.h>
++ #ifndef __BIONIC__
+ #include <wchar.h>
++ #endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
+diff -crB orig/pathfn.cpp src/pathfn.cpp
+*** orig/pathfn.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/pathfn.cpp 2013-03-11 02:10:31.434463000 +0100
+***************
+*** 11,17 ****
+ return (char*)((*Path && IsDriveDiv(Path[1]) && charnext(Path)==Path+1) ? Path+2:Path);
+ }
+
+!
+ wchar* PointToName(const wchar *Path)
+ {
+ for (int I=(int)wcslen(Path)-1;I>=0;I--)
+--- 11,17 ----
+ return (char*)((*Path && IsDriveDiv(Path[1]) && charnext(Path)==Path+1) ? Path+2:Path);
+ }
+
+! #ifndef __BIONIC__
+ wchar* PointToName(const wchar *Path)
+ {
+ for (int I=(int)wcslen(Path)-1;I>=0;I--)
+***************
+*** 19,25 ****
+ return (wchar*)&Path[I+1];
+ return (wchar*)((*Path && IsDriveDiv(Path[1])) ? Path+2:Path);
+ }
+!
+
+ char* PointToLastChar(const char *Path)
+ {
+--- 19,25 ----
+ return (wchar*)&Path[I+1];
+ return (wchar*)((*Path && IsDriveDiv(Path[1])) ? Path+2:Path);
+ }
+! #endif
+
+ char* PointToLastChar(const char *Path)
+ {
+***************
+*** 28,40 ****
+ return((char *)p);
+ }
+
+!
+ wchar* PointToLastChar(const wchar *Path)
+ {
+ size_t Length=wcslen(Path);
+ return((wchar*)(Length>0 ? Path+Length-1:Path));
+ }
+!
+
+ char* ConvertPath(const char *SrcPath,char *DestPath)
+ {
+--- 28,40 ----
+ return((char *)p);
+ }
+
+! #ifndef __BIONIC__
+ wchar* PointToLastChar(const wchar *Path)
+ {
+ size_t Length=wcslen(Path);
+ return((wchar*)(Length>0 ? Path+Length-1:Path));
+ }
+! #endif
+
+ char* ConvertPath(const char *SrcPath,char *DestPath)
+ {
+***************
+*** 84,90 ****
+ return((char *)DestPtr);
+ }
+
+!
+ wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath)
+ {
+ const wchar *DestPtr=SrcPath;
+--- 84,90 ----
+ return((char *)DestPtr);
+ }
+
+! #ifndef __BIONIC__
+ wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath)
+ {
+ const wchar *DestPtr=SrcPath;
+***************
+*** 131,137 ****
+ }
+ return((wchar *)DestPtr);
+ }
+!
+
+ void SetExt(char *Name,const char *NewExt)
+ {
+--- 131,137 ----
+ }
+ return((wchar *)DestPtr);
+ }
+! #endif
+
+ void SetExt(char *Name,const char *NewExt)
+ {
+***************
+*** 151,157 ****
+ strcpy(Dot+1,NewExt);
+ }
+
+!
+ void SetExt(wchar *Name,const wchar *NewExt)
+ {
+ if (Name==NULL || *Name==0)
+--- 151,157 ----
+ strcpy(Dot+1,NewExt);
+ }
+
+! #ifndef __BIONIC__
+ void SetExt(wchar *Name,const wchar *NewExt)
+ {
+ if (Name==NULL || *Name==0)
+***************
+*** 171,177 ****
+ else
+ wcscpy(Dot+1,NewExt);
+ }
+!
+
+ #ifndef SFX_MODULE
+ void SetSFXExt(char *SFXName)
+--- 171,177 ----
+ else
+ wcscpy(Dot+1,NewExt);
+ }
+! #endif
+
+ #ifndef SFX_MODULE
+ void SetSFXExt(char *SFXName)
+***************
+*** 188,193 ****
+--- 188,194 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ void SetSFXExt(wchar *SFXName)
+ {
+ if (SFXName==NULL || *SFXName==0)
+***************
+*** 202,207 ****
+--- 203,209 ----
+ #endif
+ }
+ #endif
++ #endif
+
+
+ char *GetExt(const char *Name)
+***************
+*** 209,220 ****
+ return(Name==NULL ? NULL:strrchrd(PointToName(Name),'.'));
+ }
+
+!
+ wchar *GetExt(const wchar *Name)
+ {
+ return(Name==NULL ? NULL:wcsrchr(PointToName(Name),'.'));
+ }
+!
+
+ // 'Ext' is an extension without the leading dot, like "rar".
+ bool CmpExt(const char *Name,const char *Ext)
+--- 211,222 ----
+ return(Name==NULL ? NULL:strrchrd(PointToName(Name),'.'));
+ }
+
+! #ifndef __BIONIC__
+ wchar *GetExt(const wchar *Name)
+ {
+ return(Name==NULL ? NULL:wcsrchr(PointToName(Name),'.'));
+ }
+! #endif
+
+ // 'Ext' is an extension without the leading dot, like "rar".
+ bool CmpExt(const char *Name,const char *Ext)
+***************
+*** 224,241 ****
+ }
+
+
+ // 'Ext' is an extension without the leading dot, like L"rar".
+ bool CmpExt(const wchar *Name,const wchar *Ext)
+ {
+ wchar *NameExt=GetExt(Name);
+ return(NameExt!=NULL && wcsicomp(NameExt+1,Ext)==0);
+ }
+
+!
+ bool IsWildcard(const char *Str,const wchar *StrW)
+ {
+ if (StrW!=NULL && *StrW!=0)
+ return(wcspbrk(StrW,L"*?")!=NULL);
+ return(Str==NULL ? false:strpbrk(Str,"*?")!=NULL);
+ }
+
+--- 226,250 ----
+ }
+
+
++ #ifndef __BIONIC__
+ // 'Ext' is an extension without the leading dot, like L"rar".
+ bool CmpExt(const wchar *Name,const wchar *Ext)
+ {
+ wchar *NameExt=GetExt(Name);
+ return(NameExt!=NULL && wcsicomp(NameExt+1,Ext)==0);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ bool IsWildcard(const char *Str,const wchar *StrW)
++ #else
++ bool IsWildcard(const char *Str)
++ #endif
+ {
++ #ifndef __BIONIC__
+ if (StrW!=NULL && *StrW!=0)
+ return(wcspbrk(StrW,L"*?")!=NULL);
++ #endif
+ return(Str==NULL ? false:strpbrk(Str,"*?")!=NULL);
+ }
+
+***************
+*** 268,274 ****
+ return(-1);
+ }
+
+!
+ int GetPathDisk(const wchar *Path)
+ {
+ if (IsDiskLetter(Path))
+--- 277,283 ----
+ return(-1);
+ }
+
+! #ifndef __BIONIC__
+ int GetPathDisk(const wchar *Path)
+ {
+ if (IsDiskLetter(Path))
+***************
+*** 276,281 ****
+--- 285,291 ----
+ else
+ return(-1);
+ }
++ #endif
+
+
+ void AddEndSlash(char *Path)
+***************
+*** 285,298 ****
+ strcat(LastChar,PATHDIVIDER);
+ }
+
+!
+ void AddEndSlash(wchar *Path)
+ {
+ size_t Length=wcslen(Path);
+ if (Length>0 && Path[Length-1]!=CPATHDIVIDER)
+ wcscat(Path,PATHDIVIDERW);
+ }
+!
+
+ // Returns file path including the trailing path separator symbol.
+ void GetFilePath(const char *FullName,char *Path,int MaxLength)
+--- 295,308 ----
+ strcat(LastChar,PATHDIVIDER);
+ }
+
+! #ifndef __BIONIC__
+ void AddEndSlash(wchar *Path)
+ {
+ size_t Length=wcslen(Path);
+ if (Length>0 && Path[Length-1]!=CPATHDIVIDER)
+ wcscat(Path,PATHDIVIDERW);
+ }
+! #endif
+
+ // Returns file path including the trailing path separator symbol.
+ void GetFilePath(const char *FullName,char *Path,int MaxLength)
+***************
+*** 302,308 ****
+ Path[PathLength]=0;
+ }
+
+!
+ // Returns file path including the trailing path separator symbol.
+ void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength)
+ {
+--- 312,318 ----
+ Path[PathLength]=0;
+ }
+
+! #ifndef __BIONIC__
+ // Returns file path including the trailing path separator symbol.
+ void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength)
+ {
+***************
+*** 310,316 ****
+ wcsncpy(Path,FullName,PathLength);
+ Path[PathLength]=0;
+ }
+!
+
+ // Removes name and returns file path without the trailing
+ // path separator symbol.
+--- 320,326 ----
+ wcsncpy(Path,FullName,PathLength);
+ Path[PathLength]=0;
+ }
+! #endif
+
+ // Removes name and returns file path without the trailing
+ // path separator symbol.
+***************
+*** 322,328 ****
+ *Name=0;
+ }
+
+!
+ // Removes name and returns file path without the trailing
+ // path separator symbol.
+ void RemoveNameFromPath(wchar *Path)
+--- 332,338 ----
+ *Name=0;
+ }
+
+! #ifndef __BIONIC__
+ // Removes name and returns file path without the trailing
+ // path separator symbol.
+ void RemoveNameFromPath(wchar *Path)
+***************
+*** 332,338 ****
+ Name--;
+ *Name=0;
+ }
+!
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+ void GetAppDataPath(char *Path)
+--- 342,348 ----
+ Name--;
+ *Name=0;
+ }
+! #endif
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+ void GetAppDataPath(char *Path)
+***************
+*** 360,365 ****
+--- 370,376 ----
+
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void GetAppDataPath(wchar *Path)
+ {
+ LPMALLOC g_pMalloc;
+***************
+*** 382,387 ****
+--- 393,399 ----
+ g_pMalloc->Free(ppidl);
+ }
+ #endif
++ #endif
+
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+***************
+*** 405,410 ****
+--- 417,423 ----
+
+
+ #if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void GetRarDataPath(wchar *Path)
+ {
+ *Path=0;
+***************
+*** 422,427 ****
+--- 435,441 ----
+ GetAppDataPath(Path);
+ }
+ #endif
++ #endif
+
+
+ #ifndef SFX_MODULE
+***************
+*** 483,488 ****
+--- 497,503 ----
+
+
+ #if defined(_WIN_ALL) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ bool EnumConfigPaths(wchar *Path,int Number)
+ {
+ if (Number<0 || Number>1)
+***************
+*** 497,502 ****
+--- 512,518 ----
+ return(true);
+ }
+ #endif
++ #endif
+
+
+ #ifndef SFX_MODULE
+***************
+*** 515,520 ****
+--- 531,537 ----
+
+
+ #if defined(_WIN_ALL) && !defined(SFX_MODULE)
++ #ifndef __BIONIC__
+ void GetConfigName(const wchar *Name,wchar *FullName,bool CheckExist)
+ {
+ *FullName=0;
+***************
+*** 527,532 ****
+--- 544,550 ----
+ }
+ }
+ #endif
++ #endif
+
+
+ // Returns a pointer to rightmost digit of volume number.
+***************
+*** 562,568 ****
+ return(ChPtr);
+ }
+
+!
+ // Returns a pointer to rightmost digit of volume number.
+ wchar* GetVolNumPart(wchar *ArcName)
+ {
+--- 580,586 ----
+ return(ChPtr);
+ }
+
+! #ifndef __BIONIC__
+ // Returns a pointer to rightmost digit of volume number.
+ wchar* GetVolNumPart(wchar *ArcName)
+ {
+***************
+*** 595,603 ****
+ }
+ return(ChPtr);
+ }
+
+!
+ void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering)
+ {
+ if (ArcName!=NULL && *ArcName!=0)
+ {
+--- 613,625 ----
+ }
+ return(ChPtr);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering)
++ #else
++ void NextVolumeName(char *ArcName,uint MaxLength,bool OldNumbering)
++ #endif
+ {
+ if (ArcName!=NULL && *ArcName!=0)
+ {
+***************
+*** 646,652 ****
+ }
+ }
+ }
+!
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ {
+ wchar *ChPtr;
+--- 668,674 ----
+ }
+ }
+ }
+! #ifndef __BIONIC__
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ {
+ wchar *ChPtr;
+***************
+*** 694,699 ****
+--- 716,722 ----
+ }
+ }
+ }
++ #endif
+ }
+
+
+***************
+*** 722,728 ****
+ return(*Name!=0 && strpbrk(Name,"?*<>|\"")==NULL);
+ }
+
+!
+ bool IsNameUsable(const wchar *Name)
+ {
+ #ifndef _UNIX
+--- 745,751 ----
+ return(*Name!=0 && strpbrk(Name,"?*<>|\"")==NULL);
+ }
+
+! #ifndef __BIONIC__
+ bool IsNameUsable(const wchar *Name)
+ {
+ #ifndef _UNIX
+***************
+*** 738,748 ****
+ #endif
+ return(*Name!=0 && wcspbrk(Name,L"?*<>|\"")==NULL);
+ }
+!
+
+ void MakeNameUsable(char *Name,bool Extended)
+ {
+ #ifdef _WIN_ALL
+ // In Windows we also need to convert characters not defined in current
+ // code page. This double conversion changes them to '?', which is
+ // catched by code below.
+--- 761,772 ----
+ #endif
+ return(*Name!=0 && wcspbrk(Name,L"?*<>|\"")==NULL);
+ }
+! #endif
+
+ void MakeNameUsable(char *Name,bool Extended)
+ {
+ #ifdef _WIN_ALL
++ #ifndef __BIONIC__
+ // In Windows we also need to convert characters not defined in current
+ // code page. This double conversion changes them to '?', which is
+ // catched by code below.
+***************
+*** 752,757 ****
+--- 776,782 ----
+ WideToChar(NameW,Name,NameLength+1);
+ Name[NameLength]=0;
+ #endif
++ #endif
+ for (char *s=Name;*s!=0;s=charnext(s))
+ {
+ if (strchr(Extended ? "?*<>|\"":"?*",*s)!=NULL || Extended && (byte)*s<32)
+***************
+*** 769,775 ****
+ }
+ }
+
+!
+ void MakeNameUsable(wchar *Name,bool Extended)
+ {
+ for (wchar *s=Name;*s!=0;s++)
+--- 794,800 ----
+ }
+ }
+
+! #ifndef __BIONIC__
+ void MakeNameUsable(wchar *Name,bool Extended)
+ {
+ for (wchar *s=Name;*s!=0;s++)
+***************
+*** 784,789 ****
+--- 809,815 ----
+ #endif
+ }
+ }
++ #endif
+
+
+ char* UnixSlashToDos(char *SrcName,char *DestName,uint MaxLength)
+***************
+*** 829,835 ****
+ return(DestName==NULL ? SrcName:DestName);
+ }
+
+!
+ wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName,uint MaxLength)
+ {
+ if (DestName!=NULL && DestName!=SrcName)
+--- 855,861 ----
+ return(DestName==NULL ? SrcName:DestName);
+ }
+
+! #ifndef __BIONIC__
+ wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName,uint MaxLength)
+ {
+ if (DestName!=NULL && DestName!=SrcName)
+***************
+*** 850,857 ****
+ }
+ return(DestName==NULL ? SrcName:DestName);
+ }
+
+!
+ wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName,uint MaxLength)
+ {
+ if (DestName!=NULL && DestName!=SrcName)
+--- 876,884 ----
+ }
+ return(DestName==NULL ? SrcName:DestName);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName,uint MaxLength)
+ {
+ if (DestName!=NULL && DestName!=SrcName)
+***************
+*** 872,878 ****
+ }
+ return(DestName==NULL ? SrcName:DestName);
+ }
+!
+
+ void ConvertNameToFull(const char *Src,char *Dest)
+ {
+--- 899,905 ----
+ }
+ return(DestName==NULL ? SrcName:DestName);
+ }
+! #endif
+
+ void ConvertNameToFull(const char *Src,char *Dest)
+ {
+***************
+*** 902,908 ****
+ #endif
+ }
+
+!
+ void ConvertNameToFull(const wchar *Src,wchar *Dest)
+ {
+ if (Src==NULL || *Src==0)
+--- 929,935 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ void ConvertNameToFull(const wchar *Src,wchar *Dest)
+ {
+ if (Src==NULL || *Src==0)
+***************
+*** 941,953 ****
+ CharToWide(AnsiName,Dest);
+ #endif
+ }
+!
+
+ bool IsFullPath(const char *Path)
+ {
+ char PathOnly[NM];
+ GetFilePath(Path,PathOnly,ASIZE(PathOnly));
+ if (IsWildcard(PathOnly,NULL))
+ return(true);
+ #if defined(_WIN_ALL) || defined(_EMX)
+ return(Path[0]=='\\' && Path[1]=='\\' ||
+--- 968,984 ----
+ CharToWide(AnsiName,Dest);
+ #endif
+ }
+! #endif
+
+ bool IsFullPath(const char *Path)
+ {
+ char PathOnly[NM];
+ GetFilePath(Path,PathOnly,ASIZE(PathOnly));
++ #ifndef __BIONIC__
+ if (IsWildcard(PathOnly,NULL))
++ #else
++ if (IsWildcard(PathOnly))
++ #endif
+ return(true);
+ #if defined(_WIN_ALL) || defined(_EMX)
+ return(Path[0]=='\\' && Path[1]=='\\' ||
+***************
+*** 957,963 ****
+ #endif
+ }
+
+!
+ bool IsFullPath(const wchar *Path)
+ {
+ wchar PathOnly[NM];
+--- 988,994 ----
+ #endif
+ }
+
+! #ifndef __BIONIC__
+ bool IsFullPath(const wchar *Path)
+ {
+ wchar PathOnly[NM];
+***************
+*** 971,977 ****
+ return(IsPathDiv(Path[0]));
+ #endif
+ }
+!
+
+ bool IsDiskLetter(const char *Path)
+ {
+--- 1002,1008 ----
+ return(IsPathDiv(Path[0]));
+ #endif
+ }
+! #endif
+
+ bool IsDiskLetter(const char *Path)
+ {
+***************
+*** 979,991 ****
+ return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
+ }
+
+!
+ bool IsDiskLetter(const wchar *Path)
+ {
+ wchar Letter=etoupperw(Path[0]);
+ return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
+ }
+!
+
+ void GetPathRoot(const char *Path,char *Root)
+ {
+--- 1010,1022 ----
+ return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
+ }
+
+! #ifndef __BIONIC__
+ bool IsDiskLetter(const wchar *Path)
+ {
+ wchar Letter=etoupperw(Path[0]);
+ return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
+ }
+! #endif
+
+ void GetPathRoot(const char *Path,char *Root)
+ {
+***************
+*** 1009,1015 ****
+ }
+ }
+
+!
+ void GetPathRoot(const wchar *Path,wchar *Root)
+ {
+ *Root=0;
+--- 1040,1046 ----
+ }
+ }
+
+! #ifndef __BIONIC__
+ void GetPathRoot(const wchar *Path,wchar *Root)
+ {
+ *Root=0;
+***************
+*** 1031,1039 ****
+ }
+ }
+ }
+
+!
+ int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
+ {
+ int Version=0;
+ char *VerText=strrchrd(Name,';');
+--- 1062,1074 ----
+ }
+ }
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
++ #else
++ int ParseVersionFileName(char *Name,bool Truncate)
++ #endif
+ {
+ int Version=0;
+ char *VerText=strrchrd(Name,';');
+***************
+*** 1043,1048 ****
+--- 1078,1084 ----
+ if (Truncate)
+ *VerText=0;
+ }
++ #ifndef __BIONIC__
+ if (NameW!=NULL)
+ {
+ wchar *VerTextW=wcsrchr(NameW,';');
+***************
+*** 1054,1059 ****
+--- 1090,1096 ----
+ *VerTextW=0;
+ }
+ }
++ #endif
+ return(Version);
+ }
+
+***************
+*** 1103,1109 ****
+--- 1140,1150 ----
+ while (Find.Next(&FD))
+ {
+ Archive Arc;
++ #ifndef __BIONIC__
+ if (Arc.Open(FD.Name,FD.NameW,0) && Arc.IsArchive(true) && !Arc.NotFirstVolume)
++ #else
++ if (Arc.Open(FD.Name,0) && Arc.IsArchive(true) && !Arc.NotFirstVolume)
++ #endif
+ {
+ strcpy(FirstName,FD.Name);
+ break;
+***************
+*** 1116,1121 ****
+--- 1157,1163 ----
+
+
+ #if !defined(SFX_MODULE) && !defined(SETUP)
++ #ifndef __BIONIC__
+ // Get the name of first volume. Return the leftmost digit of volume number.
+ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumbering)
+ {
+***************
+*** 1170,1204 ****
+--- 1212,1267 ----
+ return(VolNumStart);
+ }
+ #endif
++ #endif
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ static void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
+ uint ArcNumber,bool &ArcNumPresent);
+
+ void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,
+ char *GenerateMask,bool Archiving)
++ #else
++ static void GenArcName(char *ArcName,char *GenerateMask,
++ uint ArcNumber,bool &ArcNumPresent);
++
++ void GenerateArchiveName(char *ArcName,size_t MaxSize,
++ char *GenerateMask,bool Archiving)
++ #endif
+ {
+ // Must be enough space for archive name plus all stuff in mask plus
+ // extra overhead produced by mask 'N' (archive number) characters.
+ // One 'N' character can result in several numbers if we process more
+ // than 9 archives.
+ char NewName[NM+MAX_GENERATE_MASK+20];
++ #ifndef __BIONIC__
+ wchar NewNameW[NM+MAX_GENERATE_MASK+20];
++ #endif
+
+ uint ArcNumber=1;
+ while (true) // Loop for 'N' (archive number) processing.
+ {
+ strncpyz(NewName,NullToEmpty(ArcName),ASIZE(NewName));
++ #ifndef __BIONIC__
+ wcsncpyz(NewNameW,NullToEmpty(ArcNameW),ASIZE(NewNameW));
++ #endif
+
+ bool ArcNumPresent=false;
+
++ #ifndef __BIONIC__
+ GenArcName(NewName,NewNameW,GenerateMask,ArcNumber,ArcNumPresent);
++ #else
++ GenArcName(NewName,GenerateMask,ArcNumber,ArcNumPresent);
++ #endif
+
+ if (!ArcNumPresent)
+ break;
++ #ifndef __BIONIC__
+ if (!FileExist(NewName,NewNameW))
++ #else
++ if (!FileExist(NewName))
++ #endif
+ {
+ if (!Archiving && ArcNumber>1)
+ {
+***************
+*** 1206,1213 ****
+--- 1269,1280 ----
+ // existing archive before the first unused name. So we generate
+ // the name for (ArcNumber-1) below.
+ strncpyz(NewName,NullToEmpty(ArcName),ASIZE(NewName));
++ #ifndef __BIONIC__
+ wcsncpyz(NewNameW,NullToEmpty(ArcNameW),ASIZE(NewNameW));
+ GenArcName(NewName,NewNameW,GenerateMask,ArcNumber-1,ArcNumPresent);
++ #else
++ GenArcName(NewName,GenerateMask,ArcNumber-1,ArcNumPresent);
++ #endif
+ }
+ break;
+ }
+***************
+*** 1215,1227 ****
+ }
+ if (ArcName!=NULL && *ArcName!=0)
+ strncpyz(ArcName,NewName,MaxSize);
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcsncpyz(ArcNameW,NewNameW,MaxSize);
+ }
+
+!
+ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
+ uint ArcNumber,bool &ArcNumPresent)
+ {
+ bool Prefix=false;
+ if (*GenerateMask=='+')
+--- 1282,1300 ----
+ }
+ if (ArcName!=NULL && *ArcName!=0)
+ strncpyz(ArcName,NewName,MaxSize);
++ #ifndef __BIONIC__
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcsncpyz(ArcNameW,NewNameW,MaxSize);
++ #endif
+ }
+
+! #ifndef __BIONIC__
+ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
+ uint ArcNumber,bool &ArcNumPresent)
++ #else
++ void GenArcName(char *ArcName,char *GenerateMask,
++ uint ArcNumber,bool &ArcNumPresent)
++ #endif
+ {
+ bool Prefix=false;
+ if (*GenerateMask=='+')
+***************
+*** 1293,1298 ****
+--- 1366,1372 ----
+ }
+ }
+
++ #ifndef __BIONIC__
+ wchar ExtW[NM];
+ *ExtW=0;
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+***************
+*** 1306,1311 ****
+--- 1380,1386 ----
+ *DotW=0;
+ }
+ }
++ #endif
+
+ int WeekDay=rlt.wDay==0 ? 6:rlt.wDay-1;
+ int StartWeekDay=rlt.yDay-WeekDay;
+***************
+*** 1382,1389 ****
+--- 1457,1466 ----
+ DateText[++J]=0;
+ }
+
++ #ifndef __BIONIC__
+ wchar DateTextW[ASIZE(DateText)];
+ CharToWide(DateText,DateTextW);
++ #endif
+
+ if (Prefix)
+ {
+***************
+*** 1396,1401 ****
+--- 1473,1479 ----
+ strcat(NewName,PointToName(ArcName));
+ strcpy(ArcName,NewName);
+ }
++ #ifndef __BIONIC__
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ {
+ wchar NewNameW[NM];
+***************
+*** 1405,1426 ****
+ wcscat(NewNameW,PointToName(ArcNameW));
+ wcscpy(ArcNameW,NewNameW);
+ }
+ }
+ else
+ {
+ if (ArcName!=NULL && *ArcName!=0)
+ strcat(ArcName,DateText);
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcscat(ArcNameW,DateTextW);
+ }
+ if (ArcName!=NULL && *ArcName!=0)
+ strcat(ArcName,Ext);
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcscat(ArcNameW,ExtW);
+ }
+ #endif
+
+!
+ wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize)
+ {
+ if (NameW!=NULL && *NameW!=0)
+--- 1483,1509 ----
+ wcscat(NewNameW,PointToName(ArcNameW));
+ wcscpy(ArcNameW,NewNameW);
+ }
++ #endif
+ }
+ else
+ {
+ if (ArcName!=NULL && *ArcName!=0)
+ strcat(ArcName,DateText);
++ #ifndef __BIONIC__
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcscat(ArcNameW,DateTextW);
++ #endif
+ }
+ if (ArcName!=NULL && *ArcName!=0)
+ strcat(ArcName,Ext);
++ #ifndef __BIONIC__
+ if (ArcNameW!=NULL && *ArcNameW!=0)
+ wcscat(ArcNameW,ExtW);
++ #endif
+ }
+ #endif
+
+! #ifndef __BIONIC__
+ wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize)
+ {
+ if (NameW!=NULL && *NameW!=0)
+***************
+*** 1440,1447 ****
+
+ return(DestW);
+ }
+
+!
+ // Unlike WideToChar, always returns the zero terminated string,
+ // even if the destination buffer size is not enough.
+ char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize)
+--- 1523,1531 ----
+
+ return(DestW);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ // Unlike WideToChar, always returns the zero terminated string,
+ // even if the destination buffer size is not enough.
+ char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize)
+***************
+*** 1455,1457 ****
+--- 1539,1542 ----
+ *Name=0;
+ return Name;
+ }
++ #endif
+diff -crB orig/pathfn.hpp src/pathfn.hpp
+*** orig/pathfn.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/pathfn.hpp 2013-03-11 01:29:18.022386000 +0100
+***************
+*** 2,66 ****
+--- 2,124 ----
+ #define _RAR_PATHFN_
+
+ char* PointToName(const char *Path);
++ #ifndef __BIONIC__
+ wchar* PointToName(const wchar *Path);
++ #endif
+ char* PointToLastChar(const char *Path);
++ #ifndef __BIONIC__
+ wchar* PointToLastChar(const wchar *Path);
++ #endif
+ char* ConvertPath(const char *SrcPath,char *DestPath);
++ #ifndef __BIONIC__
+ wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath);
++ #endif
+ void SetExt(char *Name,const char *NewExt);
++ #ifndef __BIONIC__
+ void SetExt(wchar *Name,const wchar *NewExt);
++ #endif
+ void SetSFXExt(char *SFXName);
++ #ifndef __BIONIC__
+ void SetSFXExt(wchar *SFXName);
++ #endif
+ char *GetExt(const char *Name);
++ #ifndef __BIONIC__
+ wchar *GetExt(const wchar *Name);
++ #endif
+ bool CmpExt(const char *Name,const char *Ext);
++ #ifndef __BIONIC__
+ bool CmpExt(const wchar *Name,const wchar *Ext);
++ #endif
++ #ifndef __BIONIC__
+ bool IsWildcard(const char *Str,const wchar *StrW=NULL);
++ #else
++ bool IsWildcard(const char *Str);
++ #endif
+ bool IsPathDiv(int Ch);
+ bool IsDriveDiv(int Ch);
+ int GetPathDisk(const char *Path);
++ #ifndef __BIONIC__
+ int GetPathDisk(const wchar *Path);
++ #endif
+ void AddEndSlash(char *Path);
++ #ifndef __BIONIC__
+ void AddEndSlash(wchar *Path);
++ #endif
+ void GetFilePath(const char *FullName,char *Path,int MaxLength);
++ #ifndef __BIONIC__
+ void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength);
++ #endif
+ void RemoveNameFromPath(char *Path);
++ #ifndef __BIONIC__
+ void RemoveNameFromPath(wchar *Path);
++ #endif
+ void GetAppDataPath(char *Path);
++ #ifndef __BIONIC__
+ void GetAppDataPath(wchar *Path);
++ #endif
+ void GetRarDataPath(char *Path);
++ #ifndef __BIONIC__
+ void GetRarDataPath(wchar *Path);
+ bool EnumConfigPaths(wchar *Path,int Number);
++ #endif
+ bool EnumConfigPaths(char *Path,int Number);
+ void GetConfigName(const char *Name,char *FullName,bool CheckExist);
++ #ifndef __BIONIC__
+ void GetConfigName(const wchar *Name,wchar *FullName,bool CheckExist);
++ #endif
+ char* GetVolNumPart(char *ArcName);
++ #ifndef __BIONIC__
+ wchar* GetVolNumPart(wchar *ArcName);
+ void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering);
++ #else
++ void NextVolumeName(char *ArcName,uint MaxLength,bool OldNumbering);
++ #endif
+ bool IsNameUsable(const char *Name);
++ #ifndef __BIONIC__
+ bool IsNameUsable(const wchar *Name);
++ #endif
+ void MakeNameUsable(char *Name,bool Extended);
++ #ifndef __BIONIC__
+ void MakeNameUsable(wchar *Name,bool Extended);
++ #endif
+ char* UnixSlashToDos(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
+ char* DosSlashToUnix(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
++ #ifndef __BIONIC__
+ wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
+ wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
++ #endif
+ void ConvertNameToFull(const char *Src,char *Dest);
++ #ifndef __BIONIC__
+ void ConvertNameToFull(const wchar *Src,wchar *Dest);
++ #endif
+ bool IsFullPath(const char *Path);
++ #ifndef __BIONIC__
+ bool IsFullPath(const wchar *Path);
++ #endif
+ bool IsDiskLetter(const char *Path);
++ #ifndef __BIONIC__
+ bool IsDiskLetter(const wchar *Path);
++ #endif
+ void GetPathRoot(const char *Path,char *Root);
++ #ifndef __BIONIC__
+ void GetPathRoot(const wchar *Path,wchar *Root);
+ int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate);
++ #else
++ int ParseVersionFileName(char *Name,bool Truncate);
++ #endif
+ char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering);
++ #ifndef __BIONIC__
+ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumbering);
+ wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize);
+ char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize);
++ #endif
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,char *GenerateMask,bool Archiving);
++ #else
++ void GenerateArchiveName(char *ArcName,size_t MaxSize,char *GenerateMask,bool Archiving);
++ #endif
+ #endif
+
+ #endif
+diff -crB orig/rar.hpp src/rar.hpp
+*** orig/rar.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/rar.hpp 2013-03-12 00:14:40.758220000 +0100
+***************
+*** 15,21 ****
+--- 15,23 ----
+ #include "rartypes.hpp"
+ #include "rardefs.hpp"
+ #include "rarlang.hpp"
++ #ifdef __BIONIC__
+ #include "unicode.hpp"
++ #endif
+ #include "errhnd.hpp"
+ #include "array.hpp"
+ #include "timefn.hpp"
+diff -crB orig/recvol.cpp src/recvol.cpp
+*** orig/recvol.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/recvol.cpp 2013-03-13 00:40:56.543005000 +0100
+***************
+*** 67,80 ****
+ }
+ }
+
+!
+ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
+ const wchar *NameW,bool Silent)
+ {
+ char ArcName[NM];
+ wchar ArcNameW[NM];
+ strcpy(ArcName,Name);
+ wcscpy(ArcNameW,NameW);
+ char *Ext=GetExt(ArcName);
+ bool NewStyle=false;
+ bool RevName=Ext!=NULL && stricomp(Ext,".rev")==0;
+--- 67,87 ----
+ }
+ }
+
+! #ifndef __BIONIC__
+ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
+ const wchar *NameW,bool Silent)
++ #else
++ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,bool Silent)
++ #endif
+ {
+ char ArcName[NM];
++ #ifndef __BIONIC__
+ wchar ArcNameW[NM];
++ #endif
+ strcpy(ArcName,Name);
++ #ifndef __BIONIC__
+ wcscpy(ArcNameW,NameW);
++ #endif
+ char *Ext=GetExt(ArcName);
+ bool NewStyle=false;
+ bool RevName=Ext!=NULL && stricomp(Ext,".rev")==0;
+***************
+*** 94,99 ****
+--- 101,107 ----
+ Ext--;
+ strcpy(Ext,"*.*");
+
++ #ifndef __BIONIC__
+ if (*ArcNameW!=0)
+ {
+ wchar *ExtW=GetExt(ArcNameW);
+***************
+*** 111,135 ****
+--- 119,156 ----
+ ExtW--;
+ wcscpy(ExtW,L"*.*");
+ }
++ #endif
+
+ FindFile Find;
+ Find.SetMask(ArcName);
++ #ifndef __BIONIC__
+ Find.SetMaskW(ArcNameW);
++ #endif
+ FindData fd;
+ while (Find.Next(&fd))
+ {
+ Archive Arc(Cmd);
++ #ifndef __BIONIC__
+ if (Arc.WOpen(fd.Name,fd.NameW) && Arc.IsArchive(true))
++ #else
++ if (Arc.WOpen(fd.Name) && Arc.IsArchive(true))
++ #endif
+ {
+ strcpy(ArcName,fd.Name);
++ #ifndef __BIONIC__
+ wcscpy(ArcNameW,fd.NameW);
++ #endif
+ break;
+ }
+ }
+ }
+
+ Archive Arc(Cmd);
++ #ifndef __BIONIC__
+ if (!Arc.WCheckOpen(ArcName,ArcNameW))
++ #else
++ if (!Arc.WCheckOpen(ArcName))
++ #endif
+ return(false);
+ if (!Arc.Volume)
+ {
+***************
+*** 150,155 ****
+--- 171,177 ----
+ wchar RecVolMaskW[NM];
+ size_t BaseNamePartLengthW=0;
+ *RecVolMaskW=0;
++ #ifndef __BIONIC__
+ if (*ArcNameW!=0)
+ {
+ wchar *VolNumStartW=VolNameToFirstName(ArcNameW,ArcNameW,NewNumbering);
+***************
+*** 157,162 ****
+--- 179,185 ----
+ BaseNamePartLengthW=VolNumStartW-ArcNameW;
+ wcscpy(RecVolMaskW+BaseNamePartLengthW,L"*.rev");
+ }
++ #endif
+
+
+ #ifndef SILENT
+***************
+*** 170,184 ****
+--- 193,213 ----
+
+ FindFile Find;
+ Find.SetMask(RecVolMask);
++ #ifndef __BIONIC__
+ Find.SetMaskW(RecVolMaskW);
++ #endif
+ FindData RecData;
+ int FileNumber=0,RecVolNumber=0,FoundRecVolumes=0,MissingVolumes=0;
+ char PrevName[NM];
++ #ifndef __BIONIC__
+ wchar PrevNameW[NM];
++ #endif
+ while (Find.Next(&RecData))
+ {
+ char *CurName=RecData.Name;
++ #ifndef __BIONIC__
+ wchar *CurNameW=RecData.NameW;
++ #endif
+ int P[3];
+ if (!RevName && !NewStyle)
+ {
+***************
+*** 199,204 ****
+--- 228,234 ----
+ NewStyle=false;
+ }
+
++ #ifndef __BIONIC__
+ wchar *DotW=GetExt(CurNameW);
+ if (DotW!=NULL)
+ {
+***************
+*** 213,218 ****
+--- 243,249 ----
+ if (LineCount==2)
+ NewStyle=false;
+ }
++ #endif
+ }
+ if (NewStyle)
+ {
+***************
+*** 229,235 ****
+--- 260,270 ----
+ #endif
+
+ File CurFile;
++ #ifndef __BIONIC__
+ CurFile.TOpen(CurName,CurNameW);
++ #else
++ CurFile.TOpen(CurName);
++ #endif
+ CurFile.Seek(0,SEEK_END);
+ int64 Length=CurFile.Tell();
+ CurFile.Seek(Length-7,SEEK_SET);
+***************
+*** 277,285 ****
+--- 312,326 ----
+ RecVolNumber=P[1];
+ FileNumber=P[2];
+ strcpy(PrevName,CurName);
++ #ifndef __BIONIC__
+ wcscpy(PrevNameW,CurNameW);
++ #endif
+ File *NewFile=new File;
++ #ifndef __BIONIC__
+ NewFile->TOpen(CurName,CurNameW);
++ #else
++ NewFile->TOpen(CurName);
++ #endif
+ SrcFile[FileNumber+P[0]-1]=NewFile;
+ FoundRecVolumes++;
+ #ifndef SILENT
+***************
+*** 301,316 ****
+--- 342,367 ----
+
+ char LastVolName[NM];
+ *LastVolName=0;
++ #ifndef __BIONIC__
+ wchar LastVolNameW[NM];
+ *LastVolNameW=0;
++ #endif
+
+ for (int CurArcNum=0;CurArcNum<FileNumber;CurArcNum++)
+ {
+ Archive *NewFile=new Archive;
++ #ifndef __BIONIC__
+ bool ValidVolume=FileExist(ArcName,ArcNameW);
++ #else
++ bool ValidVolume=FileExist(ArcName);
++ #endif
+ if (ValidVolume)
+ {
++ #ifndef __BIONIC__
+ NewFile->TOpen(ArcName,ArcNameW);
++ #else
++ NewFile->TOpen(ArcName);
++ #endif
+ ValidVolume=NewFile->IsArchive(false);
+ if (ValidVolume)
+ {
+***************
+*** 341,355 ****
+--- 392,412 ----
+ strcpy(NewName,ArcName);
+ strcat(NewName,".bad");
+
++ #ifndef __BIONIC__
+ wchar NewNameW[NM];
+ wcscpy(NewNameW,ArcNameW);
+ if (*NewNameW!=0)
+ wcscat(NewNameW,L".bad");
++ #endif
+ #ifndef SILENT
+ mprintf(St(MBadArc),ArcName);
+ mprintf(St(MRenaming),ArcName,NewName);
+ #endif
++ #ifndef __BIONIC__
+ RenameFile(ArcName,ArcNameW,NewName,NewNameW);
++ #else
++ RenameFile(ArcName,NewName);
++ #endif
+ }
+ NewFile->Seek(0,SEEK_SET);
+ }
+***************
+*** 359,365 ****
+--- 416,426 ----
+ // so if we are called from extraction, we will be able to continue
+ // extracting. It may happen if .rar and .rev are on read-only disks
+ // like CDs.
++ #ifndef __BIONIC__
+ if (!NewFile->Create(ArcName,ArcNameW))
++ #else
++ if (!NewFile->Create(ArcName))
++ #endif
+ {
+ // We need to display the title of operation before the error message,
+ // to make clear for user that create error is related to recovery
+***************
+*** 368,374 ****
+--- 429,439 ----
+ #ifndef SILENT
+ mprintf(St(MReconstructing));
+ #endif
++ #ifndef __BIONIC__
+ ErrHandler.CreateErrorMsg(ArcName,ArcNameW);
++ #else
++ ErrHandler.CreateErrorMsg(ArcName);
++ #endif
+ return false;
+ }
+
+***************
+*** 378,384 ****
+--- 443,451 ----
+ if (CurArcNum==FileNumber-1)
+ {
+ strcpy(LastVolName,ArcName);
++ #ifndef __BIONIC__
+ wcscpy(LastVolNameW,ArcNameW);
++ #endif
+ }
+
+ #ifndef SILENT
+***************
+*** 386,392 ****
+--- 453,463 ----
+ #endif
+ }
+ SrcFile[CurArcNum]=(File*)NewFile;
++ #ifndef __BIONIC__
+ NextVolumeName(ArcName,ArcNameW,ASIZE(ArcName),!NewNumbering);
++ #else
++ NextVolumeName(ArcName,ASIZE(ArcName),!NewNumbering);
++ #endif
+ }
+
+ #ifndef SILENT
+***************
+*** 528,538 ****
+--- 599,617 ----
+ CurFile->Close();
+ SrcFile[I]=NULL;
+ }
++ #ifndef __BIONIC__
+ if (*LastVolName!=0 || *LastVolNameW!=0)
++ #else
++ if (*LastVolName!=0)
++ #endif
+ {
+ // Truncate the last volume to its real size.
+ Archive Arc(Cmd);
++ #ifndef __BIONIC__
+ if (Arc.Open(LastVolName,LastVolNameW,FMF_UPDATE) && Arc.IsArchive(true) &&
++ #else
++ if (Arc.Open(LastVolName,FMF_UPDATE) && Arc.IsArchive(true) &&
++ #endif
+ Arc.SearchBlock(ENDARC_HEAD))
+ {
+ Arc.Seek(Arc.NextBlockPos,SEEK_SET);
+diff -crB orig/recvol.hpp src/recvol.hpp
+*** orig/recvol.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/recvol.hpp 2013-03-12 01:01:25.438307000 +0100
+***************
+*** 13,20 ****
+--- 13,25 ----
+ public:
+ RecVolumes();
+ ~RecVolumes();
++ #ifndef __BIONIC__
+ void Make(RAROptions *Cmd,char *ArcName,wchar *ArcNameW);
+ bool Restore(RAROptions *Cmd,const char *Name,const wchar *NameW,bool Silent);
++ #else
++ void Make(RAROptions *Cmd,char *ArcName);
++ bool Restore(RAROptions *Cmd,const char *Name,bool Silent);
++ #endif
+ };
+
+ #endif
+diff -crB orig/scantree.cpp src/scantree.cpp
+*** orig/scantree.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/scantree.cpp 2013-03-13 01:38:49.171113000 +0100
+***************
+*** 11,17 ****
+--- 11,19 ----
+
+ SetAllMaskDepth=0;
+ *CurMask=0;
++ #ifndef __BIONIC__
+ *CurMaskW=0;
++ #endif
+ memset(FindStack,0,sizeof(FindStack));
+ Depth=0;
+ Errors=0;
+***************
+*** 61,69 ****
+--- 63,76 ----
+
+ bool ScanTree::GetNextMask()
+ {
++ #ifndef __BIONIC__
+ if (!FileMasks->GetString(CurMask,CurMaskW,ASIZE(CurMask)))
++ #else
++ if (!FileMasks->GetString(CurMask,ASIZE(CurMask)))
++ #endif
+ return(false);
+
++ #ifndef __BIONIC__
+ if (*CurMask==0 && *CurMaskW!=0)
+ {
+ // Unicode only mask is present. It is very unlikely in console tools,
+***************
+*** 72,80 ****
+--- 79,90 ----
+ // So let's convert Unicode to ASCII.
+ WideToChar(CurMaskW,CurMask,ASIZE(CurMask));
+ }
++ #endif
+
+ CurMask[ASIZE(CurMask)-1]=0;
++ #ifndef __BIONIC__
+ CurMaskW[ASIZE(CurMaskW)-1]=0;
++ #endif
+ #ifdef _WIN_ALL
+ UnixSlashToDos(CurMask);
+ #endif
+***************
+*** 94,99 ****
+--- 104,110 ----
+ }
+ SpecPathLength=Name-CurMask;
+
++ #ifndef __BIONIC__
+ bool WideName=(*CurMaskW!=0);
+
+ if (WideName)
+***************
+*** 114,127 ****
+--- 125,141 ----
+ CharToWide(CurMask,WideMask);
+ SpecPathLengthW=PointToName(WideMask)-WideMask;
+ }
++ #endif
+ Depth=0;
+
+ strcpy(OrigCurMask,CurMask);
+
++ #ifndef __BIONIC__
+ // It is better to have non-empty OrigCurMaskW even if CurMaskW is empty.
+ // We need OrigCurMaskW to process Unicode masks generated by FindProc
+ // when encountering Unicode directory name.
+ GetWideName(CurMask,CurMaskW,OrigCurMaskW,ASIZE(OrigCurMaskW));
++ #endif
+
+ return(true);
+ }
+***************
+*** 135,146 ****
+--- 149,168 ----
+
+ if (FindStack[Depth]==NULL) // No FindFile object for this depth yet.
+ {
++ #ifndef __BIONIC__
+ bool Wildcards=IsWildcard(CurMask,CurMaskW);
++ #else
++ bool Wildcards=IsWildcard(CurMask);
++ #endif
+
+ // If we have a file name without wildcards, we can try to use
+ // FastFind to optimize speed. For example, in Unix it results in
+ // stat call instead of opendir/readdir/closedir.
++ #ifndef __BIONIC__
+ bool FindCode=!Wildcards && FindFile::FastFind(CurMask,CurMaskW,FD,GetLinks);
++ #else
++ bool FindCode=!Wildcards && FindFile::FastFind(CurMask,FD,GetLinks);
++ #endif
+
+ bool IsDir=FindCode && FD->IsDir;
+
+***************
+*** 162,167 ****
+--- 184,190 ----
+ if (SearchAll)
+ strcpy(PointToName(SearchMask),MASKALL);
+ FindStack[Depth]->SetMask(SearchMask);
++ #ifndef __BIONIC__
+ if (*CurMaskW!=0)
+ {
+ wchar SearchMaskW[NM];
+***************
+*** 170,175 ****
+--- 193,199 ----
+ wcscpy(PointToName(SearchMaskW),MASKALLW);
+ FindStack[Depth]->SetMaskW(SearchMaskW);
+ }
++ #endif
+ }
+ else
+ {
+***************
+*** 193,199 ****
+--- 217,227 ----
+ if (Cmd!=NULL && Cmd->ExclCheck(CurMask,false,true,true))
+ RetCode=SCAN_NEXT;
+ else
++ #ifndef __BIONIC__
+ ErrHandler.OpenErrorMsg(ErrArcName,NULL,CurMask,CurMaskW);
++ #else
++ ErrHandler.OpenErrorMsg(ErrArcName,CurMask);
++ #endif
+ }
+
+ // If we searched only for one file or directory in "fast find"
+***************
+*** 204,210 ****
+--- 232,240 ----
+ // mode, directory recursing will quit by (Depth < 0) condition,
+ // which returns SCAN_DONE to calling function.
+ *CurMask=0;
++ #ifndef __BIONIC__
+ *CurMaskW=0;
++ #endif
+
+ return(RetCode);
+ }
+***************
+*** 249,257 ****
+--- 279,291 ----
+ #endif
+
+ char DirName[NM];
++ #ifndef __BIONIC__
+ wchar DirNameW[NM];
++ #endif
+ *DirName=0;
++ #ifndef __BIONIC__
+ *DirNameW=0;
++ #endif
+
+ // Going to at least one directory level higher.
+ delete FindStack[Depth];
+***************
+*** 283,288 ****
+--- 317,323 ----
+ strcpy(PrevSlash,Mask);
+ }
+
++ #ifndef __BIONIC__
+ if (*CurMaskW!=0)
+ {
+ wchar *Slash=wcsrchr(CurMaskW,CPATHDIVIDER);
+***************
+*** 305,324 ****
+--- 340,366 ----
+ *CurMaskW=Mask[0]=Mask[1]=0;
+ }
+ *Slash=0;
++ #ifndef __BIONIC__
+ wcscpy(DirNameW,CurMaskW);
+ wchar *PrevSlash=wcsrchr(CurMaskW,CPATHDIVIDER);
+ if (PrevSlash==NULL)
+ wcscpy(CurMaskW,Mask+1);
+ else
+ wcscpy(PrevSlash,Mask);
++ #endif
+ }
+ #ifndef _WIN_CE
+ // if (LowAscii(CurMaskW))
+ // *CurMaskW=0;
+ #endif
+ }
++ #endif
+ if (GetDirs==SCAN_GETDIRSTWICE &&
++ #ifndef __BIONIC__
+ FindFile::FastFind(DirName,DirNameW,FD,GetLinks) && FD->IsDir)
++ #else
++ FindFile::FastFind(DirName,FD,GetLinks) && FD->IsDir)
++ #endif
+ {
+ FD->Flags|=FDDF_SECONDDIR;
+ return(Error ? SCAN_ERROR:SCAN_SUCCESS);
+***************
+*** 367,372 ****
+--- 409,415 ----
+ AddEndSlash(CurMask);
+ strcat(CurMask,Mask);
+
++ #ifndef __BIONIC__
+ if (*CurMaskW!=0 && *FD->NameW==0)
+ CharToWide(FD->Name,FD->NameW);
+ if (*FD->NameW!=0)
+***************
+*** 383,388 ****
+--- 426,432 ----
+ AddEndSlash(CurMaskW);
+ wcscat(CurMaskW,Mask);
+ }
++ #endif
+ Depth++;
+
+ // We need to use OrigCurMask for depths less than SetAllMaskDepth
+diff -crB orig/scantree.hpp src/scantree.hpp
+*** orig/scantree.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/scantree.hpp 2013-03-13 01:30:03.683097000 +0100
+***************
+*** 36,44 ****
+--- 36,48 ----
+ bool ScanEntireDisk;
+
+ char CurMask[NM];
++ #ifndef __BIONIC__
+ wchar CurMaskW[NM];
++ #endif
+ char OrigCurMask[NM];
++ #ifndef __BIONIC__
+ wchar OrigCurMaskW[NM];
++ #endif
+ bool SearchAllInRoot;
+ size_t SpecPathLength;
+ size_t SpecPathLengthW;
+diff -crB orig/secpassword.cpp src/secpassword.cpp
+*** orig/secpassword.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/secpassword.cpp 2013-03-15 20:17:08.171153700 +0100
+***************
+*** 54,60 ****
+--- 54,64 ----
+
+ SecPassword::SecPassword()
+ {
++ #ifndef __BIONIC__
+ Set(L"");
++ #else
++ Set("");
++ #endif
+ }
+
+
+***************
+*** 94,100 ****
+--- 98,108 ----
+ // people share the same computer and somebody left WinRAR copy with entered
+ // password. So we decided to obfuscate the password to make it more difficult
+ // to find it in dump.
++ #ifndef __BIONIC__
+ void SecPassword::Process(const wchar *Src,wchar *Dst,size_t MaxSize,bool Encode)
++ #else
++ void SecPassword::Process(const char *Src,char *Dst,size_t MaxSize,bool Encode)
++ #endif
+ {
+ #ifdef _WIN_ALL
+ // Try to utilize the secure Crypt[Un]ProtectMemory if possible.
+***************
+*** 145,155 ****
+ #endif
+
+ for (size_t I=0;I<MaxSize;I++)
+! Dst[I]=wchar(Src[I]^(Key+I+75));
+ }
+
+!
+ void SecPassword::Get(wchar *Psw,size_t MaxSize)
+ {
+ if (PasswordSet)
+ {
+--- 153,166 ----
+ #endif
+
+ for (size_t I=0;I<MaxSize;I++)
+! Dst[I]=char(Src[I]^(Key+I+75));
+ }
+
+! #ifndef __BIONIC__
+ void SecPassword::Get(wchar *Psw,size_t MaxSize)
++ #else
++ void SecPassword::Get(char *Psw,size_t MaxSize)
++ #endif
+ {
+ if (PasswordSet)
+ {
+***************
+*** 160,167 ****
+ *Psw=0;
+ }
+
+!
+ void SecPassword::Set(const wchar *Psw)
+ {
+ if (*Psw==0)
+ {
+--- 171,181 ----
+ *Psw=0;
+ }
+
+! #ifndef __BIONIC__
+ void SecPassword::Set(const wchar *Psw)
++ #else
++ void SecPassword::Set(const char *Psw)
++ #endif
+ {
+ if (*Psw==0)
+ {
+***************
+*** 178,186 ****
+--- 192,208 ----
+
+ size_t SecPassword::Length()
+ {
++ #ifndef __BIONIC__
+ wchar Plain[MAXPASSWORD];
++ #else
++ char Plain[MAXPASSWORD];
++ #endif
+ Get(Plain,ASIZE(Plain));
++ #ifndef __BIONIC__
+ size_t Length=wcslen(Plain);
++ #else
++ size_t Length=strlen(Plain);
++ #endif
+ cleandata(Plain,ASIZE(Plain));
+ return Length;
+ }
+***************
+*** 192,201 ****
+--- 214,231 ----
+ // than encryption function will always produce the same result for same
+ // data (salt?) and because we do not clean the rest of password buffer
+ // after trailing zero before encoding password. So we decode first.
++ #ifndef __BIONIC__
+ wchar Plain1[MAXPASSWORD],Plain2[MAXPASSWORD];
++ #else
++ char Plain1[MAXPASSWORD],Plain2[MAXPASSWORD];
++ #endif
+ Get(Plain1,ASIZE(Plain1));
+ psw.Get(Plain2,ASIZE(Plain2));
++ #ifndef __BIONIC__
+ bool Result=wcscmp(Plain1,Plain2)==0;
++ #else
++ bool Result=strcmp(Plain1,Plain2)==0;
++ #endif
+ cleandata(Plain1,ASIZE(Plain1));
+ cleandata(Plain2,ASIZE(Plain2));
+ return Result;
+diff -crB orig/secpassword.hpp src/secpassword.hpp
+*** orig/secpassword.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/secpassword.hpp 2013-03-11 23:55:59.078185000 +0100
+***************
+*** 6,14 ****
+--- 6,22 ----
+ class SecPassword
+ {
+ private:
++ #ifndef __BIONIC__
+ void Process(const wchar *Src,wchar *Dst,size_t MaxSize,bool Encode);
++ #else
++ void Process(const char *Src,char *Dst,size_t MaxSize,bool Encode);
++ #endif
+
++ #ifndef __BIONIC__
+ wchar Password[MAXPASSWORD];
++ #else
++ char Password[MAXPASSWORD];
++ #endif
+
+ // It is important to have this 'bool' value, so if our object is cleaned
+ // with memset as a part of larger structure, it is handled correctly.
+***************
+*** 17,24 ****
+--- 25,37 ----
+ SecPassword();
+ ~SecPassword();
+ void Clean();
++ #ifndef __BIONIC__
+ void Get(wchar *Psw,size_t MaxSize);
+ void Set(const wchar *Psw);
++ #else
++ void Get(char *Psw,size_t MaxSize);
++ void Set(const char *Psw);
++ #endif
+ bool IsSet() {return PasswordSet;}
+ size_t Length();
+ bool operator == (SecPassword &psw);
+diff -crB orig/strfn.cpp src/strfn.cpp
+*** orig/strfn.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/strfn.cpp 2013-03-13 00:55:30.267032000 +0100
+***************
+*** 13,26 ****
+
+
+
+!
+ char *IntNameToExt(const char *Name)
+ {
+ static char OutName[NM];
+ IntToExt(Name,OutName);
+ return(OutName);
+ }
+!
+
+ void ExtToInt(const char *Src,char *Dest)
+ {
+--- 13,26 ----
+
+
+
+! #ifndef __BIONIC__
+ char *IntNameToExt(const char *Name)
+ {
+ static char OutName[NM];
+ IntToExt(Name,OutName);
+ return(OutName);
+ }
+! #endif
+
+ void ExtToInt(const char *Src,char *Dest)
+ {
+***************
+*** 101,114 ****
+ return(Str);
+ }
+
+!
+ wchar* RemoveLF(wchar *Str)
+ {
+ for (int I=(int)wcslen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
+ Str[I]=0;
+ return(Str);
+ }
+!
+
+ unsigned char loctolower(unsigned char ch)
+ {
+--- 101,114 ----
+ return(Str);
+ }
+
+! #ifndef __BIONIC__
+ wchar* RemoveLF(wchar *Str)
+ {
+ for (int I=(int)wcslen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
+ Str[I]=0;
+ return(Str);
+ }
+! #endif
+
+ unsigned char loctolower(unsigned char ch)
+ {
+***************
+*** 143,149 ****
+ return(toupper(ch));
+ }
+
+!
+ // Unicode version of etoupper.
+ wchar etoupperw(wchar ch)
+ {
+--- 143,149 ----
+ return(toupper(ch));
+ }
+
+! #ifndef __BIONIC__
+ // Unicode version of etoupper.
+ wchar etoupperw(wchar ch)
+ {
+***************
+*** 151,156 ****
+--- 151,157 ----
+ return('I');
+ return(toupperw(ch));
+ }
++ #endif
+
+
+ // We do not want to cast every signed char to unsigned when passing to
+***************
+*** 207,213 ****
+ return(true);
+ }
+
+!
+ bool LowAscii(const wchar *Str)
+ {
+ for (int I=0;Str[I]!=0;I++)
+--- 208,214 ----
+ return(true);
+ }
+
+! #ifndef __BIONIC__
+ bool LowAscii(const wchar *Str)
+ {
+ for (int I=0;Str[I]!=0;I++)
+***************
+*** 219,225 ****
+ }
+ return(true);
+ }
+!
+
+
+
+--- 220,226 ----
+ }
+ return(true);
+ }
+! #endif
+
+
+
+***************
+*** 234,239 ****
+--- 235,241 ----
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ int wcsicompc(const wchar *Str1,const wchar *Str2)
+ {
+ #if defined(_UNIX)
+***************
+*** 243,248 ****
+--- 245,251 ----
+ #endif
+ }
+ #endif
++ #endif
+
+
+ // safe strncpy: copies maxlen-1 max and always returns zero terminated dest
+***************
+*** 258,263 ****
+--- 261,267 ----
+
+
+ // Safe wcsncpy: copies maxlen-1 max and always returns zero terminated dest.
++ #ifndef __BIONIC__
+ wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen)
+ {
+ if (maxlen>0)
+***************
+*** 267,272 ****
+--- 271,277 ----
+ }
+ return(dest);
+ }
++ #endif
+
+
+ // Safe strncat: resulting dest length cannot exceed maxlen and dest
+***************
+*** 280,286 ****
+ return dest;
+ }
+
+!
+ // Safe wcsncat: resulting dest length cannot exceed maxlen and dest
+ // is always zero terminated. Note that 'maxlen' parameter defines the entire
+ // dest buffer size and is not compatible with standard wcsncat.
+--- 285,291 ----
+ return dest;
+ }
+
+! #ifndef __BIONIC__
+ // Safe wcsncat: resulting dest length cannot exceed maxlen and dest
+ // is always zero terminated. Note that 'maxlen' parameter defines the entire
+ // dest buffer size and is not compatible with standard wcsncat.
+***************
+*** 291,296 ****
+--- 296,302 ----
+ wcsncat(dest, src, maxlen - Length - 1);
+ return dest;
+ }
++ #endif
+
+
+ void itoa(int64 n,char *Str)
+***************
+*** 322,328 ****
+ return(n);
+ }
+
+!
+ void itoa(int64 n,wchar *Str)
+ {
+ wchar NumStr[50];
+--- 328,334 ----
+ return(n);
+ }
+
+! #ifndef __BIONIC__
+ void itoa(int64 n,wchar *Str)
+ {
+ wchar NumStr[50];
+***************
+*** 338,345 ****
+ Str[I]=NumStr[Pos-I-1];
+ Str[Pos]=0;
+ }
+
+!
+ int64 atoil(const wchar *Str)
+ {
+ int64 n=0;
+--- 344,352 ----
+ Str[I]=NumStr[Pos-I-1];
+ Str[Pos]=0;
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ int64 atoil(const wchar *Str)
+ {
+ int64 n=0;
+***************
+*** 350,357 ****
+ }
+ return(n);
+ }
+
+!
+ const wchar* GetWide(const char *Src)
+ {
+ const size_t MaxLength=NM;
+--- 357,365 ----
+ }
+ return(n);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ const wchar* GetWide(const char *Src)
+ {
+ const size_t MaxLength=NM;
+***************
+*** 364,378 ****
+ Str[MaxLength-1]=0;
+ return(Str);
+ }
+
+!
+ const wchar* GetWide(const char *Src,const wchar *SrcW)
+ {
+ if (SrcW!=NULL && *SrcW!=0)
+ return SrcW;
+ return GetWide(Src);
+ }
+!
+
+ #ifdef _WIN_ALL
+ // Parse string containing parameters separated with spaces.
+--- 372,387 ----
+ Str[MaxLength-1]=0;
+ return(Str);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ const wchar* GetWide(const char *Src,const wchar *SrcW)
+ {
+ if (SrcW!=NULL && *SrcW!=0)
+ return SrcW;
+ return GetWide(Src);
+ }
+! #endif
+
+ #ifdef _WIN_ALL
+ // Parse string containing parameters separated with spaces.
+diff -crB orig/strfn.hpp src/strfn.hpp
+*** orig/strfn.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/strfn.hpp 2013-03-11 01:22:43.638374000 +0100
+***************
+*** 2,8 ****
+--- 2,10 ----
+ #define _RAR_STRFN_
+
+ const char* NullToEmpty(const char *Str);
++ #ifndef __BIONIC__
+ const wchar* NullToEmpty(const wchar *Str);
++ #endif
+ char* IntNameToExt(const char *Name);
+ void ExtToInt(const char *Src,char *Dest);
+ void IntToExt(const char *Src,char *Dest);
+***************
+*** 12,28 ****
+--- 14,38 ----
+ int strnicomp(const char *Str1,const char *Str2,size_t N);
+ char* RemoveEOL(char *Str);
+ char* RemoveLF(char *Str);
++ #ifndef __BIONIC__
+ wchar* RemoveLF(wchar *Str);
++ #endif
+ unsigned char loctolower(unsigned char ch);
+ unsigned char loctoupper(unsigned char ch);
+
+ char* strncpyz(char *dest, const char *src, size_t maxlen);
++ #ifndef __BIONIC__
+ wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen);
++ #endif
+ char* strncatz(char* dest, const char* src, size_t maxlen);
++ #ifndef __BIONIC__
+ wchar* wcsncatz(wchar* dest, const wchar* src, size_t maxlen);
++ #endif
+
+ unsigned char etoupper(unsigned char ch);
++ #ifndef __BIONIC__
+ wchar etoupperw(wchar ch);
++ #endif
+
+ bool IsDigit(int ch);
+ bool IsSpace(int ch);
+***************
+*** 34,53 ****
+--- 44,69 ----
+ #endif
+
+ bool LowAscii(const char *Str);
++ #ifndef __BIONIC__
+ bool LowAscii(const wchar *Str);
++ #endif
+
+
+ int stricompc(const char *Str1,const char *Str2);
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ int wcsicompc(const wchar *Str1,const wchar *Str2);
+ #endif
++ #endif
+
+ void itoa(int64 n,char *Str);
+ int64 atoil(const char *Str);
++ #ifndef __BIONIC__
+ void itoa(int64 n,wchar *Str);
+ int64 atoil(const wchar *Str);
+ const wchar* GetWide(const char *Src);
+ const wchar* GetWide(const char *Src,const wchar *SrcW);
+ const wchar* GetCmdParam(const wchar *CmdLine,wchar *Param,size_t MaxSize);
++ #endif
+
+ #endif
+diff -crB orig/strlist.cpp src/strlist.cpp
+*** orig/strlist.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/strlist.cpp 2013-03-11 01:18:11.366365000 +0100
+***************
+*** 10,21 ****
+ {
+ Rewind();
+ StringData.Reset();
+ StringDataW.Reset();
+ StringsCount=0;
+ SavePosNumber=0;
+ }
+
+!
+ void StringList::AddString(const char *Str)
+ {
+ AddString(Str,NULL);
+--- 10,23 ----
+ {
+ Rewind();
+ StringData.Reset();
++ #ifndef __BIONIC__
+ StringDataW.Reset();
++ #endif
+ StringsCount=0;
+ SavePosNumber=0;
+ }
+
+! #ifndef __BIONIC__
+ void StringList::AddString(const char *Str)
+ {
+ AddString(Str,NULL);
+***************
+*** 26,54 ****
+ {
+ AddString(NULL,Str);
+ }
+
+
+!
+!
+ void StringList::AddString(const char *Str,const wchar *StrW)
+ {
+ if (Str==NULL)
+ Str="";
+ if (StrW==NULL)
+ StrW=L"";
+
+ size_t PrevSize=StringData.Size();
+ StringData.Add(strlen(Str)+1);
+ strcpy(&StringData[PrevSize],Str);
+
+ size_t PrevSizeW=StringDataW.Size();
+ StringDataW.Add(wcslen(StrW)+1);
+ wcscpy(&StringDataW[PrevSizeW],StrW);
+
+ StringsCount++;
+ }
+
+!
+ bool StringList::GetString(char *Str,size_t MaxLength)
+ {
+ return(GetString(Str,NULL,MaxLength));
+--- 28,63 ----
+ {
+ AddString(NULL,Str);
+ }
++ #endif
+
+
+! #ifndef __BIONIC__
+ void StringList::AddString(const char *Str,const wchar *StrW)
++ #else
++ void StringList::AddString(const char *Str)
++ #endif
+ {
+ if (Str==NULL)
+ Str="";
++ #ifndef __BIONIC__
+ if (StrW==NULL)
+ StrW=L"";
++ #endif
+
+ size_t PrevSize=StringData.Size();
+ StringData.Add(strlen(Str)+1);
+ strcpy(&StringData[PrevSize],Str);
+
++ #ifndef __BIONIC__
+ size_t PrevSizeW=StringDataW.Size();
+ StringDataW.Add(wcslen(StrW)+1);
+ wcscpy(&StringDataW[PrevSizeW],StrW);
++ #endif
+
+ StringsCount++;
+ }
+
+! #ifndef __BIONIC__
+ bool StringList::GetString(char *Str,size_t MaxLength)
+ {
+ return(GetString(Str,NULL,MaxLength));
+***************
+*** 59,88 ****
+ {
+ return(GetString(NULL,Str,MaxLength));
+ }
+
+!
+ bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength)
+ {
+ char *StrPtr;
+ wchar *StrPtrW;
+ if (!GetString(&StrPtr,&StrPtrW))
+ return(false);
+ if (Str!=NULL)
+ strncpy(Str,StrPtr,MaxLength);
+ if (StrW!=NULL)
+ wcsncpy(StrW,StrPtrW,MaxLength);
+ return(true);
+ }
+
+
+ #ifndef SFX_MODULE
+ bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum)
+ {
+ SavePosition();
+ Rewind();
+ bool RetCode=true;
+ while (StringNum-- >=0)
+ if (!GetString(Str,StrW,MaxLength))
+ {
+ RetCode=false;
+ break;
+--- 67,115 ----
+ {
+ return(GetString(NULL,Str,MaxLength));
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength)
++ #else
++ bool StringList::GetString(char *Str,size_t MaxLength)
++ #endif
+ {
+ char *StrPtr;
++ #ifndef __BIONIC__
+ wchar *StrPtrW;
+ if (!GetString(&StrPtr,&StrPtrW))
++ #else
++ if (!GetString(&StrPtr))
++ #endif
+ return(false);
++
+ if (Str!=NULL)
+ strncpy(Str,StrPtr,MaxLength);
++ #ifndef __BIONIC__
+ if (StrW!=NULL)
+ wcsncpy(StrW,StrPtrW,MaxLength);
++ #endif
+ return(true);
+ }
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum)
++ #else
++ bool StringList::GetString(char *Str,size_t MaxLength,int StringNum)
++ #endif
+ {
+ SavePosition();
+ Rewind();
+ bool RetCode=true;
+ while (StringNum-- >=0)
++ #ifndef __BIONIC__
+ if (!GetString(Str,StrW,MaxLength))
++ #else
++ if (!GetString(Str,MaxLength))
++ #endif
+ {
+ RetCode=false;
+ break;
+***************
+*** 96,125 ****
+ char* StringList::GetString()
+ {
+ char *Str;
+ GetString(&Str,NULL);
+ return(Str);
+ }
+
+!
+ wchar* StringList::GetStringW()
+ {
+ wchar *StrW;
+ GetString(NULL,&StrW);
+ return(StrW);
+ }
+
+!
+ bool StringList::GetString(char **Str,wchar **StrW)
+ {
+ // First check would be enough, because both buffers grow synchronously,
+ // but we check both for extra fail proof.
+ if (CurPos>=StringData.Size() || CurPosW>=StringDataW.Size())
+ {
+ // No more strings left unprocessed.
+ if (Str!=NULL)
+ *Str=NULL;
+ if (StrW!=NULL)
+ *StrW=NULL;
+ return(false);
+ }
+
+--- 123,166 ----
+ char* StringList::GetString()
+ {
+ char *Str;
++ #ifndef __BIONIC__
+ GetString(&Str,NULL);
++ #else
++ GetString(&Str);
++ #endif
+ return(Str);
+ }
+
+! #ifndef __BIONIC__
+ wchar* StringList::GetStringW()
+ {
+ wchar *StrW;
+ GetString(NULL,&StrW);
+ return(StrW);
+ }
++ #endif
+
+! #ifndef __BIONIC__
+ bool StringList::GetString(char **Str,wchar **StrW)
++ #else
++ bool StringList::GetString(char **Str)
++ #endif
+ {
+ // First check would be enough, because both buffers grow synchronously,
+ // but we check both for extra fail proof.
++ #ifndef __BIONIC__
+ if (CurPos>=StringData.Size() || CurPosW>=StringDataW.Size())
++ #else
++ if (CurPos>=StringData.Size())
++ #endif
+ {
+ // No more strings left unprocessed.
+ if (Str!=NULL)
+ *Str=NULL;
++ #ifndef __BIONIC__
+ if (StrW!=NULL)
+ *StrW=NULL;
++ #endif
+ return(false);
+ }
+
+***************
+*** 130,139 ****
+--- 171,182 ----
+ if (Str!=NULL)
+ *Str=CurStr;
+
++ #ifndef __BIONIC__
+ wchar *CurStrW=&StringDataW[CurPosW];
+ CurPosW+=wcslen(CurStrW)+1;
+ if (StrW!=NULL)
+ *StrW=CurStrW;
++ #endif
+
+ return(true);
+ }
+***************
+*** 142,174 ****
+--- 185,233 ----
+ void StringList::Rewind()
+ {
+ CurPos=0;
++ #ifndef __BIONIC__
+ CurPosW=0;
++ #endif
+ }
+
+
+ // Return the total size of usual and Unicode characters stored in the list.
+ size_t StringList::GetCharCount()
+ {
++ #ifndef __BIONIC__
+ return(StringData.Size()+StringDataW.Size());
++ #else
++ return(StringData.Size());
++ #endif
+ }
+
+
+ #ifndef SFX_MODULE
++ #ifndef __BIONIC__
+ bool StringList::Search(char *Str,wchar *StrW,bool CaseSensitive)
++ #else
++ bool StringList::Search(char *Str,bool CaseSensitive)
++ #endif
+ {
+ SavePosition();
+ Rewind();
+ bool Found=false;
+ char *CurStr;
++ #ifndef __BIONIC__
+ wchar *CurStrW;
+ while (GetString(&CurStr,&CurStrW))
++ #else
++ while (GetString(&CurStr))
++ #endif
+ {
+ if (Str!=NULL && CurStr!=NULL)
+ if ((CaseSensitive ? strcmp(Str,CurStr):stricomp(Str,CurStr))!=0)
+ continue;
++ #ifndef __BIONIC__
+ if (StrW!=NULL && CurStrW!=NULL)
+ if ((CaseSensitive ? wcscmp(StrW,CurStrW):wcsicomp(StrW,CurStrW))!=0)
+ continue;
++ #endif
+ Found=true;
+ break;
+ }
+***************
+*** 184,190 ****
+--- 243,251 ----
+ if (SavePosNumber<ASIZE(SaveCurPos))
+ {
+ SaveCurPos[SavePosNumber]=CurPos;
++ #ifndef __BIONIC__
+ SaveCurPosW[SavePosNumber]=CurPosW;
++ #endif
+ SavePosNumber++;
+ }
+ }
+***************
+*** 198,204 ****
+--- 259,267 ----
+ {
+ SavePosNumber--;
+ CurPos=SaveCurPos[SavePosNumber];
++ #ifndef __BIONIC__
+ CurPosW=SaveCurPosW[SavePosNumber];
++ #endif
+ }
+ }
+ #endif
+diff -crB orig/strlist.hpp src/strlist.hpp
+*** orig/strlist.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/strlist.hpp 2013-03-11 01:06:37.858344000 +0100
+***************
+*** 7,35 ****
+--- 7,55 ----
+ Array<char> StringData;
+ size_t CurPos;
+
++ #ifndef __BIONIC__
+ Array<wchar> StringDataW;
+ size_t CurPosW;
++ #endif
+
+ uint StringsCount;
+
++ #ifndef __BIONIC__
+ size_t SaveCurPos[16],SaveCurPosW[16],SavePosNumber;
++ #else
++ size_t SaveCurPos[16],SavePosNumber;
++ #endif
+ public:
+ StringList();
+ void Reset();
+ void AddString(const char *Str);
++ #ifndef __BIONIC__
+ void AddString(const wchar *Str);
+ void AddString(const char *Str,const wchar *StrW);
++ #endif
+ bool GetString(char *Str,size_t MaxLength);
++ #ifndef __BIONIC__
+ bool GetString(wchar *Str,size_t MaxLength);
+ bool GetString(char *Str,wchar *StrW,size_t MaxLength);
+ bool GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum);
++ #else
++ bool GetString(char *Str,size_t MaxLength,int StringNum);
++ #endif
+ char* GetString();
++ #ifndef __BIONIC__
+ wchar* GetStringW();
+ bool GetString(char **Str,wchar **StrW);
++ #else
++ bool GetString(char **Str);
++ #endif
+ void Rewind();
+ uint ItemsCount() {return(StringsCount);};
+ size_t GetCharCount();
++ #ifndef __BIONIC__
+ bool Search(char *Str,wchar *StrW,bool CaseSensitive);
++ #else
++ bool Search(char *Str,bool CaseSensitive);
++ #endif
+ void SavePosition();
+ void RestorePosition();
+ };
+diff -crB orig/ulinks.cpp src/ulinks.cpp
+*** orig/ulinks.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/ulinks.cpp 2013-03-12 00:35:37.410259000 +0100
+***************
+*** 13,19 ****
+--- 13,23 ----
+ LinkTarget[DataSize]=0;
+ if (Create)
+ {
++ #ifndef __BIONIC__
+ CreatePath(LinkName,NULL,true);
++ #else
++ CreatePath(LinkName,true);
++ #endif
+ if (symlink(LinkTarget,LinkName)==-1) // Error.
+ if (errno==EEXIST)
+ Log(Arc.FileName,St(MSymLinkExists),LinkName);
+diff -crB orig/uowners.cpp src/uowners.cpp
+*** orig/uowners.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/uowners.cpp 2013-03-12 00:44:05.434275000 +0100
+***************
+*** 29,35 ****
+--- 29,39 ----
+ ErrHandler.SetErrorCode(RARX_CRC);
+ return;
+ }
++ #ifndef __BIONIC__
+ uint Attr=GetFileAttr(FileName,NULL);
++ #else
++ uint Attr=GetFileAttr(FileName);
++ #endif
+ gid_t GroupID=gr->gr_gid;
+ #if defined(SAVE_LINKS) && !defined(_APPLE)
+ if (lchown(FileName,OwnerID,GroupID)!=0)
+***************
+*** 40,46 ****
+--- 44,54 ----
+ Log(Arc.FileName,St(MSetOwnersError),FileName);
+ ErrHandler.SetErrorCode(RARX_CREATE);
+ }
++ #ifndef __BIONIC__
+ SetFileAttr(FileName,NULL,Attr);
++ #else
++ SetFileAttr(FileName,Attr);
++ #endif
+ }
+
+
+***************
+*** 69,75 ****
+--- 77,87 ----
+ ErrHandler.SetErrorCode(RARX_CRC);
+ return;
+ }
++ #ifndef __BIONIC__
+ uint Attr=GetFileAttr(FileName,NULL);
++ #else
++ uint Attr=GetFileAttr(FileName);
++ #endif
+ gid_t GroupID=gr->gr_gid;
+ #if defined(SAVE_LINKS) && !defined(_APPLE)
+ if (lchown(FileName,OwnerID,GroupID)!=0)
+***************
+*** 80,84 ****
+--- 92,100 ----
+ Log(Arc.FileName,St(MSetOwnersError),FileName);
+ ErrHandler.SetErrorCode(RARX_CREATE);
+ }
++ #ifndef __BIONIC__
+ SetFileAttr(FileName,NULL,Attr);
++ #else
++ SetFileAttr(FileName,Attr);
++ #endif
+ }
+diff -crB orig/volume.cpp src/volume.cpp
+*** orig/volume.cpp 2012-06-09 15:21:04.000000000 +0200
+--- src/volume.cpp 2013-03-12 01:08:10.742320000 +0100
+***************
+*** 33,42 ****
+--- 33,48 ----
+ Arc.Close();
+
+ char NextName[NM];
++ #ifndef __BIONIC__
+ wchar NextNameW[NM];
++ #endif
+ strcpy(NextName,Arc.FileName);
++ #ifndef __BIONIC__
+ wcscpy(NextNameW,Arc.FileNameW);
+ NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
++ #else
++ NextVolumeName(NextName,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
++ #endif
+
+ #if !defined(SFX_MODULE) && !defined(RARDLL)
+ bool RecoveryDone=false;
+***************
+*** 47,58 ****
+--- 53,72 ----
+ // In -vp mode we force the pause before next volume even if it is present
+ // and even if we are on the hard disk. It is important when user does not
+ // want to process partially downloaded volumes preliminary.
++ #ifndef __BIONIC__
+ if (Cmd->VolumePause && !AskNextVol(NextName,NextNameW))
++ #else
++ if (Cmd->VolumePause && !AskNextVol(NextName))
++ #endif
+ FailedOpen=true;
+ #endif
+
+ if (!FailedOpen)
++ #ifndef __BIONIC__
+ while (!Arc.Open(NextName,NextNameW,0))
++ #else
++ while (!Arc.Open(NextName,0))
++ #endif
+ {
+ // We need to open a new volume which size was not calculated
+ // in total size before, so we cannot calculate the total progress
+***************
+*** 66,80 ****
+--- 80,106 ----
+ // Checking for new style volumes renamed by user to old style
+ // name format. Some users did it for unknown reason.
+ char AltNextName[NM];
++ #ifndef __BIONIC__
+ wchar AltNextNameW[NM];
++ #endif
+ strcpy(AltNextName,Arc.FileName);
++ #ifndef __BIONIC__
+ wcscpy(AltNextNameW,Arc.FileNameW);
+ NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
++ #else
++ NextVolumeName(AltNextName,ASIZE(AltNextName),true);
++ #endif
+ OldSchemeTested=true;
++ #ifndef __BIONIC__
+ if (Arc.Open(AltNextName,AltNextNameW,0))
++ #else
++ if (Arc.Open(AltNextName,0))
++ #endif
+ {
+ strcpy(NextName,AltNextName);
++ #ifndef __BIONIC__
+ wcscpy(NextNameW,AltNextNameW);
++ #endif
+ break;
+ }
+ }
+***************
+*** 144,150 ****
+--- 170,180 ----
+ if (!RecoveryDone)
+ {
+ RecVolumes RecVol;
++ #ifndef __BIONIC__
+ RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true);
++ #else
++ RecVol.Restore(Cmd,Arc.FileName,true);
++ #endif
+ RecoveryDone=true;
+ continue;
+ }
+***************
+*** 158,164 ****
+--- 188,198 ----
+ }
+ #endif
+ #ifndef SILENT
++ #ifndef __BIONIC__
+ if (Cmd->AllYes || !AskNextVol(NextName,NextNameW))
++ #else
++ if (Cmd->AllYes || !AskNextVol(NextName))
++ #endif
+ #endif
+ {
+ FailedOpen=true;
+***************
+*** 173,179 ****
+--- 207,217 ----
+ #if !defined(SILENT) && !defined(_WIN_CE)
+ Log(Arc.FileName,St(MAbsNextVol),NextName);
+ #endif
++ #ifndef __BIONIC__
+ Arc.Open(Arc.FileName,Arc.FileNameW,0);
++ #else
++ Arc.Open(Arc.FileName,0);
++ #endif
+ Arc.Seek(PosBeforeClose,SEEK_SET);
+ return(false);
+ }
+***************
+*** 220,225 ****
+--- 258,264 ----
+ char OutName[NM];
+ IntToExt(Arc.NewLhd.FileName,OutName);
+ #ifdef UNICODE_SUPPORTED
++ #ifndef __BIONIC__
+ bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled();
+ if (WideName)
+ {
+***************
+*** 230,235 ****
+--- 269,275 ----
+ strcpy(OutName,Name);
+ }
+ #endif
++ #endif
+ mprintf(St(MExtrPoints),OutName);
+ if (!Cmd->DisablePercentage)
+ mprintf(" ");
+***************
+*** 270,276 ****
+--- 310,320 ----
+
+
+ #ifndef SILENT
++ #ifndef __BIONIC__
+ bool AskNextVol(char *ArcName,wchar *ArcNameW)
++ #else
++ bool AskNextVol(char *ArcName)
++ #endif
+ {
+ eprintf(St(MAskNextVol),ArcName);
+ if (Ask(St(MContinueQuit))==2)
+diff -crB orig/volume.hpp src/volume.hpp
+*** orig/volume.hpp 2012-06-09 15:21:04.000000000 +0200
+--- src/volume.hpp 2013-03-12 00:53:16.458292000 +0100
+***************
+*** 6,11 ****
+--- 6,15 ----
+ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,
+ char Command);
+ void SetVolWrite(Archive &Dest,int64 VolSize);
++ #ifndef __BIONIC__
+ bool AskNextVol(char *ArcName,wchar *ArcNameW);
++ #else
++ bool AskNextVol(char *ArcName);
++ #endif
+
+ #endif
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/README-Android b/README-Android
new file mode 100644
index 0000000..3221052
--- /dev/null
+++ b/README-Android
@@ -0,0 +1,16 @@
+UnRAR on Android
+
+Source: http://www.rarlab.com/rar_add.htm
+
+The Android port of UnRAR remove exception handling, unicode, volume and crypt support.
+They are immortalized in Android.patch to ease future upgraded.
+
+This file can be regenerated using:
+
+diff -crB orig src > Android.patch
+
+
+Patch the source with the follow command:
+
+patch -p0 < Android.patch
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..1e4e668
--- /dev/null
+++ b/TODO
@@ -0,0 +1,4 @@
+UnRAR 4.20
+----------
+
+- Password support is not working properly
diff --git a/src/arccmt.cpp b/src/arccmt.cpp
index 189fc79..e29c336 100644
--- a/src/arccmt.cpp
+++ b/src/arccmt.cpp
@@ -1,6 +1,10 @@
bool IsAnsiComment(const char *Data,int Size);
+#ifndef __BIONIC__
bool Archive::GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW)
+#else
+bool Archive::GetComment(Array<byte> *CmtData)
+#endif
{
if (!MainComment)
return(false);
@@ -28,7 +32,11 @@ bool Archive::GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW)
{
// Current (RAR 3.0+) version of archive comment.
Seek(SFXSize+SIZEOF_MARKHEAD+NewMhd.HeadSize,SEEK_SET);
+#ifndef __BIONIC__
return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData,CmtDataW)!=0);
+#else
+ return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData)!=0);
+#endif
}
#ifndef SFX_MODULE
// Old style (RAR 2.9) comment header embedded into the main
@@ -125,13 +133,17 @@ bool Archive::GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW)
return(CmtData->Size()>0);
}
-
+#ifndef __BIONIC__
size_t Archive::ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW)
+#else
+size_t Archive::ReadCommentData(Array<byte> *CmtData)
+#endif
{
bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE;
if (!ReadSubData(CmtData,NULL))
return(0);
size_t CmtSize=CmtData->Size();
+#ifndef __BIONIC__
if (Unicode)
{
CmtSize/=2;
@@ -159,6 +171,7 @@ size_t Archive::ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW)
CmtData->Alloc(CmtSize);
CmtDataW->Alloc(wcslen(CmtDataW->Addr()));
}
+#endif
return(CmtSize);
}
@@ -169,7 +182,11 @@ void Archive::ViewComment()
if (Cmd->DisableComment)
return;
Array<byte> CmtBuf;
+#ifndef __BIONIC__
if (GetComment(&CmtBuf,NULL))
+#else
+ if (GetComment(&CmtBuf))
+#endif
{
size_t CmtSize=CmtBuf.Size();
char *ChPtr=(char *)memchr(&CmtBuf[0],0x1A,CmtSize);
diff --git a/src/archive.cpp b/src/archive.cpp
index b061e54..d468648 100644
--- a/src/archive.cpp
+++ b/src/archive.cpp
@@ -42,7 +42,9 @@ Archive::Archive(RAROptions *InitCmd)
*SubDataSalt=0;
#endif
*FirstVolumeName=0;
+#ifndef __BIONIC__
*FirstVolumeNameW=0;
+#endif
Splitting=false;
NewArchive=false;
@@ -66,17 +68,32 @@ void Archive::CheckArc(bool EnableBroken)
#if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void Archive::CheckOpen(const char *Name,const wchar *NameW)
+#else
+void Archive::CheckOpen(const char *Name)
+#endif
{
+#ifndef __BIONIC__
TOpen(Name,NameW);
+#else
+ TOpen(Name);
+#endif
CheckArc(false);
}
#endif
-
+#ifndef __BIONIC__
bool Archive::WCheckOpen(const char *Name,const wchar *NameW)
+#else
+bool Archive::WCheckOpen(const char *Name)
+#endif
{
+#ifndef __BIONIC__
if (!WOpen(Name,NameW))
+#else
+ if (!WOpen(Name))
+#endif
return(false);
if (!IsArchive(false))
{
@@ -250,7 +267,9 @@ bool Archive::IsArchive(bool EnableBroken)
if (!Volume || !NotFirstVolume)
{
strcpy(FirstVolumeName,FileName);
+#ifndef __BIONIC__
wcscpy(FirstVolumeNameW,FileNameW);
+#endif
}
return(true);
diff --git a/src/archive.hpp b/src/archive.hpp
index 58b4cd3..d662078 100644
--- a/src/archive.hpp
+++ b/src/archive.hpp
@@ -13,7 +13,9 @@ class Archive:public File
ARCSIGN_TYPE IsSignature(const byte *D,size_t Size);
void UpdateLatestTime(FileHeader *CurBlock);
void ConvertNameCase(char *Name);
+#ifndef __BIONIC__
void ConvertNameCase(wchar *Name);
+#endif
void ConvertUnknownHeader();
size_t ReadOldHeader();
void UnexpEndArcMsg();
@@ -48,13 +50,23 @@ class Archive:public File
size_t SearchSubBlock(const char *Type);
int ReadBlock(int BlockType);
void WriteBlock(int BlockType,BaseBlock *wb=NULL);
+#ifndef __BIONIC__
int PrepareNamesToWrite(char *Name,wchar *NameW,char *DestName,byte *DestNameW);
+#else
+ int PrepareNamesToWrite(char *Name,char *DestName);
+#endif
void SetLhdSize();
size_t ReadHeader();
void CheckArc(bool EnableBroken);
+#ifndef __BIONIC__
void CheckOpen(const char *Name,const wchar *NameW=NULL);
bool WCheckOpen(const char *Name,const wchar *NameW=NULL);
bool GetComment(Array<byte> *CmtData,Array<wchar> *CmtDataW);
+#else
+ void CheckOpen(const char *Name);
+ bool WCheckOpen(const char *Name);
+ bool GetComment(Array<byte> *CmtData);
+#endif
void ViewComment();
void ViewFileComment();
void SetLatestTime(RarTime *NewTime);
@@ -68,7 +80,11 @@ class Archive:public File
void AddSubData(byte *SrcData,size_t DataSize,File *SrcFile,const char *Name,bool AllowSplit);
bool ReadSubData(Array<byte> *UnpData,File *DestFile);
int GetHeaderType() {return(CurHeaderType);};
+#ifndef __BIONIC__
size_t ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW);
+#else
+ size_t ReadCommentData(Array<byte> *CmtData);
+#endif
void WriteCommentData(byte *Data,size_t DataSize,bool FileComment);
RAROptions* GetRAROptions() {return(Cmd);}
void SetSilentOpen(bool Mode) {SilentOpen=Mode;}
@@ -114,7 +130,9 @@ class Archive:public File
bool NewArchive;
char FirstVolumeName[NM];
+#ifndef __BIONIC__
wchar FirstVolumeNameW[NM];
+#endif
};
diff --git a/src/arcread.cpp b/src/arcread.cpp
index a524a96..d1d3ed2 100644
--- a/src/arcread.cpp
+++ b/src/arcread.cpp
@@ -99,7 +99,11 @@ size_t Archive::ReadHeader()
ErrHandler.Exit(RARX_USERBREAK);
}
#else
+#ifndef __BIONIC__
if (!GetPassword(PASSWORD_ARCHIVE,FileName,FileNameW,&Cmd->Password))
+#else
+ if (!GetPassword(PASSWORD_ARCHIVE,FileName,&Cmd->Password))
+#endif
{
Close();
ErrHandler.Exit(RARX_USERBREAK);
@@ -236,6 +240,7 @@ size_t Archive::ReadHeader()
else
if (hd->HeadType==FILE_HEAD)
{
+#ifndef __BIONIC__
if (hd->Flags & LHD_UNICODE)
{
EncodeFileName NameCoder;
@@ -258,10 +263,13 @@ size_t Archive::ReadHeader()
}
else
*hd->FileNameW=0;
+#endif
#ifndef SFX_MODULE
ConvertNameCase(hd->FileName);
+#ifndef __BIONIC__
ConvertNameCase(hd->FileNameW);
#endif
+#endif
ConvertUnknownHeader();
}
if (hd->Flags & LHD_SALT)
@@ -325,9 +333,11 @@ size_t Archive::ReadHeader()
if (!EncBroken)
{
#ifndef SHELL_EXT
+#ifndef __BIONIC__
Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName));
Alarm();
#endif
+#endif
}
}
}
@@ -547,6 +557,7 @@ void Archive::ConvertNameCase(char *Name)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
void Archive::ConvertNameCase(wchar *Name)
{
if (Cmd->ConvertNames==NAMES_UPPERCASE)
@@ -555,6 +566,7 @@ void Archive::ConvertNameCase(wchar *Name)
wcslower(Name);
}
#endif
+#endif
bool Archive::IsArcDir()
diff --git a/src/cmddata.cpp b/src/cmddata.cpp
index e17fa20..219dfcf 100644
--- a/src/cmddata.cpp
+++ b/src/cmddata.cpp
@@ -20,9 +20,13 @@ void CommandData::Init()
Close();
*Command=0;
+#ifndef __BIONIC__
*CommandW=0;
+#endif
*ArcName=0;
+#ifndef __BIONIC__
*ArcNameW=0;
+#endif
FileLists=false;
NoMoreSwitches=false;
@@ -127,7 +131,11 @@ void CommandData::ParseCommandLine(int argc, char *argv[])
}
#else
for (int I=1;I<argc;I++)
+#ifndef __BIONIC__
ParseArg(argv[I],NULL);
+#else
+ ParseArg(argv[I]);
+#endif
#endif
ParseDone();
}
@@ -135,20 +143,29 @@ void CommandData::ParseCommandLine(int argc, char *argv[])
#ifndef SFX_MODULE
+#ifndef __BIONIC__
void CommandData::ParseArg(char *Arg,wchar *ArgW)
+#else
+void CommandData::ParseArg(char *Arg)
+#endif
{
if (IsSwitch(*Arg) && !NoMoreSwitches)
if (Arg[1]=='-')
NoMoreSwitches=true;
else
+#ifndef __BIONIC__
ProcessSwitch(Arg+1,(ArgW!=NULL && *ArgW!=0 ? ArgW+1:NULL));
+#else
+ ProcessSwitch(Arg+1);
+#endif
else
if (*Command==0)
{
strncpyz(Command,Arg,ASIZE(Command));
+#ifndef __BIONIC__
if (ArgW!=NULL)
wcsncpy(CommandW,ArgW,ASIZE(CommandW));
-
+#endif
#ifndef GUI
*Command=etoupper(*Command);
@@ -160,15 +177,22 @@ void CommandData::ParseArg(char *Arg,wchar *ArgW)
#endif
}
else
+#ifndef __BIONIC__
if (*ArcName==0 && *ArcNameW==0)
+#else
+ if (*ArcName==0)
+#endif
{
strncpyz(ArcName,Arg,ASIZE(ArcName));
+#ifndef __BIONIC__
if (ArgW!=NULL)
wcsncpyz(ArcNameW,ArgW,ASIZE(ArcNameW));
+#endif
}
else
{
bool EndSeparator; // If last character is the path separator.
+#ifndef __BIONIC__
if (ArgW!=NULL)
{
size_t Length=wcslen(ArgW);
@@ -177,10 +201,13 @@ void CommandData::ParseArg(char *Arg,wchar *ArgW)
}
else
{
+#endif
size_t Length=strlen(Arg);
char EndChar=Length==0 ? 0:Arg[Length-1];
EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar);
+#ifndef __BIONIC__
}
+#endif
char CmdChar=etoupper(*Command);
bool Add=strchr("AFUM",CmdChar)!=NULL;
@@ -188,18 +215,32 @@ void CommandData::ParseArg(char *Arg,wchar *ArgW)
if (EndSeparator && !Add)
{
strncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
+#ifndef __BIONIC__
if (ArgW!=NULL)
wcsncpyz(ExtrPathW,ArgW,ASIZE(ExtrPathW));
+#endif
}
else
if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS))
+#ifndef __BIONIC__
FileArgs->AddString(Arg,ArgW);
+#else
+ FileArgs->AddString(Arg);
+#endif
else
{
FindData FileData;
+#ifndef __BIONIC__
bool Found=FindFile::FastFind(Arg,ArgW,&FileData);
+#else
+ bool Found=FindFile::FastFind(Arg,&FileData);
+#endif
if ((!Found || ListMode==RCLM_ACCEPT_LISTS) &&
+#ifndef __BIONIC__
ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg,ArgW))
+#else
+ ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg))
+#endif
{
FileLists=true;
@@ -213,8 +254,12 @@ void CommandData::ParseArg(char *Arg,wchar *ArgW)
Charset=RCH_OEM;
#endif
+#ifndef __BIONIC__
wchar *WideArgName=(ArgW!=NULL && *ArgW!=0 ? ArgW+1:NULL);
ReadTextFile(Arg+1,WideArgName,FileArgs,false,true,Charset,true,true,true);
+#else
+ ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true,true);
+#endif
}
else
@@ -222,14 +267,20 @@ void CommandData::ParseArg(char *Arg,wchar *ArgW)
{
strncpyz(ExtrPath,Arg,ASIZE(ExtrPath)-1);
AddEndSlash(ExtrPath);
+#ifndef __BIONIC__
if (ArgW!=NULL)
{
wcsncpyz(ExtrPathW,ArgW,ASIZE(ExtrPathW)-1);
AddEndSlash(ExtrPathW);
}
+#endif
}
else
+#ifndef __BIONIC__
FileArgs->AddString(Arg,ArgW);
+#else
+ FileArgs->AddString(Arg);
+#endif
}
}
}
@@ -297,7 +348,11 @@ bool CommandData::PreprocessSwitch(const char *Switch)
void CommandData::ReadConfig()
{
StringList List;
+#ifndef __BIONIC__
if (ReadTextFile(DefConfigName,NULL,&List,true))
+#else
+ if (ReadTextFile(DefConfigName,&List,true))
+#endif
{
char *Str;
while ((Str=List.GetString())!=NULL)
@@ -335,10 +390,17 @@ void CommandData::ProcessSwitchesString(char *Str)
#if !defined(SFX_MODULE)
+#ifndef __BIONIC__
void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
+#else
+void CommandData::ProcessSwitch(const char *Switch)
+#endif
{
-
+#ifndef __BIONIC__
bool WidePresent=SwitchW!=NULL && *SwitchW!=0; // If 'true', SwitchW is not empty.
+#else
+ bool WidePresent=false;
+#endif
switch(etoupper(Switch[0]))
{
@@ -494,8 +556,10 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
break;
case 'P':
strcpy(ArcPath,Switch+2);
+#ifndef __BIONIC__
if (WidePresent)
wcscpy(ArcPathW,SwitchW+2);
+#endif
break;
case 'S':
SyncFiles=true;
@@ -608,7 +672,11 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
Charset=RCH_OEM;
#endif
+#ifndef __BIONIC__
ReadTextFile(Switch+2,NULL,Args,false,true,Charset,true,true,true);
+#else
+ ReadTextFile(Switch+2,Args,false,true,Charset,true,true,true);
+#endif
}
else
Args->AddString(Switch+1);
@@ -654,13 +722,22 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
case 'P':
if (Switch[1]==0)
{
+#ifndef __BIONIC__
GetPassword(PASSWORD_GLOBAL,NULL,NULL,&Password);
+#else
+ GetPassword(PASSWORD_GLOBAL,NULL,&Password);
+#endif
eprintf("\n");
}
else
{
+#ifndef __BIONIC__
wchar PlainPsw[MAXPASSWORD];
CharToWide(Switch+1,PlainPsw,ASIZE(PlainPsw));
+#else
+ char PlainPsw[MAXPASSWORD];
+ strncpyz(PlainPsw,Switch+1,ASIZE(PlainPsw));
+#endif
PlainPsw[ASIZE(PlainPsw)-1]=0;
Password.Set(PlainPsw);
cleandata(PlainPsw,ASIZE(PlainPsw));
@@ -672,8 +749,13 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
EncryptHeaders=true;
if (Switch[2]!=0)
{
+#ifndef __BIONIC__
wchar PlainPsw[MAXPASSWORD];
CharToWide(Switch+2,PlainPsw,ASIZE(PlainPsw));
+#else
+ char PlainPsw[MAXPASSWORD];
+ strncpyz(PlainPsw,Switch+1,ASIZE(PlainPsw));
+#endif
PlainPsw[ASIZE(PlainPsw)-1]=0;
Password.Set(PlainPsw);
cleandata(PlainPsw,ASIZE(PlainPsw));
@@ -681,13 +763,21 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
else
if (!Password.IsSet())
{
+#ifndef __BIONIC__
GetPassword(PASSWORD_GLOBAL,NULL,NULL,&Password);
+#else
+ GetPassword(PASSWORD_GLOBAL,NULL,&Password);
+#endif
eprintf("\n");
}
}
break;
case 'Z':
+#ifndef __BIONIC__
if (Switch[1]==0 && (!WidePresent || SwitchW[1]==0))
+#else
+ if (Switch[1]==0)
+#endif
{
#ifndef GUI // stdin is not supported by WinRAR.
// If comment file is not specified, we read data from stdin.
@@ -697,8 +787,10 @@ void CommandData::ProcessSwitch(const char *Switch,const wchar *SwitchW)
else
{
strncpyz(CommentFile,Switch+1,ASIZE(CommentFile));
+#ifndef __BIONIC__
if (WidePresent)
wcsncpyz(CommentFileW,SwitchW+1,ASIZE(CommentFileW));
+#endif
}
break;
case 'M':
@@ -1231,7 +1323,11 @@ bool CommandData::SizeCheck(int64 Size)
int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType)
{
+#ifndef __BIONIC__
if (strlen(NewLhd.FileName)>=NM || wcslen(NewLhd.FileNameW)>=NM)
+#else
+ if (strlen(NewLhd.FileName)>=NM)
+#endif
return(0);
bool Dir=(NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY;
if (ExclCheck(NewLhd.FileName,Dir,false,true))
@@ -1247,9 +1343,14 @@ int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType
char *ArgName;
wchar *ArgNameW;
FileArgs->Rewind();
+#ifndef __BIONIC__
for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++)
+#else
+ for (int StringCount=1;FileArgs->GetString(&ArgName);StringCount++)
+#endif
{
#ifndef SFX_MODULE
+#ifndef __BIONIC__
bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL && *ArgNameW!=0;
if (Unicode)
{
@@ -1277,6 +1378,7 @@ int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType
continue;
}
#endif
+#endif
if (CmpName(ArgName,NewLhd.FileName,MatchType))
{
if (ExactMatch!=NULL)
@@ -1308,17 +1410,29 @@ void CommandData::ProcessCommand()
if (strchr("AFUMD",*Command)==NULL)
{
if (GenerateArcName)
+#ifndef __BIONIC__
GenerateArchiveName(ArcName,ArcNameW,ASIZE(ArcName),GenerateMask,false);
+#else
+ GenerateArchiveName(ArcName,ASIZE(ArcName),GenerateMask,false);
+#endif
StringList ArcMasks;
ArcMasks.AddString(ArcName);
ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS);
FindData FindData;
while (Scan.GetNext(&FindData)==SCAN_SUCCESS)
+#ifndef __BIONIC__
AddArcName(FindData.Name,FindData.NameW);
+#else
+ AddArcName(FindData.Name);
+#endif
}
else
+#ifndef __BIONIC__
AddArcName(ArcName,NULL);
+#else
+ AddArcName(ArcName);
+#endif
#endif
switch(Command[0])
@@ -1348,15 +1462,30 @@ void CommandData::ProcessCommand()
#endif
+#ifndef __BIONIC__
void CommandData::AddArcName(const char *Name,const wchar *NameW)
+#else
+void CommandData::AddArcName(const char *Name)
+#endif
{
+#ifndef __BIONIC__
ArcNames->AddString(Name,NameW);
+#else
+ ArcNames->AddString(Name);
+#endif
}
-
+#ifndef __BIONIC__
bool CommandData::GetArcName(char *Name,wchar *NameW,int MaxSize)
+#else
+bool CommandData::GetArcName(char *Name,int MaxSize)
+#endif
{
+#ifndef __BIONIC__
if (!ArcNames->GetString(Name,NameW,NM))
+#else
+ if (!ArcNames->GetString(Name,NM))
+#endif
return(false);
return(true);
}
diff --git a/src/cmddata.hpp b/src/cmddata.hpp
index aef6deb..dabf214 100644
--- a/src/cmddata.hpp
+++ b/src/cmddata.hpp
@@ -10,7 +10,11 @@ class CommandData:public RAROptions
{
private:
void ProcessSwitchesString(char *Str);
+#ifndef __BIONIC__
void ProcessSwitch(const char *Switch,const wchar *SwitchW=NULL);
+#else
+ void ProcessSwitch(const char *Switch);
+#endif
void BadSwitch(const char *Switch);
bool ExclCheckArgs(StringList *Args,bool Dir,char *CheckName,bool CheckFullPath,int MatchMode);
uint GetExclAttr(const char *Str);
@@ -27,7 +31,11 @@ class CommandData:public RAROptions
void PreprocessCommandLine(int argc, char *argv[]);
void ParseCommandLine(int argc, char *argv[]);
+#ifndef __BIONIC__
void ParseArg(char *Arg,wchar *ArgW);
+#else
+ void ParseArg(char *Arg);
+#endif
void ParseDone();
void ParseEnvVar();
void ReadConfig();
@@ -42,17 +50,26 @@ class CommandData:public RAROptions
bool AnyFiltersActive();
int IsProcessFile(FileHeader &NewLhd,bool *ExactMatch=NULL,int MatchType=MATCH_WILDSUBPATH);
void ProcessCommand();
+#ifndef __BIONIC__
void AddArcName(const char *Name,const wchar *NameW);
bool GetArcName(char *Name,wchar *NameW,int MaxSize);
+#else
+ void AddArcName(const char *Name);
+ bool GetArcName(char *Name,int MaxSize);
+#endif
bool CheckWinSize();
int GetRecoverySize(const char *Str,int DefSize);
char Command[NM+16];
+#ifndef __BIONIC__
wchar CommandW[NM+16];
+#endif
char ArcName[NM];
+#ifndef __BIONIC__
wchar ArcNameW[NM];
+#endif
StringList *FileArgs;
StringList *ExclArgs;
diff --git a/src/consio.cpp b/src/consio.cpp
index 42b72a6..b70fb8e 100644
--- a/src/consio.cpp
+++ b/src/consio.cpp
@@ -4,6 +4,10 @@
#include "log.cpp"
#endif
+#ifdef __BIONIC__
+#include <termios.h>
+#endif
+
static int KbdAnsi(char *Addr,int Size);
#if !defined(GUI) && !defined(SILENT)
@@ -121,7 +125,11 @@ void Alarm()
#ifndef SILENT
#ifndef GUI
+#ifndef __BIONIC__
void GetPasswordText(wchar *Str,uint MaxLength)
+#else
+void GetPasswordText(char *Str,uint MaxLength)
+#endif
{
if (MaxLength==0)
return;
@@ -146,19 +154,60 @@ void GetPasswordText(wchar *Str,uint MaxLength)
#else
strncpyz(StrA,getpass(""),ASIZE(StrA));
#endif
+
+#ifndef __BIONIC__
CharToWide(StrA,Str,MaxLength);
+#else
+ strncpyz(Str,StrA,MaxLength);
+#endif
cleandata(StrA,sizeof(StrA));
+
#endif
Str[MaxLength-1]=0;
RemoveLF(Str);
}
+
+#if !defined(_EMX) && !defined(_BEOS) && !defined(__sparc) && !defined(sparc) && !defined (__VMS)
+#ifdef __BIONIC__
+const char *getpass(const char *prompt) {
+ struct termios oflags, nflags;
+ static char password[64];
+
+ // disabling echo
+ tcgetattr(fileno(stdin), &oflags);
+ nflags = oflags;
+ nflags.c_lflag &= ~ECHO;
+ nflags.c_lflag |= ECHONL;
+
+ if (tcsetattr(fileno(stdin), TCSANOW, &nflags) != 0) {
+ return "\0";
+ }
+
+ mprintf("%s", prompt);
+ fgets(password, sizeof(password), stdin);
+ password[strlen(password) - 1] = 0;
+
+ // restore terminal
+ if (tcsetattr(fileno(stdin), TCSANOW, &oflags) != 0) {
+ return "\0";
+ }
+
+ return password;
+}
+#endif
+#endif
+
#endif
#endif
#ifndef SILENT
+#ifndef __BIONIC__
bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,
SecPassword *Password)
+#else
+bool GetPassword(PASSWORD_TYPE Type,const char *FileName, SecPassword *Password)
+#endif
{
Alarm();
while (true)
@@ -177,17 +226,28 @@ bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,
strcat(PromptStr,NameOnly);
}
eprintf("\n%s: ",PromptStr);
-
+#ifndef __BIONIC__
wchar PlainPsw[MAXPASSWORD];
+#else
+ char PlainPsw[MAXPASSWORD];
+#endif
GetPasswordText(PlainPsw,ASIZE(PlainPsw));
if (*PlainPsw==0 && Type==PASSWORD_GLOBAL)
return(false);
if (Type==PASSWORD_GLOBAL)
{
eprintf(St(MReAskPsw));
+#ifndef __BIONIC__
wchar CmpStr[MAXPASSWORD];
+#else
+ char CmpStr[MAXPASSWORD];
+#endif
GetPasswordText(CmpStr,ASIZE(CmpStr));
+#ifndef __BIONIC__
if (*CmpStr==0 || wcscmp(PlainPsw,CmpStr)!=0)
+#else
+ if (*CmpStr==0 || strcmp(PlainPsw,CmpStr)!=0)
+#endif
{
eprintf(St(MNotMatchPsw));
cleandata(PlainPsw,sizeof(PlainPsw));
diff --git a/src/consio.hpp b/src/consio.hpp
index 45489c3..0e1346e 100644
--- a/src/consio.hpp
+++ b/src/consio.hpp
@@ -13,9 +13,17 @@ void InitConsoleOptions(MESSAGE_TYPE MsgStream,bool Sound);
void mprintf(const char *fmt,...);
void eprintf(const char *fmt,...);
void Alarm();
+#ifndef __BIONIC__
void GetPasswordText(wchar *Str,uint MaxLength);
bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,SecPassword *Password);
+#else
+ void GetPasswordText(char *Str,uint MaxLength);
+ bool GetPassword(PASSWORD_TYPE Type,const char *FileName,SecPassword *Password);
+#endif
int Ask(const char *AskStr);
+#ifdef __BIONIC__
+ const char *getpass(const char *prompt);
+#endif
#endif
void OutComment(char *Comment,size_t Size);
@@ -29,8 +37,13 @@ void OutComment(char *Comment,size_t Size);
inline void eprintf(const char *fmt,...) {}
#endif
inline void Alarm() {}
+#ifndef __BIONIC__
inline void GetPasswordText(wchar *Str,uint MaxLength) {}
inline bool GetPassword(PASSWORD_TYPE Type,const char *FileName,const wchar *FileNameW,SecPassword *Password) {return(false);}
+#else
+ inline void GetPasswordText(char *Str,uint MaxLength) {}
+ inline bool GetPassword(PASSWORD_TYPE Type,const char *FileName,SecPassword *Password) {return(false);}
+#endif
inline int Ask(const char *AskStr) {return(0);}
#endif
diff --git a/src/crypt.cpp b/src/crypt.cpp
index 5cc5aef..c844fd7 100644
--- a/src/crypt.cpp
+++ b/src/crypt.cpp
@@ -189,7 +189,11 @@ void CryptData::SetCryptKeys(SecPassword *Password,const byte *Salt,bool Encrypt
{
if (!Password->IsSet())
return;
+#ifndef __BIONIC__
wchar PlainPsw[MAXPASSWORD];
+#else
+ char PlainPsw[MAXPASSWORD];
+#endif
Password->Get(PlainPsw,ASIZE(PlainPsw));
if (OldOnly)
{
@@ -200,7 +204,11 @@ void CryptData::SetCryptKeys(SecPassword *Password,const byte *Salt,bool Encrypt
memset(Psw,0,sizeof(Psw));
// We need to use ASCII password for older encryption algorithms.
+#ifndef __BIONIC__
WideToChar(PlainPsw,Psw,ASIZE(Psw));
+#else
+ strncpyz(Psw,PlainPsw,ASIZE(Psw));
+#endif
Psw[ASIZE(Psw)-1]=0;
size_t PswLength=strlen(Psw);
@@ -243,9 +251,15 @@ void CryptData::SetCryptKeys(SecPassword *Password,const byte *Salt,bool Encrypt
if (!Cached)
{
+#ifndef __BIONIC__
byte RawPsw[2*MAXPASSWORD+SALT_SIZE];
WideToRaw(PlainPsw,RawPsw);
size_t RawLength=2*wcslen(PlainPsw);
+#else
+ byte RawPsw[MAXPASSWORD+SALT_SIZE];
+ strncpyz((char*)RawPsw,PlainPsw,ASIZE((char*)RawPsw));
+ size_t RawLength=strlen(PlainPsw);
+#endif
if (Salt!=NULL)
{
memcpy(RawPsw+RawLength,Salt,SALT_SIZE);
diff --git a/src/crypt.hpp b/src/crypt.hpp
index 96b8a27..2c97d71 100644
--- a/src/crypt.hpp
+++ b/src/crypt.hpp
@@ -9,7 +9,11 @@ struct CryptKeyCacheItem
#ifndef _SFX_RTL_
CryptKeyCacheItem()
{
+#ifndef __BIONIC__
Password.Set(L"");
+#else
+ Password.Set("");
+#endif
}
~CryptKeyCacheItem()
diff --git a/src/errhnd.cpp b/src/errhnd.cpp
index 9323518..8de7f74 100644
--- a/src/errhnd.cpp
+++ b/src/errhnd.cpp
@@ -25,8 +25,11 @@ void ErrorHandler::MemoryError()
Throw(RARX_MEMORY);
}
-
+#ifndef __BIONIC__
void ErrorHandler::OpenError(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::OpenError(const char *FileName)
+#endif
{
#ifndef SILENT
OpenErrorMsg(FileName);
@@ -34,8 +37,11 @@ void ErrorHandler::OpenError(const char *FileName,const wchar *FileNameW)
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::CloseError(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::CloseError(const char *FileName)
+#endif
{
#ifndef SILENT
if (!UserBreak)
@@ -49,19 +55,29 @@ void ErrorHandler::CloseError(const char *FileName,const wchar *FileNameW)
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::ReadError(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::ReadError(const char *FileName)
+#endif
{
#ifndef SILENT
+#ifndef __BIONIC__
ReadErrorMsg(NULL,NULL,FileName,FileNameW);
+#else
+ ReadErrorMsg(NULL,FileName);
+#endif
#endif
#if !defined(SILENT) || defined(RARDLL)
Throw(RARX_FATAL);
#endif
}
-
+#ifndef __BIONIC__
bool ErrorHandler::AskRepeatRead(const char *FileName,const wchar *FileNameW)
+#else
+bool ErrorHandler::AskRepeatRead(const char *FileName)
+#endif
{
#if !defined(SILENT) && !defined(SFX_MODULE) && !defined(_WIN_CE)
if (!Silent)
@@ -75,11 +91,18 @@ bool ErrorHandler::AskRepeatRead(const char *FileName,const wchar *FileNameW)
return(false);
}
-
+#ifndef __BIONIC__
void ErrorHandler::WriteError(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::WriteError(const char *ArcName,const char *FileName)
+#endif
{
#ifndef SILENT
+#ifndef __BIONIC__
WriteErrorMsg(ArcName,ArcNameW,FileName,FileNameW);
+#else
+ WriteErrorMsg(ArcName,FileName);
+#endif
#endif
#if !defined(SILENT) || defined(RARDLL)
Throw(RARX_WRITE);
@@ -100,8 +123,11 @@ void ErrorHandler::WriteErrorFAT(const char *FileName,const wchar *FileNameW)
}
#endif
-
+#ifndef __BIONIC__
bool ErrorHandler::AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull)
+#else
+bool ErrorHandler::AskRepeatWrite(const char *FileName,bool DiskFull)
+#endif
{
#if !defined(SILENT) && !defined(_WIN_CE)
if (!Silent)
@@ -115,8 +141,11 @@ bool ErrorHandler::AskRepeatWrite(const char *FileName,const wchar *FileNameW,bo
return(false);
}
-
+#ifndef __BIONIC__
void ErrorHandler::SeekError(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::SeekError(const char *FileName)
+#endif
{
#ifndef SILENT
if (!UserBreak)
@@ -147,14 +176,20 @@ void ErrorHandler::MemoryErrorMsg()
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::OpenErrorMsg(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::OpenErrorMsg(const char *FileName)
+#endif
{
- OpenErrorMsg(NULL,NULL,FileName,FileNameW);
+ OpenErrorMsg(NULL,FileName);
}
-
+#ifndef __BIONIC__
void ErrorHandler::OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::OpenErrorMsg(const char *ArcName,const char *FileName)
+#endif
{
#ifndef SILENT
if (FileName!=NULL)
@@ -164,14 +199,24 @@ void ErrorHandler::OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::CreateErrorMsg(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::CreateErrorMsg(const char *FileName)
+#endif
{
+#ifndef __BIONIC__
CreateErrorMsg(NULL,NULL,FileName,FileNameW);
+#else
+ CreateErrorMsg(NULL,FileName);
+#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::CreateErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::CreateErrorMsg(const char *ArcName,const char *FileName)
+#endif
{
#ifndef SILENT
if (FileName!=NULL)
@@ -188,7 +233,11 @@ void ErrorHandler::CreateErrorMsg(const char *ArcName,const wchar *ArcNameW,cons
// Check the path length and display the error message if it is too long.
+#ifndef __BIONIC__
void ErrorHandler::CheckLongPathErrMsg(const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::CheckLongPathErrMsg(const char *FileName)
+#endif
{
#if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined (SILENT) && defined(MAX_PATH)
if (GetLastError()==ERROR_PATH_NOT_FOUND)
@@ -210,8 +259,11 @@ void ErrorHandler::CheckLongPathErrMsg(const char *FileName,const wchar *FileNam
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::ReadErrorMsg(const char *ArcName,const char *FileName)
+#endif
{
#ifndef SILENT
ErrMsg(ArcName,St(MErrRead),FileName);
@@ -219,8 +271,11 @@ void ErrorHandler::ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const
#endif
}
-
+#ifndef __BIONIC__
void ErrorHandler::WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
+#else
+void ErrorHandler::WriteErrorMsg(const char *ArcName,const char *FileName)
+#endif
{
#ifndef SILENT
ErrMsg(ArcName,St(MErrWrite),FileName);
diff --git a/src/errhnd.hpp b/src/errhnd.hpp
index ab84e0b..e80bf0a 100644
--- a/src/errhnd.hpp
+++ b/src/errhnd.hpp
@@ -2,8 +2,10 @@
#define _RAR_ERRHANDLER_
#ifndef SFX_MODULE
+#ifndef __BIONIC__
#define ALLOW_EXCEPTIONS
#endif
+#endif
enum RAR_EXIT // RAR exit code.
{
@@ -35,6 +37,7 @@ class ErrorHandler
ErrorHandler();
void Clean();
void MemoryError();
+#ifndef __BIONIC__
void OpenError(const char *FileName,const wchar *FileNameW);
void CloseError(const char *FileName,const wchar *FileNameW);
void ReadError(const char *FileName,const wchar *FileNameW);
@@ -43,8 +46,19 @@ class ErrorHandler
void WriteErrorFAT(const char *FileName,const wchar *FileNameW);
bool AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull);
void SeekError(const char *FileName,const wchar *FileNameW);
+#else
+ void OpenError(const char *FileName);
+ void CloseError(const char *FileName);
+ void ReadError(const char *FileName);
+ bool AskRepeatRead(const char *FileName);
+ void WriteError(const char *ArcName,const char *FileName);
+ void WriteErrorFAT(const char *FileName);
+ bool AskRepeatWrite(const char *FileName,bool DiskFull);
+ void SeekError(const char *FileName);
+#endif
void GeneralErrMsg(const char *Msg);
void MemoryErrorMsg();
+#ifndef __BIONIC__
void OpenErrorMsg(const char *FileName,const wchar *FileNameW=NULL);
void OpenErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
void CreateErrorMsg(const char *FileName,const wchar *FileNameW=NULL);
@@ -52,6 +66,15 @@ class ErrorHandler
void CheckLongPathErrMsg(const char *FileName,const wchar *FileNameW);
void ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
void WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW);
+#else
+ void OpenErrorMsg(const char *FileName);
+ void OpenErrorMsg(const char *ArcName,const char *FileName);
+ void CreateErrorMsg(const char *FileName);
+ void CreateErrorMsg(const char *ArcName,const char *FileName);
+ void CheckLongPathErrMsg(const char *FileName);
+ void ReadErrorMsg(const char *ArcName,const char *FileName);
+ void WriteErrorMsg(const char *ArcName,const char *FileName);
+#endif
void Exit(RAR_EXIT ExitCode);
void SetErrorCode(RAR_EXIT Code);
RAR_EXIT GetErrorCode() {return(ExitCode);}
diff --git a/src/extinfo.cpp b/src/extinfo.cpp
index 538f6a7..fc2350f 100644
--- a/src/extinfo.cpp
+++ b/src/extinfo.cpp
@@ -17,7 +17,11 @@
#ifndef SFX_MODULE
+#ifndef __BIONIC__
void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
+#else
+void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name)
+#endif
{
switch(Arc.SubBlockHead.SubType)
{
@@ -52,8 +56,11 @@ void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
}
#endif
-
+#ifndef __BIONIC__
void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW)
+#else
+void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name)
+#endif
{
#if defined(_EMX) && !defined(_DJGPP)
if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_OS2EA))
diff --git a/src/extinfo.hpp b/src/extinfo.hpp
index db7cea5..5a4f915 100644
--- a/src/extinfo.hpp
+++ b/src/extinfo.hpp
@@ -1,8 +1,12 @@
#ifndef _RAR_EXTINFO_
#define _RAR_EXTINFO_
-
+#ifndef __BIONIC__
void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW);
+#else
+void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name);
+void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name);
+#endif
#endif
diff --git a/src/extract.cpp b/src/extract.cpp
index ddd71a0..d4733f7 100644
--- a/src/extract.cpp
+++ b/src/extract.cpp
@@ -3,13 +3,21 @@
CmdExtract::CmdExtract()
{
*ArcName=0;
+#ifndef __BIONIC__
*ArcNameW=0;
+#endif
*DestFileName=0;
+#ifndef __BIONIC__
*DestFileNameW=0;
+#endif
TotalFileCount=0;
+#ifndef __BIONIC__
Password.Set(L"");
+#else
+ Password.Set("");
+#endif
Unp=new Unpack(&DataIO);
Unp->Init();
}
@@ -27,12 +35,21 @@ void CmdExtract::DoExtract(CommandData *Cmd)
DataIO.SetCurrentCommand(*Cmd->Command);
FindData FD;
+#ifndef __BIONIC__
while (Cmd->GetArcName(ArcName,ArcNameW,ASIZE(ArcName)))
if (FindFile::FastFind(ArcName,ArcNameW,&FD))
+#else
+ while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
+ if (FindFile::FastFind(ArcName,&FD))
+#endif
DataIO.TotalArcSize+=FD.Size;
Cmd->ArcNames->Rewind();
+#ifndef __BIONIC__
while (Cmd->GetArcName(ArcName,ArcNameW,ASIZE(ArcName)))
+#else
+ while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
+#endif
{
while (true)
{
@@ -48,7 +65,11 @@ void CmdExtract::DoExtract(CommandData *Cmd)
if (Code!=EXTRACT_ARC_REPEAT)
break;
}
+#ifndef __BIONIC__
if (FindFile::FastFind(ArcName,ArcNameW,&FD))
+#else
+ if (FindFile::FastFind(ArcName,&FD))
+#endif
DataIO.ProcessedArcSize+=FD.Size;
}
@@ -103,7 +124,11 @@ void CmdExtract::ExtractArchiveInit(CommandData *Cmd,Archive &Arc)
EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd)
{
Archive Arc(Cmd);
+#ifndef __BIONIC__
if (!Arc.WOpen(ArcName,ArcNameW))
+#else
+ if (!Arc.WOpen(ArcName))
+#endif
{
ErrHandler.SetErrorCode(RARX_OPEN);
return(EXTRACT_ARC_NEXT);
@@ -133,7 +158,11 @@ EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd)
// and current volume is not first in set and first volume is present
// and specified too, let's skip the current volume.
if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
+#ifndef __BIONIC__
Cmd->ArcNames->Search(FirstVolName,NULL,false))
+#else
+ Cmd->ArcNames->Search(FirstVolName,false))
+#endif
return(EXTRACT_ARC_NEXT);
}
#endif
@@ -149,16 +178,26 @@ EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd)
wchar NextNameW[NM];
strcpy(NextName,Arc.FileName);
+#ifndef __BIONIC__
wcscpy(NextNameW,Arc.FileNameW);
+#endif
while (true)
{
// First volume is already added to DataIO.TotalArcSize
// in initial TotalArcSize calculation in DoExtract.
// So we skip it and start from second volume.
+#ifndef __BIONIC__
NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+#else
+ NextVolumeName(NextName,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+#endif
struct FindData FD;
+#ifndef __BIONIC__
if (FindFile::FastFind(NextName,NextNameW,&FD))
+#else
+ if (FindFile::FastFind(NextName,&FD))
+#endif
VolumeSetSize+=FD.Size;
else
break;
@@ -202,8 +241,13 @@ EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd)
// of current volume and all volumes after it and add the size
// of new (first) volume.
FindData OldArc,NewArc;
+#ifndef __BIONIC__
if (FindFile::FastFind(Arc.FileName,Arc.FileNameW,&OldArc) &&
FindFile::FastFind(ArcName,ArcNameW,&NewArc))
+#else
+ if (FindFile::FastFind(Arc.FileName,&OldArc) &&
+ FindFile::FastFind(ArcName,&NewArc))
+#endif
DataIO.TotalArcSize-=VolumeSetSize+OldArc.Size-NewArc.Size;
return(EXTRACT_ARC_REPEAT);
}
@@ -241,7 +285,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
SignatureFound=true;
#if !defined(SFX_MODULE) && !defined(_WIN_CE)
if (HeadType==SUB_HEAD && PrevExtracted)
+#ifndef __BIONIC__
SetExtraInfo(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL);
+#else
+ SetExtraInfo(Cmd,Arc,DestFileName);
+#endif
#endif
if (HeadType==NEWSUB_HEAD)
{
@@ -249,7 +297,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
SignatureFound=true;
#if !defined(NOSUBBLOCKS) && !defined(_WIN_CE)
if (PrevExtracted)
+#ifndef __BIONIC__
SetExtraInfoNew(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL);
+#else
+ SetExtraInfoNew(Cmd,Arc,DestFileName);
+#endif
#endif
}
if (HeadType==ENDARC_HEAD)
@@ -297,7 +349,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
if (ExactMatch)
{
Cmd->FileArgs->Rewind();
+#ifndef __BIONIC__
if (Cmd->FileArgs->GetString(Cmd->ArcPath,NULL,sizeof(Cmd->ArcPath),MatchNumber-1))
+#else
+ if (Cmd->FileArgs->GetString(Cmd->ArcPath,sizeof(Cmd->ArcPath),MatchNumber-1))
+#endif
*PointToName(Cmd->ArcPath)=0;
}
}
@@ -305,12 +361,17 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
if (ExactMatch && !EqualNames)
AllMatchesExact=false;
+#ifndef __BIONIC__
#ifdef UNICODE_SUPPORTED
bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled();
#else
bool WideName=false;
#endif
+#else
+ bool WideName=false;
+#endif
+#ifndef __BIONIC__
#ifdef _APPLE
if (WideName)
{
@@ -335,6 +396,7 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
strcpy(ArcFileName,Name);
}
#endif
+#endif
ConvertPath(ArcFileName,ArcFileName);
@@ -347,9 +409,17 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
{
if (Cmd->VersionControl==0)
ExactMatch=false;
+#ifndef __BIONIC__
int Version=ParseVersionFileName(ArcFileName,ArcFileNameW,false);
+#else
+ int Version=ParseVersionFileName(ArcFileName,false);
+#endif
if (Cmd->VersionControl-1==Version)
+#ifndef __BIONIC__
ParseVersionFileName(ArcFileName,ArcFileNameW,true);
+#else
+ ParseVersionFileName(ArcFileName,true);
+#endif
else
ExactMatch=false;
}
@@ -368,10 +438,16 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
bool NewNumbering=(Arc.NewMhd.Flags & MHD_NEWNUMBERING)!=0;
VolNameToFirstName(ArcName,ArcName,NewNumbering);
+#ifndef __BIONIC__
if (*ArcNameW!=0)
VolNameToFirstName(ArcNameW,ArcNameW,NewNumbering);
+#endif
+#ifndef __BIONIC__
if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName,ArcNameW))
+#else
+ if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName))
+#endif
{
// If first volume name does not match the current name and if
// such volume name really exists, let's unpack from this first volume.
@@ -384,7 +460,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
ReconstructDone=true;
RecVolumes RecVol;
+#ifndef __BIONIC__
if (RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true))
+#else
+ if (RecVol.Restore(Cmd,Arc.FileName,true))
+#endif
{
Repeat=true;
return(false);
@@ -455,7 +535,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
Password=Cmd->Password;
#else
+#ifndef __BIONIC__
if (!GetPassword(PASSWORD_FILE,ArcFileName,ArcFileNameW,&Password))
+#else
+ if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
+#endif
{
PasswordCancelled=true;
return(false);
@@ -472,7 +556,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
case -1:
ErrHandler.Exit(RARX_USERBREAK);
case 2:
+#ifndef __BIONIC__
if (!GetPassword(PASSWORD_FILE,ArcFileName,ArcFileNameW,&Password))
+#else
+ if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
+#endif
{
return(false);
}
@@ -485,10 +573,12 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
#endif
#ifndef SFX_MODULE
+#ifndef __BIONIC__
if (*Cmd->ExtrPath==0 && *Cmd->ExtrPathW!=0)
WideToChar(Cmd->ExtrPathW,DestFileName);
else
#endif
+#endif
strcpy(DestFileName,Cmd->ExtrPath);
@@ -548,6 +638,7 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
}
}
+#ifndef __BIONIC__
#ifndef SFX_MODULE
if (!WideName && *Cmd->ExtrPathW!=0)
{
@@ -603,13 +694,18 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
}
else
*DestFileNameW=0;
+#endif
ExtrFile=!SkipSolid && !EmptyName && (Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0;
if ((Cmd->FreshFiles || Cmd->UpdateFiles) && (Command=='E' || Command=='X'))
{
struct FindData FD;
+#ifndef __BIONIC__
if (FindFile::FastFind(DestFileName,DestNameW,&FD))
+#else
+ if (FindFile::FastFind(DestFileName,&FD))
+#endif
{
if (FD.mtime >= Arc.NewLhd.mtime)
{
@@ -698,23 +794,41 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
#endif
return(true);
}
+#ifndef __BIONIC__
MKDIR_CODE MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
+#else
+ MKDIR_CODE MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
+#endif
bool DirExist=false;
if (MDCode!=MKDIR_SUCCESS)
{
+#ifndef __BIONIC__
DirExist=FileExist(DestFileName,DestNameW);
if (DirExist && !IsDir(GetFileAttr(DestFileName,DestNameW)))
+#else
+ DirExist=FileExist(DestFileName);
+ if (DirExist && !IsDir(GetFileAttr(DestFileName)))
+#endif
{
// File with name same as this directory exists. Propose user
// to overwrite it.
bool UserReject;
+#ifndef __BIONIC__
FileCreate(Cmd,NULL,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime);
+#else
+ FileCreate(Cmd,NULL,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime);
+#endif
DirExist=false;
}
if (!DirExist)
{
+#ifndef __BIONIC__
CreatePath(DestFileName,DestNameW,true);
MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
+#else
+ CreatePath(DestFileName,true);
+ MDCode=MakeDir(DestFileName,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr);
+#endif
}
}
if (MDCode==MKDIR_SUCCESS)
@@ -729,13 +843,21 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
if (DirExist)
{
if (!Cmd->IgnoreGeneralAttr)
+#ifndef __BIONIC__
SetFileAttr(DestFileName,DestNameW,Arc.NewLhd.FileAttr);
+#else
+ SetFileAttr(DestFileName,Arc.NewLhd.FileAttr);
+#endif
PrevExtracted=true;
}
else
{
Log(Arc.FileName,St(MExtrErrMkDir),DestFileName);
+#ifndef __BIONIC__
ErrHandler.CheckLongPathErrMsg(DestFileName,DestNameW);
+#else
+ ErrHandler.CheckLongPathErrMsg(DestFileName);
+#endif
ErrHandler.SysErrMsg();
#ifdef RARDLL
Cmd->DllError=ERAR_ECREATE;
@@ -749,10 +871,17 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
(Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT())
SetFileCompression(DestFileName,DestNameW,true);
#endif
+#ifndef __BIONIC__
SetDirTime(DestFileName,DestNameW,
Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
+#else
+ SetDirTime(DestFileName,
+ Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
+ Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
+ Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
+#endif
}
return(true);
}
@@ -769,31 +898,54 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
bool UserReject;
// Specify "write only" mode to avoid OpenIndiana NAS problems
// with SetFileTime and read+write files.
+#ifndef __BIONIC__
if (!FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
+#else
+ if (!FileCreate(Cmd,&CurFile,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
+#endif
{
ExtrFile=false;
if (!UserReject)
{
+#ifndef __BIONIC__
ErrHandler.CreateErrorMsg(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
+#else
+ ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
+#endif
ErrHandler.SetErrorCode(RARX_CREATE);
#ifdef RARDLL
Cmd->DllError=ERAR_ECREATE;
#endif
+#ifndef __BIONIC__
if (!IsNameUsable(DestFileName) && (!WideName || !IsNameUsable(DestNameW)))
+#else
+ if (!IsNameUsable(DestFileName))
+#endif
{
Log(Arc.FileName,St(MCorrectingName));
char OrigName[ASIZE(DestFileName)];
+#ifndef __BIONIC__
wchar OrigNameW[ASIZE(DestFileNameW)];
+#endif
strncpyz(OrigName,DestFileName,ASIZE(OrigName));
+#ifndef __BIONIC__
wcsncpyz(OrigNameW,NullToEmpty(DestNameW),ASIZE(OrigNameW));
+#endif
MakeNameUsable(DestFileName,true);
+#ifndef __BIONIC__
if (WideName)
MakeNameUsable(DestNameW,true);
+#endif
+#ifndef __BIONIC__
CreatePath(DestFileName,DestNameW,true);
if (FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
+#else
+ CreatePath(DestFileName,true);
+ if (FileCreate(Cmd,&CurFile,DestFileName,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime,true))
+#endif
{
#ifndef SFX_MODULE
Log(Arc.FileName,St(MRenaming),OrigName,DestFileName);
@@ -801,7 +953,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
ExtrFile=true;
}
else
+#ifndef __BIONIC__
ErrHandler.CreateErrorMsg(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
+#else
+ ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
+#endif
}
}
}
@@ -823,7 +979,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
if (!TestMode && Command!='P' && CurFile.IsDevice())
{
Log(Arc.FileName,St(MInvalidName),DestFileName);
+#ifndef __BIONIC__
ErrHandler.WriteError(Arc.FileName,Arc.FileNameW,DestFileName,DestFileNameW);
+#else
+ ErrHandler.WriteError(Arc.FileName,DestFileName);
+#endif
}
TotalFileCount++;
}
@@ -989,7 +1149,11 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS
Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
if (!Cmd->IgnoreGeneralAttr)
+#ifndef __BIONIC__
SetFileAttr(CurFile.FileName,CurFile.FileNameW,Arc.NewLhd.FileAttr);
+#else
+ SetFileAttr(CurFile.FileName,Arc.NewLhd.FileAttr);
+#endif
PrevExtracted=true;
}
}
diff --git a/src/extract.hpp b/src/extract.hpp
index 0995e8e..bf893a2 100644
--- a/src/extract.hpp
+++ b/src/extract.hpp
@@ -26,13 +26,17 @@ class CmdExtract
bool AnySolidDataUnpackedWell;
char ArcName[NM];
+#ifndef __BIONIC__
wchar ArcNameW[NM];
+#endif
SecPassword Password;
bool PasswordAll;
bool PrevExtracted;
char DestFileName[NM];
+#ifndef __BIONIC__
wchar DestFileNameW[NM];
+#endif
bool PasswordCancelled;
public:
CmdExtract();
diff --git a/src/filcreat.cpp b/src/filcreat.cpp
index 2bd176f..83be4e9 100644
--- a/src/filcreat.cpp
+++ b/src/filcreat.cpp
@@ -1,15 +1,25 @@
#include "rar.hpp"
+#ifndef __BIONIC__
bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize,
uint FileTime,bool WriteOnly)
+#else
+bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,
+ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize,
+ uint FileTime,bool WriteOnly)
+#endif
{
if (UserReject!=NULL)
*UserReject=false;
#if defined(_WIN_ALL) && !defined(_WIN_CE)
bool ShortNameChanged=false;
#endif
+#ifndef __BIONIC__
while (FileExist(Name,NameW))
+#else
+ while (FileExist(Name))
+#endif
{
#if defined(_WIN_ALL) && !defined(_WIN_CE)
if (!ShortNameChanged)
@@ -26,8 +36,10 @@ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
{
if (Name!=NULL && *Name!=0)
WideToChar(WideName,Name);
+#ifndef __BIONIC__
if (NameW!=NULL && *NameW!=0)
wcscpy(NameW,WideName);
+#endif
continue;
}
}
@@ -45,7 +57,11 @@ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
// Must be before Cmd->AllYes check or -y switch would override -or.
if (Mode==OVERWRITE_AUTORENAME)
{
+#ifndef __BIONIC__
if (!GetAutoRenamedName(Name,NameW))
+#else
+ if (!GetAutoRenamedName(Name))
+#endif
Mode=OVERWRITE_DEFAULT;
continue;
}
@@ -62,8 +78,10 @@ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
if (Mode==OVERWRITE_DEFAULT || Mode==OVERWRITE_FORCE_ASK)
{
char NewName[NM];
+#ifndef __BIONIC__
wchar NewNameW[NM];
*NewNameW=0;
+#endif
eprintf(St(MFileExists),Name);
int Choice=Ask(St(MYesNoAllRenQ));
if (Choice==1)
@@ -113,11 +131,13 @@ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
else
strcpy(Name,NewName);
+#ifndef __BIONIC__
if (NameW!=NULL)
if (PointToName(NewNameW)==NewNameW)
wcscpy(PointToName(NameW),NewNameW);
else
wcscpy(NameW,NewNameW);
+#endif
continue;
}
if (Choice==6)
@@ -125,21 +145,39 @@ bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
}
}
uint FileMode=WriteOnly ? FMF_WRITE|FMF_SHAREREAD:FMF_UPDATE|FMF_SHAREREAD;
+#ifndef __BIONIC__
if (NewFile!=NULL && NewFile->Create(Name,NameW,FileMode))
+#else
+ if (NewFile!=NULL && NewFile->Create(Name,FileMode))
+#endif
return(true);
+#ifndef __BIONIC__
PrepareToDelete(Name,NameW);
CreatePath(Name,NameW,true);
return(NewFile!=NULL ? NewFile->Create(Name,NameW,FileMode):DelFile(Name,NameW));
+#else
+ PrepareToDelete(Name);
+ CreatePath(Name,true);
+ return(NewFile!=NULL ? NewFile->Create(Name,FileMode):DelFile(Name));
+#endif
}
+#ifndef __BIONIC__
bool GetAutoRenamedName(char *Name,wchar *NameW)
+#else
+bool GetAutoRenamedName(char *Name)
+#endif
{
char NewName[NM];
+#ifndef __BIONIC__
wchar NewNameW[NM];
if (Name!=NULL && strlen(Name)>ASIZE(NewName)-10 ||
NameW!=NULL && wcslen(NameW)>ASIZE(NewNameW)-10)
+#else
+ if (Name!=NULL && strlen(Name)>ASIZE(NewName)-10)
+#endif
return(false);
char *Ext=NULL;
if (Name!=NULL && *Name!=0)
@@ -148,6 +186,7 @@ bool GetAutoRenamedName(char *Name,wchar *NameW)
if (Ext==NULL)
Ext=Name+strlen(Name);
}
+#ifndef __BIONIC__
wchar *ExtW=NULL;
if (NameW!=NULL && *NameW!=0)
{
@@ -155,20 +194,29 @@ bool GetAutoRenamedName(char *Name,wchar *NameW)
if (ExtW==NULL)
ExtW=NameW+wcslen(NameW);
}
+#endif
*NewName=0;
+#ifndef __BIONIC__
*NewNameW=0;
+#endif
for (int FileVer=1;;FileVer++)
{
if (Name!=NULL && *Name!=0)
sprintf(NewName,"%.*s(%d)%s",int(Ext-Name),Name,FileVer,Ext);
+#ifndef __BIONIC__
if (NameW!=NULL && *NameW!=0)
sprintfw(NewNameW,ASIZE(NewNameW),L"%.*s(%d)%s",int(ExtW-NameW),NameW,FileVer,ExtW);
if (!FileExist(NewName,NewNameW))
+#else
+ if (!FileExist(NewName))
+#endif
{
if (Name!=NULL && *Name!=0)
strcpy(Name,NewName);
+#ifndef __BIONIC__
if (NameW!=NULL && *NameW!=0)
wcscpy(NameW,NewNameW);
+#endif
break;
}
if (FileVer>=1000000)
diff --git a/src/filcreat.hpp b/src/filcreat.hpp
index 7e758bf..087b108 100644
--- a/src/filcreat.hpp
+++ b/src/filcreat.hpp
@@ -1,10 +1,17 @@
#ifndef _RAR_FILECREATE_
#define _RAR_FILECREATE_
+#ifndef __BIONIC__
bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize=INT64NDF,
uint FileTime=0,bool WriteOnly=false);
bool GetAutoRenamedName(char *Name,wchar *NameW);
+#else
+bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,
+ OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize=INT64NDF,
+ uint FileTime=0,bool WriteOnly=false);
+bool GetAutoRenamedName(char *Name);
+#endif
#if defined(_WIN_ALL) && !defined(_WIN_CE)
bool UpdateExistingShortName(wchar *Name);
diff --git a/src/file.cpp b/src/file.cpp
index dcf4e61..86699e6 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -7,7 +7,9 @@ File::File()
{
hFile=BAD_HANDLE;
*FileName=0;
+#ifndef __BIONIC__
*FileNameW=0;
+#endif
NewFile=false;
LastWrite=false;
HandleType=FILE_HANDLENORMAL;
@@ -45,8 +47,11 @@ void File::operator = (File &SrcFile)
SrcFile.SkipClose=true;
}
-
+#ifndef __BIONIC__
bool File::Open(const char *Name,const wchar *NameW,uint Mode)
+#else
+bool File::Open(const char *Name,uint Mode)
+#endif
{
ErrorType=FILE_SUCCESS;
FileHandle hNewFile;
@@ -110,14 +115,18 @@ bool File::Open(const char *Name,const wchar *NameW,uint Mode)
// with overlapped buffers. While we do not call this function with
// really overlapped buffers yet, we do call it with Name equal to
// FileName like Arc.Open(Arc.FileName,Arc.FileNameW,...).
+#ifndef __BIONIC__
if (NameW!=NULL)
memmove(FileNameW,NameW,(wcslen(NameW)+1)*sizeof(*NameW));
else
*FileNameW=0;
+#endif
if (Name!=NULL)
memmove(FileName,Name,strlen(Name)+1);
+#ifndef __BIONIC__
else
WideToChar(NameW,FileName);
+#endif
AddFileToList(hFile);
}
return(Success);
@@ -125,24 +134,46 @@ bool File::Open(const char *Name,const wchar *NameW,uint Mode)
#if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void File::TOpen(const char *Name,const wchar *NameW)
+#else
+void File::TOpen(const char *Name)
+#endif
{
+#ifndef __BIONIC__
if (!WOpen(Name,NameW))
+#else
+ if (!WOpen(Name))
+#endif
ErrHandler.Exit(RARX_OPEN);
}
#endif
-
+#ifndef __BIONIC__
bool File::WOpen(const char *Name,const wchar *NameW)
+#else
+bool File::WOpen(const char *Name)
+#endif
{
+#ifndef __BIONIC__
if (Open(Name,NameW))
+#else
+ if (Open(Name))
+#endif
return(true);
+#ifndef __BIONIC__
ErrHandler.OpenErrorMsg(Name,NameW);
+#else
+ ErrHandler.OpenErrorMsg(Name);
+#endif
return(false);
}
-
+#ifndef __BIONIC__
bool File::Create(const char *Name,const wchar *NameW,uint Mode)
+#else
+bool File::Create(const char *Name,uint Mode)
+#endif
{
// OpenIndiana based NAS and CIFS shares fail to set the file time if file
// was created in read+write mode and some data was written and not flushed
@@ -164,14 +195,18 @@ bool File::Create(const char *Name,const wchar *NameW,uint Mode)
NewFile=true;
HandleType=FILE_HANDLENORMAL;
SkipClose=false;
+#ifndef __BIONIC__
if (NameW!=NULL)
wcscpy(FileNameW,NameW);
else
*FileNameW=0;
+#endif
if (Name!=NULL)
strcpy(FileName,Name);
+#ifndef __BIONIC__
else
WideToChar(NameW,FileName);
+#endif
AddFileToList(hFile);
return(hFile!=BAD_HANDLE);
}
@@ -190,20 +225,39 @@ void File::AddFileToList(FileHandle hFile)
#if !defined(SHELL_EXT) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void File::TCreate(const char *Name,const wchar *NameW,uint Mode)
+#else
+void File::TCreate(const char *Name,uint Mode)
+#endif
{
+#ifndef __BIONIC__
if (!WCreate(Name,NameW,Mode))
+#else
+ if (!WCreate(Name,Mode))
+#endif
ErrHandler.Exit(RARX_FATAL);
}
#endif
-
+#ifndef __BIONIC__
bool File::WCreate(const char *Name,const wchar *NameW,uint Mode)
+#else
+bool File::WCreate(const char *Name,uint Mode)
+#endif
{
+#ifndef __BIONIC__
if (Create(Name,NameW,Mode))
+#else
+ if (Create(Name,Mode))
+#endif
return(true);
ErrHandler.SetErrorCode(RARX_CREATE);
+#ifndef __BIONIC__
ErrHandler.CreateErrorMsg(Name,NameW);
+#else
+ ErrHandler.CreateErrorMsg(Name);
+#endif
return(false);
}
@@ -233,7 +287,11 @@ bool File::Close()
}
hFile=BAD_HANDLE;
if (!Success && AllowExceptions)
+#ifndef __BIONIC__
ErrHandler.CloseError(FileName,FileNameW);
+#else
+ ErrHandler.CloseError(FileName);
+#endif
}
CloseCount++;
return(Success);
@@ -258,25 +316,40 @@ bool File::Delete()
Close();
if (!AllowDelete)
return(false);
+#ifndef __BIONIC__
return(DelFile(FileName,FileNameW));
+#else
+ return(DelFile(FileName));
+#endif
}
-
+#ifndef __BIONIC__
bool File::Rename(const char *NewName,const wchar *NewNameW)
+#else
+bool File::Rename(const char *NewName)
+#endif
{
// we do not need to rename if names are already same
bool Success=strcmp(FileName,NewName)==0;
+#ifndef __BIONIC__
if (Success && *FileNameW!=0 && *NullToEmpty(NewNameW)!=0)
Success=wcscmp(FileNameW,NewNameW)==0;
+#endif
if (!Success)
+#ifndef __BIONIC__
Success=RenameFile(FileName,FileNameW,NewName,NewNameW);
+#else
+ Success=RenameFile(FileName,NewName);
+#endif
if (Success)
{
// renamed successfully, storing the new name
strcpy(FileName,NewName);
+#ifndef __BIONIC__
wcscpy(FileNameW,NullToEmpty(NewNameW));
+#endif
}
return(Success);
}
@@ -338,7 +411,12 @@ void File::Write(const void *Data,size_t Size)
if (FreeSize>Size && FilePos-Size<=0xffffffff && FilePos+Size>0xffffffff)
ErrHandler.WriteErrorFAT(FileName,FileNameW);
#endif
+
+#ifndef __BIONIC__
if (ErrHandler.AskRepeatWrite(FileName,FileNameW,false))
+#else
+ if (ErrHandler.AskRepeatWrite(FileName,false))
+#endif
{
#ifndef _WIN_ALL
clearerr(hFile);
@@ -347,7 +425,11 @@ void File::Write(const void *Data,size_t Size)
Seek(Tell()-Written,SEEK_SET);
continue;
}
+#ifndef __BIONIC__
ErrHandler.WriteError(NULL,NULL,FileName,FileNameW);
+#else
+ ErrHandler.WriteError(NULL,FileName);
+#endif
}
break;
}
@@ -382,9 +464,15 @@ int File::Read(void *Data,size_t Size)
}
else
{
+#ifndef __BIONIC__
if (HandleType==FILE_HANDLENORMAL && ErrHandler.AskRepeatRead(FileName,FileNameW))
continue;
ErrHandler.ReadError(FileName,FileNameW);
+#else
+ if (HandleType==FILE_HANDLENORMAL && ErrHandler.AskRepeatRead(FileName))
+ continue;
+ ErrHandler.ReadError(FileName);
+#endif
}
}
break;
@@ -440,7 +528,11 @@ int File::DirectRead(void *Data,size_t Size)
void File::Seek(int64 Offset,int Method)
{
if (!RawSeek(Offset,Method) && AllowExceptions)
+#ifndef __BIONIC__
ErrHandler.SeekError(FileName,FileNameW);
+#else
+ ErrHandler.SeekError(FileName);
+#endif
}
@@ -475,7 +567,11 @@ int64 File::Tell()
{
if (hFile==BAD_HANDLE)
if (AllowExceptions)
+#ifndef __BIONIC__
ErrHandler.SeekError(FileName,FileNameW);
+#else
+ ErrHandler.SeekError(FileName);
+#endif
else
return(-1);
#ifdef _WIN_ALL
@@ -483,7 +579,11 @@ int64 File::Tell()
uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT);
if (LowDist==0xffffffff && GetLastError()!=NO_ERROR)
if (AllowExceptions)
+#ifndef __BIONIC__
ErrHandler.SeekError(FileName,FileNameW);
+#else
+ ErrHandler.SeekError(FileName);
+#endif
else
return(-1);
return(INT32TO64(HighDist,LowDist));
diff --git a/src/file.hpp b/src/file.hpp
index 666b519..735f661 100644
--- a/src/file.hpp
+++ b/src/file.hpp
@@ -66,7 +66,9 @@ class File
bool OpenShared; // Set by 'Archive' class.
public:
char FileName[NM];
+#ifndef __BIONIC__
wchar FileNameW[NM];
+#endif
FILE_ERRORTYPE ErrorType;
@@ -75,16 +77,29 @@ class File
File();
virtual ~File();
void operator = (File &SrcFile);
+#ifndef __BIONIC__
bool Open(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_READ);
void TOpen(const char *Name,const wchar *NameW=NULL);
bool WOpen(const char *Name,const wchar *NameW=NULL);
bool Create(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
void TCreate(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
bool WCreate(const char *Name,const wchar *NameW=NULL,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+#else
+ bool Open(const char *Name,uint Mode=FMF_READ);
+ void TOpen(const char *Name);
+ bool WOpen(const char *Name);
+ bool Create(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+ void TCreate(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+ bool WCreate(const char *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD);
+#endif
bool Close();
void Flush();
bool Delete();
+#ifndef __BIONIC__
bool Rename(const char *NewName,const wchar *NewNameW=NULL);
+#else
+ bool Rename(const char *NewName);
+#endif
void Write(const void *Data,size_t Size);
int Read(void *Data,size_t Size);
int DirectRead(void *Data,size_t Size);
diff --git a/src/filefn.cpp b/src/filefn.cpp
index e7cc8fd..aeac5ee 100644
--- a/src/filefn.cpp
+++ b/src/filefn.cpp
@@ -1,6 +1,10 @@
#include "rar.hpp"
+#ifndef __BIONIC__
MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr)
+#else
+MKDIR_CODE MakeDir(const char *Name,bool SetAttr,uint Attr)
+#endif
{
#ifdef _WIN_ALL
BOOL RetCode;
@@ -36,7 +40,11 @@ MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr)
#endif
{
if (SetAttr)
+#ifndef __BIONIC__
SetFileAttr(Name,NameW,Attr);
+#else
+ SetFileAttr(Name,Attr);
+#endif
return(MKDIR_SUCCESS);
}
return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
@@ -78,7 +86,11 @@ bool CreatePath(const char *Path,bool SkipLastName)
strncpy(DirName,Path,s-Path);
DirName[s-Path]=0;
+#ifndef __BIONIC__
if (MakeDir(DirName,NULL,true,DirAttr)==MKDIR_SUCCESS)
+#else
+ if (MakeDir(DirName,true,DirAttr)==MKDIR_SUCCESS)
+#endif
{
#ifndef GUI
mprintf(St(MCreatDir),DirName);
@@ -91,12 +103,16 @@ bool CreatePath(const char *Path,bool SkipLastName)
}
if (!SkipLastName)
if (!IsPathDiv(*PointToLastChar(Path)))
+#ifndef __BIONIC__
if (MakeDir(Path,NULL,true,DirAttr)!=MKDIR_SUCCESS)
+#else
+ if (MakeDir(Path,true,DirAttr)!=MKDIR_SUCCESS)
+#endif
Success=false;
return(Success);
}
-
+#ifndef __BIONIC__
bool CreatePath(const wchar *Path,bool SkipLastName)
{
if (Path==NULL || *Path==0)
@@ -157,9 +173,14 @@ bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName)
return(CreatePath(Path,SkipLastName));
return(false);
}
+#endif
+#ifndef __BIONIC__
void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta)
+#else
+void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta)
+#endif
{
#ifdef _WIN_ALL
if (!WinNT())
@@ -305,8 +326,11 @@ int64 GetFreeDisk(const char *Name)
-
+#ifndef __BIONIC__
bool FileExist(const char *Name,const wchar *NameW)
+#else
+bool FileExist(const char *Name)
+#endif
{
#ifdef _WIN_ALL
if (WinNT() && NameW!=NULL && *NameW!=0)
@@ -317,28 +341,46 @@ bool FileExist(const char *Name,const wchar *NameW)
return(access(Name,0)==0);
#else
FindData FD;
+#ifndef __BIONIC__
return(FindFile::FastFind(Name,NameW,&FD));
+#else
+ return(FindFile::FastFind(Name,&FD));
+#endif
#endif
}
-
+#ifndef __BIONIC__
bool FileExist(const wchar *Name)
{
return FileExist(NULL,Name);
}
+#endif
-
+#ifndef __BIONIC__
bool WildFileExist(const char *Name,const wchar *NameW)
+#else
+bool WildFileExist(const char *Name)
+#endif
{
+#ifndef __BIONIC__
if (IsWildcard(Name,NameW))
+#else
+ if (IsWildcard(Name))
+#endif
{
FindFile Find;
Find.SetMask(Name);
+#ifndef __BIONIC__
Find.SetMaskW(NameW);
+#endif
FindData fd;
return(Find.Next(&fd));
}
+#ifndef __BIONIC__
return(FileExist(Name,NameW));
+#else
+ return(FileExist(Name));
+#endif
}
@@ -395,8 +437,11 @@ bool IsDeleteAllowed(uint FileAttr)
#endif
}
-
+#ifndef __BIONIC__
void PrepareToDelete(const char *Name,const wchar *NameW)
+#else
+void PrepareToDelete(const char *Name)
+#endif
{
#if defined(_WIN_ALL) || defined(_EMX)
SetFileAttr(Name,NameW,0);
@@ -407,8 +452,11 @@ void PrepareToDelete(const char *Name,const wchar *NameW)
#endif
}
-
+#ifndef __BIONIC__
uint GetFileAttr(const char *Name,const wchar *NameW)
+#else
+uint GetFileAttr(const char *Name)
+#endif
{
#ifdef _WIN_ALL
if (WinNT() && NameW!=NULL && *NameW!=0)
@@ -429,8 +477,11 @@ uint GetFileAttr(const char *Name,const wchar *NameW)
#endif
}
-
+#ifndef __BIONIC__
bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr)
+#else
+bool SetFileAttr(const char *Name,uint Attr)
+#endif
{
bool Success;
#ifdef _WIN_ALL
@@ -508,22 +559,28 @@ uint CalcFileCRC(File *SrcFile,int64 Size,CALCCRC_SHOWMODE ShowMode)
}
#endif
-
+#ifndef __BIONIC__
bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW)
+#else
+bool RenameFile(const char *SrcName,const char *DestName)
+#endif
{
return(rename(SrcName,DestName)==0);
}
-
+#ifndef __BIONIC__
bool DelFile(const char *Name)
{
return(DelFile(Name,NULL));
}
+#endif
-
-
+#ifndef __BIONIC__
bool DelFile(const char *Name,const wchar *NameW)
+#else
+bool DelFile(const char *Name)
+#endif
{
return(Name!=NULL && remove(Name)==0);
}
diff --git a/src/filefn.hpp b/src/filefn.hpp
index bdf193e..0bc5060 100644
--- a/src/filefn.hpp
+++ b/src/filefn.hpp
@@ -3,21 +3,33 @@
enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH};
+#ifndef __BIONIC__
MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr);
+#else
+MKDIR_CODE MakeDir(const char *Name,bool SetAttr,uint Attr);
+#endif
bool CreatePath(const char *Path,bool SkipLastName);
+#ifndef __BIONIC__
bool CreatePath(const wchar *Path,bool SkipLastName);
bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName);
void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta);
+#else
+void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta);
+#endif
bool IsRemovable(const char *Name);
#ifndef SFX_MODULE
int64 GetFreeDisk(const char *Name);
#endif
-
+#ifndef __BIONIC__
bool FileExist(const char *Name,const wchar *NameW=NULL);
bool FileExist(const wchar *Name);
bool WildFileExist(const char *Name,const wchar *NameW=NULL);
+#else
+bool FileExist(const char *Name);
+bool WildFileExist(const char *Name);
+#endif
bool IsDir(uint Attr);
bool IsUnreadable(uint Attr);
bool IsLabel(uint Attr);
@@ -25,18 +37,36 @@ bool IsLink(uint Attr);
void SetSFXMode(const char *FileName);
void EraseDiskContents(const char *FileName);
bool IsDeleteAllowed(uint FileAttr);
+#ifndef __BIONIC__
void PrepareToDelete(const char *Name,const wchar *NameW=NULL);
uint GetFileAttr(const char *Name,const wchar *NameW=NULL);
bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr);
+#else
+void PrepareToDelete(const char *Name);
+uint GetFileAttr(const char *Name);
+bool SetFileAttr(const char *Name,uint Attr);
+#endif
enum CALCCRC_SHOWMODE {CALCCRC_SHOWNONE,CALCCRC_SHOWTEXT,CALCCRC_SHOWALL};
uint CalcFileCRC(File *SrcFile,int64 Size=INT64NDF,CALCCRC_SHOWMODE ShowMode=CALCCRC_SHOWNONE);
+#ifndef __BIONIC__
bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW);
+#else
+bool RenameFile(const char *SrcName,const char *DestName);
+#endif
bool DelFile(const char *Name);
+#ifndef __BIONIC__
bool DelFile(const char *Name,const wchar *NameW);
+#else
+bool DelFile(const char *Name);
+#endif
bool DelDir(const char *Name);
+#ifndef __BIONIC__
bool DelDir(const char *Name,const wchar *NameW);
+#else
+bool DelDir(const char *Name);
+#endif
#if defined(_WIN_ALL) && !defined(_WIN_CE)
bool SetFileCompression(char *Name,wchar *NameW,bool State);
diff --git a/src/filestr.cpp b/src/filestr.cpp
index 49e865b..26e3dcf 100644
--- a/src/filestr.cpp
+++ b/src/filestr.cpp
@@ -4,7 +4,9 @@ static bool IsUnicode(byte *Data,int Size);
bool ReadTextFile(
const char *Name,
+#ifndef __BIONIC__
const wchar *NameW,
+#endif
StringList *List,
bool Config,
bool AbortOnError,
@@ -21,8 +23,10 @@ bool ReadTextFile(
else
strcpy(FileName,Name);
+#ifndef __BIONIC__
wchar FileNameW[NM];
*FileNameW=0;
+#endif
#ifdef _WIN_ALL
if (NameW!=NULL)
@@ -33,9 +37,17 @@ bool ReadTextFile(
#endif
File SrcFile;
+#ifndef __BIONIC__
if (FileName!=NULL && *FileName!=0 || FileNameW!=NULL && *FileNameW!=0)
+#else
+ if (FileName!=NULL && *FileName!=0)
+#endif
{
+#ifndef __BIONIC__
bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName,FileNameW):SrcFile.Open(FileName,FileNameW,0);
+#else
+ bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName):SrcFile.Open(FileName,0);
+#endif
if (!OpenCode)
{
@@ -58,6 +70,7 @@ bool ReadTextFile(
memset(&Data[DataSize],0,5);
+#ifndef __BIONIC__
if (SrcCharset==RCH_UNICODE ||
SrcCharset==RCH_DEFAULT && IsUnicode((byte *)&Data[0],DataSize))
{
@@ -137,6 +150,7 @@ bool ReadTextFile(
}
else
{
+#endif
char *CurStr=&Data[0];
while (*CurStr!=0)
{
@@ -192,7 +206,9 @@ bool ReadTextFile(
while (*CurStr=='\r' || *CurStr=='\n')
CurStr++;
}
+#ifndef __BIONIC__
}
+#endif
return(true);
}
diff --git a/src/filestr.hpp b/src/filestr.hpp
index 3bdcfe7..3cfd707 100644
--- a/src/filestr.hpp
+++ b/src/filestr.hpp
@@ -3,7 +3,9 @@
bool ReadTextFile(
const char *Name,
+#ifndef __BIONIC__
const wchar *NameW,
+#endif
StringList *List,
bool Config,
bool AbortOnError=false,
diff --git a/src/find.cpp b/src/find.cpp
index 7ba14c0..f4ae474 100644
--- a/src/find.cpp
+++ b/src/find.cpp
@@ -3,7 +3,9 @@
FindFile::FindFile()
{
*FindMask=0;
+#ifndef __BIONIC__
*FindMaskW=0;
+#endif
FirstCall=true;
#ifdef _WIN_ALL
hFind=INVALID_HANDLE_VALUE;
@@ -28,12 +30,14 @@ FindFile::~FindFile()
void FindFile::SetMask(const char *FindMask)
{
strcpy(FindFile::FindMask,NullToEmpty(FindMask));
+#ifndef __BIONIC__
if (*FindMaskW==0)
CharToWide(FindMask,FindMaskW);
+#endif
FirstCall=true;
}
-
+#ifndef __BIONIC__
void FindFile::SetMaskW(const wchar *FindMaskW)
{
if (FindMaskW==NULL)
@@ -43,7 +47,7 @@ void FindFile::SetMaskW(const wchar *FindMaskW)
WideToChar(FindMaskW,FindMask);
FirstCall=true;
}
-
+#endif
bool FindFile::Next(struct FindData *fd,bool GetSymLink)
{
@@ -94,7 +98,11 @@ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
return(false);
}
strcat(FullName,ent->d_name);
+#ifndef __BIONIC__
if (!FastFind(FullName,NULL,fd,GetSymLink))
+#else
+ if (!FastFind(FullName,fd,GetSymLink))
+#endif
{
ErrHandler.OpenErrorMsg(FullName);
continue;
@@ -103,6 +111,8 @@ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
break;
}
}
+
+#ifndef __BIONIC__
*fd->NameW=0;
#ifdef _APPLE
if (!LowAscii(fd->Name))
@@ -112,6 +122,7 @@ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
CharToWide(fd->Name,fd->NameW);
#endif
#endif
+#endif
fd->Flags=0;
fd->IsDir=IsDir(fd->FileAttr);
FirstCall=false;
@@ -121,12 +132,19 @@ bool FindFile::Next(struct FindData *fd,bool GetSymLink)
return(true);
}
-
+#ifndef __BIONIC__
bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink)
+#else
+bool FindFile::FastFind(const char *FindMask,FindData *fd,bool GetSymLink)
+#endif
{
fd->Error=false;
#ifndef _UNIX
+#ifndef __BIONIC__
if (IsWildcard(FindMask,FindMaskW))
+#else
+ if (IsWildcard(FindMask))
+#endif
return(false);
#endif
#ifdef _WIN_ALL
@@ -169,6 +187,7 @@ bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd
fd->FileTime=fd->mtime.GetDos();
strcpy(fd->Name,FindMask);
+#ifndef __BIONIC__
*fd->NameW=0;
#ifdef _APPLE
if (!LowAscii(fd->Name))
@@ -178,6 +197,7 @@ bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd
CharToWide(fd->Name,fd->NameW);
#endif
#endif
+#endif
fd->Flags=0;
fd->IsDir=IsDir(fd->FileAttr);
return(true);
diff --git a/src/find.hpp b/src/find.hpp
index 05f5d7f..40043ce 100644
--- a/src/find.hpp
+++ b/src/find.hpp
@@ -8,7 +8,9 @@ enum FINDDATA_FLAGS {
struct FindData
{
char Name[NM];
+#ifndef __BIONIC__
wchar NameW[NM];
+#endif
int64 Size;
uint FileAttr;
uint FileTime;
@@ -34,7 +36,9 @@ class FindFile
#endif
char FindMask[NM];
+#ifndef __BIONIC__
wchar FindMaskW[NM];
+#endif
bool FirstCall;
#ifdef _WIN_ALL
HANDLE hFind;
@@ -45,9 +49,15 @@ class FindFile
FindFile();
~FindFile();
void SetMask(const char *FindMask);
+#ifndef __BIONIC__
void SetMaskW(const wchar *FindMaskW);
+#endif
bool Next(FindData *fd,bool GetSymLink=false);
+#ifndef __BIONIC__
static bool FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink=false);
+#else
+ static bool FastFind(const char *FindMask,FindData *fd,bool GetSymLink=false);
+#endif
};
#endif
diff --git a/src/list.cpp b/src/list.cpp
index 000e92d..0fe7740 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -15,15 +15,26 @@ void ListArchive(CommandData *Cmd)
bool Verbose=(*Cmd->Command=='V');
char ArcName[NM];
+#ifndef __BIONIC__
wchar ArcNameW[NM];
+#endif
+
+#ifndef __BIONIC__
while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
+#else
+ while (Cmd->GetArcName(ArcName,sizeof(ArcName)))
+#endif
{
Archive Arc(Cmd);
#ifdef _WIN_ALL
Arc.RemoveSequentialFlag();
#endif
+#ifndef __BIONIC__
if (!Arc.WOpen(ArcName,ArcNameW))
+#else
+ if (!Arc.WOpen(ArcName))
+#endif
continue;
bool FileMatched=true;
while (1)
@@ -195,6 +206,7 @@ void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,
char *Name=hd.FileName;
#ifdef UNICODE_SUPPORTED
+#ifndef __BIONIC__
char ConvertedName[NM];
if ((hd.Flags & LHD_UNICODE)!=0 && *hd.FileNameW!=0 && UnicodeEnabled())
{
@@ -202,6 +214,7 @@ void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,
Name=ConvertedName;
}
#endif
+#endif
if (Bare)
{
@@ -367,7 +380,11 @@ void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical)
(Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0 && !Cmd->DisableComment)
{
Array<byte> CmtData;
+#ifndef __BIONIC__
size_t ReadSize=Arc.ReadCommentData(&CmtData,NULL);
+#else
+ size_t ReadSize=Arc.ReadCommentData(&CmtData);
+#endif
if (ReadSize!=0)
{
mprintf(St(MFileComment));
@@ -377,6 +394,7 @@ void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical)
if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM) &&
(Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0)
{
+#ifndef __BIONIC__
size_t DestSize=Arc.SubHead.SubData.Size()/2;
wchar DestNameW[NM];
char DestName[NM];
@@ -387,5 +405,10 @@ void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical)
WideToChar(DestNameW,DestName);
mprintf("\n %s",DestName);
}
+#else
+ size_t DestSize=Arc.SubHead.SubData.Size();
+ char DestName[NM];
+ strncpyz(DestName,(const char *)&Arc.SubHead.SubData[0],ASIZE(DestName));
+#endif
}
}
diff --git a/src/match.cpp b/src/match.cpp
index 4d5a1d0..8a4b1f6 100644
--- a/src/match.cpp
+++ b/src/match.cpp
@@ -1,12 +1,18 @@
#include "rar.hpp"
static bool match(const char *pattern,const char *string,bool ForceCase);
+#ifndef __BIONIC__
static bool match(const wchar *pattern,const wchar *string,bool ForceCase);
+#endif
static int mstricompc(const char *Str1,const char *Str2,bool ForceCase);
+#ifndef __BIONIC__
static int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase);
+#endif
static int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase);
+#ifndef __BIONIC__
static int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase);
+#endif
inline uint toupperc(byte ch,bool ForceCase)
{
@@ -93,6 +99,7 @@ bool CmpName(const char *Wildcard,const char *Name,int CmpMode)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
bool CmpName(const wchar *Wildcard,const wchar *Name,int CmpMode)
{
bool ForceCase=(CmpMode&MATCH_FORCECASESENSITIVE)!=0;
@@ -150,6 +157,7 @@ bool CmpName(const wchar *Wildcard,const wchar *Name,int CmpMode)
return(match(Name1,Name2,ForceCase));
}
#endif
+#endif
bool match(const char *pattern,const char *string,bool ForceCase)
@@ -204,6 +212,7 @@ bool match(const char *pattern,const char *string,bool ForceCase)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
bool match(const wchar *pattern,const wchar *string,bool ForceCase)
{
for (;; ++string)
@@ -254,6 +263,7 @@ bool match(const wchar *pattern,const wchar *string,bool ForceCase)
}
}
#endif
+#endif
int mstricompc(const char *Str1,const char *Str2,bool ForceCase)
@@ -265,6 +275,7 @@ int mstricompc(const char *Str1,const char *Str2,bool ForceCase)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase)
{
if (ForceCase)
@@ -272,6 +283,7 @@ int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase)
return(wcsicompc(Str1,Str2));
}
#endif
+#endif
int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase)
@@ -287,6 +299,7 @@ int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase)
{
if (ForceCase)
@@ -298,3 +311,4 @@ int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase)
#endif
}
#endif
+#endif
diff --git a/src/match.hpp b/src/match.hpp
index 697286d..46d91c7 100644
--- a/src/match.hpp
+++ b/src/match.hpp
@@ -30,6 +30,8 @@ enum {
#define MATCH_FORCECASESENSITIVE 0x80000000
bool CmpName(const char *Wildcard,const char *Name,int CmpMode);
+#ifndef __BIONIC__
bool CmpName(const wchar *Wildcard,const wchar *Name,int CmpMode);
+#endif
#endif
diff --git a/src/os.hpp b/src/os.hpp
index 21488a8..b3b7a5d 100644
--- a/src/os.hpp
+++ b/src/os.hpp
@@ -155,7 +155,9 @@
#endif
#include <pwd.h>
#include <grp.h>
+#ifndef __BIONIC__
#include <wchar.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/src/pathfn.cpp b/src/pathfn.cpp
index b9244cd..1b722d3 100644
--- a/src/pathfn.cpp
+++ b/src/pathfn.cpp
@@ -11,7 +11,7 @@ char* PointToName(const char *Path)
return (char*)((*Path && IsDriveDiv(Path[1]) && charnext(Path)==Path+1) ? Path+2:Path);
}
-
+#ifndef __BIONIC__
wchar* PointToName(const wchar *Path)
{
for (int I=(int)wcslen(Path)-1;I>=0;I--)
@@ -19,7 +19,7 @@ wchar* PointToName(const wchar *Path)
return (wchar*)&Path[I+1];
return (wchar*)((*Path && IsDriveDiv(Path[1])) ? Path+2:Path);
}
-
+#endif
char* PointToLastChar(const char *Path)
{
@@ -28,13 +28,13 @@ char* PointToLastChar(const char *Path)
return((char *)p);
}
-
+#ifndef __BIONIC__
wchar* PointToLastChar(const wchar *Path)
{
size_t Length=wcslen(Path);
return((wchar*)(Length>0 ? Path+Length-1:Path));
}
-
+#endif
char* ConvertPath(const char *SrcPath,char *DestPath)
{
@@ -84,7 +84,7 @@ char* ConvertPath(const char *SrcPath,char *DestPath)
return((char *)DestPtr);
}
-
+#ifndef __BIONIC__
wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath)
{
const wchar *DestPtr=SrcPath;
@@ -131,7 +131,7 @@ wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath)
}
return((wchar *)DestPtr);
}
-
+#endif
void SetExt(char *Name,const char *NewExt)
{
@@ -151,7 +151,7 @@ void SetExt(char *Name,const char *NewExt)
strcpy(Dot+1,NewExt);
}
-
+#ifndef __BIONIC__
void SetExt(wchar *Name,const wchar *NewExt)
{
if (Name==NULL || *Name==0)
@@ -171,7 +171,7 @@ void SetExt(wchar *Name,const wchar *NewExt)
else
wcscpy(Dot+1,NewExt);
}
-
+#endif
#ifndef SFX_MODULE
void SetSFXExt(char *SFXName)
@@ -188,6 +188,7 @@ void SetSFXExt(char *SFXName)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
void SetSFXExt(wchar *SFXName)
{
if (SFXName==NULL || *SFXName==0)
@@ -202,6 +203,7 @@ void SetSFXExt(wchar *SFXName)
#endif
}
#endif
+#endif
char *GetExt(const char *Name)
@@ -209,12 +211,12 @@ char *GetExt(const char *Name)
return(Name==NULL ? NULL:strrchrd(PointToName(Name),'.'));
}
-
+#ifndef __BIONIC__
wchar *GetExt(const wchar *Name)
{
return(Name==NULL ? NULL:wcsrchr(PointToName(Name),'.'));
}
-
+#endif
// 'Ext' is an extension without the leading dot, like "rar".
bool CmpExt(const char *Name,const char *Ext)
@@ -224,18 +226,25 @@ bool CmpExt(const char *Name,const char *Ext)
}
+#ifndef __BIONIC__
// 'Ext' is an extension without the leading dot, like L"rar".
bool CmpExt(const wchar *Name,const wchar *Ext)
{
wchar *NameExt=GetExt(Name);
return(NameExt!=NULL && wcsicomp(NameExt+1,Ext)==0);
}
+#endif
-
+#ifndef __BIONIC__
bool IsWildcard(const char *Str,const wchar *StrW)
+#else
+bool IsWildcard(const char *Str)
+#endif
{
+#ifndef __BIONIC__
if (StrW!=NULL && *StrW!=0)
return(wcspbrk(StrW,L"*?")!=NULL);
+#endif
return(Str==NULL ? false:strpbrk(Str,"*?")!=NULL);
}
@@ -268,7 +277,7 @@ int GetPathDisk(const char *Path)
return(-1);
}
-
+#ifndef __BIONIC__
int GetPathDisk(const wchar *Path)
{
if (IsDiskLetter(Path))
@@ -276,6 +285,7 @@ int GetPathDisk(const wchar *Path)
else
return(-1);
}
+#endif
void AddEndSlash(char *Path)
@@ -285,14 +295,14 @@ void AddEndSlash(char *Path)
strcat(LastChar,PATHDIVIDER);
}
-
+#ifndef __BIONIC__
void AddEndSlash(wchar *Path)
{
size_t Length=wcslen(Path);
if (Length>0 && Path[Length-1]!=CPATHDIVIDER)
wcscat(Path,PATHDIVIDERW);
}
-
+#endif
// Returns file path including the trailing path separator symbol.
void GetFilePath(const char *FullName,char *Path,int MaxLength)
@@ -302,7 +312,7 @@ void GetFilePath(const char *FullName,char *Path,int MaxLength)
Path[PathLength]=0;
}
-
+#ifndef __BIONIC__
// Returns file path including the trailing path separator symbol.
void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength)
{
@@ -310,7 +320,7 @@ void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength)
wcsncpy(Path,FullName,PathLength);
Path[PathLength]=0;
}
-
+#endif
// Removes name and returns file path without the trailing
// path separator symbol.
@@ -322,7 +332,7 @@ void RemoveNameFromPath(char *Path)
*Name=0;
}
-
+#ifndef __BIONIC__
// Removes name and returns file path without the trailing
// path separator symbol.
void RemoveNameFromPath(wchar *Path)
@@ -332,7 +342,7 @@ void RemoveNameFromPath(wchar *Path)
Name--;
*Name=0;
}
-
+#endif
#if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
void GetAppDataPath(char *Path)
@@ -360,6 +370,7 @@ void GetAppDataPath(char *Path)
#if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void GetAppDataPath(wchar *Path)
{
LPMALLOC g_pMalloc;
@@ -382,6 +393,7 @@ void GetAppDataPath(wchar *Path)
g_pMalloc->Free(ppidl);
}
#endif
+#endif
#if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
@@ -405,6 +417,7 @@ void GetRarDataPath(char *Path)
#if defined(_WIN_ALL) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void GetRarDataPath(wchar *Path)
{
*Path=0;
@@ -422,6 +435,7 @@ void GetRarDataPath(wchar *Path)
GetAppDataPath(Path);
}
#endif
+#endif
#ifndef SFX_MODULE
@@ -483,6 +497,7 @@ bool EnumConfigPaths(char *Path,int Number)
#if defined(_WIN_ALL) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
bool EnumConfigPaths(wchar *Path,int Number)
{
if (Number<0 || Number>1)
@@ -497,6 +512,7 @@ bool EnumConfigPaths(wchar *Path,int Number)
return(true);
}
#endif
+#endif
#ifndef SFX_MODULE
@@ -515,6 +531,7 @@ void GetConfigName(const char *Name,char *FullName,bool CheckExist)
#if defined(_WIN_ALL) && !defined(SFX_MODULE)
+#ifndef __BIONIC__
void GetConfigName(const wchar *Name,wchar *FullName,bool CheckExist)
{
*FullName=0;
@@ -527,6 +544,7 @@ void GetConfigName(const wchar *Name,wchar *FullName,bool CheckExist)
}
}
#endif
+#endif
// Returns a pointer to rightmost digit of volume number.
@@ -562,7 +580,7 @@ char* GetVolNumPart(char *ArcName)
return(ChPtr);
}
-
+#ifndef __BIONIC__
// Returns a pointer to rightmost digit of volume number.
wchar* GetVolNumPart(wchar *ArcName)
{
@@ -595,9 +613,13 @@ wchar* GetVolNumPart(wchar *ArcName)
}
return(ChPtr);
}
+#endif
-
+#ifndef __BIONIC__
void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering)
+#else
+void NextVolumeName(char *ArcName,uint MaxLength,bool OldNumbering)
+#endif
{
if (ArcName!=NULL && *ArcName!=0)
{
@@ -646,7 +668,7 @@ void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumberi
}
}
}
-
+#ifndef __BIONIC__
if (ArcNameW!=NULL && *ArcNameW!=0)
{
wchar *ChPtr;
@@ -694,6 +716,7 @@ void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumberi
}
}
}
+#endif
}
@@ -722,7 +745,7 @@ bool IsNameUsable(const char *Name)
return(*Name!=0 && strpbrk(Name,"?*<>|\"")==NULL);
}
-
+#ifndef __BIONIC__
bool IsNameUsable(const wchar *Name)
{
#ifndef _UNIX
@@ -738,11 +761,12 @@ bool IsNameUsable(const wchar *Name)
#endif
return(*Name!=0 && wcspbrk(Name,L"?*<>|\"")==NULL);
}
-
+#endif
void MakeNameUsable(char *Name,bool Extended)
{
#ifdef _WIN_ALL
+#ifndef __BIONIC__
// In Windows we also need to convert characters not defined in current
// code page. This double conversion changes them to '?', which is
// catched by code below.
@@ -752,6 +776,7 @@ void MakeNameUsable(char *Name,bool Extended)
WideToChar(NameW,Name,NameLength+1);
Name[NameLength]=0;
#endif
+#endif
for (char *s=Name;*s!=0;s=charnext(s))
{
if (strchr(Extended ? "?*<>|\"":"?*",*s)!=NULL || Extended && (byte)*s<32)
@@ -769,7 +794,7 @@ void MakeNameUsable(char *Name,bool Extended)
}
}
-
+#ifndef __BIONIC__
void MakeNameUsable(wchar *Name,bool Extended)
{
for (wchar *s=Name;*s!=0;s++)
@@ -784,6 +809,7 @@ void MakeNameUsable(wchar *Name,bool Extended)
#endif
}
}
+#endif
char* UnixSlashToDos(char *SrcName,char *DestName,uint MaxLength)
@@ -829,7 +855,7 @@ char* DosSlashToUnix(char *SrcName,char *DestName,uint MaxLength)
return(DestName==NULL ? SrcName:DestName);
}
-
+#ifndef __BIONIC__
wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName,uint MaxLength)
{
if (DestName!=NULL && DestName!=SrcName)
@@ -850,8 +876,9 @@ wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName,uint MaxLength)
}
return(DestName==NULL ? SrcName:DestName);
}
+#endif
-
+#ifndef __BIONIC__
wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName,uint MaxLength)
{
if (DestName!=NULL && DestName!=SrcName)
@@ -872,7 +899,7 @@ wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName,uint MaxLength)
}
return(DestName==NULL ? SrcName:DestName);
}
-
+#endif
void ConvertNameToFull(const char *Src,char *Dest)
{
@@ -902,7 +929,7 @@ void ConvertNameToFull(const char *Src,char *Dest)
#endif
}
-
+#ifndef __BIONIC__
void ConvertNameToFull(const wchar *Src,wchar *Dest)
{
if (Src==NULL || *Src==0)
@@ -941,13 +968,17 @@ void ConvertNameToFull(const wchar *Src,wchar *Dest)
CharToWide(AnsiName,Dest);
#endif
}
-
+#endif
bool IsFullPath(const char *Path)
{
char PathOnly[NM];
GetFilePath(Path,PathOnly,ASIZE(PathOnly));
+#ifndef __BIONIC__
if (IsWildcard(PathOnly,NULL))
+#else
+ if (IsWildcard(PathOnly))
+#endif
return(true);
#if defined(_WIN_ALL) || defined(_EMX)
return(Path[0]=='\\' && Path[1]=='\\' ||
@@ -957,7 +988,7 @@ bool IsFullPath(const char *Path)
#endif
}
-
+#ifndef __BIONIC__
bool IsFullPath(const wchar *Path)
{
wchar PathOnly[NM];
@@ -971,7 +1002,7 @@ bool IsFullPath(const wchar *Path)
return(IsPathDiv(Path[0]));
#endif
}
-
+#endif
bool IsDiskLetter(const char *Path)
{
@@ -979,13 +1010,13 @@ bool IsDiskLetter(const char *Path)
return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
}
-
+#ifndef __BIONIC__
bool IsDiskLetter(const wchar *Path)
{
wchar Letter=etoupperw(Path[0]);
return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
}
-
+#endif
void GetPathRoot(const char *Path,char *Root)
{
@@ -1009,7 +1040,7 @@ void GetPathRoot(const char *Path,char *Root)
}
}
-
+#ifndef __BIONIC__
void GetPathRoot(const wchar *Path,wchar *Root)
{
*Root=0;
@@ -1031,9 +1062,13 @@ void GetPathRoot(const wchar *Path,wchar *Root)
}
}
}
+#endif
-
+#ifndef __BIONIC__
int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
+#else
+int ParseVersionFileName(char *Name,bool Truncate)
+#endif
{
int Version=0;
char *VerText=strrchrd(Name,';');
@@ -1043,6 +1078,7 @@ int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
if (Truncate)
*VerText=0;
}
+#ifndef __BIONIC__
if (NameW!=NULL)
{
wchar *VerTextW=wcsrchr(NameW,';');
@@ -1054,6 +1090,7 @@ int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
*VerTextW=0;
}
}
+#endif
return(Version);
}
@@ -1103,7 +1140,11 @@ char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering)
while (Find.Next(&FD))
{
Archive Arc;
+#ifndef __BIONIC__
if (Arc.Open(FD.Name,FD.NameW,0) && Arc.IsArchive(true) && !Arc.NotFirstVolume)
+#else
+ if (Arc.Open(FD.Name,0) && Arc.IsArchive(true) && !Arc.NotFirstVolume)
+#endif
{
strcpy(FirstName,FD.Name);
break;
@@ -1116,6 +1157,7 @@ char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering)
#if !defined(SFX_MODULE) && !defined(SETUP)
+#ifndef __BIONIC__
// Get the name of first volume. Return the leftmost digit of volume number.
wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumbering)
{
@@ -1170,35 +1212,56 @@ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumberin
return(VolNumStart);
}
#endif
+#endif
#ifndef SFX_MODULE
+#ifndef __BIONIC__
static void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
uint ArcNumber,bool &ArcNumPresent);
void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,
char *GenerateMask,bool Archiving)
+#else
+static void GenArcName(char *ArcName,char *GenerateMask,
+ uint ArcNumber,bool &ArcNumPresent);
+
+void GenerateArchiveName(char *ArcName,size_t MaxSize,
+ char *GenerateMask,bool Archiving)
+#endif
{
// Must be enough space for archive name plus all stuff in mask plus
// extra overhead produced by mask 'N' (archive number) characters.
// One 'N' character can result in several numbers if we process more
// than 9 archives.
char NewName[NM+MAX_GENERATE_MASK+20];
+#ifndef __BIONIC__
wchar NewNameW[NM+MAX_GENERATE_MASK+20];
+#endif
uint ArcNumber=1;
while (true) // Loop for 'N' (archive number) processing.
{
strncpyz(NewName,NullToEmpty(ArcName),ASIZE(NewName));
+#ifndef __BIONIC__
wcsncpyz(NewNameW,NullToEmpty(ArcNameW),ASIZE(NewNameW));
+#endif
bool ArcNumPresent=false;
+#ifndef __BIONIC__
GenArcName(NewName,NewNameW,GenerateMask,ArcNumber,ArcNumPresent);
+#else
+ GenArcName(NewName,GenerateMask,ArcNumber,ArcNumPresent);
+#endif
if (!ArcNumPresent)
break;
+#ifndef __BIONIC__
if (!FileExist(NewName,NewNameW))
+#else
+ if (!FileExist(NewName))
+#endif
{
if (!Archiving && ArcNumber>1)
{
@@ -1206,8 +1269,12 @@ void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,
// existing archive before the first unused name. So we generate
// the name for (ArcNumber-1) below.
strncpyz(NewName,NullToEmpty(ArcName),ASIZE(NewName));
+#ifndef __BIONIC__
wcsncpyz(NewNameW,NullToEmpty(ArcNameW),ASIZE(NewNameW));
GenArcName(NewName,NewNameW,GenerateMask,ArcNumber-1,ArcNumPresent);
+#else
+ GenArcName(NewName,GenerateMask,ArcNumber-1,ArcNumPresent);
+#endif
}
break;
}
@@ -1215,13 +1282,19 @@ void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,
}
if (ArcName!=NULL && *ArcName!=0)
strncpyz(ArcName,NewName,MaxSize);
+#ifndef __BIONIC__
if (ArcNameW!=NULL && *ArcNameW!=0)
wcsncpyz(ArcNameW,NewNameW,MaxSize);
+#endif
}
-
+#ifndef __BIONIC__
void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
uint ArcNumber,bool &ArcNumPresent)
+#else
+void GenArcName(char *ArcName,char *GenerateMask,
+ uint ArcNumber,bool &ArcNumPresent)
+#endif
{
bool Prefix=false;
if (*GenerateMask=='+')
@@ -1293,6 +1366,7 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
}
}
+#ifndef __BIONIC__
wchar ExtW[NM];
*ExtW=0;
if (ArcNameW!=NULL && *ArcNameW!=0)
@@ -1306,6 +1380,7 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
*DotW=0;
}
}
+#endif
int WeekDay=rlt.wDay==0 ? 6:rlt.wDay-1;
int StartWeekDay=rlt.yDay-WeekDay;
@@ -1382,8 +1457,10 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
DateText[++J]=0;
}
+#ifndef __BIONIC__
wchar DateTextW[ASIZE(DateText)];
CharToWide(DateText,DateTextW);
+#endif
if (Prefix)
{
@@ -1396,6 +1473,7 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
strcat(NewName,PointToName(ArcName));
strcpy(ArcName,NewName);
}
+#ifndef __BIONIC__
if (ArcNameW!=NULL && *ArcNameW!=0)
{
wchar NewNameW[NM];
@@ -1405,22 +1483,27 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
wcscat(NewNameW,PointToName(ArcNameW));
wcscpy(ArcNameW,NewNameW);
}
+#endif
}
else
{
if (ArcName!=NULL && *ArcName!=0)
strcat(ArcName,DateText);
+#ifndef __BIONIC__
if (ArcNameW!=NULL && *ArcNameW!=0)
wcscat(ArcNameW,DateTextW);
+#endif
}
if (ArcName!=NULL && *ArcName!=0)
strcat(ArcName,Ext);
+#ifndef __BIONIC__
if (ArcNameW!=NULL && *ArcNameW!=0)
wcscat(ArcNameW,ExtW);
+#endif
}
#endif
-
+#ifndef __BIONIC__
wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize)
{
if (NameW!=NULL && *NameW!=0)
@@ -1440,8 +1523,9 @@ wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestS
return(DestW);
}
+#endif
-
+#ifndef __BIONIC__
// Unlike WideToChar, always returns the zero terminated string,
// even if the destination buffer size is not enough.
char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize)
@@ -1455,3 +1539,4 @@ char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize)
*Name=0;
return Name;
}
+#endif
diff --git a/src/pathfn.hpp b/src/pathfn.hpp
index 5ee6146..5516b6a 100644
--- a/src/pathfn.hpp
+++ b/src/pathfn.hpp
@@ -2,65 +2,123 @@
#define _RAR_PATHFN_
char* PointToName(const char *Path);
+#ifndef __BIONIC__
wchar* PointToName(const wchar *Path);
+#endif
char* PointToLastChar(const char *Path);
+#ifndef __BIONIC__
wchar* PointToLastChar(const wchar *Path);
+#endif
char* ConvertPath(const char *SrcPath,char *DestPath);
+#ifndef __BIONIC__
wchar* ConvertPath(const wchar *SrcPath,wchar *DestPath);
+#endif
void SetExt(char *Name,const char *NewExt);
+#ifndef __BIONIC__
void SetExt(wchar *Name,const wchar *NewExt);
+#endif
void SetSFXExt(char *SFXName);
+#ifndef __BIONIC__
void SetSFXExt(wchar *SFXName);
+#endif
char *GetExt(const char *Name);
+#ifndef __BIONIC__
wchar *GetExt(const wchar *Name);
+#endif
bool CmpExt(const char *Name,const char *Ext);
+#ifndef __BIONIC__
bool CmpExt(const wchar *Name,const wchar *Ext);
+#endif
+#ifndef __BIONIC__
bool IsWildcard(const char *Str,const wchar *StrW=NULL);
+#else
+bool IsWildcard(const char *Str);
+#endif
bool IsPathDiv(int Ch);
bool IsDriveDiv(int Ch);
int GetPathDisk(const char *Path);
+#ifndef __BIONIC__
int GetPathDisk(const wchar *Path);
+#endif
void AddEndSlash(char *Path);
+#ifndef __BIONIC__
void AddEndSlash(wchar *Path);
+#endif
void GetFilePath(const char *FullName,char *Path,int MaxLength);
+#ifndef __BIONIC__
void GetFilePath(const wchar *FullName,wchar *Path,int MaxLength);
+#endif
void RemoveNameFromPath(char *Path);
+#ifndef __BIONIC__
void RemoveNameFromPath(wchar *Path);
+#endif
void GetAppDataPath(char *Path);
+#ifndef __BIONIC__
void GetAppDataPath(wchar *Path);
+#endif
void GetRarDataPath(char *Path);
+#ifndef __BIONIC__
void GetRarDataPath(wchar *Path);
bool EnumConfigPaths(wchar *Path,int Number);
+#endif
bool EnumConfigPaths(char *Path,int Number);
void GetConfigName(const char *Name,char *FullName,bool CheckExist);
+#ifndef __BIONIC__
void GetConfigName(const wchar *Name,wchar *FullName,bool CheckExist);
+#endif
char* GetVolNumPart(char *ArcName);
+#ifndef __BIONIC__
wchar* GetVolNumPart(wchar *ArcName);
void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering);
+#else
+void NextVolumeName(char *ArcName,uint MaxLength,bool OldNumbering);
+#endif
bool IsNameUsable(const char *Name);
+#ifndef __BIONIC__
bool IsNameUsable(const wchar *Name);
+#endif
void MakeNameUsable(char *Name,bool Extended);
+#ifndef __BIONIC__
void MakeNameUsable(wchar *Name,bool Extended);
+#endif
char* UnixSlashToDos(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
char* DosSlashToUnix(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
+#ifndef __BIONIC__
wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
wchar* DosSlashToUnix(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
+#endif
void ConvertNameToFull(const char *Src,char *Dest);
+#ifndef __BIONIC__
void ConvertNameToFull(const wchar *Src,wchar *Dest);
+#endif
bool IsFullPath(const char *Path);
+#ifndef __BIONIC__
bool IsFullPath(const wchar *Path);
+#endif
bool IsDiskLetter(const char *Path);
+#ifndef __BIONIC__
bool IsDiskLetter(const wchar *Path);
+#endif
void GetPathRoot(const char *Path,char *Root);
+#ifndef __BIONIC__
void GetPathRoot(const wchar *Path,wchar *Root);
int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate);
+#else
+int ParseVersionFileName(char *Name,bool Truncate);
+#endif
char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering);
+#ifndef __BIONIC__
wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumbering);
wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize);
char* GetAsciiName(const wchar *NameW,char *Name,size_t DestSize);
+#endif
#ifndef SFX_MODULE
+#ifndef __BIONIC__
void GenerateArchiveName(char *ArcName,wchar *ArcNameW,size_t MaxSize,char *GenerateMask,bool Archiving);
+#else
+void GenerateArchiveName(char *ArcName,size_t MaxSize,char *GenerateMask,bool Archiving);
+#endif
#endif
#endif
diff --git a/src/rar.hpp b/src/rar.hpp
index 73ebd2b..9d47cbe 100644
--- a/src/rar.hpp
+++ b/src/rar.hpp
@@ -15,7 +15,9 @@
#include "rartypes.hpp"
#include "rardefs.hpp"
#include "rarlang.hpp"
+#ifdef __BIONIC__
#include "unicode.hpp"
+#endif
#include "errhnd.hpp"
#include "array.hpp"
#include "timefn.hpp"
diff --git a/src/recvol.cpp b/src/recvol.cpp
index 0d6162e..ac7bfdc 100644
--- a/src/recvol.cpp
+++ b/src/recvol.cpp
@@ -67,14 +67,21 @@ void RSEncode::EncodeBuf()
}
}
-
+#ifndef __BIONIC__
bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
const wchar *NameW,bool Silent)
+#else
+bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,bool Silent)
+#endif
{
char ArcName[NM];
+#ifndef __BIONIC__
wchar ArcNameW[NM];
+#endif
strcpy(ArcName,Name);
+#ifndef __BIONIC__
wcscpy(ArcNameW,NameW);
+#endif
char *Ext=GetExt(ArcName);
bool NewStyle=false;
bool RevName=Ext!=NULL && stricomp(Ext,".rev")==0;
@@ -94,6 +101,7 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
Ext--;
strcpy(Ext,"*.*");
+#ifndef __BIONIC__
if (*ArcNameW!=0)
{
wchar *ExtW=GetExt(ArcNameW);
@@ -111,25 +119,38 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
ExtW--;
wcscpy(ExtW,L"*.*");
}
+#endif
FindFile Find;
Find.SetMask(ArcName);
+#ifndef __BIONIC__
Find.SetMaskW(ArcNameW);
+#endif
FindData fd;
while (Find.Next(&fd))
{
Archive Arc(Cmd);
+#ifndef __BIONIC__
if (Arc.WOpen(fd.Name,fd.NameW) && Arc.IsArchive(true))
+#else
+ if (Arc.WOpen(fd.Name) && Arc.IsArchive(true))
+#endif
{
strcpy(ArcName,fd.Name);
+#ifndef __BIONIC__
wcscpy(ArcNameW,fd.NameW);
+#endif
break;
}
}
}
Archive Arc(Cmd);
+#ifndef __BIONIC__
if (!Arc.WCheckOpen(ArcName,ArcNameW))
+#else
+ if (!Arc.WCheckOpen(ArcName))
+#endif
return(false);
if (!Arc.Volume)
{
@@ -150,6 +171,7 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
wchar RecVolMaskW[NM];
size_t BaseNamePartLengthW=0;
*RecVolMaskW=0;
+#ifndef __BIONIC__
if (*ArcNameW!=0)
{
wchar *VolNumStartW=VolNameToFirstName(ArcNameW,ArcNameW,NewNumbering);
@@ -157,6 +179,7 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
BaseNamePartLengthW=VolNumStartW-ArcNameW;
wcscpy(RecVolMaskW+BaseNamePartLengthW,L"*.rev");
}
+#endif
#ifndef SILENT
@@ -170,15 +193,21 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
FindFile Find;
Find.SetMask(RecVolMask);
+#ifndef __BIONIC__
Find.SetMaskW(RecVolMaskW);
+#endif
FindData RecData;
int FileNumber=0,RecVolNumber=0,FoundRecVolumes=0,MissingVolumes=0;
char PrevName[NM];
+#ifndef __BIONIC__
wchar PrevNameW[NM];
+#endif
while (Find.Next(&RecData))
{
char *CurName=RecData.Name;
+#ifndef __BIONIC__
wchar *CurNameW=RecData.NameW;
+#endif
int P[3];
if (!RevName && !NewStyle)
{
@@ -199,6 +228,7 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
NewStyle=false;
}
+#ifndef __BIONIC__
wchar *DotW=GetExt(CurNameW);
if (DotW!=NULL)
{
@@ -213,6 +243,7 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
if (LineCount==2)
NewStyle=false;
}
+#endif
}
if (NewStyle)
{
@@ -229,7 +260,11 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
#endif
File CurFile;
+#ifndef __BIONIC__
CurFile.TOpen(CurName,CurNameW);
+#else
+ CurFile.TOpen(CurName);
+#endif
CurFile.Seek(0,SEEK_END);
int64 Length=CurFile.Tell();
CurFile.Seek(Length-7,SEEK_SET);
@@ -277,9 +312,15 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
RecVolNumber=P[1];
FileNumber=P[2];
strcpy(PrevName,CurName);
+#ifndef __BIONIC__
wcscpy(PrevNameW,CurNameW);
+#endif
File *NewFile=new File;
+#ifndef __BIONIC__
NewFile->TOpen(CurName,CurNameW);
+#else
+ NewFile->TOpen(CurName);
+#endif
SrcFile[FileNumber+P[0]-1]=NewFile;
FoundRecVolumes++;
#ifndef SILENT
@@ -301,16 +342,26 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
char LastVolName[NM];
*LastVolName=0;
+#ifndef __BIONIC__
wchar LastVolNameW[NM];
*LastVolNameW=0;
+#endif
for (int CurArcNum=0;CurArcNum<FileNumber;CurArcNum++)
{
Archive *NewFile=new Archive;
+#ifndef __BIONIC__
bool ValidVolume=FileExist(ArcName,ArcNameW);
+#else
+ bool ValidVolume=FileExist(ArcName);
+#endif
if (ValidVolume)
{
+#ifndef __BIONIC__
NewFile->TOpen(ArcName,ArcNameW);
+#else
+ NewFile->TOpen(ArcName);
+#endif
ValidVolume=NewFile->IsArchive(false);
if (ValidVolume)
{
@@ -341,15 +392,21 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
strcpy(NewName,ArcName);
strcat(NewName,".bad");
+#ifndef __BIONIC__
wchar NewNameW[NM];
wcscpy(NewNameW,ArcNameW);
if (*NewNameW!=0)
wcscat(NewNameW,L".bad");
+#endif
#ifndef SILENT
mprintf(St(MBadArc),ArcName);
mprintf(St(MRenaming),ArcName,NewName);
#endif
+#ifndef __BIONIC__
RenameFile(ArcName,ArcNameW,NewName,NewNameW);
+#else
+ RenameFile(ArcName,NewName);
+#endif
}
NewFile->Seek(0,SEEK_SET);
}
@@ -359,7 +416,11 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
// so if we are called from extraction, we will be able to continue
// extracting. It may happen if .rar and .rev are on read-only disks
// like CDs.
+#ifndef __BIONIC__
if (!NewFile->Create(ArcName,ArcNameW))
+#else
+ if (!NewFile->Create(ArcName))
+#endif
{
// We need to display the title of operation before the error message,
// to make clear for user that create error is related to recovery
@@ -368,7 +429,11 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
#ifndef SILENT
mprintf(St(MReconstructing));
#endif
+#ifndef __BIONIC__
ErrHandler.CreateErrorMsg(ArcName,ArcNameW);
+#else
+ ErrHandler.CreateErrorMsg(ArcName);
+#endif
return false;
}
@@ -378,7 +443,9 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
if (CurArcNum==FileNumber-1)
{
strcpy(LastVolName,ArcName);
+#ifndef __BIONIC__
wcscpy(LastVolNameW,ArcNameW);
+#endif
}
#ifndef SILENT
@@ -386,7 +453,11 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
#endif
}
SrcFile[CurArcNum]=(File*)NewFile;
+#ifndef __BIONIC__
NextVolumeName(ArcName,ArcNameW,ASIZE(ArcName),!NewNumbering);
+#else
+ NextVolumeName(ArcName,ASIZE(ArcName),!NewNumbering);
+#endif
}
#ifndef SILENT
@@ -528,11 +599,19 @@ bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
CurFile->Close();
SrcFile[I]=NULL;
}
+#ifndef __BIONIC__
if (*LastVolName!=0 || *LastVolNameW!=0)
+#else
+ if (*LastVolName!=0)
+#endif
{
// Truncate the last volume to its real size.
Archive Arc(Cmd);
+#ifndef __BIONIC__
if (Arc.Open(LastVolName,LastVolNameW,FMF_UPDATE) && Arc.IsArchive(true) &&
+#else
+ if (Arc.Open(LastVolName,FMF_UPDATE) && Arc.IsArchive(true) &&
+#endif
Arc.SearchBlock(ENDARC_HEAD))
{
Arc.Seek(Arc.NextBlockPos,SEEK_SET);
diff --git a/src/recvol.hpp b/src/recvol.hpp
index 9a97465..59fa9a6 100644
--- a/src/recvol.hpp
+++ b/src/recvol.hpp
@@ -13,8 +13,13 @@ class RecVolumes
public:
RecVolumes();
~RecVolumes();
+#ifndef __BIONIC__
void Make(RAROptions *Cmd,char *ArcName,wchar *ArcNameW);
bool Restore(RAROptions *Cmd,const char *Name,const wchar *NameW,bool Silent);
+#else
+ void Make(RAROptions *Cmd,char *ArcName);
+ bool Restore(RAROptions *Cmd,const char *Name,bool Silent);
+#endif
};
#endif
diff --git a/src/scantree.cpp b/src/scantree.cpp
index 9fbfd10..2299d2c 100644
--- a/src/scantree.cpp
+++ b/src/scantree.cpp
@@ -11,7 +11,9 @@ ScanTree::ScanTree(StringList *FileMasks,RECURSE_MODE Recurse,bool GetLinks,SCAN
SetAllMaskDepth=0;
*CurMask=0;
+#ifndef __BIONIC__
*CurMaskW=0;
+#endif
memset(FindStack,0,sizeof(FindStack));
Depth=0;
Errors=0;
@@ -61,9 +63,14 @@ SCAN_CODE ScanTree::GetNext(FindData *FindData)
bool ScanTree::GetNextMask()
{
+#ifndef __BIONIC__
if (!FileMasks->GetString(CurMask,CurMaskW,ASIZE(CurMask)))
+#else
+ if (!FileMasks->GetString(CurMask,ASIZE(CurMask)))
+#endif
return(false);
+#ifndef __BIONIC__
if (*CurMask==0 && *CurMaskW!=0)
{
// Unicode only mask is present. It is very unlikely in console tools,
@@ -72,9 +79,12 @@ bool ScanTree::GetNextMask()
// So let's convert Unicode to ASCII.
WideToChar(CurMaskW,CurMask,ASIZE(CurMask));
}
+#endif
CurMask[ASIZE(CurMask)-1]=0;
+#ifndef __BIONIC__
CurMaskW[ASIZE(CurMaskW)-1]=0;
+#endif
#ifdef _WIN_ALL
UnixSlashToDos(CurMask);
#endif
@@ -94,6 +104,7 @@ bool ScanTree::GetNextMask()
}
SpecPathLength=Name-CurMask;
+#ifndef __BIONIC__
bool WideName=(*CurMaskW!=0);
if (WideName)
@@ -114,14 +125,17 @@ bool ScanTree::GetNextMask()
CharToWide(CurMask,WideMask);
SpecPathLengthW=PointToName(WideMask)-WideMask;
}
+#endif
Depth=0;
strcpy(OrigCurMask,CurMask);
+#ifndef __BIONIC__
// It is better to have non-empty OrigCurMaskW even if CurMaskW is empty.
// We need OrigCurMaskW to process Unicode masks generated by FindProc
// when encountering Unicode directory name.
GetWideName(CurMask,CurMaskW,OrigCurMaskW,ASIZE(OrigCurMaskW));
+#endif
return(true);
}
@@ -135,12 +149,20 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
if (FindStack[Depth]==NULL) // No FindFile object for this depth yet.
{
+#ifndef __BIONIC__
bool Wildcards=IsWildcard(CurMask,CurMaskW);
+#else
+ bool Wildcards=IsWildcard(CurMask);
+#endif
// If we have a file name without wildcards, we can try to use
// FastFind to optimize speed. For example, in Unix it results in
// stat call instead of opendir/readdir/closedir.
+#ifndef __BIONIC__
bool FindCode=!Wildcards && FindFile::FastFind(CurMask,CurMaskW,FD,GetLinks);
+#else
+ bool FindCode=!Wildcards && FindFile::FastFind(CurMask,FD,GetLinks);
+#endif
bool IsDir=FindCode && FD->IsDir;
@@ -162,6 +184,7 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
if (SearchAll)
strcpy(PointToName(SearchMask),MASKALL);
FindStack[Depth]->SetMask(SearchMask);
+#ifndef __BIONIC__
if (*CurMaskW!=0)
{
wchar SearchMaskW[NM];
@@ -170,6 +193,7 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
wcscpy(PointToName(SearchMaskW),MASKALLW);
FindStack[Depth]->SetMaskW(SearchMaskW);
}
+#endif
}
else
{
@@ -193,7 +217,11 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
if (Cmd!=NULL && Cmd->ExclCheck(CurMask,false,true,true))
RetCode=SCAN_NEXT;
else
+#ifndef __BIONIC__
ErrHandler.OpenErrorMsg(ErrArcName,NULL,CurMask,CurMaskW);
+#else
+ ErrHandler.OpenErrorMsg(ErrArcName,CurMask);
+#endif
}
// If we searched only for one file or directory in "fast find"
@@ -204,7 +232,9 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
// mode, directory recursing will quit by (Depth < 0) condition,
// which returns SCAN_DONE to calling function.
*CurMask=0;
+#ifndef __BIONIC__
*CurMaskW=0;
+#endif
return(RetCode);
}
@@ -249,9 +279,13 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
#endif
char DirName[NM];
+#ifndef __BIONIC__
wchar DirNameW[NM];
+#endif
*DirName=0;
+#ifndef __BIONIC__
*DirNameW=0;
+#endif
// Going to at least one directory level higher.
delete FindStack[Depth];
@@ -283,6 +317,7 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
strcpy(PrevSlash,Mask);
}
+#ifndef __BIONIC__
if (*CurMaskW!=0)
{
wchar *Slash=wcsrchr(CurMaskW,CPATHDIVIDER);
@@ -305,20 +340,27 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
*CurMaskW=Mask[0]=Mask[1]=0;
}
*Slash=0;
+#ifndef __BIONIC__
wcscpy(DirNameW,CurMaskW);
wchar *PrevSlash=wcsrchr(CurMaskW,CPATHDIVIDER);
if (PrevSlash==NULL)
wcscpy(CurMaskW,Mask+1);
else
wcscpy(PrevSlash,Mask);
+#endif
}
#ifndef _WIN_CE
// if (LowAscii(CurMaskW))
// *CurMaskW=0;
#endif
}
+#endif
if (GetDirs==SCAN_GETDIRSTWICE &&
+#ifndef __BIONIC__
FindFile::FastFind(DirName,DirNameW,FD,GetLinks) && FD->IsDir)
+#else
+ FindFile::FastFind(DirName,FD,GetLinks) && FD->IsDir)
+#endif
{
FD->Flags|=FDDF_SECONDDIR;
return(Error ? SCAN_ERROR:SCAN_SUCCESS);
@@ -367,6 +409,7 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
AddEndSlash(CurMask);
strcat(CurMask,Mask);
+#ifndef __BIONIC__
if (*CurMaskW!=0 && *FD->NameW==0)
CharToWide(FD->Name,FD->NameW);
if (*FD->NameW!=0)
@@ -383,6 +426,7 @@ SCAN_CODE ScanTree::FindProc(FindData *FD)
AddEndSlash(CurMaskW);
wcscat(CurMaskW,Mask);
}
+#endif
Depth++;
// We need to use OrigCurMask for depths less than SetAllMaskDepth
diff --git a/src/scantree.hpp b/src/scantree.hpp
index 33a6d46..7752119 100644
--- a/src/scantree.hpp
+++ b/src/scantree.hpp
@@ -36,9 +36,13 @@ class ScanTree
bool ScanEntireDisk;
char CurMask[NM];
+#ifndef __BIONIC__
wchar CurMaskW[NM];
+#endif
char OrigCurMask[NM];
+#ifndef __BIONIC__
wchar OrigCurMaskW[NM];
+#endif
bool SearchAllInRoot;
size_t SpecPathLength;
size_t SpecPathLengthW;
diff --git a/src/secpassword.cpp b/src/secpassword.cpp
index 016e136..8c322f0 100644
--- a/src/secpassword.cpp
+++ b/src/secpassword.cpp
@@ -54,7 +54,11 @@ CryptLoader GlobalCryptLoader;
SecPassword::SecPassword()
{
+#ifndef __BIONIC__
Set(L"");
+#else
+ Set("");
+#endif
}
@@ -94,7 +98,11 @@ void cleandata(void *data,size_t size)
// people share the same computer and somebody left WinRAR copy with entered
// password. So we decided to obfuscate the password to make it more difficult
// to find it in dump.
+#ifndef __BIONIC__
void SecPassword::Process(const wchar *Src,wchar *Dst,size_t MaxSize,bool Encode)
+#else
+void SecPassword::Process(const char *Src,char *Dst,size_t MaxSize,bool Encode)
+#endif
{
#ifdef _WIN_ALL
// Try to utilize the secure Crypt[Un]ProtectMemory if possible.
@@ -145,11 +153,14 @@ void SecPassword::Process(const wchar *Src,wchar *Dst,size_t MaxSize,bool Encode
#endif
for (size_t I=0;I<MaxSize;I++)
- Dst[I]=wchar(Src[I]^(Key+I+75));
+ Dst[I]=char(Src[I]^(Key+I+75));
}
-
+#ifndef __BIONIC__
void SecPassword::Get(wchar *Psw,size_t MaxSize)
+#else
+void SecPassword::Get(char *Psw,size_t MaxSize)
+#endif
{
if (PasswordSet)
{
@@ -160,8 +171,11 @@ void SecPassword::Get(wchar *Psw,size_t MaxSize)
*Psw=0;
}
-
+#ifndef __BIONIC__
void SecPassword::Set(const wchar *Psw)
+#else
+void SecPassword::Set(const char *Psw)
+#endif
{
if (*Psw==0)
{
@@ -178,9 +192,17 @@ void SecPassword::Set(const wchar *Psw)
size_t SecPassword::Length()
{
+#ifndef __BIONIC__
wchar Plain[MAXPASSWORD];
+#else
+ char Plain[MAXPASSWORD];
+#endif
Get(Plain,ASIZE(Plain));
+#ifndef __BIONIC__
size_t Length=wcslen(Plain);
+#else
+ size_t Length=strlen(Plain);
+#endif
cleandata(Plain,ASIZE(Plain));
return Length;
}
@@ -192,10 +214,18 @@ bool SecPassword::operator == (SecPassword &psw)
// than encryption function will always produce the same result for same
// data (salt?) and because we do not clean the rest of password buffer
// after trailing zero before encoding password. So we decode first.
+#ifndef __BIONIC__
wchar Plain1[MAXPASSWORD],Plain2[MAXPASSWORD];
+#else
+ char Plain1[MAXPASSWORD],Plain2[MAXPASSWORD];
+#endif
Get(Plain1,ASIZE(Plain1));
psw.Get(Plain2,ASIZE(Plain2));
+#ifndef __BIONIC__
bool Result=wcscmp(Plain1,Plain2)==0;
+#else
+ bool Result=strcmp(Plain1,Plain2)==0;
+#endif
cleandata(Plain1,ASIZE(Plain1));
cleandata(Plain2,ASIZE(Plain2));
return Result;
diff --git a/src/secpassword.hpp b/src/secpassword.hpp
index b93d97b..eee55d9 100644
--- a/src/secpassword.hpp
+++ b/src/secpassword.hpp
@@ -6,9 +6,17 @@
class SecPassword
{
private:
+#ifndef __BIONIC__
void Process(const wchar *Src,wchar *Dst,size_t MaxSize,bool Encode);
+#else
+ void Process(const char *Src,char *Dst,size_t MaxSize,bool Encode);
+#endif
+#ifndef __BIONIC__
wchar Password[MAXPASSWORD];
+#else
+ char Password[MAXPASSWORD];
+#endif
// It is important to have this 'bool' value, so if our object is cleaned
// with memset as a part of larger structure, it is handled correctly.
@@ -17,8 +25,13 @@ class SecPassword
SecPassword();
~SecPassword();
void Clean();
+#ifndef __BIONIC__
void Get(wchar *Psw,size_t MaxSize);
void Set(const wchar *Psw);
+#else
+ void Get(char *Psw,size_t MaxSize);
+ void Set(const char *Psw);
+#endif
bool IsSet() {return PasswordSet;}
size_t Length();
bool operator == (SecPassword &psw);
diff --git a/src/strfn.cpp b/src/strfn.cpp
index faf48e8..2c7e869 100644
--- a/src/strfn.cpp
+++ b/src/strfn.cpp
@@ -13,14 +13,14 @@ const wchar *NullToEmpty(const wchar *Str)
-
+#ifndef __BIONIC__
char *IntNameToExt(const char *Name)
{
static char OutName[NM];
IntToExt(Name,OutName);
return(OutName);
}
-
+#endif
void ExtToInt(const char *Src,char *Dest)
{
@@ -101,14 +101,14 @@ char* RemoveLF(char *Str)
return(Str);
}
-
+#ifndef __BIONIC__
wchar* RemoveLF(wchar *Str)
{
for (int I=(int)wcslen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
Str[I]=0;
return(Str);
}
-
+#endif
unsigned char loctolower(unsigned char ch)
{
@@ -143,7 +143,7 @@ unsigned char etoupper(unsigned char ch)
return(toupper(ch));
}
-
+#ifndef __BIONIC__
// Unicode version of etoupper.
wchar etoupperw(wchar ch)
{
@@ -151,6 +151,7 @@ wchar etoupperw(wchar ch)
return('I');
return(toupperw(ch));
}
+#endif
// We do not want to cast every signed char to unsigned when passing to
@@ -207,7 +208,7 @@ bool LowAscii(const char *Str)
return(true);
}
-
+#ifndef __BIONIC__
bool LowAscii(const wchar *Str)
{
for (int I=0;Str[I]!=0;I++)
@@ -219,7 +220,7 @@ bool LowAscii(const wchar *Str)
}
return(true);
}
-
+#endif
@@ -234,6 +235,7 @@ int stricompc(const char *Str1,const char *Str2)
#ifndef SFX_MODULE
+#ifndef __BIONIC__
int wcsicompc(const wchar *Str1,const wchar *Str2)
{
#if defined(_UNIX)
@@ -243,6 +245,7 @@ int wcsicompc(const wchar *Str1,const wchar *Str2)
#endif
}
#endif
+#endif
// safe strncpy: copies maxlen-1 max and always returns zero terminated dest
@@ -258,6 +261,7 @@ char* strncpyz(char *dest, const char *src, size_t maxlen)
// Safe wcsncpy: copies maxlen-1 max and always returns zero terminated dest.
+#ifndef __BIONIC__
wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen)
{
if (maxlen>0)
@@ -267,6 +271,7 @@ wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen)
}
return(dest);
}
+#endif
// Safe strncat: resulting dest length cannot exceed maxlen and dest
@@ -280,7 +285,7 @@ char* strncatz(char* dest, const char* src, size_t maxlen)
return dest;
}
-
+#ifndef __BIONIC__
// Safe wcsncat: resulting dest length cannot exceed maxlen and dest
// is always zero terminated. Note that 'maxlen' parameter defines the entire
// dest buffer size and is not compatible with standard wcsncat.
@@ -291,6 +296,7 @@ wchar* wcsncatz(wchar* dest, const wchar* src, size_t maxlen)
wcsncat(dest, src, maxlen - Length - 1);
return dest;
}
+#endif
void itoa(int64 n,char *Str)
@@ -322,7 +328,7 @@ int64 atoil(const char *Str)
return(n);
}
-
+#ifndef __BIONIC__
void itoa(int64 n,wchar *Str)
{
wchar NumStr[50];
@@ -338,8 +344,9 @@ void itoa(int64 n,wchar *Str)
Str[I]=NumStr[Pos-I-1];
Str[Pos]=0;
}
+#endif
-
+#ifndef __BIONIC__
int64 atoil(const wchar *Str)
{
int64 n=0;
@@ -350,8 +357,9 @@ int64 atoil(const wchar *Str)
}
return(n);
}
+#endif
-
+#ifndef __BIONIC__
const wchar* GetWide(const char *Src)
{
const size_t MaxLength=NM;
@@ -364,15 +372,16 @@ const wchar* GetWide(const char *Src)
Str[MaxLength-1]=0;
return(Str);
}
+#endif
-
+#ifndef __BIONIC__
const wchar* GetWide(const char *Src,const wchar *SrcW)
{
if (SrcW!=NULL && *SrcW!=0)
return SrcW;
return GetWide(Src);
}
-
+#endif
#ifdef _WIN_ALL
// Parse string containing parameters separated with spaces.
diff --git a/src/strfn.hpp b/src/strfn.hpp
index 9d7fee8..96bee75 100644
--- a/src/strfn.hpp
+++ b/src/strfn.hpp
@@ -2,7 +2,9 @@
#define _RAR_STRFN_
const char* NullToEmpty(const char *Str);
+#ifndef __BIONIC__
const wchar* NullToEmpty(const wchar *Str);
+#endif
char* IntNameToExt(const char *Name);
void ExtToInt(const char *Src,char *Dest);
void IntToExt(const char *Src,char *Dest);
@@ -12,17 +14,25 @@ int stricomp(const char *Str1,const char *Str2);
int strnicomp(const char *Str1,const char *Str2,size_t N);
char* RemoveEOL(char *Str);
char* RemoveLF(char *Str);
+#ifndef __BIONIC__
wchar* RemoveLF(wchar *Str);
+#endif
unsigned char loctolower(unsigned char ch);
unsigned char loctoupper(unsigned char ch);
char* strncpyz(char *dest, const char *src, size_t maxlen);
+#ifndef __BIONIC__
wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen);
+#endif
char* strncatz(char* dest, const char* src, size_t maxlen);
+#ifndef __BIONIC__
wchar* wcsncatz(wchar* dest, const wchar* src, size_t maxlen);
+#endif
unsigned char etoupper(unsigned char ch);
+#ifndef __BIONIC__
wchar etoupperw(wchar ch);
+#endif
bool IsDigit(int ch);
bool IsSpace(int ch);
@@ -34,20 +44,26 @@ uint GetDigits(uint Number);
#endif
bool LowAscii(const char *Str);
+#ifndef __BIONIC__
bool LowAscii(const wchar *Str);
+#endif
int stricompc(const char *Str1,const char *Str2);
#ifndef SFX_MODULE
+#ifndef __BIONIC__
int wcsicompc(const wchar *Str1,const wchar *Str2);
#endif
+#endif
void itoa(int64 n,char *Str);
int64 atoil(const char *Str);
+#ifndef __BIONIC__
void itoa(int64 n,wchar *Str);
int64 atoil(const wchar *Str);
const wchar* GetWide(const char *Src);
const wchar* GetWide(const char *Src,const wchar *SrcW);
const wchar* GetCmdParam(const wchar *CmdLine,wchar *Param,size_t MaxSize);
+#endif
#endif
diff --git a/src/strlist.cpp b/src/strlist.cpp
index 5e5ace2..baeb35d 100644
--- a/src/strlist.cpp
+++ b/src/strlist.cpp
@@ -10,12 +10,14 @@ void StringList::Reset()
{
Rewind();
StringData.Reset();
+#ifndef __BIONIC__
StringDataW.Reset();
+#endif
StringsCount=0;
SavePosNumber=0;
}
-
+#ifndef __BIONIC__
void StringList::AddString(const char *Str)
{
AddString(Str,NULL);
@@ -26,63 +28,88 @@ void StringList::AddString(const wchar *Str)
{
AddString(NULL,Str);
}
+#endif
-
-
+#ifndef __BIONIC__
void StringList::AddString(const char *Str,const wchar *StrW)
+#else
+void StringList::AddString(const char *Str)
+#endif
{
if (Str==NULL)
Str="";
+#ifndef __BIONIC__
if (StrW==NULL)
StrW=L"";
+#endif
size_t PrevSize=StringData.Size();
StringData.Add(strlen(Str)+1);
strcpy(&StringData[PrevSize],Str);
+#ifndef __BIONIC__
size_t PrevSizeW=StringDataW.Size();
StringDataW.Add(wcslen(StrW)+1);
wcscpy(&StringDataW[PrevSizeW],StrW);
+#endif
StringsCount++;
}
-
+#ifndef __BIONIC__
bool StringList::GetString(char *Str,size_t MaxLength)
{
return(GetString(Str,NULL,MaxLength));
}
-
bool StringList::GetString(wchar *Str,size_t MaxLength)
{
return(GetString(NULL,Str,MaxLength));
}
+#endif
-
+#ifndef __BIONIC__
bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength)
+#else
+bool StringList::GetString(char *Str,size_t MaxLength)
+#endif
{
char *StrPtr;
+#ifndef __BIONIC__
wchar *StrPtrW;
if (!GetString(&StrPtr,&StrPtrW))
+#else
+ if (!GetString(&StrPtr))
+#endif
return(false);
+
if (Str!=NULL)
strncpy(Str,StrPtr,MaxLength);
+#ifndef __BIONIC__
if (StrW!=NULL)
wcsncpy(StrW,StrPtrW,MaxLength);
+#endif
return(true);
}
#ifndef SFX_MODULE
+#ifndef __BIONIC__
bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum)
+#else
+bool StringList::GetString(char *Str,size_t MaxLength,int StringNum)
+#endif
{
SavePosition();
Rewind();
bool RetCode=true;
while (StringNum-- >=0)
+#ifndef __BIONIC__
if (!GetString(Str,StrW,MaxLength))
+#else
+ if (!GetString(Str,MaxLength))
+#endif
{
RetCode=false;
break;
@@ -96,30 +123,44 @@ bool StringList::GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum)
char* StringList::GetString()
{
char *Str;
+#ifndef __BIONIC__
GetString(&Str,NULL);
+#else
+ GetString(&Str);
+#endif
return(Str);
}
-
+#ifndef __BIONIC__
wchar* StringList::GetStringW()
{
wchar *StrW;
GetString(NULL,&StrW);
return(StrW);
}
+#endif
-
+#ifndef __BIONIC__
bool StringList::GetString(char **Str,wchar **StrW)
+#else
+bool StringList::GetString(char **Str)
+#endif
{
// First check would be enough, because both buffers grow synchronously,
// but we check both for extra fail proof.
+#ifndef __BIONIC__
if (CurPos>=StringData.Size() || CurPosW>=StringDataW.Size())
+#else
+ if (CurPos>=StringData.Size())
+#endif
{
// No more strings left unprocessed.
if (Str!=NULL)
*Str=NULL;
+#ifndef __BIONIC__
if (StrW!=NULL)
*StrW=NULL;
+#endif
return(false);
}
@@ -130,10 +171,12 @@ bool StringList::GetString(char **Str,wchar **StrW)
if (Str!=NULL)
*Str=CurStr;
+#ifndef __BIONIC__
wchar *CurStrW=&StringDataW[CurPosW];
CurPosW+=wcslen(CurStrW)+1;
if (StrW!=NULL)
*StrW=CurStrW;
+#endif
return(true);
}
@@ -142,33 +185,49 @@ bool StringList::GetString(char **Str,wchar **StrW)
void StringList::Rewind()
{
CurPos=0;
+#ifndef __BIONIC__
CurPosW=0;
+#endif
}
// Return the total size of usual and Unicode characters stored in the list.
size_t StringList::GetCharCount()
{
+#ifndef __BIONIC__
return(StringData.Size()+StringDataW.Size());
+#else
+ return(StringData.Size());
+#endif
}
#ifndef SFX_MODULE
+#ifndef __BIONIC__
bool StringList::Search(char *Str,wchar *StrW,bool CaseSensitive)
+#else
+bool StringList::Search(char *Str,bool CaseSensitive)
+#endif
{
SavePosition();
Rewind();
bool Found=false;
char *CurStr;
+#ifndef __BIONIC__
wchar *CurStrW;
while (GetString(&CurStr,&CurStrW))
+#else
+ while (GetString(&CurStr))
+#endif
{
if (Str!=NULL && CurStr!=NULL)
if ((CaseSensitive ? strcmp(Str,CurStr):stricomp(Str,CurStr))!=0)
continue;
+#ifndef __BIONIC__
if (StrW!=NULL && CurStrW!=NULL)
if ((CaseSensitive ? wcscmp(StrW,CurStrW):wcsicomp(StrW,CurStrW))!=0)
continue;
+#endif
Found=true;
break;
}
@@ -184,7 +243,9 @@ void StringList::SavePosition()
if (SavePosNumber<ASIZE(SaveCurPos))
{
SaveCurPos[SavePosNumber]=CurPos;
+#ifndef __BIONIC__
SaveCurPosW[SavePosNumber]=CurPosW;
+#endif
SavePosNumber++;
}
}
@@ -198,7 +259,9 @@ void StringList::RestorePosition()
{
SavePosNumber--;
CurPos=SaveCurPos[SavePosNumber];
+#ifndef __BIONIC__
CurPosW=SaveCurPosW[SavePosNumber];
+#endif
}
}
#endif
diff --git a/src/strlist.hpp b/src/strlist.hpp
index 4c8985e..9675b75 100644
--- a/src/strlist.hpp
+++ b/src/strlist.hpp
@@ -7,29 +7,49 @@ class StringList
Array<char> StringData;
size_t CurPos;
+#ifndef __BIONIC__
Array<wchar> StringDataW;
size_t CurPosW;
+#endif
uint StringsCount;
+#ifndef __BIONIC__
size_t SaveCurPos[16],SaveCurPosW[16],SavePosNumber;
+#else
+ size_t SaveCurPos[16],SavePosNumber;
+#endif
public:
StringList();
void Reset();
void AddString(const char *Str);
+#ifndef __BIONIC__
void AddString(const wchar *Str);
void AddString(const char *Str,const wchar *StrW);
+#endif
bool GetString(char *Str,size_t MaxLength);
+#ifndef __BIONIC__
bool GetString(wchar *Str,size_t MaxLength);
bool GetString(char *Str,wchar *StrW,size_t MaxLength);
bool GetString(char *Str,wchar *StrW,size_t MaxLength,int StringNum);
+#else
+ bool GetString(char *Str,size_t MaxLength,int StringNum);
+#endif
char* GetString();
+#ifndef __BIONIC__
wchar* GetStringW();
bool GetString(char **Str,wchar **StrW);
+#else
+ bool GetString(char **Str);
+#endif
void Rewind();
uint ItemsCount() {return(StringsCount);};
size_t GetCharCount();
+#ifndef __BIONIC__
bool Search(char *Str,wchar *StrW,bool CaseSensitive);
+#else
+ bool Search(char *Str,bool CaseSensitive);
+#endif
void SavePosition();
void RestorePosition();
};
diff --git a/src/ulinks.cpp b/src/ulinks.cpp
index c3c828d..e0bc84d 100644
--- a/src/ulinks.cpp
+++ b/src/ulinks.cpp
@@ -13,7 +13,11 @@ bool ExtractLink(ComprDataIO &DataIO,Archive &Arc,const char *LinkName,uint &Lin
LinkTarget[DataSize]=0;
if (Create)
{
+#ifndef __BIONIC__
CreatePath(LinkName,NULL,true);
+#else
+ CreatePath(LinkName,true);
+#endif
if (symlink(LinkTarget,LinkName)==-1) // Error.
if (errno==EEXIST)
Log(Arc.FileName,St(MSymLinkExists),LinkName);
diff --git a/src/uowners.cpp b/src/uowners.cpp
index 913aaef..3babc28 100644
--- a/src/uowners.cpp
+++ b/src/uowners.cpp
@@ -29,7 +29,11 @@ void ExtractUnixOwner(Archive &Arc,char *FileName)
ErrHandler.SetErrorCode(RARX_CRC);
return;
}
+#ifndef __BIONIC__
uint Attr=GetFileAttr(FileName,NULL);
+#else
+ uint Attr=GetFileAttr(FileName);
+#endif
gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE)
if (lchown(FileName,OwnerID,GroupID)!=0)
@@ -40,7 +44,11 @@ void ExtractUnixOwner(Archive &Arc,char *FileName)
Log(Arc.FileName,St(MSetOwnersError),FileName);
ErrHandler.SetErrorCode(RARX_CREATE);
}
+#ifndef __BIONIC__
SetFileAttr(FileName,NULL,Attr);
+#else
+ SetFileAttr(FileName,Attr);
+#endif
}
@@ -69,7 +77,11 @@ void ExtractUnixOwnerNew(Archive &Arc,char *FileName)
ErrHandler.SetErrorCode(RARX_CRC);
return;
}
+#ifndef __BIONIC__
uint Attr=GetFileAttr(FileName,NULL);
+#else
+ uint Attr=GetFileAttr(FileName);
+#endif
gid_t GroupID=gr->gr_gid;
#if defined(SAVE_LINKS) && !defined(_APPLE)
if (lchown(FileName,OwnerID,GroupID)!=0)
@@ -80,5 +92,9 @@ void ExtractUnixOwnerNew(Archive &Arc,char *FileName)
Log(Arc.FileName,St(MSetOwnersError),FileName);
ErrHandler.SetErrorCode(RARX_CREATE);
}
+#ifndef __BIONIC__
SetFileAttr(FileName,NULL,Attr);
+#else
+ SetFileAttr(FileName,Attr);
+#endif
}
diff --git a/src/volume.cpp b/src/volume.cpp
index 073edb8..b711575 100644
--- a/src/volume.cpp
+++ b/src/volume.cpp
@@ -33,10 +33,16 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
Arc.Close();
char NextName[NM];
+#ifndef __BIONIC__
wchar NextNameW[NM];
+#endif
strcpy(NextName,Arc.FileName);
+#ifndef __BIONIC__
wcscpy(NextNameW,Arc.FileNameW);
NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+#else
+ NextVolumeName(NextName,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+#endif
#if !defined(SFX_MODULE) && !defined(RARDLL)
bool RecoveryDone=false;
@@ -47,12 +53,20 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
// In -vp mode we force the pause before next volume even if it is present
// and even if we are on the hard disk. It is important when user does not
// want to process partially downloaded volumes preliminary.
+#ifndef __BIONIC__
if (Cmd->VolumePause && !AskNextVol(NextName,NextNameW))
+#else
+ if (Cmd->VolumePause && !AskNextVol(NextName))
+#endif
FailedOpen=true;
#endif
if (!FailedOpen)
+#ifndef __BIONIC__
while (!Arc.Open(NextName,NextNameW,0))
+#else
+ while (!Arc.Open(NextName,0))
+#endif
{
// We need to open a new volume which size was not calculated
// in total size before, so we cannot calculate the total progress
@@ -66,15 +80,27 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
// Checking for new style volumes renamed by user to old style
// name format. Some users did it for unknown reason.
char AltNextName[NM];
+#ifndef __BIONIC__
wchar AltNextNameW[NM];
+#endif
strcpy(AltNextName,Arc.FileName);
+#ifndef __BIONIC__
wcscpy(AltNextNameW,Arc.FileNameW);
NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
+#else
+ NextVolumeName(AltNextName,ASIZE(AltNextName),true);
+#endif
OldSchemeTested=true;
+#ifndef __BIONIC__
if (Arc.Open(AltNextName,AltNextNameW,0))
+#else
+ if (Arc.Open(AltNextName,0))
+#endif
{
strcpy(NextName,AltNextName);
+#ifndef __BIONIC__
wcscpy(NextNameW,AltNextNameW);
+#endif
break;
}
}
@@ -144,7 +170,11 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
if (!RecoveryDone)
{
RecVolumes RecVol;
+#ifndef __BIONIC__
RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true);
+#else
+ RecVol.Restore(Cmd,Arc.FileName,true);
+#endif
RecoveryDone=true;
continue;
}
@@ -158,7 +188,11 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
}
#endif
#ifndef SILENT
+#ifndef __BIONIC__
if (Cmd->AllYes || !AskNextVol(NextName,NextNameW))
+#else
+ if (Cmd->AllYes || !AskNextVol(NextName))
+#endif
#endif
{
FailedOpen=true;
@@ -173,7 +207,11 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
#if !defined(SILENT) && !defined(_WIN_CE)
Log(Arc.FileName,St(MAbsNextVol),NextName);
#endif
+#ifndef __BIONIC__
Arc.Open(Arc.FileName,Arc.FileNameW,0);
+#else
+ Arc.Open(Arc.FileName,0);
+#endif
Arc.Seek(PosBeforeClose,SEEK_SET);
return(false);
}
@@ -220,6 +258,7 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
char OutName[NM];
IntToExt(Arc.NewLhd.FileName,OutName);
#ifdef UNICODE_SUPPORTED
+#ifndef __BIONIC__
bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled();
if (WideName)
{
@@ -230,6 +269,7 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
strcpy(OutName,Name);
}
#endif
+#endif
mprintf(St(MExtrPoints),OutName);
if (!Cmd->DisablePercentage)
mprintf(" ");
@@ -270,7 +310,11 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
#ifndef SILENT
+#ifndef __BIONIC__
bool AskNextVol(char *ArcName,wchar *ArcNameW)
+#else
+bool AskNextVol(char *ArcName)
+#endif
{
eprintf(St(MAskNextVol),ArcName);
if (Ask(St(MContinueQuit))==2)
diff --git a/src/volume.hpp b/src/volume.hpp
index 22dd5ba..e70c9a7 100644
--- a/src/volume.hpp
+++ b/src/volume.hpp
@@ -6,6 +6,10 @@ void SplitArchive(Archive &Arc,FileHeader *fh,int64 *HeaderPos,
bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,
char Command);
void SetVolWrite(Archive &Dest,int64 VolSize);
+#ifndef __BIONIC__
bool AskNextVol(char *ArcName,wchar *ArcNameW);
+#else
+bool AskNextVol(char *ArcName);
+#endif
#endif