Permalink
Browse files

add return message length for AMQPMessage getMessage method

  • Loading branch information...
1 parent 20b20da commit 9e44cfbf5c316795ff084dcab744f4e99ae7739b @lufeng1102 committed Feb 26, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/AMQPMessage.cpp
View
@@ -20,19 +20,24 @@ AMQPMessage::~AMQPMessage() {
}
}
-void AMQPMessage::setMessage(const char * data) {
+void AMQPMessage::setMessage(const char * data,uint32_t length) {
if (!data)
return;
if (this->data)
free(this->data);
this->data = strdup(data);
+ this->len = length;
}
-char * AMQPMessage::getMessage() {
+char * AMQPMessage::getMessage(uint32_t* length) {
if (this->data)
- return this->data;
+ {
+ *length = this->len;
+ return this->data;
+ }
+ *length = 0;
return '\0';
}

0 comments on commit 9e44cfb

Please sign in to comment.