Skip to content

Commit

Permalink
Merge pull request #437 from simsong/fix-shadow
Browse files Browse the repository at this point in the history
restart() was improperly declared with arguments
  • Loading branch information
simsong authored Jan 14, 2024
2 parents 92b29c3 + 724bc63 commit 3eb2a98
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 46 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/check-jo-work.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ jobs:
build:
runs-on: ubuntu-latest

if: false # disabled

steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion src/be20_api
2 changes: 1 addition & 1 deletion src/bulk_extractor_restarter.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public:;
std::filesystem::rename(report_path, report_path_bak);
}
#else
void restart(Phase1::Config &cfg, scanner_config &sc) {
void restart() {
throw std::runtime_error("Compiled without libexpat; cannot restart.");
}
#endif
Expand Down
13 changes: 7 additions & 6 deletions src/rar/errhnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void ErrorHandler::CheckLongPathErrMsg(const char *FileName,const wchar *FileNam
}


#ifdef REMOVE_ME
void ErrorHandler::ReadErrorMsg(const char *ArcName,const wchar *ArcNameW,const char *FileName,const wchar *FileNameW)
{
#ifndef SILENT
Expand All @@ -141,6 +142,7 @@ void ErrorHandler::WriteErrorMsg(const char *ArcName,const wchar *ArcNameW,const
SysErrMsg();
#endif
}
#endif


void ErrorHandler::Exit(int ExitCode_)
Expand All @@ -149,19 +151,22 @@ void ErrorHandler::Exit(int ExitCode_)
}


#ifdef REMOVE_ME
#ifndef GUI
void ErrorHandler::ErrMsg(const char *ArcName,const char *fmt,...)
{
safebuf char Msg[NM+1024];
const size_t buflen=NM+1024;
safebuf char Msg[buflen];
va_list argptr;
va_start(argptr,fmt);
vsprintf(Msg,fmt,argptr);
vsnprintf(Msg,buflen,fmt,argptr);
va_end(argptr);
if (*Msg)
{
}
}
#endif
#endif


void ErrorHandler::SetErrorCode(int Code)
Expand Down Expand Up @@ -241,7 +246,3 @@ void ErrorHandler::SysErrMsg()

#endif
}




50 changes: 26 additions & 24 deletions src/rar/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void File::InitFile(void* ptr, int64 length)
initptrlocation = (byte*)ptr; //initialize the initial pointer location
ptrlocation = (byte*)ptr; //initialize the current pointer location
ptrlength = length; //set the length of the file
return;
return;
}

