Fix assorted warnings on gcc 8.2.2

This commit is contained in:
Brian Cox 2018-10-13 16:54:16 -07:00
parent b2e7db6ba9
commit ee71c537a8
5 changed files with 24 additions and 16 deletions

View File

@ -790,7 +790,7 @@ int cFileArchive::Write(const void* pDest, int count) // throw(eArchive)
// increase the size, if needed
if (mReadHead > mFileSize)
{
#if 0 // IS_SUNPRO \
#if 0 // IS_SUNPRO
// These two lines seem to be all there is between code that crashes and code that works for sunpro
cDebug d("cFileArchive::Write()");
d.TraceDebug(_T("file(%s) adjusted mFileSize = %d mReadHead = %d\n"), mCurrentFilename.c_str(), (int)mFileSize, (int)mReadHead);

View File

@ -141,7 +141,7 @@ void cFSPropDisplayer::Merge(const iFCOPropDisplayer* const ppd)
if (ppd->GetType() != this->GetType())
ASSERT(false);
const cFSPropDisplayer* const pfspd = static_cast<const cFSPropDisplayer* const>(ppd);
const cFSPropDisplayer* const pfspd = static_cast<const cFSPropDisplayer*>(ppd);
// merge propvectors
mpvPropsWeDisplay |= pfspd->GetPropsConverted();
@ -260,7 +260,7 @@ void cFSPropDisplayer::InitForProp(const iFCO* const pFCO, const int propIdx)
case cFSPropSet::PROP_UID:
{
const int64& i64UID =
static_cast<const cFCOPropInt64* const>(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_UID))->GetValue();
static_cast<const cFCOPropInt64*>(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_UID))->GetValue();
// check if prop is in table. if it is, then don't hit the FS
TSTRING tstrDummy;
@ -279,7 +279,7 @@ void cFSPropDisplayer::InitForProp(const iFCO* const pFCO, const int propIdx)
case cFSPropSet::PROP_GID:
{
const int64& i64GID =
static_cast<const cFCOPropInt64* const>(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_GID))->GetValue();
static_cast<const cFCOPropInt64*>(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_GID))->GetValue();
// check if prop is in table. if it is, then don't hit the FS
TSTRING tstrDummy;
@ -330,7 +330,9 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx
case cFSPropSet::PROP_SIZE:
case cFSPropSet::PROP_NLINK:
{
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64* const>(pProp);
// Note that supplying both consts within the static cast makes gcc emit a
// "type qualifiers ignored on cast result type" (-Wignored-qualifiers) warning.
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64*>(pProp);
cTWLocale::FormatNumber(pTypedProp->GetValue(), strProp);
}
break;
@ -338,14 +340,14 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx
case cFSPropSet::PROP_MTIME:
case cFSPropSet::PROP_CTIME:
{
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64* const>(pProp);
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64*>(pProp);
int64 i64 = pTypedProp->GetValue();
cTWLocale::FormatTime(i64, strProp);
}
break;
case cFSPropSet::PROP_MODE:
{
const cFCOPropUint64* const pTypedProp = static_cast<const cFCOPropUint64* const>(pProp);
const cFCOPropUint64* const pTypedProp = static_cast<const cFCOPropUint64*>(pProp);
ASSERT(pTypedProp != 0);
iFSServices::GetInstance()->ConvertModeToString(pTypedProp->GetValue(), strProp);
@ -353,7 +355,7 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx
break;
case cFSPropSet::PROP_UID:
{
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64* const>(pProp);
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64*>(pProp);
ASSERT(pTypedProp != 0);
if (GetUsername(pTypedProp->GetValue(), strProp))
{
@ -367,7 +369,7 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx
break;
case cFSPropSet::PROP_GID:
{
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64* const>(pProp);
const cFCOPropInt64* const pTypedProp = static_cast<const cFCOPropInt64*>(pProp);
ASSERT(pTypedProp != 0);
if (GetGroupname(pTypedProp->GetValue(), strProp))
{

View File

@ -103,10 +103,12 @@ void TestFCOReport()
cFSObject* newChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file")));
cFCOPropVector changedPropVector;
/*
//Calculate the time taken to generate the test report:
time_t* dummy_arg = NULL;
time_t time_finish;
//time_t time_begin = time(dummy_arg);
time_t time_begin = time(dummy_arg);
*/
{
cFCOReport report;
@ -122,10 +124,12 @@ void TestFCOReport()
it.GetRemovedSet()->Insert(removedFCO);
report.AddChangedFCO(it, oldChangedFCO, newChangedFCO, changedPropVector);
/*
//Store the time taken to generate the test report:
time_finish = time(dummy_arg);
//report.SetCreationTime( (int64)difftime(time_finish, time_begin));
//d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime());
report.SetCreationTime( (int64)difftime(time_finish, time_begin));
d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime());
*/
d.TraceDebug("Before serializing report:\n");
TraceReport(report, d);

View File

@ -62,6 +62,7 @@
void MakeFile(TSTRING& fcoNameMakeMe);
void MakeDir(const TCHAR* const lpszDirName);
#if 0 // Not used untill this test is fixed
// we use this instead of TraceContents() so we can test the report iterators.
static void TraceReport(const cFCOReport& r, cDebug& d)
{
@ -105,6 +106,7 @@ static void TraceReport(const cFCOReport& r, cDebug& d)
}
}
}
#endif
/*
//
@ -156,7 +158,7 @@ void TestTextReportViewer()
fcoNameTempFile = fcoNameTempDir += _T("twtempXXXXXX");
pFSServices->MakeTempFilename( fcoNameTempFile );
}
catch(eFSServices& /* e */)
catch(const eFSServices& /* e */)
{
// TODO: properly handle error
TEST( false );
@ -459,7 +461,7 @@ void MakeFile(TSTRING& strNameMakeMe)
TEST(file);
file.close();
}
catch (eFSServices e)
catch (const eFSServices& e)
{
TEST(false);
}

View File

@ -111,7 +111,7 @@ bool cFileUtil::IsDir(const TSTRING& fileName)
{
iFSServices::GetInstance()->Stat(fileName, s);
}
catch (eFSServices)
catch (const eFSServices&)
{
return false;
}
@ -126,7 +126,7 @@ bool cFileUtil::IsRegularFile(const TSTRING& fileName)
{
iFSServices::GetInstance()->Stat(fileName, s);
}
catch (eFSServices)
catch (const eFSServices&)
{
return false;
}