Browse Source

copy is optional

AllGroupDevicesShowHandshake
Volker Birk 6 years ago
parent
commit
40e4fc50f2
2 changed files with 11 additions and 6 deletions
  1. +10
    -5
      src/message.cc
  2. +1
    -1
      src/message.hh

+ 10
- 5
src/message.cc View File

@ -12,13 +12,18 @@ namespace pEp {
}
Message::Blob::Blob(const Blob& second)
Message::Blob::Blob(const Blob& second, bool copy)
{
_size = second._size;
_value = (char *) malloc(_size);
if (!_value)
throw bad_alloc();
memcpy(_value, second._value, _size);
if (copy) {
_value = (char *) malloc(_size);
if (!_value)
throw bad_alloc();
memcpy(_value, second._value, _size);
}
else {
_value = second._value;
}
_mime_type = second._mime_type;
_filename = second._filename;
}


+ 1
- 1
src/message.hh View File

@ -19,7 +19,7 @@ namespace pEp {
public:
Blob(char *value = NULL, size_t size = 0, string mime_type = "",
string filename = "");
Blob(const Blob& second);
Blob(const Blob& second, bool copy = false);
~Blob();
void attach(bloblist_t *blob);
bloblist_t *detach();


Loading…
Cancel
Save