The warning message from gcc doesn't make that much sense in my reading
as there is no loop which could overflow here, but it is better to use
our SPtrArray wrapping anyway which fixes the warning as well.
warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]
delete[] Dsc;
Git-Dch: Ignore
Reported-By: gcc -Wunsafe-loop-optimizations
pkgAcquire Fetcher;
Fetcher.SetLog(&Stat);
pkgAcquire Fetcher;
Fetcher.SetLog(&Stat);
- DscFile *Dsc = new DscFile[CmdL.FileSize()];
+ SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
// insert all downloaded uris into this set to avoid downloading them
// twice
// insert all downloaded uris into this set to avoid downloading them
// twice
pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
if (Last == 0) {
pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
if (Last == 0) {
return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
}
return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
}
// Back track
vector<pkgSrcRecords::File> Lst;
if (Last->Files(Lst) == false) {
// Back track
vector<pkgSrcRecords::File> Lst;
if (Last->Files(Lst) == false) {
struct statvfs Buf;
string OutputDir = ".";
if (statvfs(OutputDir.c_str(),&Buf) != 0) {
struct statvfs Buf;
string OutputDir = ".";
if (statvfs(OutputDir.c_str(),&Buf) != 0) {
if (errno == EOVERFLOW)
return _error->WarningE("statvfs",_("Couldn't determine free space in %s"),
OutputDir.c_str());
if (errno == EOVERFLOW)
return _error->WarningE("statvfs",_("Couldn't determine free space in %s"),
OutputDir.c_str());
|| unsigned(Stat.f_type) != RAMFS_MAGIC
#endif
) {
|| unsigned(Stat.f_type) != RAMFS_MAGIC
#endif
) {
return _error->Error(_("You don't have enough free space in %s"),
OutputDir.c_str());
}
return _error->Error(_("You don't have enough free space in %s"),
OutputDir.c_str());
}
{
for (unsigned I = 0; I != J; I++)
ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str());
{
for (unsigned I = 0; I != J; I++)
ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str());
for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
bool Failed = false;
if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
{
bool Failed = false;
if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
{
return _error->Error(_("Failed to fetch some archives."));
}
if (_config->FindB("APT::Get::Download-only",false) == true)
{
c1out << _("Download complete and in download only mode") << endl;
return _error->Error(_("Failed to fetch some archives."));
}
if (_config->FindB("APT::Get::Download-only",false) == true)
{
c1out << _("Download complete and in download only mode") << endl;
// Wait for the subprocess
int Status = 0;
// Wait for the subprocess
int Status = 0;