Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bad cast, trying to set non-pod field

  • Loading branch information...
commit 9a908f2fae05d5b4957671da937485b94692cb62 1 parent a974d6b
@erikfrey erikfrey authored
Showing with 8 additions and 9 deletions.
  1. +1 −5 include/darner/queue/queue.h
  2. +7 −4 src/queue/queue.cpp
View
6 include/darner/queue/queue.h
@@ -72,11 +72,7 @@ class queue
id_type end;
size_type size;
- const std::string& str() const;
-
- private:
-
- mutable std::string buf_;
+ void str(std::string& out) const;
};
// queue methods aren't meant to be used directly. instead create an iqstream or oqstream to use it
View
11 src/queue/queue.cpp
@@ -88,7 +88,11 @@ void queue::push(id_type& result, const string& item)
void queue::push(id_type& result, const header_type& header)
{
- put(queue_head_.slice(), header.str());
+ std::string buf;
+
+ header.str(buf);
+
+ put(queue_head_.slice(), buf);
result = queue_head_.id++;
@@ -245,10 +249,9 @@ void queue::compact()
}
// child classes
-const string& queue::header_type::str() const
+void queue::header_type::str(std::string& out) const
{
- buf_ = string(reinterpret_cast<const char *>(this), sizeof(header_type)) + '\1' + '\0';
- return buf_;
+ out = string(reinterpret_cast<const char *>(this), sizeof(header_type)) + '\1' + '\0';
}
leveldb::Slice queue::key_type::slice() const
Please sign in to comment.
Something went wrong with that request. Please try again.