Bladeren bron

fix -Wformat= warnings about size_t != %lu on e.g. armel

Git-Dch: Ignore
Reported-By: gcc
David Kalnischkies 12 jaren geleden
bovenliggende
commit
6298ff8b64
2 gewijzigde bestanden met toevoegingen van 9 en 8 verwijderingen
  1. 3 2
      apt-private/private-show.cc
  2. 6 6
      methods/rred.cc

+ 3 - 2
apt-private/private-show.cc

@@ -148,8 +148,9 @@ bool ShowPackage(CommandLine &CmdL)					/*{{{*/
    if (select == APT::VersionList::CANDIDATE)
    if (select == APT::VersionList::CANDIDATE)
    {
    {
       APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper);
       APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper);
-      if (verset_all.size() > verset.size())
-         _error->Notice(ngettext("There is %lu additional record. Please use the '-a' switch to see it", "There are %lu additional records. Please use the '-a' switch to see them.", verset_all.size() - verset.size()), verset_all.size() - verset.size());
+      int const records = verset_all.size() - verset.size();
+      if (records > 0)
+         _error->Notice(P_("There is %i additional record. Please use the '-a' switch to see it", "There are %i additional records. Please use the '-a' switch to see them.", records), records);
    }
    }
 
 
    for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin();
    for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin();

+ 6 - 6
methods/rred.cc

@@ -469,7 +469,7 @@ class Patch {
 
 
    void write_diff(FILE *f)
    void write_diff(FILE *f)
    {
    {
-      size_t line = 0;
+      unsigned long long line = 0;
       std::list<struct Change>::reverse_iterator ch;
       std::list<struct Change>::reverse_iterator ch;
       for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) {
       for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) {
 	 line += ch->offset + ch->del_cnt;
 	 line += ch->offset + ch->del_cnt;
@@ -482,11 +482,11 @@ class Patch {
 	 line -= ch->del_cnt;
 	 line -= ch->del_cnt;
 	 if (ch->add_cnt > 0) {
 	 if (ch->add_cnt > 0) {
 	    if (ch->del_cnt == 0) {
 	    if (ch->del_cnt == 0) {
-	       fprintf(f, "%lua\n", line);
+	       fprintf(f, "%llua\n", line);
 	    } else if (ch->del_cnt == 1) {
 	    } else if (ch->del_cnt == 1) {
-	       fprintf(f, "%luc\n", line+1);
+	       fprintf(f, "%lluc\n", line+1);
 	    } else {
 	    } else {
-	       fprintf(f, "%lu,%luc\n", line+1, line+ch->del_cnt);
+	       fprintf(f, "%llu,%lluc\n", line+1, line+ch->del_cnt);
 	    }
 	    }
 
 
 	    mg_i = ch;
 	    mg_i = ch;
@@ -496,9 +496,9 @@ class Patch {
 
 
 	    fprintf(f, ".\n");
 	    fprintf(f, ".\n");
 	 } else if (ch->del_cnt == 1) {
 	 } else if (ch->del_cnt == 1) {
-	    fprintf(f, "%lud\n", line+1);
+	    fprintf(f, "%llud\n", line+1);
 	 } else if (ch->del_cnt > 1) {
 	 } else if (ch->del_cnt > 1) {
-	    fprintf(f, "%lu,%lud\n", line+1, line+ch->del_cnt);
+	    fprintf(f, "%llu,%llud\n", line+1, line+ch->del_cnt);
 	 }
 	 }
 	 line -= ch->offset;
 	 line -= ch->offset;
       }
       }