From 8212ce04cafa89e0a3f3b46e7fb2940548e08214 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 19 Mar 2003 17:03:54 +0000 Subject: I am the dumbest... --- include/Exceptions.h | 2 ++ lib/Action.cc | 1 - lib/Buffer.cc | 1 - lib/Confirm.cc | 1 - lib/Exceptions.cc | 2 +- lib/Form.cc | 1 - lib/GMPString.cc | 1 - lib/Handle.cc | 24 ++++++++++++------------ lib/IRC.cc | 1 - lib/Input.cc | 14 +++++++------- lib/Regex.cc | 4 ++-- lib/String.cc | 6 +++--- src/Main.cc | 5 +++-- 13 files changed, 30 insertions(+), 33 deletions(-) diff --git a/include/Exceptions.h b/include/Exceptions.h index b829222..40f402f 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -11,7 +11,9 @@ typedef int pid_t; #endif +#ifdef _MSC_VER #pragma warning (disable:4290) +#endif class String; struct ugly_string; diff --git a/lib/Action.cc b/lib/Action.cc index 1b560ff..e5825b9 100644 --- a/lib/Action.cc +++ b/lib/Action.cc @@ -4,7 +4,6 @@ #include "BString.h" #include "Action.h" #include "HttpServ.h" -#include "gettext.h" Action * Action::start = 0; diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 6dcfa6e..db8b3ee 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -4,7 +4,6 @@ #endif #include "Buffer.h" #include "generic.h" -#include "gettext.h" Buffer::Buffer() : Handle(-1), buffer(0), zero(0), realsiz(0), bufsiz(0), ptr(0) { } diff --git a/lib/Confirm.cc b/lib/Confirm.cc index 64a623f..18e56e6 100644 --- a/lib/Confirm.cc +++ b/lib/Confirm.cc @@ -5,7 +5,6 @@ #include "Confirm.h" #include "Buffer.h" #include "CopyJob.h" -#include "gettext.h" Confirm::Confirm(const String & t, const String & m, const String & U, Action * y, Action * n) : Action(U), tit(t), msg(m), NYes(y), NNo(n) { } diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index 7a068aa..fe3aecc 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -197,7 +197,7 @@ void * Base::calloc(size_t n, size_t s) { void * Base::operator new(size_t s) { #ifdef DEBUG - std::cerr << _("Operator new(s) called. Allocating memory.\n"); + printm(M_BARE, _("Operator new(s) called. Allocating memory.\n")); #endif return xmalloc(s); } diff --git a/lib/Form.cc b/lib/Form.cc index e0e5073..fedfc3e 100644 --- a/lib/Form.cc +++ b/lib/Form.cc @@ -5,7 +5,6 @@ #include "HttpServ.h" #include "Buffer.h" #include "CopyJob.h" -#include "gettext.h" Form::Form(const String & titre, const String & url, const String & inv, String * names, String * invs, String * defaults, String ** lists, String ** descs, int nb, Action * na) : diff --git a/lib/GMPString.cc b/lib/GMPString.cc index ee4debb..5b2d1c6 100644 --- a/lib/GMPString.cc +++ b/lib/GMPString.cc @@ -4,7 +4,6 @@ #ifdef HAVE_GMP #include #include "GMPString.h" -#include "gettext.h" GMPString::GMPString(const GMPString & s) : str(s.str) { } diff --git a/lib/Handle.cc b/lib/Handle.cc index de4114e..7207f36 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -40,7 +40,7 @@ enum { Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0) { #ifdef DEBUG - std::cerr << _("Duplication of handle ") << nh.h << _(" to ") << h << std::endl; + printm(M_INFO, String(_("Duplication of handle ")) + nh.h + _(" to ") + h + "\n"); #endif if ((h >= 0) && (nh.z)) { SetZ(nh.z); @@ -49,7 +49,7 @@ Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), c Handle::~Handle() { #ifdef DEBUG - std::cerr << _("Destroying handle ") << h << std::endl; + printm(M_INFO, String(_("Destroying handle ")) + h + "\n"); #endif close(); } @@ -57,7 +57,7 @@ Handle::~Handle() { Handle::Handle(int nh) : h(nh), closed(false), nonblock(false), zfile(0), z(0) { #ifdef DEBUG - std::cerr << _("Initialising handle ") << h << std::endl; + printm(M_INFO, String(_("Initialising handle ")) + h + "\n"); #endif } @@ -92,7 +92,7 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { full = true; if (nonblock) { #ifdef DEBUG - std::cerr << _("write: throwing IOAgain for handle ") << GetName() << std::endl; + printm(M_INFO, _("write: throwing IOAgain for handle ") + GetName() + "\n"); #endif throw IOAgain(); } else { @@ -121,7 +121,7 @@ ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { ssize_t r; #ifdef FULLDEBUG - std::cerr << _("read: reading ") << count << _(" bytes from handle ") << GetHandle() << std::endl; + printm(M_INFO, String(_("read: reading ")) + count + _(" bytes from handle ") + GetHandle() + "\n"); #endif errno = 0; @@ -131,7 +131,7 @@ ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { // problème lié au fait qu'il n'y a plus d'octets. if (nonblock) { #ifdef DEBUG - std::cerr << _("read: throwing IOAgain for handle ") << GetName() << std::endl; + printm(M_INFO, _("read: throwing IOAgain for handle ") + GetName() + "\n"); #endif throw IOAgain(); } @@ -223,11 +223,11 @@ void Handle::close() throw (GeneralException) { } } else if (z) { #ifdef DEBUG - std::cerr << _("Performing gzclose on handle ") << h << std::endl; + printm(M_INFO, String(_("Performing gzclose on handle ")) + h + "\n"); #endif int err = gzclose(zfile); #ifdef DEBUG - std::cerr << _("gzclose returned ") << err << std::endl; + printm(M_INFO, String(_("gzclose returned ")) + err + "\n"); #endif if (err) { if (err == Z_ERRNO) { @@ -286,7 +286,7 @@ void Handle::SetZ(int az) throw (GeneralException) { } if (az >= 10) { #ifdef DEBUG - std::cerr << _("Setting up zstream using inflate/deflate...\n"); + printm(M_INFO, _("Setting up zstream using inflate/deflate...\n")); #endif int err; zstrm.zalloc = Z_NULL; @@ -318,7 +318,7 @@ void Handle::SetZ(int az) throw (GeneralException) { format[index++] = (char) (az + '0'); format[index] = 0; #ifdef FULLDEBUG - std::cerr << _("Performing gzdopen on handle ") << h << _(" with mode \"") << format << "\"\n"; + printm(M_INFO, _("Performing gzdopen on handle ") << h << _(" with mode \"") + format + "\"\n"; #endif if (!(zfile = gzdopen(h, format))) { throw GeneralException(_("Was not able to gzdopen.")); @@ -331,7 +331,7 @@ ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) if (z >= 10) { } else if (z) { #ifdef FULLDEBUG - std::cerr << _("Performing gzwrite of ") << count << _(" byte(s) for handle ") << h << std::endl; + printm(M_INFO, String(_("Performing gzwrite of ")) + count + _(" byte(s) for handle ") + h + "\n"); #endif #ifdef HAVE_WD_ZLIB int err = gzwrite(zfile, buf, count); @@ -358,7 +358,7 @@ ssize_t Handle::uread(void * buf, size_t count) { if (z >= 10) { } if (z) { #ifdef DEBUG - std::cerr << _("Performing gzread of ") << count << _(" byte(s) for handle ") << h << std::endl; + printm(M_BARE, String(_("Performing gzread of ")) + count + _(" byte(s) for handle ") + h + "\n"); #endif int err = gzread(zfile, buf, count); if (err == -1) { diff --git a/lib/IRC.cc b/lib/IRC.cc index 54f26f1..f29b2c1 100644 --- a/lib/IRC.cc +++ b/lib/IRC.cc @@ -4,7 +4,6 @@ #include "BString.h" #include "IRC.h" #include "HttpServ.h" -#include "gettext.h" ircmsg_t ircmsgs[MSG_COUNT] = diff --git a/lib/Input.cc b/lib/Input.cc index 8ce13cf..bfb771c 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -91,7 +91,7 @@ Input::Input(const String & no) throw (GeneralException) : } } else { #ifdef DEBUG - std::cerr << _("Opening file in archive, position ") << results.ptr << std::endl; + printm(M_INFO, String(_("Opening file in archive, position ")) + results.ptr + "\n"); #endif size = results.size; seek(results.ptr, SEEK_SET); @@ -151,14 +151,14 @@ off_t Input::seek(off_t offset, int whence) throw (GeneralException) { int Input::wrapopen(const String & fname, openresults_t * results) { #ifdef DEBUG - std::cerr << _("Wrap-opening ") << fname << std::endl; + printm(M_INFO, _("Wrap-opening ") + fname + "\n"); #endif if (fname[0] != '/') { bool t; t = Archive::inarchive(fname); if (t) { #ifdef DEBUG - std::cerr << _("Trying to open the file in archive, since it seems to be here\n"); + printm(M_BARE, _("Trying to open the file in archive, since it seems to be here\n")); #endif return Archive::open(fname, results); } @@ -211,7 +211,7 @@ Archive::Archive(const String & fname, int atype) throw (GeneralException) : size = archive.readU32(); archive.read(buffer, 1); #ifdef DEBUG - std::cerr << _("Adding file `") << ifname << _("' to node `") << p->name << "'\n"; + printm(M_BARE, _("Adding file `") + ifname + _("' to node `") + p->name + "'\n"); #endif t = new FileTree(ifname, size, buffer[0], p); if (buffer[0]) @@ -247,11 +247,11 @@ bool Archive::inarchive(const String & fname) { Archive * p; for (p = header; p; p = p->next) { #ifdef DEBUG - std::cerr << _("Looking for file `") << fname << _("' in archive ") << p->name << std::endl; + printm(M_BARE, _("Looking for file `") + fname + _("' in archive ") + p->name + "\n"); #endif if (p->inarchivein(fname)) { #ifdef DEBUG - std::cerr << _("File `") << fname << _("' found in archive ") << p->name << std::endl; + printm(M_BARE, _("File `") + fname + _("' found in archive ") + p->name + "\n"); #endif return true; } @@ -287,7 +287,7 @@ bool Archive::inarchivein(const String & fname) { name = ""; } #ifdef DEBUG - std::cerr << _("Checking against node `") << p->name << "'\n"; + printm(M_BARE, _("Checking against node `") + p->name + "'\n"); #endif while (p) { if (p->name == reste) { diff --git a/lib/Regex.cc b/lib/Regex.cc index 7fd9741..258d378 100644 --- a/lib/Regex.cc +++ b/lib/Regex.cc @@ -23,9 +23,9 @@ Regex::Regex(const Regex & regex) : pattern(Base::strdup(pattern)) { int r; if ((r = regcomp(&preg, pattern, cflags | REG_NOSUB))) { - std::cerr << "Error in regcomp:"; + printm(M_ERROR, _("Error in regcomp:")); regerror(r, &preg, t, sizeof(t)); - std::cerr << t << std::endl; + printm(M_ERROR, "%s\n", t); throw GeneralException(String(_("Regex \"")) + pattern + _("\" failed to compile: ") + t + "\n"); } } diff --git a/lib/String.cc b/lib/String.cc index 53ecb83..ba84b4c 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -23,7 +23,7 @@ char String::t[BUFSIZ + 1]; String::String(const String & s) : str(Base::strdup(s.str)), siz(s.siz) { #ifdef DEBUG - fprintf(stderr, _("Duplicating string `%s', from %p to %p, from this %p to this %p\n"), str, s.str, str, s, this); + fprintf(stderr, _("Duplicating string `%s', from %p to %p, from this %p to this %p\n"), str, s.str, str, &s, this); #endif } @@ -455,7 +455,7 @@ String::operator ugly_string() const { } String & String::toupper() { - for (int i = 0; i < strlen(); i++) { + for (unsigned int i = 0; i < strlen(); i++) { str[i] = ::toupper(str[i]); } @@ -463,7 +463,7 @@ String & String::toupper() { } String & String::tolower() { - for (int i = 0; i < strlen(); i++) { + for (unsigned int i = 0; i < strlen(); i++) { str[i] = ::tolower(str[i]); } diff --git a/src/Main.cc b/src/Main.cc index 22534c1..e945075 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -22,6 +22,7 @@ #include "CopyJob.h" #include "IRC.h" #include "Main.h" +#include "gettext.h" InPipe * in; @@ -178,7 +179,7 @@ int startup() throw (GeneralException) { std::cout.flush(); (*in) >> r; if (r != "poide") { - std::cerr << "The stdout redirect has failed.\n"; + printm(M_ERROR, "The stdout redirect has failed.\n"); exit(-1); } @@ -188,7 +189,7 @@ int startup() throw (GeneralException) { port = optarg; break; default: - std::cerr << "Usage: " << argv[0] << " [-p port]\n"; + printm(M_BARE, String(_("Usage: ")) + argv[0] + " [-p port]\n"); exit(-1); } } -- cgit v1.2.3