X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e5054186e69880d24528092c2f8a9dd3023224f8..189bb640d2443a5fcaade2ce169429c629ba3148:/apt-pkg/contrib/error.cc

diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index e8b71fa7d..927b7e05c 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: error.cc,v 1.8 1999/08/08 07:24:54 jgg Exp $
+// $Id: error.cc,v 1.11 2002/03/26 07:38:58 jgg Exp $
 /* ######################################################################
    
    Global Erorr Class - Global error mechanism
@@ -14,27 +14,28 @@
    ##################################################################### */
 									/*}}}*/
 // Include Files							/*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/error.h"
-#endif 
-
 #include <apt-pkg/error.h>
 
+#include <iostream>
 #include <errno.h>
 #include <stdio.h>
-#include <string.h>
 #include <stdarg.h>
 #include <unistd.h>
 
+#include <string>
+#include <cstring>
+
 #include "config.h"
    									/*}}}*/
 
+using namespace std;
+
 // Global Error Object							/*{{{*/
 /* If the implementation supports posix threads then the accessor function
    is compiled to be thread safe otherwise a non-safe version is used. A
    Per-Thread error object is maintained in much the same manner as libc
    manages errno */
-#if _POSIX_THREADS == 1 && defined(HAVE_PTHREAD)
+#if defined(_POSIX_THREADS) && defined(HAVE_PTHREAD)
  #include <pthread.h>
 
  static pthread_key_t ErrorKey;
@@ -83,17 +84,17 @@ bool GlobalError::Errno(const char *Function,const char *Description,...)
    char S[400];
    vsnprintf(S,sizeof(S),Description,args);
    snprintf(S + strlen(S),sizeof(S) - strlen(S),
-	    " - %s (%i %s)",Function,errno,strerror(errno));
+	    " - %s (%i: %s)",Function,errno,strerror(errno));
 
    // Put it on the list
    Item *Itm = new Item;
    Itm->Text = S;
    Itm->Error = true;
    Insert(Itm);
-   
+
    PendingFlag = true;
 
-   return false;   
+   return false;
 }
 									/*}}}*/
 // GlobalError::WarningE - Get part of the warn string from errno	/*{{{*/
@@ -111,15 +112,16 @@ bool GlobalError::WarningE(const char *Function,const char *Description,...)
    // sprintf the description
    char S[400];
    vsnprintf(S,sizeof(S),Description,args);
-   snprintf(S + strlen(S),sizeof(S) - strlen(S)," - %s (%i %s)",Function,errno,strerror(errno));
+   snprintf(S + strlen(S),sizeof(S) - strlen(S),
+	    " - %s (%i: %s)",Function,errno,strerror(errno));
 
    // Put it on the list
    Item *Itm = new Item;
    Itm->Text = S;
    Itm->Error = false;
    Insert(Itm);
-   
-   return false;   
+
+   return false;
 }
 									/*}}}*/
 // GlobalError::Error - Add an error to the list			/*{{{*/