fix typo (mkostemp->mkstemp)
[ntk/apt.git] / ftparchive / override.cc
index 3cf10b8..1288ff1 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "override.h"
-    
-#include <apti18n.h>
+#include <config.h>
+
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
 #include <stdio.h>
-    
+
 #include "override.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // Override::ReadOverride - Read the override file                     /*{{{*/
@@ -34,7 +35,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       return _error->Errno("fopen",_("Unable to open %s"),File.c_str());
    
    char Line[500];
-   unsigned long Counter = 0;
+   unsigned long long Counter = 0;
    while (fgets(Line,sizeof(Line),F) != 0)
    {
       Counter++;
@@ -48,7 +49,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       // Strip space leading up to the package name, skip blank lines
       char *Pkg = Line;
       for (; isspace(*Pkg) && *Pkg != 0;Pkg++);
-      if (Pkg == 0)
+      if (*Pkg == 0)
         continue;
 
       // Find the package and zero..
@@ -57,7 +58,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -71,7 +72,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
         for (; isspace(*End) == 0 && *End != 0; End++);
         if (*End == 0)
         {
-           _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(),
+           _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
                            Counter);
            continue;
         }
@@ -85,7 +86,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -142,7 +143,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       return _error->Errno("fopen",_("Unable to open %s"),File.c_str());
   
    char Line[500];
-   unsigned long Counter = 0;
+   unsigned long long Counter = 0;
    while (fgets(Line,sizeof(Line),F) != 0)
    {
       Counter++;
@@ -163,7 +164,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -175,7 +176,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
                         Counter);
         continue;
       }
@@ -188,7 +189,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*(End-1)) && End > Value; End--);
       if (End == Value)
       {
-        _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -231,7 +232,7 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect
         if (R->OldMaint != "") result->OldMaint = R->OldMaint;
         if (R->NewMaint != "") result->NewMaint = R->NewMaint;
         for (map<string,string>::const_iterator foI = R->FieldOverride.begin();
-             foI != R->FieldOverride.end(); foI++)
+             foI != R->FieldOverride.end(); ++foI)
          {
            result->FieldOverride[foI->first] = foI->second;
         }
@@ -268,7 +269,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed)
       string::const_iterator Start = End;      
       for (; End < OldMaint.end() &&
           (End + 3 >= OldMaint.end() || End[0] != ' ' || 
-           End[1] != '/' || End[2] != '/'); End++);
+           End[1] != '/' || End[2] != '/'); ++End);
       if (stringcasecmp(Start,End,Orig.begin(),Orig.end()) == 0)
         return NewMaint;
       
@@ -276,7 +277,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed)
         break;
 
       // Skip the divider and white space
-      for (; End < OldMaint.end() && (*End == '/' || *End == ' '); End++);
+      for (; End < OldMaint.end() && (*End == '/' || *End == ' '); ++End);
    }
 #else
    if (stringcasecmp(OldMaint.begin(),OldMaint.end(),Orig.begin(),Orig.end()) == 0)