mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-09 15:09:50 +03:00
std::string. Replaced += with append
This commit is contained in:
+1
-1
@@ -2971,7 +2971,7 @@ void auth_3d_data_get_obj_sets_from_category(std::string& name, std::vector<uint
|
||||
obj_sets.push_back(obj_set);
|
||||
}
|
||||
|
||||
stgpv += "HRC";
|
||||
stgpv.append("HRC");
|
||||
|
||||
uint32_t obj_set = obj_db->get_object_set_id(stgpv.c_str());
|
||||
if (obj_set != -1)
|
||||
|
||||
+26
-27
@@ -294,7 +294,7 @@ bool data_struct::check_directory_exists(const char* dir) {
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
|
||||
if (path_check_directory_exists(temp.c_str()))
|
||||
@@ -306,13 +306,13 @@ bool data_struct::check_directory_exists(const char* dir) {
|
||||
bool data_struct::check_file_exists(const char* path) {
|
||||
const char* t = strrchr(path, '/');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return check_file_exists(dir.c_str(), t + 1);
|
||||
}
|
||||
|
||||
t = strrchr(path, '\\');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return check_file_exists(dir.c_str(), t + 1);
|
||||
}
|
||||
return false;
|
||||
@@ -330,7 +330,8 @@ bool data_struct::check_file_exists(const char* dir, const char* file) {
|
||||
t_len = file_len;
|
||||
|
||||
uint32_t h = hash_murmurhash(file, t_len, 0, false, false);
|
||||
std::string path = std::string(dir) + file;
|
||||
std::string path(dir);
|
||||
path.append(file);
|
||||
if (path_check_file_exists(path.c_str()))
|
||||
return true;
|
||||
}
|
||||
@@ -369,7 +370,7 @@ bool data_struct::check_file_exists(const char* dir, const char* file) {
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
temp.append(file, file_len);
|
||||
|
||||
@@ -417,7 +418,7 @@ bool data_struct::check_file_exists(const char* dir, uint32_t hash) {
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
|
||||
std::vector<std::string> files = path_get_files(temp.c_str());
|
||||
@@ -484,7 +485,7 @@ void data_struct::get_directory_files(const char* dir, std::vector<data_struct_f
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
|
||||
std::vector<std::string> files = path_get_files(temp.c_str());
|
||||
@@ -545,7 +546,7 @@ bool data_struct::get_file(const char* dir, uint32_t hash, const char* ext, std:
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
|
||||
std::vector<std::string> files = path_get_files(temp.c_str());
|
||||
@@ -578,13 +579,13 @@ bool data_struct::load_file(void* data, const char* path,
|
||||
bool (*load_func)(void* data, const char* path, const char* file, uint32_t hash)) {
|
||||
const char* t = strrchr(path, '/');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return load_file(data, dir.c_str(), t + 1, load_func);
|
||||
}
|
||||
|
||||
t = strrchr(path, '\\');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return load_file(data, dir.c_str(), t + 1, load_func);
|
||||
}
|
||||
return false;
|
||||
@@ -642,7 +643,7 @@ bool data_struct::load_file(void* data, const char* dir, const char* file,
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
temp.append(file, file_len);
|
||||
|
||||
@@ -704,7 +705,7 @@ bool data_struct::load_file(void* data, const char* dir, uint32_t hash, const ch
|
||||
for (data_struct_path& i : data_paths)
|
||||
for (data_struct_directory& j : i.data) {
|
||||
temp.assign(j.path);
|
||||
temp += '\\';
|
||||
temp.push_back('\\');
|
||||
temp.append(dir_temp);
|
||||
|
||||
std::vector<std::string> files = path_get_files(temp.c_str());
|
||||
@@ -930,11 +931,10 @@ static void data_load_inner(stream& s) {
|
||||
|
||||
ds->data_paths.reserve(count);
|
||||
for (size_t j = 0; j < count; j++) {
|
||||
data_struct_path data_path;
|
||||
ds->data_paths.push_back({});
|
||||
data_struct_path& data_path = ds->data_paths.back();
|
||||
t -= t_len[count - j - 1] + 1;
|
||||
data_path.path = std::string(t, t_len[count - j - 1]);
|
||||
data_path.data = {};
|
||||
ds->data_paths.push_back(data_path);
|
||||
data_path.path.assign(t, t_len[count - j - 1]);
|
||||
}
|
||||
free_def(t_len);
|
||||
|
||||
@@ -945,7 +945,7 @@ static void data_load_inner(stream& s) {
|
||||
main_rom_path.assign(j.path);
|
||||
else if (data_path_length) {
|
||||
main_rom_path.assign(j.path);
|
||||
main_rom_path += '\\';
|
||||
main_rom_path.push_back('\\');
|
||||
main_rom_path.append(main_rom, main_rom_len);
|
||||
}
|
||||
else
|
||||
@@ -955,7 +955,7 @@ static void data_load_inner(stream& s) {
|
||||
add_data_rom_path.assign(j.path);
|
||||
else if (data_path_length) {
|
||||
add_data_rom_path.assign(j.path);
|
||||
add_data_rom_path += '\\';
|
||||
add_data_rom_path.push_back('\\');
|
||||
add_data_rom_path.append(add_data, add_data_len);
|
||||
}
|
||||
else
|
||||
@@ -976,27 +976,26 @@ static void data_load_inner(stream& s) {
|
||||
if (data_directories.size()) {
|
||||
j.data.reserve(data_directories.size() + 1);
|
||||
data_dir_path.assign(add_data_rom_path);
|
||||
data_dir_path += '\\';
|
||||
data_dir_path.push_back('\\');
|
||||
for (std::vector<std::string>::reverse_iterator k = data_directories.rbegin();
|
||||
k != data_directories.rend(); k++) {
|
||||
data_struct_directory data_dir;
|
||||
j.data.push_back({});
|
||||
data_struct_directory& data_dir = j.data.back();
|
||||
data_dir.path.assign(data_dir_path);
|
||||
data_dir.path.append(*k);
|
||||
if (add_data_rom_len) {
|
||||
data_dir.path += '\\';
|
||||
data_dir.path.push_back('\\');
|
||||
data_dir.path.append(add_data_rom, add_data_rom_len);
|
||||
}
|
||||
data_dir.name.assign(*k);
|
||||
j.data.push_back(data_dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
j.data.reserve(1);
|
||||
|
||||
data_struct_directory data_dir;
|
||||
data_dir.path = main_rom_path;
|
||||
data_dir.name = {};
|
||||
j.data.push_back(data_dir);
|
||||
j.data.push_back({});
|
||||
data_struct_directory& data_dir = j.data.back();
|
||||
data_dir.path.assign(main_rom_path);
|
||||
}
|
||||
ds->ready = true;
|
||||
}
|
||||
@@ -1027,7 +1026,7 @@ static void data_load_glitter_list(data_struct* ds, const char* path) {
|
||||
glitter_list_names.reserve(count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
size_t len = utf8_length(lines[i]);
|
||||
std::string name = std::string(lines[i], min_def(len, 0x7F));
|
||||
std::string name(lines[i], min_def(len, 0x7F));
|
||||
glitter_list_names.push_back(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -381,13 +381,13 @@ size_t p_file_handler::get_size() {
|
||||
bool p_file_handler::read_file(void* data, const char* path) {
|
||||
const char* t = strrchr(path, '/');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return read_file(data, dir.c_str(), 0, t + 1, false);
|
||||
}
|
||||
|
||||
t = strrchr(path, '\\');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
std::string dir(path, t - path + 1);
|
||||
return read_file(data, dir.c_str(), 0, t + 1, false);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -279,7 +279,7 @@ std::vector<std::string> path_get_directories_recursive(
|
||||
std::vector<std::string> directories;
|
||||
std::string path_temp;
|
||||
path_temp.assign(path);
|
||||
path_temp += '\\';
|
||||
path_temp.push_back('\\');
|
||||
for (std::string& i : temp_vec) {
|
||||
path_temp.append(i);
|
||||
std::vector<std::string> temp = path_get_directories_recursive(
|
||||
@@ -301,7 +301,7 @@ std::vector<std::string> path_get_directories_recursive(
|
||||
if (i.size()) {
|
||||
std::string sub_path_temp;
|
||||
sub_path_temp.assign(i);
|
||||
sub_path_temp += '\\';
|
||||
sub_path_temp.push_back('\\');
|
||||
for (std::string& j : temp)
|
||||
directories.push_back(sub_path_temp + j);
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ void stream::write_uint8_t(uint8_t val) {
|
||||
}
|
||||
|
||||
std::string stream::read_string(size_t length) {
|
||||
std::string str = std::string(length, 0);
|
||||
std::string str(length, 0);
|
||||
read(&str.front(), sizeof(char) * length);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring stream::read_wstring(size_t length) {
|
||||
std::wstring str = std::wstring(length, 0);
|
||||
std::wstring str(length, 0);
|
||||
read(&str.front(), sizeof(wchar_t) * length);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -718,8 +718,8 @@ void key_val_out::open_scope(std::string& str) {
|
||||
temp_key.clear();
|
||||
temp_key.reserve(curr_scope->size() + str.size() + 1);
|
||||
temp_key.assign(*curr_scope);
|
||||
temp_key += '.';
|
||||
temp_key += str;
|
||||
temp_key.push_back('.');
|
||||
temp_key.append(str);
|
||||
scope.push_back(temp_key);
|
||||
}
|
||||
else
|
||||
@@ -739,7 +739,7 @@ void key_val_out::open_scope(const char* str) {
|
||||
temp_key.clear();
|
||||
temp_key.reserve(curr_scope->size() + str_len + 1);
|
||||
temp_key.assign(*curr_scope);
|
||||
temp_key += '.';
|
||||
temp_key.push_back('.');
|
||||
temp_key.append(str, str_len);
|
||||
scope.push_back(temp_key);
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ static int64_t key_val_get_key_index(key_val* kv, const char* key) {
|
||||
kv->temp_key.clear();
|
||||
kv->temp_key.reserve(kv->curr_scope->key.size() + str_len + 1);
|
||||
kv->temp_key.assign(kv->curr_scope->key);
|
||||
kv->temp_key += '.';
|
||||
kv->temp_key.push_back('.');
|
||||
kv->temp_key.append(key, str_len);
|
||||
return key_val_get_key_index(kv, kv->temp_key.c_str(), kv->temp_key.size());
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ static int64_t key_val_get_key_index(key_val* kv, std::string& key) {
|
||||
kv->temp_key.clear();
|
||||
kv->temp_key.reserve(kv->curr_scope->key.size() + key.size() + 1);
|
||||
kv->temp_key.assign(kv->curr_scope->key);
|
||||
kv->temp_key += '.';
|
||||
kv->temp_key.push_back('.');
|
||||
kv->temp_key.append(key);
|
||||
return key_val_get_key_index(kv, kv->temp_key.c_str(), kv->temp_key.size());
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
}
|
||||
|
||||
if (indir.back() != '\\')
|
||||
indir += '\\';
|
||||
indir.push_back('\\');
|
||||
|
||||
bool encrypt = (argc == 3 && !str_utils_compare(argv[2], L"-e"))
|
||||
|| (argc == 4 && !str_utils_compare(argv[3], L"-e"));
|
||||
@@ -56,7 +56,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
: (indir.substr(0, indir.size() - 1) + (encrypt ? L"_enc" : L"_dec"));
|
||||
|
||||
if (outdir.back() != '\\')
|
||||
outdir += '\\';
|
||||
outdir.push_back('\\');
|
||||
|
||||
if (!path_check_directory_exists(outdir.c_str())
|
||||
&& !CreateDirectoryW(outdir.c_str(), 0))
|
||||
|
||||
@@ -615,7 +615,7 @@ void Auth3dTestTask::SetStage() {
|
||||
|
||||
size_t v24 = v20 - name;
|
||||
if (v24 != -1) {
|
||||
std::string v30 = std::string(name + v16, v24 - v16);
|
||||
std::string v30(name + v16, v24 - v16);
|
||||
int32_t stage_index = aft_stage_data->get_stage_index(v30.c_str());
|
||||
if (this->stage_index != stage_index)
|
||||
load_stage_index = stage_index;
|
||||
|
||||
@@ -4375,7 +4375,7 @@ void x_pv_game_data::load(int32_t pv_id, FrameRateControl* frame_rate_control, c
|
||||
|
||||
char buf[0x200];
|
||||
size_t len = sprintf_s(buf, sizeof(buf), "exp_PV%03d", pv_id);
|
||||
exp_file = std::string(buf, len);
|
||||
exp_file.assign(buf, len);
|
||||
|
||||
camera.load(pv_id, stage->stage_id, frame_rate_control);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user