summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/aes256.h12
-rw-r--r--core/io/fastlz.h26
-rw-r--r--core/io/file_access_buffered.cpp22
-rw-r--r--core/io/file_access_buffered.h6
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/http_client.cpp6
-rw-r--r--core/io/http_client.h4
-rw-r--r--core/io/image_loader.cpp28
-rw-r--r--core/io/image_loader.h14
-rw-r--r--core/io/ip.cpp2
-rw-r--r--core/io/marshalls.cpp8
-rw-r--r--core/io/marshalls.h42
-rw-r--r--core/io/packet_peer.cpp6
-rw-r--r--core/io/resource_format_binary.cpp4
-rw-r--r--core/io/resource_format_xml.cpp2
-rw-r--r--core/io/resource_loader.cpp14
-rw-r--r--core/io/resource_loader.h10
-rw-r--r--core/io/resource_saver.cpp26
-rw-r--r--core/io/resource_saver.h10
-rw-r--r--core/io/stream_peer_ssl.cpp16
-rw-r--r--core/io/stream_peer_ssl.h14
21 files changed, 150 insertions, 124 deletions
diff --git a/core/io/aes256.h b/core/io/aes256.h
index fabbcf1968..8fcc25a4de 100644
--- a/core/io/aes256.h
+++ b/core/io/aes256.h
@@ -1,6 +1,6 @@
-/*
+/*
* Byte-oriented AES-256 implementation.
-* All lookup tables replaced with 'on the fly' calculations.
+* All lookup tables replaced with 'on the fly' calculations.
*
* Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com
* Other contributors: Hal Finney
@@ -24,14 +24,14 @@
#include "typedefs.h"
#ifdef __cplusplus
-extern "C" {
+extern "C" {
#endif
typedef struct {
- uint8_t key[32];
- uint8_t enckey[32];
+ uint8_t key[32];
+ uint8_t enckey[32];
uint8_t deckey[32];
- } aes256_context;
+ } aes256_context;
void aes256_init(aes256_context *, uint8_t * /* key */);
diff --git a/core/io/fastlz.h b/core/io/fastlz.h
index f87bc7be31..e5ca8dfc02 100644
--- a/core/io/fastlz.h
+++ b/core/io/fastlz.h
@@ -1,4 +1,4 @@
-/*
+/*
FastLZ - lightning-fast lossless compression library
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
@@ -40,11 +40,11 @@ extern "C" {
#endif
/**
- Compress a block of data in the input buffer and returns the size of
- compressed block. The size of input buffer is specified by length. The
+ Compress a block of data in the input buffer and returns the size of
+ compressed block. The size of input buffer is specified by length. The
minimum input buffer size is 16.
- The output buffer must be at least 5% larger than the input buffer
+ The output buffer must be at least 5% larger than the input buffer
and can not be smaller than 66 bytes.
If the input is not compressible, the return value might be larger than
@@ -56,9 +56,9 @@ extern "C" {
int fastlz_compress(const void* input, int length, void* output);
/**
- Decompress a block of compressed data and returns the size of the
- decompressed block. If error occurs, e.g. the compressed data is
- corrupted or the output buffer is not large enough, then 0 (zero)
+ Decompress a block of compressed data and returns the size of the
+ decompressed block. If error occurs, e.g. the compressed data is
+ corrupted or the output buffer is not large enough, then 0 (zero)
will be returned instead.
The input buffer and the output buffer can not overlap.
@@ -67,14 +67,14 @@ int fastlz_compress(const void* input, int length, void* output);
more than what is specified in maxout.
*/
-int fastlz_decompress(const void* input, int length, void* output, int maxout);
+int fastlz_decompress(const void* input, int length, void* output, int maxout);
/**
- Compress a block of data in the input buffer and returns the size of
- compressed block. The size of input buffer is specified by length. The
+ Compress a block of data in the input buffer and returns the size of
+ compressed block. The size of input buffer is specified by length. The
minimum input buffer size is 16.
- The output buffer must be at least 5% larger than the input buffer
+ The output buffer must be at least 5% larger than the input buffer
and can not be smaller than 66 bytes.
If the input is not compressible, the return value might be larger than
@@ -82,14 +82,14 @@ int fastlz_decompress(const void* input, int length, void* output, int maxout);
The input buffer and the output buffer can not overlap.
- Compression level can be specified in parameter level. At the moment,
+ Compression level can be specified in parameter level. At the moment,
only level 1 and level 2 are supported.
Level 1 is the fastest compression and generally useful for short data.
Level 2 is slightly slower but it gives better compression ratio.
Note that the compressed data, regardless of the level, can always be
decompressed using the function fastlz_decompress above.
-*/
+*/
int fastlz_compress_level(int level, const void* input, int length, void* output);
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index b38fda3686..e6b01475b6 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -33,17 +33,17 @@
#include "error_macros.h"
Error FileAccessBuffered::set_error(Error p_error) const {
-
+
return (last_error = p_error);
};
void FileAccessBuffered::set_cache_size(int p_size) {
-
+
cache_size = p_size;
};
int FileAccessBuffered::get_cache_size() {
-
+
return cache_size;
};
@@ -66,27 +66,27 @@ int FileAccessBuffered::cache_data_left() const {
};
void FileAccessBuffered::seek(size_t p_position) {
-
+
file.offset = p_position;
};
void FileAccessBuffered::seek_end(int64_t p_position) {
-
+
file.offset = file.size + p_position;
};
size_t FileAccessBuffered::get_pos() const {
-
+
return file.offset;
};
size_t FileAccessBuffered::get_len() const {
-
+
return file.size;
};
bool FileAccessBuffered::eof_reached() const {
-
+
return file.offset > file.size;
};
@@ -165,12 +165,12 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest,int p_elements) const {
};
bool FileAccessBuffered::is_open() const {
-
+
return file.open;
};
Error FileAccessBuffered::get_error() const {
-
+
return last_error;
};
@@ -180,5 +180,5 @@ FileAccessBuffered::FileAccessBuffered() {
};
FileAccessBuffered::~FileAccessBuffered(){
-
+
}
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index 9d405e15f7..058c26b8a9 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -60,9 +60,9 @@ protected:
String name;
int access_flags;
} file;
-
+
mutable struct Cache {
-
+
Vector<uint8_t> buffer;
int offset;
} cache;
@@ -71,7 +71,7 @@ protected:
void set_cache_size(int p_size);
int get_cache_size();
-
+
public:
virtual size_t get_pos() const; ///< get position in the file
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index e63b57533f..a3c839e761 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -217,7 +217,7 @@ Error FileAccessNetworkClient::connect(const String& p_host,int p_port,const Str
return ERR_CANT_CONNECT;
}
- CharString cs = p_password.utf8();
+ CharString cs = p_password.utf8();
put_32(cs.length());
client->put_data((const uint8_t*)cs.ptr(),cs.length());
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index b070e52f0a..e0c01c9422 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -31,10 +31,6 @@
VARIANT_ENUM_CAST(HTTPClient::Status);
-Error HTTPClient::connect_url(const String& p_url) {
-
- return OK;
-}
Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){
@@ -309,7 +305,7 @@ Error HTTPClient::poll(){
String header = responses[i].strip_edges();
String s = header.to_lower();
if (s.length()==0)
- continue;
+ continue;
if (s.begins_with("content-length:")) {
body_size = s.substr(s.find(":")+1,s.length()).strip_edges().to_int();
body_left=body_size;
diff --git a/core/io/http_client.h b/core/io/http_client.h
index e138681396..e795646c70 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -164,7 +164,7 @@ private:
public:
- Error connect_url(const String& p_url); //connects to a full url and perform request
+ //Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request
Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true);
void set_connection(const Ref<StreamPeer>& p_connection);
@@ -192,7 +192,7 @@ public:
Error poll();
- String query_string_from_dict(const Dictionary& p_dict);
+ String query_string_from_dict(const Dictionary& p_dict);
HTTPClient();
~HTTPClient();
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index aa641f00b4..05bad97e90 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -30,16 +30,16 @@
#include "print_string.h"
bool ImageFormatLoader::recognize(const String& p_extension) const {
-
-
+
+
List<String> extensions;
get_recognized_extensions(&extensions);
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
-
+
if (E->get().nocasecmp_to(p_extension.extension())==0)
return true;
}
-
+
return false;
}
@@ -55,12 +55,12 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom
return err;
}
}
-
+
String extension = p_file.extension();
for (int i=0;i<loader_count;i++) {
-
+
if (!loader[i]->recognize(extension))
continue;
Error err = loader[i]->load_image(p_image,f);
@@ -73,25 +73,25 @@ Error ImageLoader::load_image(String p_file,Image *p_image, FileAccess *p_custom
return err;
}
-
-
+
+
}
print_line("NO LOADER?");
if (!p_custom)
- memdelete(f);
-
+ memdelete(f);
+
return ERR_FILE_UNRECOGNIZED;
}
void ImageLoader::get_recognized_extensions(List<String> *p_extensions) {
-
+
for (int i=0;i<loader_count;i++) {
-
+
loader[i]->get_recognized_extensions(p_extensions);
-
- }
+
+ }
}
bool ImageLoader::recognize(const String& p_extension) {
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 3cc6c6cf43..c799837792 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -41,11 +41,11 @@
/**
* @class ImageScanLineLoader
* @author Juan Linietsky <reduzio@gmail.com>
- *
-
+ *
+
*/
class ImageLoader;
-
+
/**
* @class ImageLoader
@@ -60,8 +60,8 @@ protected:
virtual Error load_image(Image *p_image,FileAccess *p_fileaccess)=0;
virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
bool recognize(const String& p_extension) const;
-
-
+
+
public:
virtual ~ImageFormatLoader() {}
};
@@ -79,11 +79,11 @@ protected:
public:
-
+
static Error load_image(String p_file,Image *p_image, FileAccess *p_custom=NULL);
static void get_recognized_extensions(List<String> *p_extensions) ;
static bool recognize(const String& p_extension) ;
-
+
static void add_image_format_loader(ImageFormatLoader *p_loader);
};
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index b8bd00c2fb..a77aace07f 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -49,7 +49,7 @@ struct _IP_ResolverPrivate {
response = IP_Address();
hostname="";
};
-
+
QueueItem() {
clear();
};
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 4dccf21d2d..1733aecd46 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -95,7 +95,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
str.parse_utf8((const char*)buf,strlen);
r_variant=str;
- if (r_len) {
+ if (r_len) {
if (strlen%4)
(*r_len)+=4-strlen%4;
(*r_len)+=4+strlen;
@@ -294,7 +294,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
} break;
case Variant::NODE_PATH: {
- ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
+ ERR_FAIL_COND_V(len<4,ERR_INVALID_DATA);
uint32_t strlen = decode_uint32(buf);
if (strlen&0x80000000) {
@@ -1077,7 +1077,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
r_len+=data.size()+5*4+pad;
- } break;
+ } break;
/*case Variant::RESOURCE: {
ERR_EXPLAIN("Can't marshallize resources");
@@ -1238,7 +1238,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
DVector<uint8_t> data = p_variant;
int datalen=data.size();
int datasize=sizeof(uint8_t);
-
+
if (buf) {
encode_uint32(datalen,buf);
buf+=4;
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 7a5b16e8af..6a46e9882a 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -37,7 +37,7 @@
* Miscelaneous helpers for marshalling data types, and encoding
* in an endian independent way
*/
-
+
union MarshallFloat {
@@ -54,22 +54,22 @@ union MarshallDouble {
static inline unsigned int encode_uint16(uint16_t p_uint, uint8_t *p_arr) {
for (int i=0;i<2;i++) {
-
+
*p_arr=p_uint&0xFF;
p_arr++; p_uint>>=8;
}
-
+
return sizeof( uint16_t );
}
static inline unsigned int encode_uint32(uint32_t p_uint, uint8_t *p_arr) {
for (int i=0;i<4;i++) {
-
+
*p_arr=p_uint&0xFF;
p_arr++; p_uint>>=8;
}
-
+
return sizeof( uint32_t );
}
@@ -85,11 +85,11 @@ static inline unsigned int encode_float(float p_float, uint8_t *p_arr) {
static inline unsigned int encode_uint64(uint64_t p_uint, uint8_t *p_arr) {
for (int i=0;i<8;i++) {
-
+
*p_arr=p_uint&0xFF;
p_arr++; p_uint>>=8;
}
-
+
return sizeof(uint64_t);
}
@@ -100,25 +100,25 @@ static inline unsigned int encode_double(double p_double, uint8_t *p_arr) {
encode_uint64( md.l, p_arr );
return sizeof(uint64_t);
-
+
}
static inline int encode_cstring(const char *p_string, uint8_t * p_data) {
int len=0;
-
+
while (*p_string) {
if (p_data) {
-
+
*p_data=(uint8_t)*p_string;
p_data++;
}
p_string++;
len++;
};
-
+
if (p_data) *p_data = 0;
return len+1;
}
@@ -126,35 +126,35 @@ static inline int encode_cstring(const char *p_string, uint8_t * p_data) {
static inline uint16_t decode_uint16(const uint8_t *p_arr) {
uint16_t u=0;
-
+
for (int i=0;i<2;i++) {
-
+
uint16_t b = *p_arr;
b<<=(i*8);
u|=b;
p_arr++;
}
-
+
return u;
}
static inline uint32_t decode_uint32(const uint8_t *p_arr) {
uint32_t u=0;
-
+
for (int i=0;i<4;i++) {
-
+
uint32_t b = *p_arr;
b<<=(i*8);
u|=b;
p_arr++;
}
-
+
return u;
}
static inline float decode_float(const uint8_t *p_arr) {
-
+
MarshallFloat mf;
mf.i = decode_uint32(p_arr);
return mf.f;
@@ -163,15 +163,15 @@ static inline float decode_float(const uint8_t *p_arr) {
static inline uint64_t decode_uint64(const uint8_t *p_arr) {
uint64_t u=0;
-
+
for (int i=0;i<8;i++) {
-
+
uint64_t b = (*p_arr)&0xFF;
b<<=(i*8);
u|=b;
p_arr++;
}
-
+
return u;
}
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 973a2ec9a5..22b8bc0b39 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -180,10 +180,10 @@ int PacketPeerStream::get_available_packet_count() const {
ring_buffer.copy(lbuf,ofs,4);
uint32_t len = decode_uint32(lbuf);
remaining-=4;
- ofs+=4;
+ ofs+=4;
if (len>remaining)
break;
- remaining-=len;
+ remaining-=len;
ofs+=len;
count++;
}
@@ -201,7 +201,7 @@ Error PacketPeerStream::get_packet(const uint8_t **r_buffer,int &r_buffer_size)
uint8_t lbuf[4];
ring_buffer.copy(lbuf,0,4);
remaining-=4;
- uint32_t len = decode_uint32(lbuf);
+ uint32_t len = decode_uint32(lbuf);
ERR_FAIL_COND_V(remaining<(int)len,ERR_UNAVAILABLE);
ring_buffer.read(lbuf,4); //get rid of first 4 bytes
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index c008c3f9a4..58f3a4df2b 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -378,7 +378,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
} break;
case OBJECT_INTERNAL_RESOURCE: {
uint32_t index=f->get_32();
- String path = res_path+"::"+itos(index);
+ String path = res_path+"::"+itos(index);
RES res = ResourceLoader::load(path);
if (res.is_null()) {
WARN_PRINT(String("Couldn't load resource: "+path).utf8().get_data());
@@ -2100,7 +2100,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
p.value=E->get()->get(F->get().name);
if ((F->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero())||(F->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && p.value.is_one()) )
continue;
- p.pi=F->get();
+ p.pi=F->get();
rd.properties.push_back(p);
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index 03b77a4aab..a42a922baf 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -1818,7 +1818,7 @@ Error ResourceInteractiveLoaderXML::rename_dependencies(FileAccess *p_f, const S
void ResourceInteractiveLoaderXML::open(FileAccess *p_f) {
- error=OK;
+ error=OK;
lines=1;
f=p_f;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 67208b5960..abb1082256 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -49,16 +49,16 @@ Error ResourceInteractiveLoader::wait() {
bool ResourceFormatLoader::recognize(const String& p_extension) const {
-
-
+
+
List<String> extensions;
get_recognized_extensions(&extensions);
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
-
+
if (E->get().nocasecmp_to(p_extension.extension())==0)
return true;
}
-
+
return false;
}
@@ -184,9 +184,9 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
String extension=remapped_path.extension();
bool found=false;
-
+
for (int i=0;i<loader_count;i++) {
-
+
if (!loader[i]->recognize(extension))
continue;
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
@@ -356,7 +356,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
}
void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_loader) {
-
+
ERR_FAIL_COND( loader_count >= MAX_LOADERS );
loader[loader_count++]=p_format_loader;
}
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index fe58303066..6404e6cb13 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -47,7 +47,7 @@ public:
virtual Ref<Resource> get_resource()=0;
virtual Error poll()=0;
virtual int get_stage() const=0;
- virtual int get_stage_count() const=0;
+ virtual int get_stage_count() const=0;
virtual Error wait();
ResourceInteractiveLoader() {}
@@ -76,12 +76,12 @@ typedef void (*ResourceLoadErrorNotify)(void *p_ud,const String& p_text);
typedef void (*DependencyErrorNotify)(void *p_ud,const String& p_loading,const String& p_which,const String& p_type);
-class ResourceLoader {
-
+class ResourceLoader {
+
enum {
MAX_LOADERS=64
};
-
+
static ResourceFormatLoader *loader[MAX_LOADERS];
static int loader_count;
static bool timestamp_on_load;
@@ -96,7 +96,7 @@ class ResourceLoader {
public:
-
+
static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
static RES load(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
static Ref<ResourceImportMetadata> load_import_metadata(const String &p_path);
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 51020a0285..8d78ecabbf 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -39,30 +39,30 @@ bool ResourceSaver::timestamp_on_save=false;
ResourceSavedCallback ResourceSaver::save_callback=0;
Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_flags) {
-
+
String extension=p_path.extension();
Error err=ERR_FILE_UNRECOGNIZED;
for (int i=0;i<saver_count;i++) {
-
+
if (!saver[i]->recognize(p_resource))
continue;
-
+
List<String> extensions;
bool recognized=false;
saver[i]->get_recognized_extensions(p_resource,&extensions);
-
+
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
-
+
if (E->get().nocasecmp_to(extension.extension())==0)
recognized=true;
}
if (!recognized)
continue;
-
+
String old_path=p_resource->get_path();
-
+
String local_path=Globals::get_singleton()->localize_path(p_path);
@@ -92,10 +92,10 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_
return OK;
} else {
-
+
}
}
-
+
return err;
}
@@ -108,16 +108,16 @@ void ResourceSaver::set_save_callback(ResourceSavedCallback p_callback) {
void ResourceSaver::get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) {
-
+
for (int i=0;i<saver_count;i++) {
-
+
saver[i]->get_recognized_extensions(p_resource,p_extensions);
}
-
+
}
void ResourceSaver::add_resource_format_saver(ResourceFormatSaver *p_format_saver) {
-
+
ERR_FAIL_COND( saver_count >= MAX_SAVERS );
saver[saver_count++]=p_format_saver;
}
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 7bc96c1087..97500c46f4 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -42,7 +42,7 @@
class ResourceFormatSaver {
public:
-
+
virtual Error save(const String &p_path,const RES& p_resource,uint32_t p_flags=0)=0;
virtual bool recognize(const RES& p_resource) const=0;
virtual void get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) const=0;
@@ -52,12 +52,12 @@ public:
typedef void (*ResourceSavedCallback)(const String& p_path);
-class ResourceSaver {
-
+class ResourceSaver {
+
enum {
MAX_SAVERS=64
};
-
+
static ResourceFormatSaver *saver[MAX_SAVERS];
static int saver_count;
static bool timestamp_on_save;
@@ -86,7 +86,7 @@ public:
static void set_save_callback(ResourceSavedCallback p_callback);
-
+
};
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index a7132d99ef..2114993783 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -4,12 +4,28 @@
StreamPeerSSL* (*StreamPeerSSL::_create)()=NULL;
+
+
StreamPeerSSL *StreamPeerSSL::create() {
return _create();
}
+
+StreamPeerSSL::LoadCertsFromMemory StreamPeerSSL::load_certs_func=NULL;
+bool StreamPeerSSL::available=false;
+bool StreamPeerSSL::initialize_certs=true;
+
+void StreamPeerSSL::load_certs_from_memory(const ByteArray& p_memory) {
+ if (load_certs_func)
+ load_certs_func(p_memory);
+}
+
+bool StreamPeerSSL::is_available() {
+ return available;
+}
+
void StreamPeerSSL::_bind_methods() {
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index be7504cd8f..4b1c8e93bb 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -5,11 +5,23 @@
class StreamPeerSSL : public StreamPeer {
OBJ_TYPE(StreamPeerSSL,StreamPeer);
+public:
+
+ typedef void (*LoadCertsFromMemory)(const ByteArray& p_certs);
protected:
static StreamPeerSSL* (*_create)();
static void _bind_methods();
+
+ static LoadCertsFromMemory load_certs_func;
+ static bool available;
+
+
+friend class Main;
+ static bool initialize_certs;
+
public:
+
enum Status {
STATUS_DISCONNECTED,
STATUS_CONNECTED,
@@ -25,6 +37,8 @@ public:
static StreamPeerSSL* create();
+ static void load_certs_from_memory(const ByteArray& p_memory);
+ static bool is_available();
StreamPeerSSL();
};