mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
This commit is contained in:
parent
1d418afe86
commit
f8db8a3faa
1308 changed files with 147754 additions and 174357 deletions
|
|
@ -28,12 +28,12 @@
|
|||
/*************************************************************************/
|
||||
#include "file_access_memory.h"
|
||||
|
||||
#include "os/dir_access.h"
|
||||
#include "os/copymem.h"
|
||||
#include "globals.h"
|
||||
#include "map.h"
|
||||
#include "os/copymem.h"
|
||||
#include "os/dir_access.h"
|
||||
|
||||
static Map<String, Vector<uint8_t> >* files = NULL;
|
||||
static Map<String, Vector<uint8_t> > *files = NULL;
|
||||
|
||||
void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
|
||||
|
||||
|
|
@ -59,37 +59,35 @@ void FileAccessMemory::cleanup() {
|
|||
memdelete(files);
|
||||
}
|
||||
|
||||
|
||||
FileAccess* FileAccessMemory::create() {
|
||||
FileAccess *FileAccessMemory::create() {
|
||||
|
||||
return memnew(FileAccessMemory);
|
||||
}
|
||||
|
||||
bool FileAccessMemory::file_exists(const String& p_name) {
|
||||
bool FileAccessMemory::file_exists(const String &p_name) {
|
||||
|
||||
String name = fix_path(p_name);
|
||||
// name = DirAccess::normalize_path(name);
|
||||
// name = DirAccess::normalize_path(name);
|
||||
|
||||
return files && (files->find(name) != NULL);
|
||||
}
|
||||
|
||||
Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
|
||||
|
||||
Error FileAccessMemory::open_custom(const uint8_t* p_data, int p_len) {
|
||||
|
||||
data=(uint8_t*)p_data;
|
||||
length=p_len;
|
||||
pos=0;
|
||||
data = (uint8_t *)p_data;
|
||||
length = p_len;
|
||||
pos = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
|
||||
Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
|
||||
|
||||
ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND);
|
||||
|
||||
String name = fix_path(p_path);
|
||||
// name = DirAccess::normalize_path(name);
|
||||
// name = DirAccess::normalize_path(name);
|
||||
|
||||
Map<String, Vector<uint8_t> >::Element* E = files->find(name);
|
||||
Map<String, Vector<uint8_t> >::Element *E = files->find(name);
|
||||
ERR_FAIL_COND_V(!E, ERR_FILE_NOT_FOUND);
|
||||
|
||||
data = &(E->get()[0]);
|
||||
|
|
@ -149,7 +147,7 @@ uint8_t FileAccessMemory::get_8() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
|
||||
int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const {
|
||||
|
||||
ERR_FAIL_COND_V(!data, -1);
|
||||
|
||||
|
|
@ -178,7 +176,7 @@ void FileAccessMemory::store_8(uint8_t p_byte) {
|
|||
data[pos++] = p_byte;
|
||||
}
|
||||
|
||||
void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
|
||||
void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
|
||||
|
||||
int left = length - pos;
|
||||
int write = MIN(p_length, left);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue