diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/test/old/testbuffers.cc | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/old/testbuffers.cc')
-rw-r--r-- | src/test/old/testbuffers.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/old/testbuffers.cc b/src/test/old/testbuffers.cc new file mode 100644 index 00000000..be2298ff --- /dev/null +++ b/src/test/old/testbuffers.cc @@ -0,0 +1,40 @@ + +#include <iostream> +using namespace std; + +#include "include/bufferlist.h" + + +int main() +{ + + bufferptr p1 = new buffer("123456",6); + bufferptr p2 = p1; + + cout << "it is '" << p1.c_str() << "'" << endl; + + bufferptr p3 = new buffer("abcdef",6); + + cout << "p3 is " << p3 << endl; + + bufferlist bl; + bl.push_back(p2); + bl.push_back(p1); + bl.push_back(p3); + + cout << "bl is " << bl << endl; + + cout << "len is " << bl.length() << endl; + + bufferlist took; + bl.splice(10,4,&took); + + cout << "took out " << took << "leftover is " << bl << endl; + //cout << "len is " << bl.length() << endl; + + bufferlist bl2; + bl2.substr_of(bl, 3, 5); + cout << "bl2 is " << bl2 << endl; + + +} |