Fixed assignment of double to MString.
This commit is contained in:
1 parent
1cfdc23a57
commit
363a6aa496
5 files changed
+36
No files matched your search
+16
@@ -2,6 +2,7 @@
|
||||
#include "Log.h"
|
||||
#include "uuid/uuid.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -80,6 +81,13 @@ namespace coreutils {
|
||||
this->length = fread(this->data, 1000000, 1000000, file);
|
||||
cursor = this->data;
|
||||
}
|
||||
|
||||
MString::MString(double value) {
|
||||
std::string data = std::to_string(value);
|
||||
setSize(data.length());
|
||||
memcpy(this->data, (char *)data.c_str(), data.length());
|
||||
cursor = this->data;
|
||||
}
|
||||
|
||||
MString::~MString() {
|
||||
if (data)
|
||||
@@ -120,6 +128,14 @@ namespace coreutils {
|
||||
*data = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MString &MString::operator=(double value) {
|
||||
std::string data = std::to_string(value);
|
||||
setSize(data.length());
|
||||
memcpy(this->data, (char *)data.c_str(), data.length());
|
||||
cursor = this->data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MString &MString::operator<<(const char *value) {
|
||||
int temp = length;
|
||||
|
||||
Reference in new issue
Block a user