]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: make [], hexdump const
authorSage Weil <sage@newdream.net>
Thu, 29 Oct 2009 20:11:43 +0000 (13:11 -0700)
committerSage Weil <sage@newdream.net>
Thu, 29 Oct 2009 22:36:27 +0000 (15:36 -0700)
src/common/buffer.cc
src/include/buffer.h

index 6fbfa06a1f9a8906665b6a1198a026725b0c4a4a..dbe3c2e9af12e1ef5cc24698a10c63cc7f2102cb 100644 (file)
@@ -88,7 +88,7 @@ int buffer::list::write_file(const char *fn)
   return 0;
 }
 
-void buffer::list::hexdump(std::ostream &out)
+void buffer::list::hexdump(std::ostream &out) const
 {
   out.setf(std::ios::right);
   out.fill('0');
index 08d87233fbdf81a822aa00c403b5ab80331fa180..c4d0557bec81f1681ae79da838318f6507b687cc 100644 (file)
@@ -941,11 +941,11 @@ public:
     /*
      * get a char
      */
-    const char& operator[](unsigned n) {
+    const char& operator[](unsigned n) const {
       if (n >= _len)
        throw new end_of_buffer;
 
-      for (std::list<ptr>::iterator p = _buffers.begin();
+      for (std::list<ptr>::const_iterator p = _buffers.begin();
           p != _buffers.end();
           p++) {
        if (n >= p->length()) {
@@ -1090,7 +1090,7 @@ public:
 
     void encode_base64(list& o);
 
-    void hexdump(std::ostream &out);
+    void hexdump(std::ostream &out) const;
     int read_file(const char *fn, bool silent=false);
     int write_file(const char *fn);
     __u32 crc32c(__u32 crc) {