Renaming CrtFile* -> File*.

This commit is contained in:
Branimir Karadžić
2017-06-11 21:01:38 -07:00
parent b0697ec349
commit 525af7685e
6 changed files with 25 additions and 33 deletions

View File

@@ -108,7 +108,7 @@ void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint
void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip) void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip)
{ {
bx::CrtFileWriter writer; bx::FileWriter writer;
bx::Error err; bx::Error err;
if (bx::open(&writer, _filePath, false, &err) ) if (bx::open(&writer, _filePath, false, &err) )
{ {

View File

@@ -56,10 +56,9 @@ namespace entry
static String s_currentDir; static String s_currentDir;
#if BX_CONFIG_CRT_FILE_READER_WRITER class FileReader : public bx::FileReader
class FileReader : public bx::CrtFileReader
{ {
typedef bx::CrtFileReader super; typedef bx::FileReader super;
public: public:
virtual bool open(const char* _filePath, bx::Error* _err) BX_OVERRIDE virtual bool open(const char* _filePath, bx::Error* _err) BX_OVERRIDE
@@ -70,9 +69,9 @@ namespace entry
} }
}; };
class FileWriter : public bx::CrtFileWriter class FileWriter : public bx::FileWriter
{ {
typedef bx::CrtFileWriter super; typedef bx::FileWriter super;
public: public:
virtual bool open(const char* _filePath, bool _append, bx::Error* _err) BX_OVERRIDE virtual bool open(const char* _filePath, bool _append, bx::Error* _err) BX_OVERRIDE
@@ -82,7 +81,6 @@ namespace entry
return super::open(filePath.getPtr(), _append, _err); return super::open(filePath.getPtr(), _append, _err);
} }
}; };
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
void setCurrentDir(const char* _dir) void setCurrentDir(const char* _dir)
{ {
@@ -443,10 +441,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
} }
} }
#if BX_CONFIG_CRT_FILE_READER_WRITER
s_fileReader = BX_NEW(g_allocator, FileReader); s_fileReader = BX_NEW(g_allocator, FileReader);
s_fileWriter = BX_NEW(g_allocator, FileWriter); s_fileWriter = BX_NEW(g_allocator, FileWriter);
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
cmdInit(); cmdInit();
cmdAdd("mouselock", cmdMouseLock); cmdAdd("mouselock", cmdMouseLock);
@@ -468,13 +464,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
cmdShutdown(); cmdShutdown();
#if BX_CONFIG_CRT_FILE_READER_WRITER
BX_DELETE(g_allocator, s_fileReader); BX_DELETE(g_allocator, s_fileReader);
s_fileReader = NULL; s_fileReader = NULL;
BX_DELETE(g_allocator, s_fileWriter); BX_DELETE(g_allocator, s_fileWriter);
s_fileWriter = NULL; s_fileWriter = NULL;
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
if (BX_ENABLED(ENTRY_CONFIG_PROFILER) if (BX_ENABLED(ENTRY_CONFIG_PROFILER)
&& NULL != s_rmt) && NULL != s_rmt)

View File

@@ -117,19 +117,17 @@ namespace bgfx
{ {
BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip); BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip);
#if BX_CONFIG_CRT_FILE_READER_WRITER
const int32_t len = bx::strLen(_filePath)+5; const int32_t len = bx::strLen(_filePath)+5;
char* filePath = (char*)alloca(len); char* filePath = (char*)alloca(len);
bx::strCopy(filePath, len, _filePath); bx::strCopy(filePath, len, _filePath);
bx::strCat(filePath, len, ".tga"); bx::strCat(filePath, len, ".tga");
bx::CrtFileWriter writer; bx::FileWriter writer;
if (bx::open(&writer, filePath) ) if (bx::open(&writer, filePath) )
{ {
bimg::imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip); bimg::imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip);
bx::close(&writer); bx::close(&writer);
} }
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
} }
virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, TextureFormat::Enum /*_format*/, bool /*_yflip*/) BX_OVERRIDE virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, TextureFormat::Enum /*_format*/, bool /*_yflip*/) BX_OVERRIDE

View File

