Просмотр исходного кода

warning: useless cast to type A [-Wuseless-cast]

Git-Dch: Ignore
Reported-By: gcc -Wuseless-cast
David Kalnischkies лет назад: 12
Родитель
Сommit
e788a834ce

+ 6 - 6
apt-pkg/acquire-item.cc

@@ -709,7 +709,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff()					/*{{{*/
    }
 
    // queue the right diff
-   Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz";
+   Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz";
    Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file);
@@ -797,7 +797,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner,
    Desc.Owner = this;
    Desc.ShortDesc = ShortDesc;
 
-   Desc.URI = string(RealURI) + ".diff/" + patch.file + ".gz";
+   Desc.URI = RealURI + ".diff/" + patch.file + ".gz";
    Desc.Description = Description + " " + patch.file + string(".pdiff");
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(RealURI + ".diff/" + patch.file);
@@ -1558,7 +1558,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
 	 {
 	    std::vector<std::string> types = APT::Configuration::getCompressionTypes();
 	    for (std::vector<std::string>::const_iterator t = types.begin(); t != types.end(); ++t)
-	       if (MetaIndexParser->Exists(string((*Target)->MetaKey).append(".").append(*t)) == true)
+	       if (MetaIndexParser->Exists((*Target)->MetaKey + "." + *t) == true)
 	       {
 		  compressedAvailable = true;
 		  break;
@@ -1596,7 +1596,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
 	 else if (transInRelease == false || Record != NULL || compressedAvailable == true)
 	 {
 	    if (_config->FindB("Acquire::PDiffs",true) == true && transInRelease == true &&
-		MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true)
+		MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true)
 	       new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
 				   (*Target)->ShortDesc, ExpectedIndexHash);
 	    else
@@ -1610,7 +1610,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
          in the Meta-Index file. Ideal would be if pkgAcqDiffIndex would test this
          instead, but passing the required info to it is to much hassle */
       if(_config->FindB("Acquire::PDiffs",true) == true && (verify == false ||
-	  MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true))
+	  MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true))
 	 new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
 			     (*Target)->ShortDesc, ExpectedIndexHash);
       else
@@ -1635,7 +1635,7 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message)			/*{{{*/
       missingkeys += (Fingerprint);
    }
    if(!missingkeys.empty())
-      _error->Warning("%s", string(msg+missingkeys).c_str());
+      _error->Warning("%s", (msg + missingkeys).c_str());
 
    string Transformed = MetaIndexParser->GetExpectedDist();
 

+ 2 - 2
apt-pkg/algorithms.cc

@@ -885,8 +885,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
                }
 
 	       if (Debug == true)
-		  clog << "  Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] <<
-		  " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl;
+		  clog << "  Considering " << Pkg.FullName(false) << ' ' << Scores[Pkg->ID] <<
+		  " as a solution to " << I.FullName(false) << ' ' << Scores[I->ID] << endl;
 
 	       /* Try to fix the package under consideration rather than
 	          fiddle with the VList package */

+ 4 - 4
apt-pkg/cdrom.cc

@@ -440,7 +440,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
    Out.close();
 
    if (FileExists(DFile) == true)
-      rename(DFile.c_str(), string(DFile + '~').c_str());
+      rename(DFile.c_str(), (DFile + '~').c_str());
    if (rename(NewFile.c_str(),DFile.c_str()) != 0)
       return _error->Errno("rename","Failed to rename %s.new to %s",
 			   DFile.c_str(),DFile.c_str());
@@ -553,7 +553,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
    
    Out.close();
 
-   rename(File.c_str(),string(File + '~').c_str());
+   rename(File.c_str(), (File + '~').c_str());
    if (rename(NewFile.c_str(),File.c_str()) != 0)
       return _error->Errno("rename","Failed to rename %s.new to %s",
 			   File.c_str(),File.c_str());
