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

warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]

Git-Dch: Ignore
Reported-By: gcc -Wunsafe-loop-optimizations
David Kalnischkies лет назад: 12
Родитель
Сommit
ef74268b47
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      apt-pkg/contrib/strutl.cc
  2. 2 2
      apt-pkg/pkgcachegen.cc

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

@@ -1184,7 +1184,7 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin,
       R->Hit = false;
 
    unsigned long Hits = 0;
-   for (; ListBegin != ListEnd; ListBegin++)
+   for (; ListBegin < ListEnd; ++ListBegin)
    {
       // Check if the name is a regex
       const char *I;

+ 2 - 2
apt-pkg/pkgcachegen.cc

@@ -1249,10 +1249,10 @@ static bool CheckValidity(const string &CacheFile,
 static unsigned long ComputeSize(FileIterator Start,FileIterator End)
 {
    unsigned long TotalSize = 0;
-   for (; Start != End; ++Start)
+   for (; Start < End; ++Start)
    {
       if ((*Start)->HasPackages() == false)
-	 continue;      
+	 continue;
       TotalSize += (*Start)->Size();
    }
    return TotalSize;