Commit ebf125f0 authored by Chen Bill's avatar Chen Bill

remove wcscpy

parent 48ecc05a
......@@ -237,7 +237,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
myswprintf(catepath, L"./pack");
break;
case 1:
myswprintf(catepath, mainGame->gameConf.bot_deck_path);
BufferIO::CopyWideString(mainGame->gameConf.bot_deck_path, catepath);
break;
case -1:
case 2:
......
......@@ -135,7 +135,7 @@ int main(int argc, char* argv[]) {
myswprintf(open_file_name, L"%ls/%ls", ygo::mainGame->gameConf.lastcategory, wargv[i]);
#endif
} else {
wcscpy(open_file_name, wargv[i]);
BufferIO::CopyWideString(wargv[i], open_file_name);
}
}
ClickButton(ygo::mainGame->btnDeckEdit);
......@@ -156,7 +156,7 @@ int main(int argc, char* argv[]) {
++i;
if(i < wargc) {
open_file = true;
wcscpy(open_file_name, wargv[i]);
BufferIO::CopyWideString(wargv[i], open_file_name);
}
ClickButton(ygo::mainGame->btnReplayMode);
if(open_file)
......@@ -167,7 +167,7 @@ int main(int argc, char* argv[]) {
++i;
if(i < wargc) {
open_file = true;
wcscpy(open_file_name, wargv[i]);
BufferIO::CopyWideString(wargv[i], open_file_name);
}
ClickButton(ygo::mainGame->btnSingleMode);
if(open_file)
......@@ -177,14 +177,14 @@ int main(int argc, char* argv[]) {
wchar_t* pstrext = wargv[1] + wcslen(wargv[1]) - 4;
if(!mywcsncasecmp(pstrext, L".ydk", 4)) {
open_file = true;
wcscpy(open_file_name, wargv[i]);
BufferIO::CopyWideString(wargv[i], open_file_name);
exit_on_return = !keep_on_return;
ClickButton(ygo::mainGame->btnDeckEdit);
break;
}
if(!mywcsncasecmp(pstrext, L".yrp", 4)) {
open_file = true;
wcscpy(open_file_name, wargv[i]);
BufferIO::CopyWideString(wargv[i], open_file_name);
exit_on_return = !keep_on_return;
ClickButton(ygo::mainGame->btnReplayMode);
ClickButton(ygo::mainGame->btnLoadReplay);
......
......@@ -70,14 +70,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->TrimText(mainGame->ebJoinHost);
mainGame->TrimText(mainGame->ebJoinPort);
char ip[20];
const wchar_t* pstr = mainGame->ebJoinHost->getText();
BufferIO::CopyWStr(pstr, ip, 16);
wchar_t pstr[100];
wchar_t portstr[10];
BufferIO::CopyWideString(mainGame->ebJoinHost->getText(), pstr);
BufferIO::CopyWideString(mainGame->ebJoinPort->getText(), portstr);
BufferIO::EncodeUTF8(pstr, ip);
unsigned int remote_addr = htonl(inet_addr(ip));
if(remote_addr == -1) {
char hostname[100];
char port[6];
BufferIO::CopyWStr(pstr, hostname, 100);
BufferIO::CopyWStr(mainGame->ebJoinPort->getText(), port, 6);
BufferIO::EncodeUTF8(pstr, hostname);
BufferIO::EncodeUTF8(portstr, port);
struct evutil_addrinfo hints;
struct evutil_addrinfo *answer = NULL;
std::memset(&hints, 0, sizeof hints);
......@@ -99,9 +102,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
evutil_freeaddrinfo(answer);
}
}
unsigned int remote_port = wcstol(mainGame->ebJoinPort->getText(), nullptr, 10);
BufferIO::CopyWStr(pstr, mainGame->gameConf.lasthost, 100);
BufferIO::CopyWStr(mainGame->ebJoinPort->getText(), mainGame->gameConf.lastport, 20);
unsigned int remote_port = wcstol(portstr, nullptr, 10);
BufferIO::CopyWideString(pstr, mainGame->gameConf.lasthost);
BufferIO::CopyWideString(portstr, mainGame->gameConf.lastport);
if(DuelClient::StartClient(remote_addr, remote_port, false)) {
mainGame->btnCreateHost->setEnabled(false);
mainGame->btnJoinHost->setEnabled(false);
......@@ -129,7 +132,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case BUTTON_HOST_CONFIRM: {
bot_mode = false;
BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20);
BufferIO::CopyWideString(mainGame->ebServerName->getText(), mainGame->gameConf.gamename);
if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment