Browse Source

warning: cast from type A to type B casts away qualifiers [-Wcast-qual]

Git-Dch: Ignore
Reported-By: gcc -Wcast-qual
tags/debian/0.9.16
David Kalnischkies 7 years ago
parent
commit
cf4ff3b78d
6 changed files with 35 additions and 35 deletions
  1. +3
    -3
      apt-inst/contrib/extracttar.cc
  2. +1
    -1
      apt-pkg/cacheiterators.h
  3. +2
    -2
      apt-pkg/contrib/fileutl.cc
  4. +1
    -1
      apt-pkg/contrib/hashes.h
  5. +21
    -21
      apt-pkg/contrib/hashsum_template.h
  6. +7
    -7
      apt-pkg/pkgcachegen.cc

+ 3
- 3
apt-inst/contrib/extracttar.cc View File

@@ -120,7 +120,7 @@ bool ExtractTar::StartGzip()
int Pipes[2];
if (pipe(Pipes) != 0)
return _error->Errno("pipe",_("Failed to create pipes"));
// Fork off the process
GZPid = ExecFork();

@@ -136,9 +136,9 @@ bool ExtractTar::StartGzip()
dup2(Fd,STDERR_FILENO);
close(Fd);
SetCloseExec(STDOUT_FILENO,false);
SetCloseExec(STDIN_FILENO,false);
SetCloseExec(STDIN_FILENO,false);
SetCloseExec(STDERR_FILENO,false);
const char *Args[3];
string confvar = string("dir::bin::") + DecompressProg;
string argv0 = _config->Find(confvar.c_str(),DecompressProg.c_str());


+ 1
- 1
apt-pkg/cacheiterators.h View File

@@ -79,7 +79,7 @@ template<typename Str, typename Itr> class pkgCache::Iterator :
void ReMap(void const * const oldMap, void const * const newMap) {
if (Owner == 0 || S == 0)
return;
S += (Str*)(newMap) - (Str*)(oldMap);
S += (Str const * const)(newMap) - (Str const * const)(oldMap);
}

// Constructors - look out for the variable assigning


+ 2
- 2
apt-pkg/contrib/fileutl.cc View File

@@ -1400,7 +1400,7 @@ bool FileFd::Write(const void *From,unsigned long long Size)
return FileFdErrno("write",_("Write error"));
}
From = (char *)From + Res;
From = (char const *)From + Res;
Size -= Res;
if (d != NULL)
d->seekpos += Res;
@@ -1424,7 +1424,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
if (Res < 0)
return _error->Errno("write",_("Write error"));

From = (char *)From + Res;
From = (char const *)From + Res;
Size -= Res;
}
while (Res > 0 && Size > 0);


+ 1
- 1
apt-pkg/contrib/hashes.h View File

@@ -77,7 +77,7 @@ class Hashes
{
return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
};
inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
inline bool Add(const char *Data) {return Add((unsigned char const *)Data,strlen(Data));};
inline bool AddFD(int const Fd,unsigned long long Size = 0)
{ return AddFD(Fd, Size, true, true, true, true); };
bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,


+ 21
- 21
apt-pkg/contrib/hashsum_template.h View File

@@ -28,18 +28,18 @@ template<int N>
class HashSumValue
{
unsigned char Sum[N/8];
public:

// Accessors
bool operator ==(const HashSumValue &rhs) const
{
return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
};
}
bool operator !=(const HashSumValue &rhs) const
{
return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0;
};
}

std::string Value() const
{
@@ -49,7 +49,7 @@ class HashSumValue
};
char Result[((N/8)*2)+1];
Result[(N/8)*2] = 0;
// Convert each char into two letters
int J = 0;
int I = 0;
@@ -59,31 +59,31 @@ class HashSumValue
Result[I + 1] = Conv[Sum[J] & 0xF];
}
return std::string(Result);
};
}
inline void Value(unsigned char S[N/8])
{
for (int I = 0; I != sizeof(Sum); I++)
for (int I = 0; I != sizeof(Sum); ++I)
S[I] = Sum[I];
};
}

inline operator std::string() const
inline operator std::string() const
{
return Value();
};
}

bool Set(std::string Str)
bool Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
};
}

inline void Set(unsigned char S[N/8])
inline void Set(unsigned char S[N/8])
{
for (int I = 0; I != sizeof(Sum); I++)
for (int I = 0; I != sizeof(Sum); ++I)
Sum[I] = S[I];
};
}

HashSumValue(std::string Str)
HashSumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -99,17 +99,17 @@ class SummationImplementation
public:
virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0;
inline bool Add(const char *inbuf, unsigned long long const inlen)
{ return Add((unsigned char *)inbuf, inlen); };
{ return Add((const unsigned char *)inbuf, inlen); }

inline bool Add(const unsigned char *Data)
{ return Add(Data, strlen((const char *)Data)); };
{ return Add(Data, strlen((const char *)Data)); }
inline bool Add(const char *Data)
{ return Add((const unsigned char *)Data, strlen((const char *)Data)); };
{ return Add((const unsigned char *)Data, strlen((const char *)Data)); }

inline bool Add(const unsigned char *Beg, const unsigned char *End)
{ return Add(Beg, End - Beg); };
{ return Add(Beg, End - Beg); }
inline bool Add(const char *Beg, const char *End)
{ return Add((const unsigned char *)Beg, End - Beg); };
{ return Add((const unsigned char *)Beg, End - Beg); }

bool AddFD(int Fd, unsigned long long Size = 0);
bool AddFD(FileFd &Fd, unsigned long long Size = 0);


+ 7
- 7
apt-pkg/pkgcachegen.cc View File

@@ -118,11 +118,11 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM

Cache.ReMap(false);

CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap;
CurrentFile += (pkgCache::PackageFile const * const) newMap - (pkgCache::PackageFile const * const) oldMap;

for (size_t i = 0; i < _count(UniqHash); ++i)
if (UniqHash[i] != 0)
UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap;
UniqHash[i] += (pkgCache::StringItem const * const) newMap - (pkgCache::StringItem const * const) oldMap;

for (std::vector<pkgCache::GrpIterator*>::const_iterator i = Dynamic<pkgCache::GrpIterator>::toReMap.begin();
i != Dynamic<pkgCache::GrpIterator>::toReMap.end(); ++i)
@@ -398,7 +398,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
Pkg.Name(), "NewVersion", 1);

if (oldMap != Map.Data())
LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
LastVer += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
*LastVer = verindex;

if (unlikely(List.NewVersion(Ver) == false))
@@ -909,7 +909,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
if (unlikely(index == 0))
return false;
if (OldDepLast != 0 && oldMap != Map.Data())
OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
}
}
return NewDepends(Pkg, Ver, index, Op, Type, OldDepLast);
@@ -948,7 +948,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
OldDepLast = &D->NextDepends;
} else if (oldMap != Map.Data())
OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;

Dep->NextDepends = *OldDepLast;
*OldDepLast = Dep.Index();
@@ -1125,8 +1125,8 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
if (unlikely(idxString == 0))
return 0;
if (oldMap != Map.Data()) {
Last += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
I += (pkgCache::StringItem*) Map.Data() - (pkgCache::StringItem*) oldMap;
Last += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap;
I += (pkgCache::StringItem const * const) Map.Data() - (pkgCache::StringItem const * const) oldMap;
}
*Last = Item;



Loading…
Cancel
Save