qualify all calls to std::move

This commit is contained in:
Martin Michelsen
2023-05-15 23:46:19 -07:00
parent f813ed68df
commit 695e53a714
26 changed files with 145 additions and 141 deletions
+1 -1
View File
@@ -237,7 +237,7 @@ Channel::Message Channel::recv(bool print_contents) {
return {
.command = header.command(this->version),
.flag = header.flag(this->version),
.data = move(command_data),
.data = std::move(command_data),
};
}
+1 -1
View File
@@ -132,7 +132,7 @@ static void server_command_lobby_info(shared_ptr<ServerState>, shared_ptr<Lobby>
}
}
}
lines.emplace_back(move(slots_str));
lines.emplace_back(std::move(slots_str));
}
send_text_message(c, decode_sjis(join(lines, "\n")));
+4 -4
View File
@@ -206,7 +206,7 @@ string prs_compress(
const void* vdata, size_t size, function<void(size_t, size_t)> progress_fn) {
PRSCompressor prs(progress_fn);
prs.add(vdata, size);
return move(prs.close());
return std::move(prs.close());
}
string prs_compress(
@@ -328,7 +328,7 @@ string prs_decompress(const void* data, size_t size, size_t max_output_size) {
}
}
return move(w.str());
return std::move(w.str());
}
string prs_decompress(const string& data, size_t max_output_size) {
@@ -562,7 +562,7 @@ string bc0_compress(
w.str().resize(w.str().size() - 1);
}
return move(w.str());
return std::move(w.str());
}
// The BC0 decompression implementation in PSO GC is vulnerable to overflow
@@ -638,5 +638,5 @@ string bc0_decompress(const string& data) {
}
}
return move(w.str());
return std::move(w.str());
}
+1 -1
View File
@@ -47,7 +47,7 @@ void DNSServer::add_socket(int fd) {
event_new(this->base.get(), fd, EV_READ | EV_PERSIST, &DNSServer::dispatch_on_receive_message, this),
event_free);
event_add(e.get(), nullptr);
this->fd_to_receive_event.emplace(fd, move(e));
this->fd_to_receive_event.emplace(fd, std::move(e));
}
void DNSServer::dispatch_on_receive_message(evutil_socket_t fd,
+6 -6
View File
@@ -106,7 +106,7 @@ string BattleRecord::serialize() const {
for (const auto& ev : this->events) {
ev.serialize(w);
}
return move(w.str());
return std::move(w.str());
}
bool BattleRecord::writable() const {
@@ -170,7 +170,7 @@ void BattleRecord::add_command(Event::Type type, string&& data) {
Event& ev = this->events.emplace_back();
ev.type = type;
ev.timestamp = now();
ev.data = move(data);
ev.data = std::move(data);
}
void BattleRecord::add_chat_message(
@@ -182,7 +182,7 @@ void BattleRecord::add_chat_message(
ev.type = Event::Type::CHAT_MESSAGE;
ev.timestamp = now();
ev.guild_card_number = guild_card_number;
ev.data = move(data);
ev.data = std::move(data);
}
bool BattleRecord::is_map_definition_event(const Event& ev) {
@@ -248,7 +248,7 @@ void BattleRecord::set_battle_start_timestamp() {
initial_ev.players.emplace_back(players[z]);
}
}
new_events.emplace_back(move(initial_ev));
new_events.emplace_back(std::move(initial_ev));
// Skip all events before the last map definition event, and only retain
// battle commands between then and now (since these battle commands will all
@@ -264,10 +264,10 @@ void BattleRecord::set_battle_start_timestamp() {
}
for (; it != this->events.end(); it++) {
if (it->type == Event::Type::BATTLE_COMMAND) {
new_events.emplace_back(move(*it));
new_events.emplace_back(std::move(*it));
}
}
this->events = move(new_events);
this->events = std::move(new_events);
}
void BattleRecord::set_battle_end_timestamp() {
-2
View File
@@ -3871,7 +3871,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
const InterferenceProbabilityEntry* ret_entry = nullptr;
int16_t current_max = -1;
size_t logical_index = 0;
uint16_t current_row_card_id = 0xFFFF;
for (size_t z = 0; z < num_entries; z++) {
const auto& entry = entries[z];
@@ -3885,7 +3884,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
current_max = v;
}
}
logical_index++;
} else {
current_row_card_id = current_column_card_id;
}
+9 -9
View File
@@ -856,7 +856,7 @@ shared_ptr<JSONObject> Rules::json() const {
dict.emplace("disable_dialogue", make_json_int(this->disable_dialogue));
dict.emplace("dice_exchange_mode", make_json_int(static_cast<uint8_t>(this->dice_exchange_mode)));
dict.emplace("disable_dice_boost", make_json_int(this->disable_dice_boost));
return shared_ptr<JSONObject>(new JSONObject(move(dict)));
return shared_ptr<JSONObject>(new JSONObject(std::move(dict)));
}
void Rules::set_defaults() {
@@ -1015,7 +1015,7 @@ string MapDefinition::str(const DataIndex* data_index) const {
for (size_t x = 0; x < 0x10; x++) {
line += string_printf(" %02hhX", tiles[y][x]);
}
lines.emplace_back(move(line));
lines.emplace_back(std::move(line));
}
};
@@ -1212,7 +1212,7 @@ string MapDefinition::str(const DataIndex* data_index) const {
}
}
unavailable_sc_cards += ']';
lines.emplace_back(move(unavailable_sc_cards));
lines.emplace_back(std::move(unavailable_sc_cards));
for (size_t z = 0; z < 4; z++) {
string player_type;
switch (this->entry_states[z].player_type) {
@@ -1403,14 +1403,14 @@ DataIndex::DataIndex(const string& directory, uint32_t behavior_flags)
for (size_t offset = tag.find(" "); offset != string::npos; offset = tag.find(" ")) {
tag = tag.substr(0, offset) + tag.substr(offset + 1);
}
tags.emplace_back(move(tag));
tags.emplace_back(std::move(tag));
}
}
if (!card_text.emplace(card_id, move(orig_text)).second) {
if (!card_text.emplace(card_id, std::move(orig_text)).second) {
throw runtime_error("duplicate card text id");
}
if (!card_tags.emplace(card_id, move(tags)).second) {
if (!card_tags.emplace(card_id, std::move(tags)).second) {
throw logic_error("duplicate card tags id");
}
@@ -1473,11 +1473,11 @@ DataIndex::DataIndex(const string& directory, uint32_t behavior_flags)
if (this->behavior_flags & BehaviorFlag::LOAD_CARD_TEXT) {
try {
entry->text = move(card_text.at(defs[x].card_id));
entry->text = std::move(card_text.at(defs[x].card_id));
} catch (const out_of_range&) {
}
try {
entry->debug_tags = move(card_tags.at(defs[x].card_id));
entry->debug_tags = std::move(card_tags.at(defs[x].card_id));
} catch (const out_of_range&) {
}
}
@@ -1658,7 +1658,7 @@ const string& DataIndex::get_compressed_map_list() const {
StringWriter compressed_w;
compressed_w.put_u32b(prs.input_size());
compressed_w.write(prs.close());
this->compressed_map_list = move(compressed_w.str());
this->compressed_map_list = std::move(compressed_w.str());
if (this->compressed_map_list.size() > 0x7BEC) {
throw runtime_error("Episode 3 compressed map list is too large");
}
+3 -3
View File
@@ -225,7 +225,7 @@ string Server::prepare_6xB6x41_map_definition(
uint32_t subcommand_size = (compressed.size() + sizeof(G_MapData_GC_Ep3_6xB6x41) + 3) & (~3);
w.put<G_MapData_GC_Ep3_6xB6x41>({{{{0xB6, 0, 0}, subcommand_size}, 0x41, {}}, map->map.map_number.load(), compressed.size(), 0});
w.write(compressed);
return move(w.str());
return std::move(w.str());
}
void Server::send_commands_for_joining_spectator(Channel& c) const {
@@ -2146,7 +2146,7 @@ void Server::handle_6xB3x40_map_list_request(const string& data) {
if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command(
BattleRecord::Event::Type::BATTLE_COMMAND, move(w.str()));
BattleRecord::Event::Type::BATTLE_COMMAND, std::move(w.str()));
}
}
@@ -2170,7 +2170,7 @@ void Server::handle_6xB3x41_map_request(const string& data) {
if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command(
BattleRecord::Event::Type::BATTLE_COMMAND, move(out_cmd));
BattleRecord::Event::Type::BATTLE_COMMAND, std::move(out_cmd));
}
}
+7 -7
View File
@@ -380,9 +380,9 @@ void Tournament::init() {
current_round_matches[z + 1]);
current_round_matches[z]->following = m;
current_round_matches[z + 1]->following = m;
next_round_matches.emplace_back(move(m));
next_round_matches.emplace_back(std::move(m));
}
current_round_matches = move(next_round_matches);
current_round_matches = std::move(next_round_matches);
}
this->final_match = current_round_matches.at(0);
@@ -476,14 +476,14 @@ std::shared_ptr<JSONObject> Tournament::json() const {
player_jsons_list.emplace_back(make_json_str(player.com_deck->deck_name));
}
}
team_dict.emplace("player_specs", make_json_list(move(player_jsons_list)));
team_dict.emplace("player_specs", make_json_list(std::move(player_jsons_list)));
team_dict.emplace("name", make_json_str(team->name));
team_dict.emplace("password", make_json_str(team->password));
team_dict.emplace("num_rounds_cleared", make_json_int(team->num_rounds_cleared));
teams_list.emplace_back(new JSONObject(move(team_dict)));
teams_list.emplace_back(new JSONObject(std::move(team_dict)));
}
dict.emplace("teams", make_json_list(move(teams_list)));
return shared_ptr<JSONObject>(new JSONObject(move(dict)));
dict.emplace("teams", make_json_list(std::move(teams_list)));
return shared_ptr<JSONObject>(new JSONObject(std::move(dict)));
}
std::shared_ptr<const DataIndex> Tournament::get_data_index() const {
@@ -690,7 +690,7 @@ void TournamentIndex::save() const {
list.emplace_back(make_json_null());
}
}
auto json = make_json_list(move(list));
auto json = make_json_list(std::move(list));
save_file(this->state_filename, json->serialize(JSONObject::SerializeOption::FORMAT));
}
+3 -3
View File
@@ -14,7 +14,7 @@ FileContentsCache::File::File(
string&& data,
uint64_t load_time)
: name(name),
data(new string(move(data))),
data(new string(std::move(data))),
load_time(load_time) {}
shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
@@ -22,7 +22,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
if (t == 0) {
t = now();
}
shared_ptr<File> new_file(new File(name, move(data), t));
shared_ptr<File> new_file(new File(name, std::move(data), t));
auto emplace_ret = this->name_to_file.emplace(name, new_file);
if (!emplace_ret.second) {
emplace_ret.first->second = new_file;
@@ -33,7 +33,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
const string& name, const void* data, size_t size, uint64_t t) {
string s(reinterpret_cast<const char*>(data), size);
return this->replace(name, move(s), t);
return this->replace(name, std::move(s), t);
}
FileContentsCache::GetResult FileContentsCache::get_or_load(const std::string& name) {
+3 -3
View File
@@ -82,7 +82,7 @@ string CompiledFunctionCode::generate_client_command_t(
}
w.put(footer);
return move(w.str());
return std::move(w.str());
}
string CompiledFunctionCode::generate_client_command(
@@ -125,8 +125,8 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
if (arch == CompiledFunctionCode::Architecture::POWERPC) {
auto assembled = PPC32Emulator::assemble(text, {directory});
ret->code = move(assembled.code);
ret->label_offsets = move(assembled.label_offsets);
ret->code = std::move(assembled.code);
ret->label_offsets = std::move(assembled.label_offsets);
} else if (arch == CompiledFunctionCode::Architecture::X86) {
throw runtime_error("x86 assembler is not implemented");
}
+6 -6
View File
@@ -991,7 +991,7 @@ void ItemCreator::generate_armor_shop_armors(
this->generate_common_armor_slot_count(item);
if (this->shop_does_not_contain_duplicate_armor(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
items_generated++;
}
}
@@ -1035,7 +1035,7 @@ void ItemCreator::generate_armor_shop_shields(
}
if (this->shop_does_not_contain_duplicate_item_by_primary_identifier(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
items_generated++;
}
}
@@ -1070,7 +1070,7 @@ void ItemCreator::generate_armor_shop_units(
item.data1[1] = 3;
item.data1[2] = pt.pop();
if (this->shop_does_not_contain_duplicate_item_by_primary_identifier(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
items_generated++;
}
}
@@ -1181,7 +1181,7 @@ void ItemCreator::generate_rare_tool_shop_recovery_items(
item.data1[1] = tool_item_defs[type].first;
item.data1[2] = tool_item_defs[type].second;
if (this->shop_does_not_contain_duplicate_item_by_primary_identifier(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
items_generated++;
}
}
@@ -1225,7 +1225,7 @@ void ItemCreator::generate_tool_shop_tech_disks(
this->choose_tech_disk_level_for_tool_shop(
item, player_level, tech_num_index);
if (this->shop_does_not_contain_duplicate_tech_disk(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
items_generated++;
}
}
@@ -1445,7 +1445,7 @@ vector<ItemData> ItemCreator::generate_weapon_shop_contents(size_t player_level)
item.data1[11] = 0;
if (this->shop_does_not_contain_duplicate_or_too_many_similar_weapons(shop, item)) {
shop.emplace_back(move(item));
shop.emplace_back(std::move(item));
}
}
+1 -1
View File
@@ -1444,7 +1444,7 @@ string ItemData::name(bool include_color_codes) const {
}
token += pb_names[x];
}
ret_tokens.emplace_back(move(token));
ret_tokens.emplace_back(std::move(token));
static const vector<const char*> mag_colors({
/* 00 */ "red",
+1 -1
View File
@@ -258,7 +258,7 @@ PlayerInventoryItem Lobby::remove_item(uint32_t item_id) {
if (item_it == this->item_id_to_floor_item.end()) {
throw out_of_range("item not present");
}
PlayerInventoryItem ret = move(item_it->second.inv_item);
PlayerInventoryItem ret = std::move(item_it->second.inv_item);
this->item_id_to_floor_item.erase(item_it);
return ret;
}
+2 -2
View File
@@ -838,7 +838,7 @@ int main(int argc, char** argv) {
throw logic_error("plaintext and mask are not the same size");
}
max_plaintext_size = max<size_t>(max_plaintext_size, data.size());
plaintexts.emplace_back(move(data), move(mask));
plaintexts.emplace_back(std::move(data), std::move(mask));
}
string ciphertext = parse_data_string(find_decryption_seed_ciphertext, nullptr, ParseDataFlags::ALLOW_FILES);
@@ -937,7 +937,7 @@ int main(int argc, char** argv) {
}
string data = read_input_data();
shared_ptr<string> data_shared(new string(move(data)));
shared_ptr<string> data_shared(new string(std::move(data)));
if (behavior == Behavior::EXTRACT_GSL) {
GSLArchive arch(data_shared, big_endian);
+54 -48
View File
@@ -19,7 +19,10 @@ void PSOEncryption::decrypt(void* data, size_t size, bool advance) {
PSOLFGEncryption::PSOLFGEncryption(
uint32_t seed, size_t stream_length, size_t end_offset)
: stream(stream_length, 0), offset(0), end_offset(end_offset), seed(seed) {}
: stream(stream_length, 0),
offset(0),
end_offset(end_offset),
seed(seed) {}
uint32_t PSOLFGEncryption::next(bool advance) {
if (this->offset == this->end_offset) {
@@ -226,14 +229,14 @@ void PSOBBEncryption::encrypt(void* vdata, size_t size, bool advance) {
for (size_t y = 0; y < 4; y += 2) {
dwords[x] ^= this->state.initial_keys.as32[y];
dwords[x + 1] ^= ((this->state.private_keys.as32[dwords[x] >> 24] +
this->state.private_keys.as32[((dwords[x] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x] & 0xFF) + 0x300];
this->state.private_keys.as32[((dwords[x] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x] & 0xFF) + 0x300];
dwords[x + 1] ^= this->state.initial_keys.as32[y + 1];
dwords[x] ^= ((this->state.private_keys.as32[dwords[x + 1] >> 24] +
this->state.private_keys.as32[(dwords[x + 1] >> 16 & 0xFF) + 0x100]) ^
this->state.private_keys.as32[(dwords[x + 1] >> 8 & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x + 1] & 0xFF) + 0x300];
this->state.private_keys.as32[(dwords[x + 1] >> 16 & 0xFF) + 0x100]) ^
this->state.private_keys.as32[(dwords[x + 1] >> 8 & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x + 1] & 0xFF) + 0x300];
}
dwords[x] ^= this->state.initial_keys.as32[4];
dwords[x + 1] ^= this->state.initial_keys.as32[5];
@@ -282,26 +285,26 @@ void PSOBBEncryption::encrypt(void* vdata, size_t size, bool advance) {
while (edx < num_dwords) {
ebx = data[edx] ^ this->state.initial_keys.as32[0];
ebp = ((this->state.private_keys.as32[(ebx >> 0x18)] +
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
ebp = ebp ^ this->state.initial_keys.as32[1];
ebp ^= data[edx + 1];
edi = ((this->state.private_keys.as32[(ebp >> 0x18)] +
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
edi = edi ^ this->state.initial_keys.as32[2];
ebx = ebx ^ edi;
esi = ((this->state.private_keys.as32[(ebx >> 0x18)] +
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
ebp = ebp ^ esi ^ this->state.initial_keys.as32[3];
edi = ((this->state.private_keys.as32[(ebp >> 0x18)] +
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
edi = edi ^ this->state.initial_keys.as32[4];
ebp = ebp ^ this->state.initial_keys.as32[5];
ebx = ebx ^ edi;
@@ -323,14 +326,14 @@ void PSOBBEncryption::decrypt(void* vdata, size_t size, bool advance) {
for (size_t y = 4; y > 0; y -= 2) {
dwords[x] = dwords[x] ^ this->state.initial_keys.as32[y + 1];
dwords[x + 1] ^= ((this->state.private_keys.as32[dwords[x] >> 24] +
this->state.private_keys.as32[((dwords[x] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x] & 0xFF) + 0x300];
this->state.private_keys.as32[((dwords[x] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x] & 0xFF) + 0x300];
dwords[x + 1] ^= this->state.initial_keys.as32[y];
dwords[x] ^= ((this->state.private_keys.as32[dwords[x + 1] >> 24] +
this->state.private_keys.as32[((dwords[x + 1] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x + 1] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x + 1] & 0xFF) + 0x300];
this->state.private_keys.as32[((dwords[x + 1] >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((dwords[x + 1] >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(dwords[x + 1] & 0xFF) + 0x300];
}
dwords[x] ^= this->state.initial_keys.as32[1];
dwords[x + 1] ^= this->state.initial_keys.as32[0];
@@ -378,26 +381,26 @@ void PSOBBEncryption::decrypt(void* vdata, size_t size, bool advance) {
ebx = dwords[edx];
ebx = ebx ^ this->state.initial_keys.as32[5];
ebp = ((this->state.private_keys.as32[(ebx >> 0x18)] +
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
ebp = ebp ^ this->state.initial_keys.as32[4];
ebp ^= dwords[edx + 1];
edi = ((this->state.private_keys.as32[(ebp >> 0x18)] +
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
edi = edi ^ this->state.initial_keys.as32[3];
ebx = ebx ^ edi;
esi = ((this->state.private_keys.as32[(ebx >> 0x18)] +
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
this->state.private_keys.as32[((ebx >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebx >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebx & 0xFF) + 0x300];
ebp = ebp ^ esi ^ this->state.initial_keys.as32[2];
edi = ((this->state.private_keys.as32[(ebp >> 0x18)] +
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
this->state.private_keys.as32[((ebp >> 0x10) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((ebp >> 0x8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(ebp & 0xFF) + 0x300];
edi = edi ^ this->state.initial_keys.as32[1];
ebp = ebp ^ this->state.initial_keys.as32[0];
ebx = ebx ^ edi;
@@ -418,14 +421,14 @@ void PSOBBEncryption::tfs1_scramble(uint32_t* out1, uint32_t* out2) const {
for (size_t x = 0; x < 0x10; x += 2) {
a ^= this->state.initial_keys.as32[x];
b ^= (((this->state.private_keys.as32[a >> 24] +
this->state.private_keys.as32[((a >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((a >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(a & 0xFF) + 0x300]) ^
this->state.initial_keys.as32[x + 1];
this->state.private_keys.as32[((a >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((a >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(a & 0xFF) + 0x300]) ^
this->state.initial_keys.as32[x + 1];
a ^= ((this->state.private_keys.as32[b >> 24] +
this->state.private_keys.as32[((b >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((b >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(b & 0xFF) + 0x300];
this->state.private_keys.as32[((b >> 16) & 0xFF) + 0x100]) ^
this->state.private_keys.as32[((b >> 8) & 0xFF) + 0x200]) +
this->state.private_keys.as32[(b & 0xFF) + 0x300];
}
*out1 = this->state.initial_keys.as32[0x11] ^ b;
*out2 = this->state.initial_keys.as32[0x10] ^ a;
@@ -688,7 +691,9 @@ PSOV2OrV3DetectorEncryption::PSOV2OrV3DetectorEncryption(
uint32_t key,
const std::unordered_set<uint32_t>& v2_matches,
const std::unordered_set<uint32_t>& v3_matches)
: key(key), v2_matches(v2_matches), v3_matches(v3_matches) {}
: key(key),
v2_matches(v2_matches),
v3_matches(v3_matches) {}
void PSOV2OrV3DetectorEncryption::encrypt(void* data, size_t size, bool advance) {
if (!this->active_crypt) {
@@ -717,9 +722,9 @@ void PSOV2OrV3DetectorEncryption::encrypt(void* data, size_t size, bool advance)
"ambiguous crypt version (v2=%08" PRIX32 ", v3=%08" PRIX32 ")",
decrypted_v2.load(), decrypted_v3.load()));
} else if (v2_match) {
this->active_crypt = move(v2_crypt);
this->active_crypt = std::move(v2_crypt);
} else {
this->active_crypt = move(v3_crypt);
this->active_crypt = std::move(v3_crypt);
}
}
this->active_crypt->encrypt(data, size, advance);
@@ -734,7 +739,8 @@ PSOEncryption::Type PSOV2OrV3DetectorEncryption::type() const {
PSOV2OrV3ImitatorEncryption::PSOV2OrV3ImitatorEncryption(
uint32_t key, std::shared_ptr<PSOV2OrV3DetectorEncryption> detector_crypt)
: key(key), detector_crypt(detector_crypt) {}
: key(key),
detector_crypt(detector_crypt) {}
void PSOV2OrV3ImitatorEncryption::encrypt(void* data, size_t size, bool advance) {
if (!this->active_crypt) {
+9 -9
View File
@@ -60,7 +60,7 @@ shared_ptr<PSOGCObjectGraph::Object> PSOGCObjectGraph::parse_object_memo(
auto ret = this->all_objects.emplace(addr, new Object()).first->second;
ret->address = addr;
ret->flags = obj.flags;
ret->type_name = move(type_name);
ret->type_name = std::move(type_name);
ret->vtable = this->parse_vtable_memo(r, obj.vtable_addr);
if (obj.parent_addr) {
ret->parent = this->parse_object_memo(r, obj.parent_addr);
@@ -85,14 +85,14 @@ void PSOGCObjectGraph::Object::print(FILE* stream, size_t indent_level) const {
fputc(' ', stream);
}
fprintf(stream, "%s +%04hX @ %08" PRIX32 " (VT %08" PRIX32 ": destroy=%08" PRIX32 " update=%08" PRIX32 " render=%08" PRIX32 " render_shadow=%08" PRIX32 ")\n",
this->type_name.c_str(),
this->flags,
this->address,
this->vtable->address,
this->vtable->destroy_addr,
this->vtable->update_addr,
this->vtable->render_addr,
this->vtable->render_shadow_addr);
this->type_name.c_str(),
this->flags,
this->address,
this->vtable->address,
this->vtable->destroy_addr,
this->vtable->update_addr,
this->vtable->render_addr,
this->vtable->render_shadow_addr);
for (const auto& child : this->children) {
child->print(stream, indent_level + 1);
}
+1 -1
View File
@@ -207,5 +207,5 @@ std::string prepend_command_header(
throw logic_error("unimplemented game version in prepend_command_header");
}
ret.write(data);
return move(ret.str());
return std::move(ret.str());
}
+2 -2
View File
@@ -114,10 +114,10 @@ PatchFileIndex::PatchFileIndex(const string& root_dir)
make_json_int(f->size),
make_json_int(st.st_mtime),
make_json_int(f->crc32),
make_json_list(move(chunk_crcs_item)),
make_json_list(std::move(chunk_crcs_item)),
});
new_metadata_cache_json->as_dict().emplace(
relative_item_path, make_json_list(move(new_cache_item)));
relative_item_path, make_json_list(std::move(new_cache_item)));
should_write_metadata_cache = true;
} else {
+2 -2
View File
@@ -628,7 +628,7 @@ static HandlerResult S_B2(shared_ptr<ServerState>,
while (!r.eof()) {
w.put_u32b(r.get_u32b() ^ crypt.next());
}
decrypted_data = move(w.str());
decrypted_data = std::move(w.str());
} else {
decrypted_data = r.read(r.remaining());
crypt.decrypt(decrypted_data.data(), decrypted_data.size());
@@ -1096,7 +1096,7 @@ static HandlerResult S_44_A6(shared_ptr<ServerState>,
ProxyServer::LinkedSession::SavingFile sf(
cmd.filename, output_filename, cmd.file_size);
session.saving_files.emplace(cmd.filename, move(sf));
session.saving_files.emplace(cmd.filename, std::move(sf));
if (session.options.save_files) {
session.log.info("Opened file %s", output_filename.c_str());
} else {
+11 -11
View File
@@ -153,7 +153,7 @@ void ProxyServer::on_client_connect(
session->log.info("Opened linked session");
Channel ch(bev, version, nullptr, nullptr, session.get(), "", TerminalFormat::FG_YELLOW, TerminalFormat::FG_GREEN);
session->resume(move(ch));
session->resume(std::move(ch));
// If no default destination exists, or the client is not a patch client,
// create an unlinked session - we'll have to get the destination from the
@@ -329,7 +329,7 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
session->server->state->license_manager->add(l);
license = l;
}
login_command_bb = move(data);
login_command_bb = std::move(data);
} else {
throw logic_error("unsupported unlinked session version");
@@ -392,12 +392,12 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
try {
if (session->version == GameVersion::BB) {
linked_session->resume(
move(session->channel),
std::move(session->channel),
session->detector_crypt,
move(login_command_bb));
std::move(login_command_bb));
} else {
linked_session->resume(
move(session->channel),
std::move(session->channel),
session->detector_crypt,
sub_version,
language,
@@ -527,22 +527,22 @@ void ProxyServer::LinkedSession::resume(
this->language = language;
this->character_name = character_name;
this->hardware_id = hardware_id;
this->resume_inner(move(client_channel), detector_crypt);
this->resume_inner(std::move(client_channel), detector_crypt);
}
void ProxyServer::LinkedSession::resume(
Channel&& client_channel,
shared_ptr<PSOBBMultiKeyDetectorEncryption> detector_crypt,
string&& login_command_bb) {
this->login_command_bb = move(login_command_bb);
this->resume_inner(move(client_channel), detector_crypt);
this->login_command_bb = std::move(login_command_bb);
this->resume_inner(std::move(client_channel), detector_crypt);
}
void ProxyServer::LinkedSession::resume(Channel&& client_channel) {
this->sub_version = 0;
this->language = 1;
this->character_name.clear();
this->resume_inner(move(client_channel), nullptr);
this->resume_inner(std::move(client_channel), nullptr);
}
void ProxyServer::LinkedSession::resume_inner(
@@ -556,7 +556,7 @@ void ProxyServer::LinkedSession::resume_inner(
}
this->client_channel.replace_with(
move(client_channel),
std::move(client_channel),
ProxyServer::LinkedSession::on_input,
ProxyServer::LinkedSession::on_error,
this,
@@ -826,7 +826,7 @@ void ProxyServer::delete_session(struct bufferevent* bev) {
throw logic_error("unlinked session exists but is not registered");
}
it->second->log.info("Closing session");
this->unlinked_sessions_to_destroy.emplace(move(it->second));
this->unlinked_sessions_to_destroy.emplace(std::move(it->second));
this->bev_to_unlinked_session.erase(it);
auto tv = usecs_to_timeval(0);
+6 -6
View File
@@ -129,7 +129,7 @@ string find_seed_and_decrypt_gci_or_vms_v2_download_quest_data_section(
string ret = decrypt_gci_or_vms_v2_download_quest_data_section<IsBigEndian>(
data_section, size, seed);
lock_guard<mutex> g(result_lock);
result = move(ret);
result = std::move(ret);
return true;
} catch (const runtime_error&) {
return false;
@@ -551,8 +551,8 @@ shared_ptr<const string> Quest::bin_contents() const {
break;
case FileFormat::QST: {
auto result = this->decode_qst(this->file_basename + ".qst");
this->bin_contents_ptr.reset(new string(move(result.first)));
this->dat_contents_ptr.reset(new string(move(result.second)));
this->bin_contents_ptr.reset(new string(std::move(result.first)));
this->dat_contents_ptr.reset(new string(std::move(result.second)));
break;
}
default:
@@ -585,8 +585,8 @@ shared_ptr<const string> Quest::dat_contents() const {
break;
case FileFormat::QST: {
auto result = this->decode_qst(this->file_basename + ".qst");
this->bin_contents_ptr.reset(new string(move(result.first)));
this->dat_contents_ptr.reset(new string(move(result.second)));
this->bin_contents_ptr.reset(new string(std::move(result.first)));
this->dat_contents_ptr.reset(new string(std::move(result.second)));
break;
}
default:
@@ -960,7 +960,7 @@ string Quest::export_qst(GameVersion version) const {
throw logic_error("invalid game version");
}
return move(w.str());
return std::move(w.str());
}
QuestIndex::QuestIndex(const string& directory) : directory(directory) {
+2 -2
View File
@@ -1065,7 +1065,7 @@ static bool start_ep3_battle_table_game_if_ready(
if (!all_clients_accepted) {
return false;
}
game_clients = move(table_clients);
game_clients = std::move(table_clients);
}
// If there are no clients, do nothing (this happens when the last player
@@ -2597,7 +2597,7 @@ static void on_chat_generic(shared_ptr<ServerState> s, shared_ptr<Client> c,
c->version(), c->game_data.player()->disp.name.data(),
processed_text.c_str(), private_flags);
string prepared_message_sjis = encode_sjis(prepared_message);
l->battle_record->add_chat_message(c->license->serial_number, move(prepared_message_sjis));
l->battle_record->add_chat_message(c->license->serial_number, std::move(prepared_message_sjis));
}
}
+1 -1
View File
@@ -377,7 +377,7 @@ void send_function_call(
}
w.write(data);
data = move(w.str());
data = std::move(w.str());
}
}
+8 -8
View File
@@ -52,7 +52,7 @@ void Server::disconnect_client(shared_ptr<Client> c) {
// move it to another set, which we'll clear in an immediately-enqueued
// callback after the current event. This will also call the client's
// disconnect hooks (if any).
this->clients_to_destroy.insert(move(c));
this->clients_to_destroy.insert(std::move(c));
this->enqueue_destroy_clients();
}
@@ -73,7 +73,7 @@ void Server::destroy_clients() {
// Note: It's important to move the disconnect hooks out of the client here
// because the hooks could modify c->disconnect_hooks while it's being
// iterated here, which would invalidate these iterators.
unordered_map<string, function<void()>> hooks = move(c->disconnect_hooks);
unordered_map<string, function<void()>> hooks = std::move(c->disconnect_hooks);
for (auto h_it : hooks) {
try {
h_it.second();
@@ -299,30 +299,30 @@ vector<shared_ptr<Client>> Server::get_clients_by_identifier(const string& ident
for (const auto& it : this->channel_to_client) {
auto c = it.second;
if (c->license && c->license->serial_number == serial_number_dec) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
if (c->license && c->license->serial_number == serial_number_hex) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
if (c->license && c->license->username == ident) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
auto p = c->game_data.player(false);
if (p && p->disp.name == u16name) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
if (c->channel.name == ident) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
if (starts_with(c->channel.name, ident + " ")) {
results.emplace_back(move(c));
results.emplace_back(std::move(c));
continue;
}
}
+1 -1
View File
@@ -609,7 +609,7 @@ session with ID 17205AE4, run the command `on 17205AE4 sc 1D 00 04 00`.\n\
if (clients.size() > 1) {
throw runtime_error("multiple clients found");
}
c = move(clients[0]);
c = std::move(clients[0]);
}
if (c) {