summaryrefslogtreecommitdiff
path: root/ptunxor.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-06-20 17:21:42 +0200
committerRobin Gareus <robin@gareus.org>2019-06-20 18:20:00 +0200
commit73d90f6a983af8fda0b7f9ac5f66f40513482ecb (patch)
tree13834dc92783ba2d109ffc3d26c8d8c73f938f36 /ptunxor.cc
parent4f2708e4d29e54f2e8d2d5c5fbf8002905bc1021 (diff)
API cleanup: const-ness, remove public variables
Do not allow users of the API to modify internal variables, prefer accessor methods to constant data. Use const-references whenever possible (don't copy-construct arguments), likewise prefer direct references over iterators.
Diffstat (limited to 'ptunxor.cc')
-rw-r--r--ptunxor.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/ptunxor.cc b/ptunxor.cc
index 1e0cc88..484454e 100644
--- a/ptunxor.cc
+++ b/ptunxor.cc
@@ -37,9 +37,12 @@ int main(int argc, char** argv) {
fprintf(stderr, "Can't decrypt pt session, still try to dump...\n");
}
- if (ptf.ptfunxored) {
- for (i = 0; i < ptf.len; i++) {
- printf("%c", ptf.ptfunxored[i]);
+ const unsigned char* unxored = ptf.unxored_data();
+ uint64_t len = ptf.unxored_size ();
+
+ if (unxored) {
+ for (i = 0; i < len; i++) {
+ printf("%c", unxored[i]);
}
}