/**
Expand All @@ -106,7 +106,7 @@ const File& File::operator=(const File &SrcFile)


bool File::Open(const char *Name,const wchar *NameW,bool OpenShared_,bool Update)
{ //This function does nothing. It simply complies with the File class.
{ //This function does nothing. It simply complies with the File class.
//This class should utilize the Init(void* ptr) function to open a file.
//hFile = hNewFile;
return true;
Expand Down Expand Up @@ -288,7 +288,7 @@ bool File::WCreate(const char *Name,const wchar *NameW,bool ShareRead)
This function does nothing. It simply complies with the File class.
*/
bool File::Close()
{
{
ptrlocation = initptrlocation; //reset Pointer location to the initial spot
return true;
/*bool Success=true;
Expand Down Expand Up @@ -336,7 +336,7 @@ void File::Flush()
This is not called in bulk_extractor.
*/
bool File::Delete()
{
{
if (HandleType!=FILE_HANDLENORMAL)
return(false);
if (hFile!=BAD_HANDLE)
Expand All @@ -350,7 +350,7 @@ if (HandleType!=FILE_HANDLENORMAL)
This function should never be called since the file name should never be changed
*/
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)
Expand All @@ -372,7 +372,7 @@ bool File::Rename(const char *NewName,const wchar *NewNameW)
This is not called in bulk_extractor
*/
void File::Write(const void *Data,size_t Size)
{ //This is not called in bulk_extractor
{ //This is not called in bulk_extractor
if (Size==0)
return;
#ifndef _WIN_CE
Expand Down Expand Up @@ -447,7 +447,7 @@ void File::Write(const void *Data,size_t Size)

/**
Read data from memory of size <code>Size</code>. Calls the <code>DirectRead(Data,Size)</code> function.
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Size - the length, in bytes, of the <code>Data</code> variable
@return the size that was read from the memory location
*/
Expand All @@ -456,7 +456,7 @@ int File::Read(void *Data,size_t Size)

//call directRead
int readsize = DirectRead(Data, Size);

return readsize;

/*int64 FilePos=0; // Initialized only to suppress some compilers warning.
Expand Down Expand Up @@ -496,7 +496,7 @@ int File::Read(void *Data,size_t Size)

/**
Read data from memory of size <code>Size</code>. Calls the <code>DirectRead(Data,Size)</code> function.
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Size - the length, in bytes, of the <code>Data</code> variable
@return the size that was read from the memory location
*/
Expand All @@ -508,7 +508,7 @@ int File::DirectRead(void *Data,size_t Size)

/**
Read data from memory of size <code>Size</code>. Calls the <code>DirectRead(Data,Size)</code> function.
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Data - a pointer to the memory location of the RAR file to be extracted
@param Size - the length, in bytes, of the <code>Data</code> variable
@return the size that was read from the memory location. If a '-1' is returned, an error has occurred.
*/
Expand All @@ -525,10 +525,10 @@ int File::DirectRead(byte *Data,size_t Size)
{ //verifies that we will be in bounds
result = Size;
memcpy(Data, ptrlocation, Size);


ptrlocation += Size; //adjust the pointer location

//Tell(); //for debugging purposes
/*for(int i = 0; i < result; i++)
{
Expand Down Expand Up @@ -569,7 +569,7 @@ int File::DirectRead(byte *Data,size_t Size)
}
return(Read);
#else
if (LastWrite)no
if (LastWrite)no
{
fflush(hFile);
LastWrite=false;
Expand All @@ -585,7 +585,7 @@ int File::DirectRead(byte *Data,size_t Size)
/**
Moves the pointer in the file to a specified location. Calls the <code>RawSeek</code> function.
@param Offset - the length from the current position
@param Method - the method to move the pointer.
@param Method - the method to move the pointer.
If <code>SEEK_SET</code>, move the pointer <code>Offset</code> number of bytes to the new location in memory.
If <code>SEEK_END</code>, move the pointer to the end of the file (NOT IMPLEMENTED)
If <code>SEEK_CUR</code>, move the pointer (NOT IMPLEMENTED).
Expand All @@ -600,7 +600,7 @@ void File::Seek(int64 Offset,int Method)
/**
Moves the pointer in the file to a specified location
@param Offset - the length from the current position
@param Method - the method to move the pointer.
@param Method - the method to move the pointer.
If <code>SEEK_SET</code>, move the pointer <code>Offset</code> number of bytes to the new location in memory.
If <code>SEEK_END</code>, move the pointer to the end of the file (NOT IMPLEMENTED)
If <code>SEEK_CUR</code>, move the pointer (NOT IMPLEMENTED).
Expand All @@ -610,7 +610,7 @@ bool File::RawSeek(int64 Offset,int Method)
/* if (hFile==BAD_HANDLE)
return(true);*/ //we will assume all is well if we have gone this far.


if(Method == SEEK_SET)
{
/*if(&ptrlocation + Offset > &initptrlocation + ptrlength)
Expand Down Expand Up @@ -745,7 +745,7 @@ int64 File::Tell()
this is not needed for bulk_extractor
*/
void File::Prealloc(int64 Size)
{
{
#ifdef _WIN_ALL
if (RawSeek(Size,SEEK_SET))
{
Expand Down Expand Up @@ -873,7 +873,7 @@ void File::GetOpenFileTime(RarTime *ft)
int64 File::FileLength()
{ //returns length of file
return ptrlength;

/* SaveFilePos SavePos(*this);
Seek(0,SEEK_END);
return(Tell());*/
Expand Down Expand Up @@ -905,6 +905,7 @@ bool File::IsDevice()
}


#ifdef DELETE_ME
#ifndef SFX_MODULE
/**
this is not needed for bulk_extractor
Expand All @@ -913,8 +914,9 @@ void File::fprintf(const char *fmt,...)
{ //This function is not called in bulk_extractor
va_list argptr;
va_start(argptr,fmt);
safebuf char Msg[2*NM+1024],OutMsg[2*NM+1024];
vsprintf(Msg,fmt,argptr);
const size_t buflen = 2*NM+1024;
safebuf char Msg[buflen],OutMsg[buflen];
vsnprintf(Msg,buflen,fmt,argptr);
#ifdef _WIN_ALL
for (int Src=0,Dest=0;;Src++)
{
Expand All @@ -932,16 +934,15 @@ void File::fprintf(const char *fmt,...)
va_end(argptr);
}
#endif
#endif

/**
this is not needed for bulk_extractor
*/
bool File::RemoveCreated()
{ //This file is not called in bulk_extractor
return false;
}


#ifdef DELETE_ME
#ifndef SFX_MODULE
/**
this is not needed for bulk_extractor
Expand All @@ -966,6 +967,7 @@ int64 File::Copy(File &Dest,int64 Length)
}
return(CopySize);
}
#endif

/**
@return the current pointer location as a <code>void*</code> type pointer
Expand Down
27 changes: 16 additions & 11 deletions src/rar/pathfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ bool IsDiskLetter(const wchar *Path)
}


#ifdef REMOVE_TEST_1
void GetPathRoot(const char *Path,char *Root)
{
*Root=0;
Expand Down Expand Up @@ -1002,6 +1003,7 @@ void GetPathRoot(const wchar *Path,wchar *Root)
{
*Root=0;
}
#endif


int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate)
Expand Down Expand Up @@ -1101,6 +1103,7 @@ wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,bool NewNumberin
#endif


#ifdef DELETE_ME_NOT_NEEDED_WITH_BULK_EXTRACTOR
#ifndef SFX_MODULE
static void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
uint ArcNumber,bool &ArcNumPresent);
Expand Down Expand Up @@ -1253,18 +1256,19 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
if (StartWeekDay%7>=4)
CurWeek++;

char Field[10][12]; // make 12 to avoid warnings below
const size_t flen=12;
char Field[10][flen]; // make 12 to avoid warnings below

sprintf(Field[0],"%04d",rlt.Year);
sprintf(Field[1],"%02d",rlt.Month);
sprintf(Field[2],"%02d",rlt.Day);
sprintf(Field[3],"%02d",rlt.Hour);
sprintf(Field[4],"%02d",rlt.Minute);
sprintf(Field[5],"%02d",rlt.Second);
sprintf(Field[6],"%02d",CurWeek);
sprintf(Field[7],"%d",WeekDay+1);
sprintf(Field[8],"%03d",rlt.yDay+1);
sprintf(Field[9],"%05d",ArcNumber);
snprintf(Field[0],flen,"%04d",rlt.Year);
snprintf(Field[1],flen,"%02d",rlt.Month);
snprintf(Field[2],flen,"%02d",rlt.Day);
snprintf(Field[3],flen,"%02d",rlt.Hour);
snprintf(Field[4],flen,"%02d",rlt.Minute);
snprintf(Field[5],flen,"%02d",rlt.Second);
snprintf(Field[6],flen,"%02d",CurWeek);
snprintf(Field[7],flen,"%d",WeekDay+1);
snprintf(Field[8],flen,"%03d",rlt.yDay+1);
snprintf(Field[9],flen,"%05d",ArcNumber);

const char *MaskChars="YMDHISWAEN";

Expand Down Expand Up @@ -1354,6 +1358,7 @@ void GenArcName(char *ArcName,wchar *ArcNameW,char *GenerateMask,
wcscat(ArcNameW,ExtW);
}
#endif
#endif


wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW,size_t DestSize)
Expand Down
4 changes: 3 additions & 1 deletion src/rar/timefn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void RarTime::SetDos(uint DosTime)
}


#ifdef REMOVED_FOR_SAFETY
#if !defined(GUI) || !defined(SFX_MODULE)
void RarTime::GetText(char *DateStr,bool FullYear)
{
Expand All @@ -241,6 +242,7 @@ void RarTime::GetText(char *DateStr,bool FullYear)
sprintf(DateStr,"%02u-%02u-%02u %02u:%02u",rlt.Day,rlt.Month,rlt.Year%100,rlt.Hour,rlt.Minute);
}
#endif
#endif


std::string RarTime::GetLocalTimeXML()
Expand All @@ -256,7 +258,7 @@ std::string RarTime::GetLocalTimeXML()
<< "</Reminder>\n<wDay>" << rlt.wDay
<< "</wDay>\n<yDay>" << rlt.yDay
<< "</yDay>\n";

return oss.str();
}

Expand Down

0 comments on commit 3eb2a98

Please sign in to comment.