@@ -851,7 +851,7 @@ int main(int _argc, const char* _argv[])
PrimitiveArray primitives; PrimitiveArray primitives;
bx::CrtFileWriter writer; bx::FileWriter writer;
if (!bx::open(&writer, outFilePath) ) if (!bx::open(&writer, outFilePath) )
{ {
printf("Unable to open output file '%s'.", outFilePath); printf("Unable to open output file '%s'.", outFilePath);

View File

@@ -211,7 +211,7 @@ namespace bgfx
return len; return len;
} }
class Bin2cWriter : public bx::CrtFileWriter class Bin2cWriter : public bx::FileWriter
{ {
public: public:
Bin2cWriter(const char* _name) Bin2cWriter(const char* _name)
@@ -226,7 +226,7 @@ namespace bgfx
virtual void close() BX_OVERRIDE virtual void close() BX_OVERRIDE
{ {
generate(); generate();
return bx::CrtFileWriter::close(); return bx::FileWriter::close();
} }
virtual int32_t write(const void* _data, int32_t _size, bx::Error*) BX_OVERRIDE virtual int32_t write(const void* _data, int32_t _size, bx::Error*) BX_OVERRIDE
@@ -300,7 +300,7 @@ namespace bgfx
} }
bx::Error err; bx::Error err;
int32_t size = bx::CrtFileWriter::write(out, len, &err); int32_t size = bx::FileWriter::write(out, len, &err);
va_end(argList); va_end(argList);
@@ -331,7 +331,7 @@ namespace bgfx
File(const char* _filePath) File(const char* _filePath)
: m_data(NULL) : m_data(NULL)
{ {
bx::CrtFileReader reader; bx::FileReader reader;
if (bx::open(&reader, _filePath) ) if (bx::open(&reader, _filePath) )
{ {
m_size = (uint32_t)bx::getSize(&reader); m_size = (uint32_t)bx::getSize(&reader);
@@ -442,7 +442,7 @@ namespace bgfx
void writeFile(const char* _filePath, const void* _data, int32_t _size) void writeFile(const char* _filePath, const void* _data, int32_t _size)
{ {
bx::CrtFileWriter out; bx::FileWriter out;
if (bx::open(&out, _filePath) ) if (bx::open(&out, _filePath) )
{ {
bx::write(&out, _data, _size); bx::write(&out, _data, _size);
@@ -1056,7 +1056,7 @@ namespace bgfx
bool compiled = false; bool compiled = false;
bx::CrtFileReader reader; bx::FileReader reader;
if (!bx::open(&reader, filePath) ) if (!bx::open(&reader, filePath) )
{ {
fprintf(stderr, "Unable to open file '%s'.\n", filePath); fprintf(stderr, "Unable to open file '%s'.\n", filePath);
@@ -1236,7 +1236,7 @@ namespace bgfx
if (raw) if (raw)
{ {
bx::CrtFileWriter* writer = NULL; bx::FileWriter* writer = NULL;
if (NULL != bin2c) if (NULL != bin2c)
{ {
@@ -1244,7 +1244,7 @@ namespace bgfx
} }
else else
{ {
writer = new bx::CrtFileWriter; writer = new bx::FileWriter;
} }
if (!bx::open(writer, outFilePath) ) if (!bx::open(writer, outFilePath) )
@@ -1382,7 +1382,7 @@ namespace bgfx
if (preprocessOnly) if (preprocessOnly)
{ {
bx::CrtFileWriter writer; bx::FileWriter writer;
if (!bx::open(&writer, outFilePath) ) if (!bx::open(&writer, outFilePath) )
{ {
@@ -1397,7 +1397,7 @@ namespace bgfx
} }
{ {
bx::CrtFileWriter* writer = NULL; bx::FileWriter* writer = NULL;
if (NULL != bin2c) if (NULL != bin2c)
{ {
@@ -1405,7 +1405,7 @@ namespace bgfx
} }
else else
{ {
writer = new bx::CrtFileWriter; writer = new bx::FileWriter;
} }
if (!bx::open(writer, outFilePath) ) if (!bx::open(writer, outFilePath) )
@@ -1468,7 +1468,7 @@ namespace bgfx
{ {
std::string ofp = outFilePath; std::string ofp = outFilePath;
ofp += ".d"; ofp += ".d";
bx::CrtFileWriter writer; bx::FileWriter writer;
if (bx::open(&writer, ofp.c_str() ) ) if (bx::open(&writer, ofp.c_str() ) )
{ {
writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );
@@ -1852,7 +1852,7 @@ namespace bgfx
if (preprocessOnly) if (preprocessOnly)
{ {
bx::CrtFileWriter writer; bx::FileWriter writer;
if (!bx::open(&writer, outFilePath) ) if (!bx::open(&writer, outFilePath) )
{ {
@@ -1878,7 +1878,7 @@ namespace bgfx
} }
{ {
bx::CrtFileWriter* writer = NULL; bx::FileWriter* writer = NULL;
if (NULL != bin2c) if (NULL != bin2c)
{ {
@@ -1886,7 +1886,7 @@ namespace bgfx
} }
else else
{ {
writer = new bx::CrtFileWriter; writer = new bx::FileWriter;
} }
if (!bx::open(writer, outFilePath) ) if (!bx::open(writer, outFilePath) )
@@ -2178,7 +2178,7 @@ namespace bgfx
{ {
std::string ofp = outFilePath; std::string ofp = outFilePath;
ofp += ".d"; ofp += ".d";
bx::CrtFileWriter writer; bx::FileWriter writer;
if (bx::open(&writer, ofp.c_str() ) ) if (bx::open(&writer, ofp.c_str() ) )
{ {
writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() );

View File

@@ -646,7 +646,7 @@ void associate()
GetTempPathA(MAX_PATH, temp); GetTempPathA(MAX_PATH, temp);
bx::strCat(temp, MAX_PATH, "\\texturev.reg"); bx::strCat(temp, MAX_PATH, "\\texturev.reg");
bx::CrtFileWriter writer; bx::FileWriter writer;
bx::Error err; bx::Error err;
if (bx::open(&writer, temp, false, &err) ) if (bx::open(&writer, temp, false, &err) )
{ {
@@ -677,7 +677,7 @@ void associate()
str += "\n"; str += "\n";
bx::CrtFileWriter writer; bx::FileWriter writer;
bx::Error err; bx::Error err;
if (bx::open(&writer, "/tmp/texturev.sh", false, &err) ) if (bx::open(&writer, "/tmp/texturev.sh", false, &err) )
{ {