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 { return {
.command = header.command(this->version), .command = header.command(this->version),
.flag = header.flag(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"))); 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) { const void* vdata, size_t size, function<void(size_t, size_t)> progress_fn) {
PRSCompressor prs(progress_fn); PRSCompressor prs(progress_fn);
prs.add(vdata, size); prs.add(vdata, size);
return move(prs.close()); return std::move(prs.close());
} }
string prs_compress( 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) { 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); 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 // 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_new(this->base.get(), fd, EV_READ | EV_PERSIST, &DNSServer::dispatch_on_receive_message, this),
event_free); event_free);
event_add(e.get(), nullptr); 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, 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) { for (const auto& ev : this->events) {
ev.serialize(w); ev.serialize(w);
} }
return move(w.str()); return std::move(w.str());
} }
bool BattleRecord::writable() const { bool BattleRecord::writable() const {
@@ -170,7 +170,7 @@ void BattleRecord::add_command(Event::Type type, string&& data) {
Event& ev = this->events.emplace_back(); Event& ev = this->events.emplace_back();
ev.type = type; ev.type = type;
ev.timestamp = now(); ev.timestamp = now();
ev.data = move(data); ev.data = std::move(data);
} }
void BattleRecord::add_chat_message( void BattleRecord::add_chat_message(
@@ -182,7 +182,7 @@ void BattleRecord::add_chat_message(
ev.type = Event::Type::CHAT_MESSAGE; ev.type = Event::Type::CHAT_MESSAGE;
ev.timestamp = now(); ev.timestamp = now();
ev.guild_card_number = guild_card_number; 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) { 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]); 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 // Skip all events before the last map definition event, and only retain
// battle commands between then and now (since these battle commands will all // 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++) { for (; it != this->events.end(); it++) {
if (it->type == Event::Type::BATTLE_COMMAND) { 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() { void BattleRecord::set_battle_end_timestamp() {
-2
View File
@@ -3871,7 +3871,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
const InterferenceProbabilityEntry* ret_entry = nullptr; const InterferenceProbabilityEntry* ret_entry = nullptr;
int16_t current_max = -1; int16_t current_max = -1;
size_t logical_index = 0;
uint16_t current_row_card_id = 0xFFFF; uint16_t current_row_card_id = 0xFFFF;
for (size_t z = 0; z < num_entries; z++) { for (size_t z = 0; z < num_entries; z++) {
const auto& entry = entries[z]; const auto& entry = entries[z];
@@ -3885,7 +3884,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
current_max = v; current_max = v;
} }
} }
logical_index++;
} else { } else {
current_row_card_id = current_column_card_id; 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("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("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)); 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() { void Rules::set_defaults() {
@@ -1015,7 +1015,7 @@ string MapDefinition::str(const DataIndex* data_index) const {
for (size_t x = 0; x < 0x10; x++) { for (size_t x = 0; x < 0x10; x++) {
line += string_printf(" %02hhX", tiles[y][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 += ']'; 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++) { for (size_t z = 0; z < 4; z++) {
string player_type; string player_type;
switch (this->entry_states[z].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(" ")) { for (size_t offset = tag.find(" "); offset != string::npos; offset = tag.find(" ")) {
tag = tag.substr(0, offset) + tag.substr(offset + 1); 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"); 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"); 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) { if (this->behavior_flags & BehaviorFlag::LOAD_CARD_TEXT) {
try { 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&) { } catch (const out_of_range&) {
} }
try { 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&) { } catch (const out_of_range&) {
} }
} }
@@ -1658,7 +1658,7 @@ const string& DataIndex::get_compressed_map_list() const {
StringWriter compressed_w; StringWriter compressed_w;
compressed_w.put_u32b(prs.input_size()); compressed_w.put_u32b(prs.input_size());
compressed_w.write(prs.close()); 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) { if (this->compressed_map_list.size() > 0x7BEC) {
throw runtime_error("Episode 3 compressed map list is too large"); 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); 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.put<G_MapData_GC_Ep3_6xB6x41>({{{{0xB6, 0, 0}, subcommand_size}, 0x41, {}}, map->map.map_number.load(), compressed.size(), 0});
w.write(compressed); w.write(compressed);
return move(w.str()); return std::move(w.str());
} }
void Server::send_commands_for_joining_spectator(Channel& c) const { 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()) { if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command( 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()) { if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command( 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 + 1]);
current_round_matches[z]->following = m; current_round_matches[z]->following = m;
current_round_matches[z + 1]->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); 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)); 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("name", make_json_str(team->name));
team_dict.emplace("password", make_json_str(team->password)); team_dict.emplace("password", make_json_str(team->password));
team_dict.emplace("num_rounds_cleared", make_json_int(team->num_rounds_cleared)); 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))); dict.emplace("teams", make_json_list(std::move(teams_list)));
return shared_ptr<JSONObject>(new JSONObject(move(dict))); return shared_ptr<JSONObject>(new JSONObject(std::move(dict)));
} }
std::shared_ptr<const DataIndex> Tournament::get_data_index() const { std::shared_ptr<const DataIndex> Tournament::get_data_index() const {
@@ -690,7 +690,7 @@ void TournamentIndex::save() const {
list.emplace_back(make_json_null()); 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)); save_file(this->state_filename, json->serialize(JSONObject::SerializeOption::FORMAT));
} }
+3 -3
View File
@@ -14,7 +14,7 @@ FileContentsCache::File::File(
string&& data, string&& data,
uint64_t load_time) uint64_t load_time)
: name(name), : name(name),
data(new string(move(data))), data(new string(std::move(data))),
load_time(load_time) {} load_time(load_time) {}
shared_ptr<const FileContentsCache::File> FileContentsCache::replace( shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
@@ -22,7 +22,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
if (t == 0) { if (t == 0) {
t = now(); 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); auto emplace_ret = this->name_to_file.emplace(name, new_file);
if (!emplace_ret.second) { if (!emplace_ret.second) {
emplace_ret.first->second = new_file; emplace_ret.first->second = new_file;
@@ -33,7 +33,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
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) { const string& name, const void* data, size_t size, uint64_t t) {
string s(reinterpret_cast<const char*>(data), size); 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) { 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); w.put(footer);
return move(w.str()); return std::move(w.str());
} }
string CompiledFunctionCode::generate_client_command( string CompiledFunctionCode::generate_client_command(
@@ -125,8 +125,8 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
if (arch == CompiledFunctionCode::Architecture::POWERPC) { if (arch == CompiledFunctionCode::Architecture::POWERPC) {
auto assembled = PPC32Emulator::assemble(text, {directory}); auto assembled = PPC32Emulator::assemble(text, {directory});
ret->code = move(assembled.code); ret->code = std::move(assembled.code);
ret->label_offsets = move(assembled.label_offsets); ret->label_offsets = std::move(assembled.label_offsets);
} else if (arch == CompiledFunctionCode::Architecture::X86) { } else if (arch == CompiledFunctionCode::Architecture::X86) {
throw runtime_error("x86 assembler is not implemented"); 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); this->generate_common_armor_slot_count(item);
if (this->shop_does_not_contain_duplicate_armor(shop, item)) { if (this->shop_does_not_contain_duplicate_armor(shop, item)) {
shop.emplace_back(move(item)); shop.emplace_back(std::move(item));
items_generated++; 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)) { 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++; items_generated++;
} }
} }
@@ -1070,7 +1070,7 @@ void ItemCreator::generate_armor_shop_units(
item.data1[1] = 3; item.data1[1] = 3;
item.data1[2] = pt.pop(); item.data1[2] = pt.pop();
if (this->shop_does_not_contain_duplicate_item_by_primary_identifier(shop, item)) { 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++; items_generated++;
} }
} }
@@ -1181,7 +1181,7 @@ void ItemCreator::generate_rare_tool_shop_recovery_items(
item.data1[1] = tool_item_defs[type].first; item.data1[1] = tool_item_defs[type].first;
item.data1[2] = tool_item_defs[type].second; item.data1[2] = tool_item_defs[type].second;
if (this->shop_does_not_contain_duplicate_item_by_primary_identifier(shop, item)) { 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++; items_generated++;
} }
} }
@@ -1225,7 +1225,7 @@ void ItemCreator::generate_tool_shop_tech_disks(
this->choose_tech_disk_level_for_tool_shop( this->choose_tech_disk_level_for_tool_shop(
item, player_level, tech_num_index); item, player_level, tech_num_index);
if (this->shop_does_not_contain_duplicate_tech_disk(shop, item)) { if (this->shop_does_not_contain_duplicate_tech_disk(shop, item)) {
shop.emplace_back(move(item)); shop.emplace_back(std::move(item));
items_generated++; items_generated++;
} }
} }
@@ -1445,7 +1445,7 @@ vector<ItemData> ItemCreator::generate_weapon_shop_contents(size_t player_level)
item.data1[11] = 0; item.data1[11] = 0;
if (this->shop_does_not_contain_duplicate_or_too_many_similar_weapons(shop, item)) { 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]; token += pb_names[x];
} }
ret_tokens.emplace_back(move(token)); ret_tokens.emplace_back(std::move(token));
static const vector<const char*> mag_colors({ static const vector<const char*> mag_colors({
/* 00 */ "red", /* 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()) { if (item_it == this->item_id_to_floor_item.end()) {
throw out_of_range("item not present"); 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); this->item_id_to_floor_item.erase(item_it);
return ret; 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"); throw logic_error("plaintext and mask are not the same size");
} }
max_plaintext_size = max<size_t>(max_plaintext_size, data.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); 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(); 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) { if (behavior == Behavior::EXTRACT_GSL) {
GSLArchive arch(data_shared, big_endian); GSLArchive arch(data_shared, big_endian);
+11 -5
View File
@@ -19,7 +19,10 @@ void PSOEncryption::decrypt(void* data, size_t size, bool advance) {
PSOLFGEncryption::PSOLFGEncryption( PSOLFGEncryption::PSOLFGEncryption(
uint32_t seed, size_t stream_length, size_t end_offset) 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) { uint32_t PSOLFGEncryption::next(bool advance) {
if (this->offset == this->end_offset) { if (this->offset == this->end_offset) {
@@ -688,7 +691,9 @@ PSOV2OrV3DetectorEncryption::PSOV2OrV3DetectorEncryption(
uint32_t key, uint32_t key,
const std::unordered_set<uint32_t>& v2_matches, const std::unordered_set<uint32_t>& v2_matches,
const std::unordered_set<uint32_t>& v3_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) { void PSOV2OrV3DetectorEncryption::encrypt(void* data, size_t size, bool advance) {
if (!this->active_crypt) { 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 ")", "ambiguous crypt version (v2=%08" PRIX32 ", v3=%08" PRIX32 ")",
decrypted_v2.load(), decrypted_v3.load())); decrypted_v2.load(), decrypted_v3.load()));
} else if (v2_match) { } else if (v2_match) {
this->active_crypt = move(v2_crypt); this->active_crypt = std::move(v2_crypt);
} else { } else {
this->active_crypt = move(v3_crypt); this->active_crypt = std::move(v3_crypt);
} }
} }
this->active_crypt->encrypt(data, size, advance); this->active_crypt->encrypt(data, size, advance);
@@ -734,7 +739,8 @@ PSOEncryption::Type PSOV2OrV3DetectorEncryption::type() const {
PSOV2OrV3ImitatorEncryption::PSOV2OrV3ImitatorEncryption( PSOV2OrV3ImitatorEncryption::PSOV2OrV3ImitatorEncryption(
uint32_t key, std::shared_ptr<PSOV2OrV3DetectorEncryption> detector_crypt) 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) { void PSOV2OrV3ImitatorEncryption::encrypt(void* data, size_t size, bool advance) {
if (!this->active_crypt) { if (!this->active_crypt) {
+1 -1
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; auto ret = this->all_objects.emplace(addr, new Object()).first->second;
ret->address = addr; ret->address = addr;
ret->flags = obj.flags; 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); ret->vtable = this->parse_vtable_memo(r, obj.vtable_addr);
if (obj.parent_addr) { if (obj.parent_addr) {
ret->parent = this->parse_object_memo(r, obj.parent_addr); ret->parent = this->parse_object_memo(r, obj.parent_addr);
+1 -1
View File
@@ -207,5 +207,5 @@ std::string prepend_command_header(
throw logic_error("unimplemented game version in prepend_command_header"); throw logic_error("unimplemented game version in prepend_command_header");
} }
ret.write(data); 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(f->size),
make_json_int(st.st_mtime), make_json_int(st.st_mtime),
make_json_int(f->crc32), 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( 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; should_write_metadata_cache = true;
} else { } else {
+2 -2
View File
@@ -628,7 +628,7 @@ static HandlerResult S_B2(shared_ptr<ServerState>,
while (!r.eof()) { while (!r.eof()) {
w.put_u32b(r.get_u32b() ^ crypt.next()); w.put_u32b(r.get_u32b() ^ crypt.next());
} }
decrypted_data = move(w.str()); decrypted_data = std::move(w.str());
} else { } else {
decrypted_data = r.read(r.remaining()); decrypted_data = r.read(r.remaining());
crypt.decrypt(decrypted_data.data(), decrypted_data.size()); crypt.decrypt(decrypted_data.data(), decrypted_data.size());
@@ -1096,7 +1096,7 @@ static HandlerResult S_44_A6(shared_ptr<ServerState>,
ProxyServer::LinkedSession::SavingFile sf( ProxyServer::LinkedSession::SavingFile sf(
cmd.filename, output_filename, cmd.file_size); 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) { if (session.options.save_files) {
session.log.info("Opened file %s", output_filename.c_str()); session.log.info("Opened file %s", output_filename.c_str());
} else { } else {
+11 -11
View File
@@ -153,7 +153,7 @@ void ProxyServer::on_client_connect(
session->log.info("Opened linked session"); session->log.info("Opened linked session");
Channel ch(bev, version, nullptr, nullptr, session.get(), "", TerminalFormat::FG_YELLOW, TerminalFormat::FG_GREEN); 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, // 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 // 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); session->server->state->license_manager->add(l);
license = l; license = l;
} }
login_command_bb = move(data); login_command_bb = std::move(data);
} else { } else {
throw logic_error("unsupported unlinked session version"); throw logic_error("unsupported unlinked session version");
@@ -392,12 +392,12 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
try { try {
if (session->version == GameVersion::BB) { if (session->version == GameVersion::BB) {
linked_session->resume( linked_session->resume(
move(session->channel), std::move(session->channel),
session->detector_crypt, session->detector_crypt,
move(login_command_bb)); std::move(login_command_bb));
} else { } else {
linked_session->resume( linked_session->resume(
move(session->channel), std::move(session->channel),
session->detector_crypt, session->detector_crypt,
sub_version, sub_version,
language, language,
@@ -527,22 +527,22 @@ void ProxyServer::LinkedSession::resume(
this->language = language; this->language = language;
this->character_name = character_name; this->character_name = character_name;
this->hardware_id = hardware_id; 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( void ProxyServer::LinkedSession::resume(
Channel&& client_channel, Channel&& client_channel,
shared_ptr<PSOBBMultiKeyDetectorEncryption> detector_crypt, shared_ptr<PSOBBMultiKeyDetectorEncryption> detector_crypt,
string&& login_command_bb) { string&& login_command_bb) {
this->login_command_bb = move(login_command_bb); this->login_command_bb = std::move(login_command_bb);
this->resume_inner(move(client_channel), detector_crypt); this->resume_inner(std::move(client_channel), detector_crypt);
} }
void ProxyServer::LinkedSession::resume(Channel&& client_channel) { void ProxyServer::LinkedSession::resume(Channel&& client_channel) {
this->sub_version = 0; this->sub_version = 0;
this->language = 1; this->language = 1;
this->character_name.clear(); this->character_name.clear();
this->resume_inner(move(client_channel), nullptr); this->resume_inner(std::move(client_channel), nullptr);
} }
void ProxyServer::LinkedSession::resume_inner( void ProxyServer::LinkedSession::resume_inner(
@@ -556,7 +556,7 @@ void ProxyServer::LinkedSession::resume_inner(
} }
this->client_channel.replace_with( this->client_channel.replace_with(
move(client_channel), std::move(client_channel),
ProxyServer::LinkedSession::on_input, ProxyServer::LinkedSession::on_input,
ProxyServer::LinkedSession::on_error, ProxyServer::LinkedSession::on_error,
this, this,
@@ -826,7 +826,7 @@ void ProxyServer::delete_session(struct bufferevent* bev) {
throw logic_error("unlinked session exists but is not registered"); throw logic_error("unlinked session exists but is not registered");
} }
it->second->log.info("Closing session"); 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); this->bev_to_unlinked_session.erase(it);
auto tv = usecs_to_timeval(0); 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>( string ret = decrypt_gci_or_vms_v2_download_quest_data_section<IsBigEndian>(
data_section, size, seed); data_section, size, seed);
lock_guard<mutex> g(result_lock); lock_guard<mutex> g(result_lock);
result = move(ret); result = std::move(ret);
return true; return true;
} catch (const runtime_error&) { } catch (const runtime_error&) {
return false; return false;
@@ -551,8 +551,8 @@ shared_ptr<const string> Quest::bin_contents() const {
break; break;
case FileFormat::QST: { case FileFormat::QST: {
auto result = this->decode_qst(this->file_basename + ".qst"); auto result = this->decode_qst(this->file_basename + ".qst");
this->bin_contents_ptr.reset(new string(move(result.first))); this->bin_contents_ptr.reset(new string(std::move(result.first)));
this->dat_contents_ptr.reset(new string(move(result.second))); this->dat_contents_ptr.reset(new string(std::move(result.second)));
break; break;
} }
default: default:
@@ -585,8 +585,8 @@ shared_ptr<const string> Quest::dat_contents() const {
break; break;
case FileFormat::QST: { case FileFormat::QST: {
auto result = this->decode_qst(this->file_basename + ".qst"); auto result = this->decode_qst(this->file_basename + ".qst");
this->bin_contents_ptr.reset(new string(move(result.first))); this->bin_contents_ptr.reset(new string(std::move(result.first)));
this->dat_contents_ptr.reset(new string(move(result.second))); this->dat_contents_ptr.reset(new string(std::move(result.second)));
break; break;
} }
default: default:
@@ -960,7 +960,7 @@ string Quest::export_qst(GameVersion version) const {
throw logic_error("invalid game version"); throw logic_error("invalid game version");
} }
return move(w.str()); return std::move(w.str());
} }
QuestIndex::QuestIndex(const string& directory) : directory(directory) { 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) { if (!all_clients_accepted) {
return false; 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 // 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(), c->version(), c->game_data.player()->disp.name.data(),
processed_text.c_str(), private_flags); processed_text.c_str(), private_flags);
string prepared_message_sjis = encode_sjis(prepared_message); 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); 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 // 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 // callback after the current event. This will also call the client's
// disconnect hooks (if any). // disconnect hooks (if any).
this->clients_to_destroy.insert(move(c)); this->clients_to_destroy.insert(std::move(c));
this->enqueue_destroy_clients(); 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 // 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 // because the hooks could modify c->disconnect_hooks while it's being
// iterated here, which would invalidate these iterators. // 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) { for (auto h_it : hooks) {
try { try {
h_it.second(); 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) { for (const auto& it : this->channel_to_client) {
auto c = it.second; auto c = it.second;
if (c->license && c->license->serial_number == serial_number_dec) { if (c->license && c->license->serial_number == serial_number_dec) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; continue;
} }
if (c->license && c->license->serial_number == serial_number_hex) { if (c->license && c->license->serial_number == serial_number_hex) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; continue;
} }
if (c->license && c->license->username == ident) { if (c->license && c->license->username == ident) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; continue;
} }
auto p = c->game_data.player(false); auto p = c->game_data.player(false);
if (p && p->disp.name == u16name) { if (p && p->disp.name == u16name) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; continue;
} }
if (c->channel.name == ident) { if (c->channel.name == ident) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; continue;
} }
if (starts_with(c->channel.name, ident + " ")) { if (starts_with(c->channel.name, ident + " ")) {
results.emplace_back(move(c)); results.emplace_back(std::move(c));
continue; 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) { if (clients.size() > 1) {
throw runtime_error("multiple clients found"); throw runtime_error("multiple clients found");
} }
c = move(clients[0]); c = std::move(clients[0]);
} }
if (c) { if (c) {