summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-07 18:25:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-07 18:26:38 -0300
commit2ab83e1abbf5ee6d00e16056a9e9394114026f28 (patch)
tree7efbb375cc4d00d8e8589fcf1b6a1303bec5df2d /core/io
parent2a38a5eaa844043b846e03d6655f84caf8a31e74 (diff)
Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector
Diffstat (limited to 'core/io')
-rw-r--r--core/io/file_access_buffered.cpp4
-rw-r--r--core/io/file_access_buffered_fa.h2
-rw-r--r--core/io/http_client.cpp6
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/io/marshalls.cpp62
-rw-r--r--core/io/packet_peer.cpp14
-rw-r--r--core/io/packet_peer.h8
-rw-r--r--core/io/resource_format_binary.cpp88
-rw-r--r--core/io/resource_format_xml.cpp96
-rw-r--r--core/io/stream_peer.cpp32
-rw-r--r--core/io/stream_peer.h10
-rw-r--r--core/io/tcp_server.cpp4
-rw-r--r--core/io/tcp_server.h2
13 files changed, 165 insertions, 165 deletions
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 347edc7407..71518de38b 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -117,7 +117,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest,int p_elements) const {
int size = (cache.buffer.size() - (file.offset - cache.offset));
size = size - (size % 4);
- //DVector<uint8_t>::Read read = cache.buffer.read();
+ //PoolVector<uint8_t>::Read read = cache.buffer.read();
//memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size);
memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size);
p_dest += size;
@@ -152,7 +152,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest,int p_elements) const {
};
int r = MIN(left, to_read);
- //DVector<uint8_t>::Read read = cache.buffer.read();
+ //PoolVector<uint8_t>::Read read = cache.buffer.read();
//memcpy(p_dest+total_read, &read.ptr()[file.offset - cache.offset], r);
memcpy(p_dest+total_read, cache.buffer.ptr() + (file.offset - cache.offset), r);
diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h
index 8a15584b13..884d40a266 100644
--- a/core/io/file_access_buffered_fa.h
+++ b/core/io/file_access_buffered_fa.h
@@ -53,7 +53,7 @@ class FileAccessBufferedFA : public FileAccessBuffered {
cache.buffer.resize(p_size);
// on dvector
- //DVector<uint8_t>::Write write = cache.buffer.write();
+ //PoolVector<uint8_t>::Write write = cache.buffer.write();
//f.get_buffer(write.ptr(), p_size);
// on vector
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 4051ae302f..b556d46105 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -87,7 +87,7 @@ Ref<StreamPeer> HTTPClient::get_connection() const {
return connection;
}
-Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const DVector<uint8_t>& p_body) {
+Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const PoolVector<uint8_t>& p_body) {
ERR_FAIL_INDEX_V(p_method,METHOD_MAX,ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(status!=STATUS_CONNECTED,ERR_INVALID_PARAMETER);
@@ -120,7 +120,7 @@ Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vecto
request+="\r\n";
CharString cs=request.utf8();
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
//Maybe this goes faster somehow?
for(int i=0;i<cs.length();i++) {
@@ -128,7 +128,7 @@ Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vecto
}
data.append_array( p_body );
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
Error err = connection->put_data(&r[0], data.size());
if (err) {
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 2e78882303..231475775f 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -172,7 +172,7 @@ public:
void set_connection(const Ref<StreamPeer>& p_connection);
Ref<StreamPeer> get_connection() const;
- Error request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const DVector<uint8_t>& p_body);
+ Error request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const PoolVector<uint8_t>& p_body);
Error request( Method p_method, const String& p_url, const Vector<String>& p_headers,const String& p_body=String());
Error send_body_text(const String& p_body);
Error send_body_data(const ByteArray& p_body);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index bc6cc0bb83..e10e4413bc 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -272,11 +272,11 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (datalen>0) {
len-=5*4;
ERR_FAIL_COND_V( len < datalen, ERR_INVALID_DATA );
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(datalen);
- DVector<uint8_t>::Write wr = data.write();
+ PoolVector<uint8_t>::Write wr = data.write();
copymem(&wr[0],&buf[20],datalen);
- wr = DVector<uint8_t>::Write();
+ wr = PoolVector<uint8_t>::Write();
@@ -537,17 +537,17 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
ERR_FAIL_COND_V((int)count>len,ERR_INVALID_DATA);
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
if (count) {
data.resize(count);
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
for(int i=0;i<count;i++) {
w[i]=buf[i];
}
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
}
r_variant=data;
@@ -569,18 +569,18 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
len-=4;
ERR_FAIL_COND_V((int)count*4>len,ERR_INVALID_DATA);
- DVector<int> data;
+ PoolVector<int> data;
if (count) {
//const int*rbuf=(const int*)buf;
data.resize(count);
- DVector<int>::Write w = data.write();
+ PoolVector<int>::Write w = data.write();
for(int i=0;i<count;i++) {
w[i]=decode_uint32(&buf[i*4]);
}
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
}
r_variant=Variant(data);
if (r_len) {
@@ -596,18 +596,18 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
len-=4;
ERR_FAIL_COND_V((int)count*4>len,ERR_INVALID_DATA);
- DVector<float> data;
+ PoolVector<float> data;
if (count) {
//const float*rbuf=(const float*)buf;
data.resize(count);
- DVector<float>::Write w = data.write();
+ PoolVector<float>::Write w = data.write();
for(int i=0;i<count;i++) {
w[i]=decode_float(&buf[i*4]);
}
- w = DVector<float>::Write();
+ w = PoolVector<float>::Write();
}
r_variant=data;
@@ -623,7 +623,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
uint32_t count = decode_uint32(buf);
ERR_FAIL_COND_V(count<0,ERR_INVALID_DATA);
- DVector<String> strings;
+ PoolVector<String> strings;
buf+=4;
len-=4;
@@ -676,7 +676,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
len-=4;
ERR_FAIL_COND_V((int)count*4*2>len,ERR_INVALID_DATA);
- DVector<Vector2> varray;
+ PoolVector<Vector2> varray;
if (r_len) {
(*r_len)+=4;
@@ -684,7 +684,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
varray.resize(count);
- DVector<Vector2>::Write w = varray.write();
+ PoolVector<Vector2>::Write w = varray.write();
for(int i=0;i<(int)count;i++) {
@@ -714,7 +714,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
len-=4;
ERR_FAIL_COND_V((int)count*4*3>len,ERR_INVALID_DATA);
- DVector<Vector3> varray;
+ PoolVector<Vector3> varray;
if (r_len) {
(*r_len)+=4;
@@ -722,7 +722,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
varray.resize(count);
- DVector<Vector3>::Write w = varray.write();
+ PoolVector<Vector3>::Write w = varray.write();
for(int i=0;i<(int)count;i++) {
@@ -753,7 +753,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
len-=4;
ERR_FAIL_COND_V((int)count*4*4>len,ERR_INVALID_DATA);
- DVector<Color> carray;
+ PoolVector<Color> carray;
if (r_len) {
(*r_len)+=4;
@@ -761,7 +761,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (count) {
carray.resize(count);
- DVector<Color>::Write w = carray.write();
+ PoolVector<Color>::Write w = carray.write();
for(int i=0;i<(int)count;i++) {
@@ -1055,7 +1055,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
case Variant::IMAGE: {
Image image = p_variant;
- DVector<uint8_t> data=image.get_data();
+ PoolVector<uint8_t> data=image.get_data();
if (buf) {
@@ -1065,7 +1065,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
encode_uint32(image.get_height(),&buf[12]);
int ds=data.size();
encode_uint32(ds,&buf[16]);
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
copymem(&buf[20],&r[0],ds);
}
@@ -1234,14 +1234,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
// arrays
case Variant::RAW_ARRAY: {
- DVector<uint8_t> data = p_variant;
+ PoolVector<uint8_t> data = p_variant;
int datalen=data.size();
int datasize=sizeof(uint8_t);
if (buf) {
encode_uint32(datalen,buf);
buf+=4;
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
copymem(buf,&r[0],datalen*datasize);
}
@@ -1253,14 +1253,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::INT_ARRAY: {
- DVector<int> data = p_variant;
+ PoolVector<int> data = p_variant;
int datalen=data.size();
int datasize=sizeof(int32_t);
if (buf) {
encode_uint32(datalen,buf);
buf+=4;
- DVector<int>::Read r = data.read();
+ PoolVector<int>::Read r = data.read();
for(int i=0;i<datalen;i++)
encode_uint32(r[i],&buf[i*datasize]);
@@ -1271,14 +1271,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::REAL_ARRAY: {
- DVector<real_t> data = p_variant;
+ PoolVector<real_t> data = p_variant;
int datalen=data.size();
int datasize=sizeof(real_t);
if (buf) {
encode_uint32(datalen,buf);
buf+=4;
- DVector<real_t>::Read r = data.read();
+ PoolVector<real_t>::Read r = data.read();
for(int i=0;i<datalen;i++)
encode_float(r[i],&buf[i*datasize]);
@@ -1290,7 +1290,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
case Variant::STRING_ARRAY: {
- DVector<String> data = p_variant;
+ PoolVector<String> data = p_variant;
int len=data.size();
if (buf) {
@@ -1323,7 +1323,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::VECTOR2_ARRAY: {
- DVector<Vector2> data = p_variant;
+ PoolVector<Vector2> data = p_variant;
int len=data.size();
if (buf) {
@@ -1351,7 +1351,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::VECTOR3_ARRAY: {
- DVector<Vector3> data = p_variant;
+ PoolVector<Vector3> data = p_variant;
int len=data.size();
if (buf) {
@@ -1380,7 +1380,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::COLOR_ARRAY: {
- DVector<Color> data = p_variant;
+ PoolVector<Color> data = p_variant;
int len=data.size();
if (buf) {
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 720e912e71..5ff09f9fb0 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -39,7 +39,7 @@ PacketPeer::PacketPeer() {
last_get_error=OK;
}
-Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const {
+Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const {
const uint8_t *buffer;
int buffer_size;
@@ -51,7 +51,7 @@ Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const {
if (buffer_size==0)
return OK;
- DVector<uint8_t>::Write w = r_buffer.write();
+ PoolVector<uint8_t>::Write w = r_buffer.write();
for(int i=0;i<buffer_size;i++)
w[i]=buffer[i];
@@ -59,13 +59,13 @@ Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const {
}
-Error PacketPeer::put_packet_buffer(const DVector<uint8_t> &p_buffer) {
+Error PacketPeer::put_packet_buffer(const PoolVector<uint8_t> &p_buffer) {
int len = p_buffer.size();
if (len==0)
return OK;
- DVector<uint8_t>::Read r = p_buffer.read();
+ PoolVector<uint8_t>::Read r = p_buffer.read();
return put_packet(&r[0],len);
}
@@ -108,12 +108,12 @@ Variant PacketPeer::_bnd_get_var() const {
return var;
};
-Error PacketPeer::_put_packet(const DVector<uint8_t> &p_buffer) {
+Error PacketPeer::_put_packet(const PoolVector<uint8_t> &p_buffer) {
return put_packet_buffer(p_buffer);
}
-DVector<uint8_t> PacketPeer::_get_packet() const {
+PoolVector<uint8_t> PacketPeer::_get_packet() const {
- DVector<uint8_t> raw;
+ PoolVector<uint8_t> raw;
last_get_error=get_packet_buffer(raw);
return raw;
}
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index c67cfb943e..bacd5214f1 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -42,8 +42,8 @@ class PacketPeer : public Reference {
static void _bind_methods();
- Error _put_packet(const DVector<uint8_t> &p_buffer);
- DVector<uint8_t> _get_packet() const;
+ Error _put_packet(const PoolVector<uint8_t> &p_buffer);
+ PoolVector<uint8_t> _get_packet() const;
Error _get_packet_error() const;
@@ -59,8 +59,8 @@ public:
/* helpers / binders */
- virtual Error get_packet_buffer(DVector<uint8_t> &r_buffer) const;
- virtual Error put_packet_buffer(const DVector<uint8_t> &p_buffer);
+ virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer) const;
+ virtual Error put_packet_buffer(const PoolVector<uint8_t> &p_buffer);
virtual Error get_var(Variant &r_variant) const;
virtual Error put_var(const Variant& p_packet);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 512031b128..2a9089e8e8 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -264,22 +264,22 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t datalen = f->get_32();
- DVector<uint8_t> imgdata;
+ PoolVector<uint8_t> imgdata;
imgdata.resize(datalen);
- DVector<uint8_t>::Write w = imgdata.write();
+ PoolVector<uint8_t>::Write w = imgdata.write();
f->get_buffer(w.ptr(),datalen);
_advance_padding(datalen);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_v=Image(width,height,mipmaps,fmt,imgdata);
} else {
//compressed
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(f->get_32());
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
f->get_buffer(w.ptr(),data.size());
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
Image img;
@@ -448,12 +448,12 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t len = f->get_32();
- DVector<uint8_t> array;
+ PoolVector<uint8_t> array;
array.resize(len);
- DVector<uint8_t>::Write w = array.write();
+ PoolVector<uint8_t>::Write w = array.write();
f->get_buffer(w.ptr(),len);
_advance_padding(len);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_v=array;
} break;
@@ -461,9 +461,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t len = f->get_32();
- DVector<int> array;
+ PoolVector<int> array;
array.resize(len);
- DVector<int>::Write w = array.write();
+ PoolVector<int>::Write w = array.write();
f->get_buffer((uint8_t*)w.ptr(),len*4);
#ifdef BIG_ENDIAN_ENABLED
{
@@ -475,16 +475,16 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
}
#endif
- w=DVector<int>::Write();
+ w=PoolVector<int>::Write();
r_v=array;
} break;
case VARIANT_REAL_ARRAY: {
uint32_t len = f->get_32();
- DVector<real_t> array;
+ PoolVector<real_t> array;
array.resize(len);
- DVector<real_t>::Write w = array.write();
+ PoolVector<real_t>::Write w = array.write();
f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t));
#ifdef BIG_ENDIAN_ENABLED
{
@@ -497,18 +497,18 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
#endif
- w=DVector<real_t>::Write();
+ w=PoolVector<real_t>::Write();
r_v=array;
} break;
case VARIANT_STRING_ARRAY: {
uint32_t len = f->get_32();
- DVector<String> array;
+ PoolVector<String> array;
array.resize(len);
- DVector<String>::Write w = array.write();
+ PoolVector<String>::Write w = array.write();
for(uint32_t i=0;i<len;i++)
w[i]=get_unicode_string();
- w=DVector<String>::Write();
+ w=PoolVector<String>::Write();
r_v=array;
@@ -517,9 +517,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t len = f->get_32();
- DVector<Vector2> array;
+ PoolVector<Vector2> array;
array.resize(len);
- DVector<Vector2>::Write w = array.write();
+ PoolVector<Vector2>::Write w = array.write();
if (sizeof(Vector2)==8) {
f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*2);
#ifdef BIG_ENDIAN_ENABLED
@@ -537,7 +537,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
ERR_EXPLAIN("Vector2 size is NOT 8!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
- w=DVector<Vector2>::Write();
+ w=PoolVector<Vector2>::Write();
r_v=array;
} break;
@@ -545,9 +545,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t len = f->get_32();
- DVector<Vector3> array;
+ PoolVector<Vector3> array;
array.resize(len);
- DVector<Vector3>::Write w = array.write();
+ PoolVector<Vector3>::Write w = array.write();
if (sizeof(Vector3)==12) {
f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*3);
#ifdef BIG_ENDIAN_ENABLED
@@ -565,7 +565,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
ERR_EXPLAIN("Vector3 size is NOT 12!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
- w=DVector<Vector3>::Write();
+ w=PoolVector<Vector3>::Write();
r_v=array;
} break;
@@ -573,9 +573,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
uint32_t len = f->get_32();
- DVector<Color> array;
+ PoolVector<Color> array;
array.resize(len);
- DVector<Color>::Write w = array.write();
+ PoolVector<Color>::Write w = array.write();
if (sizeof(Color)==16) {
f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*4);
#ifdef BIG_ENDIAN_ENABLED
@@ -593,7 +593,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
ERR_EXPLAIN("Color size is NOT 16!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
- w=DVector<Color>::Write();
+ w=PoolVector<Color>::Write();
r_v=array;
} break;
@@ -1587,12 +1587,12 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
int dlen = val.get_data().size();
f->store_32(dlen);
- DVector<uint8_t>::Read r = val.get_data().read();
+ PoolVector<uint8_t>::Read r = val.get_data().read();
f->store_buffer(r.ptr(),dlen);
_pad_buffer(dlen);
} else {
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
if (encoding==IMAGE_ENCODING_LOSSY) {
data=Image::lossy_packer(val,quality);
@@ -1604,7 +1604,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
int ds=data.size();
f->store_32(ds);
if (ds>0) {
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
f->store_buffer(r.ptr(),ds);
_pad_buffer(ds);
@@ -1703,10 +1703,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::RAW_ARRAY: {
f->store_32(VARIANT_RAW_ARRAY);
- DVector<uint8_t> arr = p_property;
+ PoolVector<uint8_t> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<uint8_t>::Read r = arr.read();
+ PoolVector<uint8_t>::Read r = arr.read();
f->store_buffer(r.ptr(),len);
_pad_buffer(len);
@@ -1714,10 +1714,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::INT_ARRAY: {
f->store_32(VARIANT_INT_ARRAY);
- DVector<int> arr = p_property;
+ PoolVector<int> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<int>::Read r = arr.read();
+ PoolVector<int>::Read r = arr.read();
for(int i=0;i<len;i++)
f->store_32(r[i]);
@@ -1725,10 +1725,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::REAL_ARRAY: {
f->store_32(VARIANT_REAL_ARRAY);
- DVector<real_t> arr = p_property;
+ PoolVector<real_t> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<real_t>::Read r = arr.read();
+ PoolVector<real_t>::Read r = arr.read();
for(int i=0;i<len;i++) {
f->store_real(r[i]);
}
@@ -1737,10 +1737,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::STRING_ARRAY: {
f->store_32(VARIANT_STRING_ARRAY);
- DVector<String> arr = p_property;
+ PoolVector<String> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<String>::Read r = arr.read();
+ PoolVector<String>::Read r = arr.read();
for(int i=0;i<len;i++) {
save_unicode_string(r[i]);
}
@@ -1749,10 +1749,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::VECTOR3_ARRAY: {
f->store_32(VARIANT_VECTOR3_ARRAY);
- DVector<Vector3> arr = p_property;
+ PoolVector<Vector3> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<Vector3>::Read r = arr.read();
+ PoolVector<Vector3>::Read r = arr.read();
for(int i=0;i<len;i++) {
f->store_real(r[i].x);
f->store_real(r[i].y);
@@ -1763,10 +1763,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::VECTOR2_ARRAY: {
f->store_32(VARIANT_VECTOR2_ARRAY);
- DVector<Vector2> arr = p_property;
+ PoolVector<Vector2> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<Vector2>::Read r = arr.read();
+ PoolVector<Vector2>::Read r = arr.read();
for(int i=0;i<len;i++) {
f->store_real(r[i].x);
f->store_real(r[i].y);
@@ -1776,10 +1776,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Variant::COLOR_ARRAY: {
f->store_32(VARIANT_COLOR_ARRAY);
- DVector<Color> arr = p_property;
+ PoolVector<Color> arr = p_property;
int len=arr.size();
f->store_32(len);
- DVector<Color>::Read r = arr.read();
+ PoolVector<Color>::Read r = arr.read();
for(int i=0;i<len;i++) {
f->store_real(r[i].r);
f->store_real(r[i].g);
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index d4808d4741..34e3f282c1 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -623,9 +623,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
return OK;
};
- DVector<uint8_t> pixels;
+ PoolVector<uint8_t> pixels;
pixels.resize(datasize);
- DVector<uint8_t>::Write wb = pixels.write();
+ PoolVector<uint8_t>::Write wb = pixels.write();
int idx=0;
uint8_t byte;
@@ -652,7 +652,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
ERR_FAIL_COND_V(f->eof_reached(),ERR_FILE_CORRUPT);
- wb=DVector<uint8_t>::Write();
+ wb=PoolVector<uint8_t>::Write();
r_v=Image(w,h,mipmaps,imgformat,pixels);
String sdfsdfg;
@@ -672,9 +672,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();
- DVector<uint8_t> bytes;
+ PoolVector<uint8_t> bytes;
bytes.resize(len);
- DVector<uint8_t>::Write w=bytes.write();
+ PoolVector<uint8_t>::Write w=bytes.write();
uint8_t *bytesptr=w.ptr();
int idx=0;
uint8_t byte;
@@ -700,7 +700,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
ERR_FAIL_COND_V(f->eof_reached(),ERR_FILE_CORRUPT);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
r_v=bytes;
String sdfsdfg;
Error err=parse_property_data(sdfsdfg);
@@ -717,9 +717,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();
- DVector<int> ints;
+ PoolVector<int> ints;
ints.resize(len);
- DVector<int>::Write w=ints.write();
+ PoolVector<int>::Write w=ints.write();
int *intsptr=w.ptr();
int idx=0;
String str;
@@ -770,7 +770,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
#endif
- w=DVector<int>::Write();
+ w=PoolVector<int>::Write();
r_v=ints;
Error err=goto_end_of_tag();
@@ -786,9 +786,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();;
- DVector<real_t> reals;
+ PoolVector<real_t> reals;
reals.resize(len);
- DVector<real_t>::Write w=reals.write();
+ PoolVector<real_t>::Write w=reals.write();
real_t *realsptr=w.ptr();
int idx=0;
String str;
@@ -845,7 +845,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
#endif
- w=DVector<real_t>::Write();
+ w=PoolVector<real_t>::Write();
r_v=reals;
Error err=goto_end_of_tag();
@@ -861,9 +861,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();
- DVector<String> strings;
+ PoolVector<String> strings;
strings.resize(len);
- DVector<String>::Write w=strings.write();
+ PoolVector<String>::Write w=strings.write();
String *stringsptr=w.ptr();
int idx=0;
String str;
@@ -903,7 +903,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
cs.push_back(c);
}
}
- w=DVector<String>::Write();
+ w=PoolVector<String>::Write();
r_v=strings;
String sdfsdfg;
Error err=parse_property_data(sdfsdfg);
@@ -923,7 +923,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
StringArray array;
array.resize(len);
- DVector<String>::Write w = array.write();
+ PoolVector<String>::Write w = array.write();
Error err;
Variant v;
@@ -964,9 +964,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();;
- DVector<Vector3> vectors;
+ PoolVector<Vector3> vectors;
vectors.resize(len);
- DVector<Vector3>::Write w=vectors.write();
+ PoolVector<Vector3>::Write w=vectors.write();
Vector3 *vectorsptr=w.ptr();
int idx=0;
int subidx=0;
@@ -1041,7 +1041,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
// double time_taken = (OS::get_singleton()->get_ticks_usec() - tbegin)/1000000.0;
- w=DVector<Vector3>::Write();
+ w=PoolVector<Vector3>::Write();
r_v=vectors;
String sdfsdfg;
Error err=goto_end_of_tag();
@@ -1058,9 +1058,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();;
- DVector<Vector2> vectors;
+ PoolVector<Vector2> vectors;
vectors.resize(len);
- DVector<Vector2>::Write w=vectors.write();
+ PoolVector<Vector2>::Write w=vectors.write();
Vector2 *vectorsptr=w.ptr();
int idx=0;
int subidx=0;
@@ -1135,7 +1135,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
// double time_taken = (OS::get_singleton()->get_ticks_usec() - tbegin)/1000000.0;
- w=DVector<Vector2>::Write();
+ w=PoolVector<Vector2>::Write();
r_v=vectors;
String sdfsdfg;
Error err=goto_end_of_tag();
@@ -1152,9 +1152,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
}
int len=tag->args["len"].to_int();;
- DVector<Color> colors;
+ PoolVector<Color> colors;
colors.resize(len);
- DVector<Color>::Write w=colors.write();
+ PoolVector<Color>::Write w=colors.write();
Color *colorsptr=w.ptr();
int idx=0;
int subidx=0;
@@ -1194,7 +1194,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
str+=c;
}
}
- w=DVector<Color>::Write();
+ w=PoolVector<Color>::Write();
r_v=colors;
String sdfsdfg;
Error err=parse_property_data(sdfsdfg);
@@ -2248,13 +2248,13 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
case Variant::DICTIONARY: type="dictionary"; params="shared=\""+String(p_property.is_shared()?"true":"false")+"\""; oneliner=false; break;
case Variant::ARRAY: type="array"; params="len=\""+itos(p_property.operator Array().size())+"\" shared=\""+String(p_property.is_shared()?"true":"false")+"\""; oneliner=false; break;
- case Variant::RAW_ARRAY: type="raw_array"; params="len=\""+itos(p_property.operator DVector < uint8_t >().size())+"\""; break;
- case Variant::INT_ARRAY: type="int_array"; params="len=\""+itos(p_property.operator DVector < int >().size())+"\""; break;
- case Variant::REAL_ARRAY: type="real_array"; params="len=\""+itos(p_property.operator DVector < real_t >().size())+"\""; break;
- case Variant::STRING_ARRAY: oneliner=false; type="string_array"; params="len=\""+itos(p_property.operator DVector < String >().size())+"\""; break;
- case Variant::VECTOR2_ARRAY: type="vector2_array"; params="len=\""+itos(p_property.operator DVector < Vector2 >().size())+"\""; break;
- case Variant::VECTOR3_ARRAY: type="vector3_array"; params="len=\""+itos(p_property.operator DVector < Vector3 >().size())+"\""; break;
- case Variant::COLOR_ARRAY: type="color_array"; params="len=\""+itos(p_property.operator DVector < Color >().size())+"\""; break;
+ case Variant::RAW_ARRAY: type="raw_array"; params="len=\""+itos(p_property.operator PoolVector < uint8_t >().size())+"\""; break;
+ case Variant::INT_ARRAY: type="int_array"; params="len=\""+itos(p_property.operator PoolVector < int >().size())+"\""; break;
+ case Variant::REAL_ARRAY: type="real_array"; params="len=\""+itos(p_property.operator PoolVector < real_t >().size())+"\""; break;
+ case Variant::STRING_ARRAY: oneliner=false; type="string_array"; params="len=\""+itos(p_property.operator PoolVector < String >().size())+"\""; break;
+ case Variant::VECTOR2_ARRAY: type="vector2_array"; params="len=\""+itos(p_property.operator PoolVector < Vector2 >().size())+"\""; break;
+ case Variant::VECTOR3_ARRAY: type="vector3_array"; params="len=\""+itos(p_property.operator PoolVector < Vector3 >().size())+"\""; break;
+ case Variant::COLOR_ARRAY: type="color_array"; params="len=\""+itos(p_property.operator PoolVector < Color >().size())+"\""; break;
default: {
ERR_PRINT("Unknown Variant type.");
@@ -2403,9 +2403,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
String s;
Image img = p_property;
- DVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t> data = img.get_data();
int len = data.size();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
const uint8_t *ptr=r.ptr();;
for (int i=0;i<len;i++) {
@@ -2487,9 +2487,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
case Variant::RAW_ARRAY: {
String s;
- DVector<uint8_t> data = p_property;
+ PoolVector<uint8_t> data = p_property;
int len = data.size();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
const uint8_t *ptr=r.ptr();;
for (int i=0;i<len;i++) {
@@ -2504,9 +2504,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::INT_ARRAY: {
- DVector<int> data = p_property;
+ PoolVector<int> data = p_property;
int len = data.size();
- DVector<int>::Read r = data.read();
+ PoolVector<int>::Read r = data.read();
const int *ptr=r.ptr();;
write_tabs();
@@ -2523,9 +2523,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::REAL_ARRAY: {
- DVector<real_t> data = p_property;
+ PoolVector<real_t> data = p_property;
int len = data.size();
- DVector<real_t>::Read r = data.read();
+ PoolVector<real_t>::Read r = data.read();
const real_t *ptr=r.ptr();;
write_tabs();
String cm=", " ;
@@ -2541,9 +2541,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::STRING_ARRAY: {
- DVector<String> data = p_property;
+ PoolVector<String> data = p_property;
int len = data.size();
- DVector<String>::Read r = data.read();
+ PoolVector<String>::Read r = data.read();
const String *ptr=r.ptr();;
String s;
//write_string("\n");
@@ -2560,9 +2560,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::VECTOR2_ARRAY: {
- DVector<Vector2> data = p_property;
+ PoolVector<Vector2> data = p_property;
int len = data.size();
- DVector<Vector2>::Read r = data.read();
+ PoolVector<Vector2>::Read r = data.read();
const Vector2 *ptr=r.ptr();;
write_tabs();
@@ -2579,9 +2579,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::VECTOR3_ARRAY: {
- DVector<Vector3> data = p_property;
+ PoolVector<Vector3> data = p_property;
int len = data.size();
- DVector<Vector3>::Read r = data.read();
+ PoolVector<Vector3>::Read r = data.read();
const Vector3 *ptr=r.ptr();;
write_tabs();
@@ -2599,9 +2599,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
} break;
case Variant::COLOR_ARRAY: {
- DVector<Color> data = p_property;
+ PoolVector<Color> data = p_property;
int len = data.size();
- DVector<Color>::Read r = data.read();
+ PoolVector<Color>::Read r = data.read();
const Color *ptr=r.ptr();;
write_tabs();
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 218e17278e..a2812edb81 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -29,16 +29,16 @@
#include "stream_peer.h"
#include "io/marshalls.h"
-Error StreamPeer::_put_data(const DVector<uint8_t>& p_data) {
+Error StreamPeer::_put_data(const PoolVector<uint8_t>& p_data) {
int len = p_data.size();
if (len==0)
return OK;
- DVector<uint8_t>::Read r = p_data.read();
+ PoolVector<uint8_t>::Read r = p_data.read();
return put_data(&r[0],len);
}
-Array StreamPeer::_put_partial_data(const DVector<uint8_t>& p_data) {
+Array StreamPeer::_put_partial_data(const PoolVector<uint8_t>& p_data) {
Array ret;
@@ -49,7 +49,7 @@ Array StreamPeer::_put_partial_data(const DVector<uint8_t>& p_data) {
return ret;
}
- DVector<uint8_t>::Read r = p_data.read();
+ PoolVector<uint8_t>::Read r = p_data.read();
int sent;
Error err = put_partial_data(&r[0],len,sent);
@@ -66,18 +66,18 @@ Array StreamPeer::_get_data(int p_bytes) {
Array ret;
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(p_bytes);
if (data.size()!=p_bytes) {
ret.push_back(ERR_OUT_OF_MEMORY);
- ret.push_back(DVector<uint8_t>());
+ ret.push_back(PoolVector<uint8_t>());
return ret;
}
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
Error err = get_data(&w[0],p_bytes);
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
ret.push_back(err);
ret.push_back(data);
return ret;
@@ -88,19 +88,19 @@ Array StreamPeer::_get_partial_data(int p_bytes) {
Array ret;
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
data.resize(p_bytes);
if (data.size()!=p_bytes) {
ret.push_back(ERR_OUT_OF_MEMORY);
- ret.push_back(DVector<uint8_t>());
+ ret.push_back(PoolVector<uint8_t>());
return ret;
}
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
int received;
Error err = get_partial_data(&w[0],p_bytes,received);
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
if (err!=OK) {
data.resize(0);
@@ -454,7 +454,7 @@ Error StreamPeerBuffer::put_data(const uint8_t* p_data,int p_bytes) {
}
- DVector<uint8_t>::Write w = data.write();
+ PoolVector<uint8_t>::Write w = data.write();
copymem(&w[pointer],p_data,p_bytes);
pointer+=p_bytes;
@@ -490,7 +490,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_r
r_received=p_bytes;
}
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t>::Read r = data.read();
copymem(p_buffer,r.ptr(),r_received);
}
@@ -520,13 +520,13 @@ void StreamPeerBuffer::resize(int p_size){
data.resize(p_size);
}
-void StreamPeerBuffer::set_data_array(const DVector<uint8_t> & p_data){
+void StreamPeerBuffer::set_data_array(const PoolVector<uint8_t> & p_data){
data=p_data;
pointer=0;
}
-DVector<uint8_t> StreamPeerBuffer::get_data_array() const{
+PoolVector<uint8_t> StreamPeerBuffer::get_data_array() const{
return data;
}
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 232a908dd7..eb0f90ba50 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -38,8 +38,8 @@ protected:
static void _bind_methods();
//bind helpers
- Error _put_data(const DVector<uint8_t>& p_data);
- Array _put_partial_data(const DVector<uint8_t>& p_data);
+ Error _put_data(const PoolVector<uint8_t>& p_data);
+ Array _put_partial_data(const PoolVector<uint8_t>& p_data);
Array _get_data(int p_bytes);
Array _get_partial_data(int p_bytes);
@@ -96,7 +96,7 @@ class StreamPeerBuffer : public StreamPeer {
GDCLASS(StreamPeerBuffer,StreamPeer);
- DVector<uint8_t> data;
+ PoolVector<uint8_t> data;
int pointer;
protected:
@@ -116,8 +116,8 @@ public:
void resize(int p_size);
- void set_data_array(const DVector<uint8_t> & p_data);
- DVector<uint8_t> get_data_array() const;
+ void set_data_array(const PoolVector<uint8_t> & p_data);
+ PoolVector<uint8_t> get_data_array() const;
void clear();
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 751dfbadca..bfa5dce58f 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -44,7 +44,7 @@ TCP_Server* TCP_Server::create() {
return _create();
}
-Error TCP_Server::_listen(uint16_t p_port, DVector<String> p_accepted_hosts) {
+Error TCP_Server::_listen(uint16_t p_port, PoolVector<String> p_accepted_hosts) {
List<String> hosts;
for(int i=0;i<p_accepted_hosts.size();i++)
@@ -62,7 +62,7 @@ void TCP_Server::set_ip_type(IP::Type p_type) {
void TCP_Server::_bind_methods() {
ClassDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type);
- ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>()));
+ ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(PoolVector<String>()));
ClassDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available);
ClassDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection);
ClassDB::bind_method(_MD("stop"),&TCP_Server::stop);
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index 5fd65575f6..3d7b3ddd8d 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -43,7 +43,7 @@ protected:
static TCP_Server* (*_create)();
//bind helper
- Error _listen(uint16_t p_port, DVector<String> p_accepted_hosts=DVector<String>());
+ Error _listen(uint16_t p_port, PoolVector<String> p_accepted_hosts=PoolVector<String>());
static void _bind_methods();
public: