diff options
| author | Pixel <Pixel> | 2002-06-01 00:45:34 +0000 | 
|---|---|---|
| committer | Pixel <Pixel> | 2002-06-01 00:45:34 +0000 | 
| commit | 6be21a3b278d3bb3f8ac4176f923d42dfb9b1e12 (patch) | |
| tree | 885d79500dfa392e950dba743aa13f1433174151 /include | |
| parent | 718469e240675b161006ee4f2d5d52de9ad14f2f (diff) | |
gcc-3.0.1 fixing.
Diffstat (limited to 'include')
| -rw-r--r-- | include/Buffer.h | 2 | ||||
| -rw-r--r-- | include/Exceptions.h | 115 | ||||
| -rw-r--r-- | include/HttpServ.h | 2 | ||||
| -rw-r--r-- | include/TaskMan.h | 2 | ||||
| -rw-r--r-- | include/Variables.h | 2 | 
5 files changed, 75 insertions, 48 deletions
diff --git a/include/Buffer.h b/include/Buffer.h index 360abad..79d0e02 100644 --- a/include/Buffer.h +++ b/include/Buffer.h @@ -15,7 +15,7 @@ class Buffer : public Handle {        Buffer();        Buffer(const Buffer &);        virtual ~Buffer(); -    virtual ssize_t write(const void *buf, size_t count); +    virtual ssize_t write(const void *buf, size_t count) throw(GeneralException);      virtual ssize_t read(void *buf, size_t count) throw (GeneralException);      virtual bool CanRead();      virtual bool CanWrite(); diff --git a/include/Exceptions.h b/include/Exceptions.h index 1b98598..85451f0 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -8,55 +8,25 @@  #include <string.h>  #include <stdlib.h> -class GeneralException; - -char * xstrdup(const char *); -void * xmalloc(size_t) throw (GeneralException); -void xfree(void *&); -void xfree(char *&); -void * xrealloc(void *, size_t); -int xpipe(int *, int = 0) throw (GeneralException); -pid_t xfork() throw (GeneralException); - -class String; +#define INLINE __inline__  class Base {    public: -    static char * strdup(const char * s) { -	return xstrdup(s); -    } -    static void * malloc(ssize_t s) { -	return xmalloc(s); -    } -    static void * realloc(void * p, size_t s) { -	return xrealloc(p, s); -    } -    static void * calloc(size_t n, size_t s) { -	return xmalloc(n * s); -    } -    void * operator new(size_t s) { -	return xmalloc(s); -    } -    void * operator new(size_t s, void * p) { -	return memset(p, 0, s); -    } -    void operator delete(void * p) { -	xfree(p); -    } -    static void free(void *& p) { -	xfree(p); -    } -    static void free(char *& p) { -	xfree(p); -    } -    static int pipe(int * p, int flag = 0) { -	return xpipe(p, flag); -    } -    static pid_t fork() { -	return xfork(); -    } +    static char * strdup(const char * s); +    static void * malloc(ssize_t s); +    static void * realloc(void * p, size_t s); +    static void * calloc(size_t n, size_t s); +    void * operator new(size_t s); +    void * operator new(size_t s, void * p); +    void operator delete(void * p); +    static void free(void *& p); +    static void free(char *& p); +    static int pipe(int * p, int flag = 0); +    static pid_t fork();  }; +class String; +  class GeneralException : public Base {    public:        GeneralException(String); @@ -70,11 +40,68 @@ class GeneralException : public Base {      static char t[BUFSIZ];  }; +char * xstrdup(const char *); +void * xmalloc(size_t) throw (GeneralException); +void xfree(void *&); +void xfree(char *&); +void * xrealloc(void *, size_t); +int xpipe(int *, int = 0) throw (GeneralException); +pid_t xfork() throw (GeneralException); + +INLINE char * Base::strdup(const char * s) { +    return xstrdup(s); +} + +INLINE void * Base::malloc(ssize_t s) { +    return xmalloc(s); +} + +INLINE void * Base::realloc(void * p, size_t s) { +    return xrealloc(p, s); +} + +INLINE void * Base::calloc(size_t n, size_t s) { +    return xmalloc(n * s); +} + +INLINE void * Base::operator new(size_t s) { +    return xmalloc(s); +} + +INLINE void * Base::operator new(size_t s, void * p) { +    return memset(p, 0, s); +} + +INLINE void Base::operator delete(void * p) { +    xfree(p); +} + +INLINE void Base::free(void *& p) { +    xfree(p); +} + +INLINE void Base::free(char *& p) { +    xfree(p); +} + +INLINE int Base::pipe(int * p, int flag = 0) { +    return xpipe(p, flag); +} + +INLINE pid_t Base::fork() { +    return xfork(); +} +  class MemoryException : public GeneralException {    public:        MemoryException(ssize_t);  }; +class TaskNotFound : public GeneralException { +  public: +      TaskNotFound(); +}; +  enum op_t {    IO_WRITE = 1,    IO_READ diff --git a/include/HttpServ.h b/include/HttpServ.h index a51a16e..7d63517 100644 --- a/include/HttpServ.h +++ b/include/HttpServ.h @@ -17,7 +17,7 @@ class HttpServ : public Task {      virtual String GetName();    protected: -    virtual int Do(); +    virtual int Do() throw (GeneralException);    private:      Socket Listener; diff --git a/include/TaskMan.h b/include/TaskMan.h index e61aa3f..2cab500 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -15,7 +15,7 @@  class TaskMan : public Base {    public:      static void AddTask(Task *); -    static vector<Task *>::iterator FindTask(Task *); +    static vector<Task *>::iterator FindTask(Task *) throw (GeneralException);      static void RemoveFromWatches(Task *);      static void Init() throw (GeneralException);      static void MainLoop() throw (GeneralException); diff --git a/include/Variables.h b/include/Variables.h index f4eb6db..8d7189b 100644 --- a/include/Variables.h +++ b/include/Variables.h @@ -2,7 +2,7 @@  #define __VARIABLES_H__  #ifdef __cplusplus -#include <vector> +#include <vector.h>  #include <String.h>  #include <Handle.h>  #include <Exceptions.h>  | 
