-replaced 3 snprintf in code with strncpy, saves a little

bit time maybe, main reason is that its a more proper way ;)
This commit is contained in:
fix94.1 2012-05-03 18:54:16 +00:00
parent 8be989e485
commit de0306c275
2 changed files with 3 additions and 3 deletions

View File

@ -487,12 +487,12 @@ void CMenu::_game(bool launch)
if (GC_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR))
{
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(hdr->path, sizeof(hdr->path), "%s", (char*)hdr->hdr.id);
strncpy(hdr->path, (char*)hdr->hdr.id, sizeof(hdr->path));
}
else if(GC_GameIsInstalled(gcfolder, DeviceName[SD], DML_DIR))
{
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(hdr->path, sizeof(hdr->path), "%s", gcfolder);
strncpy(hdr->path, gcfolder, sizeof(hdr->path));
}
else if(!GC_GameIsInstalled(hdr->path, DeviceName[SD], DML_DIR) && !_wbfsOp(CMenu::WO_COPY_GAME))
break;

View File

@ -340,7 +340,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
char gcfolder[300];
char dmlgamedir[50];
snprintf(dmlgamedir, sizeof(dmlgamedir), "%s", (currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR);
strncpy(dmlgamedir, (currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, sizeof(dmlgamedir));
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", gcheader.title, (char *)gcheader.id);
if (_searchGamesByID((const char *) gcheader.id).size() != 0 || GC_GameIsInstalled((char *)gcheader.id, DeviceName[currentPartition], dmlgamedir) || GC_GameIsInstalled(gcfolder, DeviceName[currentPartition], dmlgamedir))
{