1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-30 16:26:50 +00:00

Merge pull request #48768 from akien-mga/file-access-64-bit-4.0

Make all file access 64-bit (`uint64_t`)
This commit is contained in:
Rémi Verschelde
2021-05-17 16:02:12 +02:00
committed by GitHub
65 changed files with 326 additions and 342 deletions

View File

@@ -1222,12 +1222,12 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
}
for (int i = 0; i < pd.file_ofs.size(); i++) {
int string_len = pd.file_ofs[i].path_utf8.length();
int pad = _get_pad(4, string_len);
uint32_t string_len = pd.file_ofs[i].path_utf8.length();
uint32_t pad = _get_pad(4, string_len);
fhead->store_32(string_len + pad);
fhead->store_buffer((const uint8_t *)pd.file_ofs[i].path_utf8.get_data(), string_len);
for (int j = 0; j < pad; j++) {
for (uint32_t j = 0; j < pad; j++) {
fhead->store_8(0);
}
@@ -1269,8 +1269,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
uint8_t buf[bufsize];
while (true) {
int got = ftmp->get_buffer(buf, bufsize);
if (got <= 0) {
uint64_t got = ftmp->get_buffer(buf, bufsize);
if (got == 0) {
break;
}
f->store_buffer(buf, got);
@@ -1280,13 +1280,13 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
if (p_embed) {
// Ensure embedded data ends at a 64-bit multiple
int64_t embed_end = f->get_position() - embed_pos + 12;
int pad = embed_end % 8;
for (int i = 0; i < pad; i++) {
uint64_t embed_end = f->get_position() - embed_pos + 12;
uint64_t pad = embed_end % 8;
for (uint64_t i = 0; i < pad; i++) {
f->store_8(0);
}
int64_t pck_size = f->get_position() - pck_start_pos;
uint64_t pck_size = f->get_position() - pck_start_pos;
f->store_64(pck_size);
f->store_32(PACK_HEADER_MAGIC);

View File

@@ -230,8 +230,7 @@ void EditorFileServer::_subthread_start(void *s) {
cd->files[id]->seek(offset);
Vector<uint8_t> buf;
buf.resize(blocklen);
int read = cd->files[id]->get_buffer(buf.ptrw(), blocklen);
ERR_CONTINUE(read < 0);
uint32_t read = cd->files[id]->get_buffer(buf.ptrw(), blocklen);
print_verbose("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen));

View File

@@ -75,7 +75,7 @@ Error ResourceImporterImage::import(const String &p_source_file, const String &p
ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file from path '" + p_source_file + "'.");
size_t len = f->get_len();
uint64_t len = f->get_len();
Vector<uint8_t> data;
data.resize(len);