aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rpcs.cc
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2003-02-05 07:59:09 +0000
committerFritz Elfert <felfert@to.com>2003-02-05 07:59:09 +0000
commitf0c047e1f40ee2214fe1f73dc3bdc6b0f6de5d85 (patch)
tree166bf2df5ca4fc40904af30a56a0de88683baf8d /lib/rpcs.cc
parent27ba222abbf3137eef49e31ac521de01d39c8088 (diff)
downloadplptools-f0c047e1f40ee2214fe1f73dc3bdc6b0f6de5d85.tar.gz
plptools-f0c047e1f40ee2214fe1f73dc3bdc6b0f6de5d85.tar.bz2
plptools-f0c047e1f40ee2214fe1f73dc3bdc6b0f6de5d85.zip
- Changes for compiling with gcc 3.2
Diffstat (limited to 'lib/rpcs.cc')
-rw-r--r--lib/rpcs.cc41
1 files changed, 17 insertions, 24 deletions
diff --git a/lib/rpcs.cc b/lib/rpcs.cc
index 4a310f0..48298b8 100644
--- a/lib/rpcs.cc
+++ b/lib/rpcs.cc
@@ -24,14 +24,6 @@
#include "config.h"
#endif
-#include <stream.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fstream.h>
-#include <iomanip.h>
-#include <time.h>
-#include <string.h>
-
#include "rpcs.h"
#include "bufferstore.h"
#include "ppsocket.h"
@@ -39,6 +31,10 @@
#include "psiprocess.h"
#include "Enum.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
using namespace std;
ENUM_DEFINITION(rpcs::machs, rpcs::PSI_MACH_UNKNOWN) {
@@ -387,23 +383,20 @@ getOwnerInfo(bufferArray &owner)
if ((res = (enum rfsv::errs)getResponse(a, true)) != rfsv::E_PSI_GEN_NONE)
return res;
a.addByte(0);
- int l = a.getLen();
- char *s = (char *)a.getString(0);
- for (int i = 0; i < l; i++)
- if (s[i] == 6)
- s[i] = 0;
+ string s = a.getString(0);
owner.clear();
- while (l > 0) {
- if (*s != '\0') {
- bufferStore b;
- b.addStringT(s);
- owner += b;
- l -= (strlen(s) + 1);
- s += (strlen(s) + 1);
- } else {
- l--;
- s++;
- }
+ int p = 0;
+ int l;
+ while ((l = s.find('\006', p)) != s.npos) {
+ bufferStore b;
+ b.addStringT(s.substr(p, l - p).c_str());
+ owner += b;
+ p = l + 1;
+ }
+ if (s.substr(p).length()) {
+ bufferStore b;
+ b.addStringT(s.substr(p).c_str());
+ owner += b;
}
return res;
}