Kill off some usages of c_str.

Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
Lioncash
2014-03-12 15:33:41 -04:00
parent dccc6d8b47
commit a82675b7d5
170 changed files with 812 additions and 704 deletions

View File

@ -25,7 +25,7 @@
namespace DiscIO
{
CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(filename)
CompressedBlobReader::CompressedBlobReader(const std::string& filename) : file_name(filename)
{
m_file.Open(filename, "rb");
file_size = File::GetSize(filename);
@ -50,7 +50,7 @@ CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(fil
memset(zlib_buffer, 0, zlib_buffer_size);
}
CompressedBlobReader* CompressedBlobReader::Create(const char* filename)
CompressedBlobReader* CompressedBlobReader::Create(const std::string& filename)
{
if (IsCompressedBlob(filename))
return new CompressedBlobReader(filename);
@ -107,7 +107,7 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
PanicAlert("Hash of block %" PRIu64 " is %08x instead of %08x.\n"
"Your ISO, %s, is corrupt.",
block_num, block_hash, hashes[block_num],
file_name.c_str());
file_name.c_str());
if (uncompressed)
{
@ -140,14 +140,14 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
}
}
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u32 sub_type,
int block_size, CompressCB callback, void* arg)
{
bool scrubbing = false;
if (IsCompressedBlob(infile))
{
PanicAlertT("%s is already compressed! Cannot compress it further.", infile);
PanicAlertT("%s is already compressed! Cannot compress it further.", infile.c_str());
return false;
}
@ -155,7 +155,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
{
if (!DiscScrubber::SetupScrub(infile, block_size))
{
PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile);
PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile.c_str());
return false;
}
@ -278,7 +278,7 @@ cleanup:
return true;
}
bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB callback, void* arg)
bool DecompressBlobToFile(const std::string& infile, const std::string& outfile, CompressCB callback, void* arg)
{
if (!IsCompressedBlob(infile))
{
@ -320,7 +320,7 @@ bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB ca
return true;
}
bool IsCompressedBlob(const char* filename)
bool IsCompressedBlob(const std::string& filename)
{
File::IOFile f(filename, "rb");