summaryrefslogtreecommitdiffstats
path: root/Field.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-21 15:31:43 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-21 15:31:43 +0200
commit71760514fc044f273914c17b1510fa3cf10419b3 (patch)
tree72f822efde300d8e1e9de1cc578d431ff72e0e03 /Field.cpp
parent2017-04-15 (diff)
downloadAltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.gz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.bz2
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.lz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.xz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.zst
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.zip
Diffstat (limited to 'Field.cpp')
-rw-r--r--Field.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Field.cpp b/Field.cpp
index d061bcc..c95c32d 100644
--- a/Field.cpp
+++ b/Field.cpp
@@ -7,7 +7,7 @@ Field::Field() {
Field::Field(const Field &other) : m_dataLength(other.m_dataLength), m_type(other.m_type) {
m_data = new byte[m_dataLength];
- memcpy(m_data, other.m_data, m_dataLength);
+ std::copy(other.m_data,other.m_data+m_dataLength,m_data);
}
void Field::swap(Field &other) {
@@ -39,7 +39,7 @@ void Field::Clear() {
void Field::CopyToBuff(byte *ptr) {
if (m_dataLength > 0)
- memcpy(ptr, m_data, m_dataLength);
+ std::copy(m_data,m_data+m_dataLength,ptr);
}
void Field::SetRaw(byte *ptr, size_t len, FieldType type) {
@@ -47,7 +47,7 @@ void Field::SetRaw(byte *ptr, size_t len, FieldType type) {
m_dataLength = len;
m_type = type;
m_data = new byte[m_dataLength];
- memcpy(m_data, ptr, m_dataLength);
+ std::copy(ptr,ptr+m_dataLength,m_data);
}
int Field::GetVarInt() {
@@ -129,7 +129,7 @@ void Field::SetString(std::string value) {
byte *p = m_data;
fLen.CopyToBuff(p);
p += fLen.GetLength();
- memcpy(p, value.c_str(), value.size());
+ std::copy(value.begin(),value.end(),p);
}
long long Field::GetLong() {
@@ -176,7 +176,7 @@ sbyte Field::GetByte() {
void Field::SetByte(sbyte value) {
Clear();
- m_type = Byte;
+ m_type = Byte8_t;
endswap(&value);
m_dataLength = 1;
m_data = new byte[m_dataLength];
@@ -259,7 +259,7 @@ size_t Field::GetFieldLength(FieldType type) {
return 0;
case Boolean:
return 1;
- case Byte:
+ case Byte8_t:
return 1;
case UnsignedByte:
return 1;