From 6a187a8702b0eba9448fa0735df316d4cc324de2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 15 Apr 2013 22:06:09 +0200 Subject: [PATCH] mm_mem_io_c: get_buffer() for r/w instances --- src/common/mm_io.cpp | 8 ++++++++ src/common/mm_io.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index 97b2090dc..8ec2185e2 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -819,6 +819,14 @@ mm_mem_io_c::eof() { return m_pos >= m_mem_size; } +unsigned char * +mm_mem_io_c::get_buffer() + const { + if (m_read_only) + throw mtx::invalid_parameter_x(); + return m_mem; +} + unsigned char * mm_mem_io_c::get_and_lock_buffer() { m_free_mem = false; diff --git a/src/common/mm_io.h b/src/common/mm_io.h index 81b6e5516..22b94b099 100644 --- a/src/common/mm_io.h +++ b/src/common/mm_io.h @@ -236,6 +236,7 @@ public: m_file_name = file_name; } + virtual unsigned char *get_buffer() const; virtual unsigned char *get_and_lock_buffer(); virtual std::string get_content() const;