diff options
author | Fritz Elfert <felfert@to.com> | 2002-07-14 06:35:33 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2002-07-14 06:35:33 +0000 |
commit | f9e740af36b44a1c9e834dc8fff08fba8fb1b13f (patch) | |
tree | 8b84b4ffcb235224f8de1761fdd59446f155281d /lib | |
parent | 97984a6f290d1bd87aaba317c47c70a14b1c0b31 (diff) | |
download | plptools-f9e740af36b44a1c9e834dc8fff08fba8fb1b13f.tar.gz plptools-f9e740af36b44a1c9e834dc8fff08fba8fb1b13f.tar.bz2 plptools-f9e740af36b44a1c9e834dc8fff08fba8fb1b13f.zip |
Applied patches from debian bug #104967 (not yet tested)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Enum.cc | 2 | ||||
-rw-r--r-- | lib/Enum.h | 22 | ||||
-rw-r--r-- | lib/bufferstore.cc | 2 | ||||
-rw-r--r-- | lib/plpdirent.cc | 2 | ||||
-rw-r--r-- | lib/plpdirent.h | 16 | ||||
-rw-r--r-- | lib/ppsocket.h | 8 | ||||
-rw-r--r-- | lib/psiprocess.cc | 2 | ||||
-rw-r--r-- | lib/psitime.h | 4 | ||||
-rw-r--r-- | lib/rfsv.cc | 2 | ||||
-rw-r--r-- | lib/rfsv.h | 12 | ||||
-rw-r--r-- | lib/rfsv16.cc | 6 | ||||
-rw-r--r-- | lib/rfsv16.h | 4 | ||||
-rw-r--r-- | lib/rfsv32.cc | 6 | ||||
-rw-r--r-- | lib/rfsv32.h | 4 | ||||
-rw-r--r-- | lib/rfsvfactory.cc | 2 | ||||
-rw-r--r-- | lib/rpcs.cc | 2 | ||||
-rw-r--r-- | lib/rpcs16.h | 2 | ||||
-rw-r--r-- | lib/rpcs32.h | 2 |
18 files changed, 59 insertions, 41 deletions
diff --git a/lib/Enum.cc b/lib/Enum.cc index 74fc2e3..2c4142b 100644 --- a/lib/Enum.cc +++ b/lib/Enum.cc @@ -22,6 +22,8 @@ */ #include "Enum.h" +using namespace std; + void EnumBase::i2sMapper::add(long i, const char* s) { stringMap.insert(pair<long, const char* const>(i, s)); } @@ -59,7 +59,7 @@ protected: * there can be one value, mapping to multiple * strings. Therefore, we need a multimap. */ - typedef multimap<long, const char*> i2s_map_t; + typedef std::multimap<long, const char*> i2s_map_t; /** * just for the record. Mapping back a string to the @@ -89,7 +89,7 @@ protected: * If there are multiple strings for this integer, * return a comma delimited list. */ - string lookup(long) const; + std::string lookup(long) const; /** * returns the integer associated with the @@ -152,9 +152,9 @@ private: * properly before the program starts. */ sdata(); - i2sMapper stringRep; - string name; - E defaultValue; + i2sMapper stringRep; + std::string name; + E defaultValue; }; static sdata staticData; @@ -184,7 +184,7 @@ public: * initialize with the string representation * XXX: throw Exception if not found ? */ - Enum(const string& s) : value(getValueFor(s)) { + Enum(const std::string& s) : value(getValueFor(s)) { assert(inRange(value)); } @@ -215,7 +215,7 @@ public: * returns the String representation for the value * represented by this instance. */ - string toString() const { return getStringFor(value); } + std::string toString() const { return getStringFor(value); } /** * returns the C string representation for the value @@ -242,13 +242,13 @@ public: * returns the Name for this enumeration. Useful for * error reporting. */ - static string getEnumName() { return staticData.name; } + static std::string getEnumName() { return staticData.name; } /** * gives the String represenatation of a specific * value of this Enumeration. */ - static string getStringFor(E e) { + static std::string getStringFor(E e) { return staticData.stringRep.lookup((long) e); } @@ -256,7 +256,7 @@ public: * returns the Value for a specific String. * XXX: throw OutOfRangeException ? */ - static E getValueFor(const string &s) { + static E getValueFor(const std::string &s) { return (E) staticData.stringRep.lookup(s.getCStr()); } }; @@ -312,7 +312,7 @@ name(#EnumName),defaultValue(initWith) * Writes enumeration's string representation. */ template <typename E> -inline ostream& operator << (ostream& out, const Enum<E> &e) { +inline std::ostream& operator << (ostream& out, const Enum<E> &e) { return out << _(e.toString().c_str()); } diff --git a/lib/bufferstore.cc b/lib/bufferstore.cc index 811c690..4712c45 100644 --- a/lib/bufferstore.cc +++ b/lib/bufferstore.cc @@ -35,6 +35,8 @@ #include "bufferstore.h" +using namespace std; + bufferStore::bufferStore() : len(0) , lenAllocd(0) diff --git a/lib/plpdirent.cc b/lib/plpdirent.cc index fa97232..813e1d5 100644 --- a/lib/plpdirent.cc +++ b/lib/plpdirent.cc @@ -24,6 +24,8 @@ #include <stream.h> #include <iomanip> +using namespace std; + PlpUID::PlpUID() { memset(uid, 0, sizeof(uid)); } diff --git a/lib/plpdirent.h b/lib/plpdirent.h index c07ce3c..1c5e8ab 100644 --- a/lib/plpdirent.h +++ b/lib/plpdirent.h @@ -182,8 +182,8 @@ private: u_int32_t attr; PlpUID UID; PsiTime time; - string attrstr; - string name; + std::string attrstr; + std::string name; }; /** @@ -195,8 +195,8 @@ private: * @author Fritz Elfert <felfert@to.com> */ class PlpDrive { - friend rfsv32; - friend rfsv16; + friend class rfsv32; + friend class rfsv16; public: /** @@ -238,7 +238,7 @@ public: * * @param ret The string is returned here. */ - void getMediaType(string &ret); + void getMediaType(std::string &ret); /** * Retrieve the attributes of the drive. @@ -292,7 +292,7 @@ public: * * @param ret The string is returned here. */ - void getMediaAttribute(string &ret); + void getMediaAttribute(std::string &ret); /** * Retrieve the UID of the drive. @@ -322,7 +322,7 @@ public: * * returns The volume name of the drive. */ - string getName(); + std::string getName(); /** * Retrieve the drive letter of the drive. @@ -347,7 +347,7 @@ private: u_int64_t size; u_int64_t space; char drivechar; - string name; + std::string name; }; #endif diff --git a/lib/ppsocket.h b/lib/ppsocket.h index bde8f97..4abecca 100644 --- a/lib/ppsocket.h +++ b/lib/ppsocket.h @@ -81,7 +81,7 @@ public: * where elements not known, are replaced by "???" and none-existing * elements are represented by the word "none". */ - virtual string toString(); + virtual std::string toString(); /** * Starts listening. @@ -101,7 +101,7 @@ public: * @returns A pointer to a new instance for the accepted connection or NULL * if an error happened. */ - ppsocket *accept(string *Peer, IOWatch *); + ppsocket *accept(std::string *Peer, IOWatch *); /** * Check and optionally wait for incoming data. @@ -183,7 +183,7 @@ public: * * @returns true on success, false otherwise. */ - bool getPeer(string *Peer, int *Port); + bool getPeer(std::string *Peer, int *Port); /** * Retrieves local information. @@ -193,7 +193,7 @@ public: * * @returns true on success, false otherwise. */ - bool getHost(string *Host, int *Port); + bool getHost(std::string *Host, int *Port); /** * Registers an @ref IOWatch for this socket. diff --git a/lib/psiprocess.cc b/lib/psiprocess.cc index ce27450..d868820 100644 --- a/lib/psiprocess.cc +++ b/lib/psiprocess.cc @@ -25,6 +25,8 @@ #include <strstream> #include <iomanip> +using namespace std; + PsiProcess::PsiProcess() : pid(0), name(""), args(""), s5mx(false) { } diff --git a/lib/psitime.h b/lib/psitime.h index 7732783..79fd521 100644 --- a/lib/psitime.h +++ b/lib/psitime.h @@ -68,7 +68,7 @@ typedef struct psi_timeval_t { int d = micro % 365; micro /= 365; int y = micro; - o << dec; + o << std::dec; if (y > 0) o << y << ((y > 1) ? _(" years ") : _(" year ")); if (d > 0) @@ -99,7 +99,7 @@ typedef struct psi_timezone_t { ostream::fmtflags old = s.flags(); int h = ptz.utc_offset / 3600; int m = ptz.utc_offset % 3600; - s << "offs: " << dec << h << "h"; + s << "offs: " << std::dec << h << "h"; if (m != 0) s << ", " << m << "m"; s.flags(old); diff --git a/lib/rfsv.cc b/lib/rfsv.cc index 310d7c4..9724f71 100644 --- a/lib/rfsv.cc +++ b/lib/rfsv.cc @@ -27,6 +27,8 @@ #include "bufferstore.h" #include "Enum.h" +using namespace std; + ENUM_DEFINITION(rfsv::errs, rfsv::E_PSI_GEN_NONE) { stringRep.add(rfsv::E_PSI_GEN_NONE, N_("no error")); stringRep.add(rfsv::E_PSI_GEN_FAIL, N_("general")); @@ -30,7 +30,7 @@ #include <plpdirent.h> #include <bufferstore.h> -typedef deque<class PlpDirent> PlpDir; +typedef std::deque<class PlpDirent> PlpDir; class ppsocket; class PlpDrive; @@ -53,8 +53,8 @@ class rfsv32; * @internal */ class rfsvDirhandle { - friend rfsv16; - friend rfsv32; + friend class rfsv16; + friend class rfsv32; private: u_int32_t h; @@ -247,7 +247,7 @@ public: * * @returns A Psion error code (One of enum @ref #errs ). */ - virtual Enum<errs> mktemp(u_int32_t &handle, string &name) = 0; + virtual Enum<errs> mktemp(u_int32_t &handle, std::string &name) = 0; /** * Creates a named file. @@ -582,7 +582,7 @@ public: * @returns Pointer to static textual representation of file attributes. * */ - string attr2String(const u_int32_t attr); + std::string attr2String(const u_int32_t attr); /** * Converts an open-mode (A combination of the PSI_O_ constants.) @@ -598,7 +598,7 @@ public: /** * Utility method, converts '/' to '\'. */ - static string convertSlash(const string &name); + static std::string convertSlash(const std::string &name); /** * Retrieve speed of serial link. diff --git a/lib/rfsv16.cc b/lib/rfsv16.cc index c8e50a0..09b78e2 100644 --- a/lib/rfsv16.cc +++ b/lib/rfsv16.cc @@ -40,6 +40,8 @@ #define RFSV16_MAXDATALEN 852 // 640 +using namespace std; + rfsv16::rfsv16(ppsocket *_skt) { serNum = 0; @@ -583,7 +585,7 @@ copyFromPsion(const char *from, const char *to, void *ptr, cpCallback_t cb) unsigned char buf[RFSV_SENDLEN]; if ((res = fread(handle, buf, sizeof(buf), len)) == E_PSI_GEN_NONE) { if (len > 0) - op.write(buf, len); + op.write((char *)buf, len); total += len; if (cb && !cb(ptr, total)) res = E_PSI_FILE_CANCEL; @@ -643,7 +645,7 @@ copyToPsion(const char *from, const char *to, void *ptr, cpCallback_t cb) } unsigned char *buff = new unsigned char[RFSV_SENDLEN]; while (res == E_PSI_GEN_NONE && ip && !ip.eof()) { - ip.read(buff, RFSV_SENDLEN); + ip.read((char *)buff, RFSV_SENDLEN); if ((res = fwrite(handle, buff, ip.gcount(), len)) == E_PSI_GEN_NONE) { total += len; if (cb && !cb(ptr, total)) diff --git a/lib/rfsv16.h b/lib/rfsv16.h index 94b6742..2bfa7ee 100644 --- a/lib/rfsv16.h +++ b/lib/rfsv16.h @@ -40,11 +40,11 @@ class rfsv16 : public rfsv { /** * rfsvfactory may call our constructor. */ - friend rfsvfactory; + friend class rfsvfactory; public: Enum<rfsv::errs> fopen(const u_int32_t, const char * const, u_int32_t &); - Enum<rfsv::errs> mktemp(u_int32_t &, string &); + Enum<rfsv::errs> mktemp(u_int32_t &, std::string &); Enum<rfsv::errs> fcreatefile(const u_int32_t, const char * const, u_int32_t &); Enum<rfsv::errs> freplacefile(const u_int32_t, const char * const, u_int32_t &); Enum<rfsv::errs> fclose(const u_int32_t); diff --git a/lib/rfsv32.cc b/lib/rfsv32.cc index da9c6e0..ae12711 100644 --- a/lib/rfsv32.cc +++ b/lib/rfsv32.cc @@ -38,6 +38,8 @@ #include "bufferarray.h" #include "plpdirent.h" +using namespace std; + rfsv32::rfsv32(ppsocket * _skt) { skt = _skt; @@ -494,7 +496,7 @@ copyFromPsion(const char *from, const char *to, void *ptr, cpCallback_t cb) unsigned char *buff = new unsigned char[RFSV_SENDLEN]; do { if ((res = fread(handle, buff, RFSV_SENDLEN, len)) == E_PSI_GEN_NONE) { - op.write(buff, len); + op.write((char *)buff, len); total += len; if (cb && !cb(ptr, total)) res = E_PSI_FILE_CANCEL; @@ -549,7 +551,7 @@ copyToPsion(const char *from, const char *to, void *ptr, cpCallback_t cb) u_int32_t total = 0; while (ip && !ip.eof() && (res == E_PSI_GEN_NONE)) { u_int32_t len; - ip.read(buff, RFSV_SENDLEN); + ip.read((char *)buff, RFSV_SENDLEN); if ((res = fwrite(handle, buff, ip.gcount(), len)) == E_PSI_GEN_NONE) { total += len; if (cb && !cb(ptr, total)) diff --git a/lib/rfsv32.h b/lib/rfsv32.h index 4de3feb..c3b89db 100644 --- a/lib/rfsv32.h +++ b/lib/rfsv32.h @@ -42,7 +42,7 @@ class rfsv32 : public rfsv { /** * rfsvfactory may call our constructor. */ - friend rfsvfactory; + friend class rfsvfactory; public: Enum<rfsv::errs> dir(const char * const, PlpDir &); @@ -55,7 +55,7 @@ public: Enum<rfsv::errs> rmdir(const char * const); Enum<rfsv::errs> remove(const char * const); Enum<rfsv::errs> rename(const char * const, const char * const); - Enum<rfsv::errs> mktemp(u_int32_t &, string &); + Enum<rfsv::errs> mktemp(u_int32_t &, std::string &); Enum<rfsv::errs> fgeteattr(const char * const, PlpDirent &); Enum<rfsv::errs> fgetattr(const char * const, u_int32_t &); Enum<rfsv::errs> fsetattr(const char * const, const u_int32_t, const u_int32_t); diff --git a/lib/rfsvfactory.cc b/lib/rfsvfactory.cc index 3a142da..46de414 100644 --- a/lib/rfsvfactory.cc +++ b/lib/rfsvfactory.cc @@ -39,6 +39,8 @@ #include "ppsocket.h" #include "Enum.h" +using namespace std; + ENUM_DEFINITION(rfsvfactory::errs, rfsvfactory::FACERR_NONE) { stringRep.add(rfsvfactory::FACERR_NONE, N_("no error")); stringRep.add(rfsvfactory::FACERR_COULD_NOT_SEND, N_("could not send version request")); diff --git a/lib/rpcs.cc b/lib/rpcs.cc index bc24272..4a310f0 100644 --- a/lib/rpcs.cc +++ b/lib/rpcs.cc @@ -39,6 +39,8 @@ #include "psiprocess.h" #include "Enum.h" +using namespace std; + ENUM_DEFINITION(rpcs::machs, rpcs::PSI_MACH_UNKNOWN) { stringRep.add(rpcs::PSI_MACH_UNKNOWN, N_("Unknown device")); stringRep.add(rpcs::PSI_MACH_PC, N_("PC")); diff --git a/lib/rpcs16.h b/lib/rpcs16.h index 35c5a1c..58ca05b 100644 --- a/lib/rpcs16.h +++ b/lib/rpcs16.h @@ -38,7 +38,7 @@ class rpcsfactory; * @ref rpcs . For a complete documentation, see @ref rpcs . */ class rpcs16 : public rpcs { - friend rpcsfactory; + friend class rpcsfactory; public: Enum<rfsv::errs> getCmdLine(const char *, string &); diff --git a/lib/rpcs32.h b/lib/rpcs32.h index 5adf829..9089b66 100644 --- a/lib/rpcs32.h +++ b/lib/rpcs32.h @@ -37,7 +37,7 @@ class rpcsfactory; * @ref rpcs . For a complete documentation, see @ref rpcs . */ class rpcs32 : public rpcs { - friend rpcsfactory; + friend class rpcsfactory; public: Enum<rfsv::errs> getCmdLine(const char *, string &); |