summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-12-05 08:23:06 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-12-05 08:23:06 +0100
commitbb1c35235b71079b20f469421a895b038bcfa0db (patch)
tree73e75e99815dbf97c9f4aafec89633d2767d7217 /src
parent7a0173db5f0acf0848ccc0589f64f08f44782337 (diff)
XDR: Add proper get_string method
Diffstat (limited to 'src')
-rw-r--r--src/os/object/xdrinput.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/os/object/xdrinput.cc b/src/os/object/xdrinput.cc
index 077f695..5fb17bf 100644
--- a/src/os/object/xdrinput.cc
+++ b/src/os/object/xdrinput.cc
@@ -61,3 +61,17 @@ char *XDRInput::get_opaque(uint32_t length)
}
return ret;
}
+
+void XDRInput::get_string(char* target)
+{
+ uint16_t length = get_opaque_length();
+ uint16_t i;
+ for (i = 0; i < length; i++) {
+ target[i] = data[pos + i];
+ }
+ target[i] = 0;
+ pos += length;
+ if (length % 4) {
+ pos += 4 - (length % 4);
+ }
+}