@@ -737,7 +737,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
       if (InfoDir.empty() == false &&
 	  FileExists(InfoDir + "/info") == true)
       {
-	 ifstream F(string(InfoDir + "/info").c_str());
+	 ifstream F((InfoDir + "/info").c_str());
 	 if (!F == 0)
 	    getline(F,Name);
 
@@ -981,7 +981,7 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly)
       cdrom.DeviceName = string(devnode);
       if (mountpath != "") {
 	 cdrom.MountPath = mountpath;
-	 string s = string(mountpath);
+	 string s = mountpath;
 	 cdrom.Mounted = IsMounted(s);
       } else {
 	 cdrom.Mounted = false;

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

@@ -891,7 +891,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress,
    {
       for (; compressor != compressors.end(); ++compressor)
       {
-	 std::string file = std::string(FileName).append(compressor->Extension);
+	 std::string file = FileName + compressor->Extension;
 	 if (FileExists(file) == false)
 	    continue;
 	 FileName = file;
@@ -1793,7 +1793,7 @@ bool FileFd::FileFdError(const char *Description,...) {
 }
 									/*}}}*/
 
-gzFile FileFd::gzFd() { return (gzFile) d->gz; }
+gzFile FileFd::gzFd() { return d->gz; }
 
 
 // Glob - wrapper around "glob()"                                      /*{{{*/

+ 1 - 1
apt-pkg/contrib/hashsum_template.h

@@ -104,7 +104,7 @@ class SummationImplementation
    inline bool Add(const unsigned 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(Data)); }
 
    inline bool Add(const unsigned char *Beg, const unsigned char *End)
    { return Add(Beg, End - Beg); }

+ 1 - 1
apt-pkg/contrib/mmap.cc

@@ -198,7 +198,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       {
 #ifdef _POSIX_SYNCHRONIZED_IO
 	 unsigned long long const PSize = sysconf(_SC_PAGESIZE);
-	 if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
+	 if (msync((char *)Base+(Start/PSize)*PSize, Stop - Start, MS_SYNC) < 0)
 	    return _error->Errno("msync", _("Unable to synchronize mmap"));
 #endif
       }

+ 1 - 1
apt-pkg/contrib/netrc.cc

@@ -198,7 +198,7 @@ void maybe_add_auth (URI &Uri, string NetRCFile)
       // if host did not work, try Host+Path next, this will trigger
       // a lookup uri.startswith(host) in the netrc file parser (because
       // of the "/"
-      char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str());
+      char *hostpath = strdup((Uri.Host + Uri.Path).c_str());
       if (hostpath && parsenetrc_string(hostpath, login, password, netrcfile) == 0)
       {
 	 if (_config->FindB("Debug::Acquire::netrc", false) == true)

+ 1 - 1
apt-pkg/deb/debsrcrecords.cc

@@ -57,7 +57,7 @@ const char **debSrcRecordParser::Binaries()
    } while (*bin != '\0');
    StaticBinList.push_back(NULL);
 
-   return (const char **) &StaticBinList[0];
+   return &StaticBinList[0];
 }
 									/*}}}*/
 // SrcRecordParser::BuildDepends - Return the Build-Depends information	/*{{{*/

+ 6 - 6
apt-pkg/indexcopy.cc

@@ -65,7 +65,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
 	   c != compressor.end(); ++c)
       {
-	 if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+	 if (stat((file + c->Extension).c_str(), &Buf) != 0)
 	    continue;
 	 found = true;
 	 break;
@@ -160,7 +160,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
 	    
 	    // Get the size
 	    struct stat Buf;
-	    if (stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0 || 
+	    if (stat((CDROM + Prefix + File).c_str(),&Buf) != 0 || 
 		Buf.st_size == 0)
 	    {
 	       bool Mangled = false;
@@ -175,7 +175,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
 	       }
 	       
 	       if (Mangled == false ||
-		   stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0)
+		   stat((CDROM + Prefix + File).c_str(),&Buf) != 0)
 	       {
 		  if (Debug == true)
 		     clog << "Missed(2): " << OrigFile << endl;
@@ -286,7 +286,7 @@ bool IndexCopy::ReconstructPrefix(string &Prefix,string OrigPath,string CD,
    while (1)
    {
       struct stat Buf;
-      if (stat(string(CD + MyPrefix + File).c_str(),&Buf) != 0)
+      if (stat((CD + MyPrefix + File).c_str(),&Buf) != 0)
       {
 	 if (Debug == true)
 	    cout << "Failed, " << CD + MyPrefix + File << endl;
@@ -315,7 +315,7 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File)
    while (1)
    {
       struct stat Buf;
-      if (stat(string(Dir + File).c_str(),&Buf) != 0)
+      if (stat((Dir + File).c_str(),&Buf) != 0)
       {
 	 File = ChopDirs(File,1);
 	 Depth++;
@@ -676,7 +676,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
       for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
 	   c != compressor.end(); ++c)
       {
-	 if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+	 if (stat((file + c->Extension).c_str(), &Buf) != 0)
 	    continue;
 	 found = true;
 	 break;

+ 2 - 2
apt-pkg/indexrecords.cc

@@ -129,10 +129,10 @@ bool indexRecords::Load(const string Filename)				/*{{{*/
    // get the user settings for this archive and use what expires earlier
    int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0);
    if (Label.empty() == false)
-      MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
+      MaxAge = _config->FindI(("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
    int MinAge = _config->FindI("Acquire::Min-ValidTime", 0);
    if (Label.empty() == false)
-      MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
+      MinAge = _config->FindI(("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
 
    if(MaxAge == 0 &&
       (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file