This commit is contained in:
Chuck Walbourn 2016-05-11 11:47:10 -07:00
Родитель 416092606e
Коммит 893180091a
3 изменённых файлов: 33 добавлений и 33 удалений

Просмотреть файл

@ -43,7 +43,7 @@ namespace
return S_OK;
}
inline HRESULT write_file_string(HANDLE hFile, const WCHAR* value)
inline HRESULT write_file_string(HANDLE hFile, const wchar_t* value)
{
UINT length = (value) ? static_cast<UINT>( wcslen(value)+1 ) : 1;
@ -56,7 +56,7 @@ namespace
if (length > 0)
{
DWORD bytes = static_cast<DWORD>(sizeof(WCHAR) * length);
DWORD bytes = static_cast<DWORD>(sizeof(wchar_t) * length);
if (!WriteFile(hFile, value, bytes, &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
@ -66,11 +66,11 @@ namespace
}
else
{
WCHAR nul = 0;
if (!WriteFile(hFile, &nul, sizeof(WCHAR), &bytesWritten, nullptr))
wchar_t nul = 0;
if (!WriteFile(hFile, &nul, sizeof(wchar_t), &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
if (bytesWritten != sizeof(WCHAR))
if (bytesWritten != sizeof(wchar_t))
return E_FAIL;
}
@ -1437,7 +1437,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
return hr;
{
WCHAR fname[_MAX_FNAME];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s(szFileName, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, nullptr, 0);
hr = write_file_string(hFile.get(), fname);
@ -1475,7 +1475,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
}
else
{
WCHAR name[64];
wchar_t name[64];
swprintf_s(name, L"material%03u\n", j);
hr = write_file_string(hFile.get(), name);
}

Просмотреть файл

@ -52,7 +52,7 @@ static_assert( OPT_MAX <= 32, "dwOptions is a DWORD bitfield" );
struct SConversion
{
WCHAR szSrc [MAX_PATH];
wchar_t szSrc [MAX_PATH];
};
struct SValue
@ -96,7 +96,7 @@ SValue g_pOptions[] =
#pragma prefast(disable : 26018, "Only used with static internal arrays")
DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
DWORD LookupByName(const wchar_t *pName, const SValue *pArray)
{
while(pArray->pName)
{
@ -109,7 +109,7 @@ DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
return 0;
}
const WCHAR* LookupByValue(DWORD pValue, const SValue *pArray)
const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
{
while(pArray->pName)
{
@ -157,7 +157,7 @@ void PrintUsage()
//--------------------------------------------------------------------------------------
HRESULT LoadFromOBJ(const WCHAR* szFilename, std::unique_ptr<Mesh>& inMesh, std::vector<Mesh::Material>& inMaterial, DWORD options )
HRESULT LoadFromOBJ(const wchar_t* szFilename, std::unique_ptr<Mesh>& inMesh, std::vector<Mesh::Material>& inMaterial, DWORD options )
{
WaveFrontReader<uint32_t> wfReader;
HRESULT hr = wfReader.Load(szFilename, (options & (1 << OPT_CLOCKWISE)) ? false : true );
@ -236,11 +236,11 @@ HRESULT LoadFromOBJ(const WCHAR* szFilename, std::unique_ptr<Mesh>& inMesh, std:
mtl.diffuseColor = it->vDiffuse;
mtl.specularColor = (it->bSpecular) ? it->vSpecular : XMFLOAT3(0.f, 0.f, 0.f);
WCHAR texture[_MAX_PATH] = { 0 };
wchar_t texture[_MAX_PATH] = { 0 };
if (*it->strTexture)
{
WCHAR txext[_MAX_EXT];
WCHAR txfname[_MAX_FNAME];
wchar_t txext[_MAX_EXT];
wchar_t txfname[_MAX_FNAME];
_wsplitpath_s(it->strTexture, nullptr, 0, nullptr, 0, txfname, _MAX_FNAME, txext, _MAX_EXT);
if (!(options & (1 << OPT_NODDS)))
@ -269,7 +269,7 @@ HRESULT LoadFromOBJ(const WCHAR* szFilename, std::unique_ptr<Mesh>& inMesh, std:
int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
{
// Parameters and defaults
WCHAR szOutputFile[MAX_PATH] = { 0 };
wchar_t szOutputFile[MAX_PATH] = { 0 };
// Process command line
DWORD dwOptions = 0;
@ -415,8 +415,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
// Process files
for( auto pConv = conversion.begin(); pConv != conversion.end(); ++pConv )
{
WCHAR ext[_MAX_EXT];
WCHAR fname[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );
if ( pConv != conversion.begin() )
@ -626,8 +626,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
}
WCHAR outputPath[MAX_PATH] = { 0 };
WCHAR outputExt[_MAX_EXT] = { 0 };
wchar_t outputPath[MAX_PATH] = { 0 };
wchar_t outputExt[_MAX_EXT] = { 0 };
if (*szOutputFile)
{
@ -650,7 +650,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wcscpy_s(outputExt, L".sdkmesh");
}
WCHAR outFilename[_MAX_FNAME] = { 0 };
wchar_t outFilename[_MAX_FNAME] = { 0 };
wcscpy_s(outFilename, fname);
_wmakepath_s(outputPath, nullptr, nullptr, outFilename, outputExt);

Просмотреть файл

@ -56,7 +56,7 @@ public:
if( !InFile )
return HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND );
WCHAR fname[_MAX_FNAME];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s( szFileName, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, nullptr, 0 );
name = fname;
@ -74,8 +74,8 @@ public:
uint32_t curSubset = 0;
WCHAR strCommand[256] = {0};
WCHAR strMaterialFilename[MAX_PATH] = {0};
wchar_t strCommand[256] = {0};
wchar_t strMaterialFilename[MAX_PATH] = {0};
for( ;; )
{
InFile >> strCommand;
@ -260,7 +260,7 @@ public:
else if( 0 == wcscmp( strCommand, L"usemtl" ) )
{
// Material
WCHAR strName[MAX_PATH] = {0};
wchar_t strName[MAX_PATH] = {0};
InFile >> strName;
bool bFound = false;
@ -302,14 +302,14 @@ public:
// If an associated material file was found, read that in as well.
if( *strMaterialFilename )
{
WCHAR ext[_MAX_EXT];
wchar_t ext[_MAX_EXT];
_wsplitpath_s( strMaterialFilename, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );
WCHAR drive[_MAX_DRIVE];
WCHAR dir[_MAX_DIR];
wchar_t drive[_MAX_DRIVE];
wchar_t dir[_MAX_DIR];
_wsplitpath_s( szFileName, drive, _MAX_DRIVE, dir, _MAX_DIR, nullptr, 0, nullptr, 0 );
WCHAR szPath[ MAX_PATH ];
wchar_t szPath[ MAX_PATH ];
_wmakepath_s( szPath, MAX_PATH, drive, dir, fname, ext );
HRESULT hr = LoadMTL( szPath );
@ -329,7 +329,7 @@ public:
auto curMaterial = materials.end();
WCHAR strCommand[256] = {0};
wchar_t strCommand[256] = {0};
for( ;; )
{
InFile >> strCommand;
@ -339,7 +339,7 @@ public:
if( 0 == wcscmp( strCommand, L"newmtl" ) )
{
// Switching active materials
WCHAR strName[MAX_PATH] = {0};
wchar_t strName[MAX_PATH] = {0};
InFile >> strName;
curMaterial = materials.end();
@ -438,7 +438,7 @@ public:
{
Clear();
WCHAR fname[_MAX_FNAME];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s( szFileName, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, nullptr, 0 );
name = fname;
@ -503,8 +503,8 @@ public:
bool bSpecular;
WCHAR strName[MAX_PATH];
WCHAR strTexture[MAX_PATH];
wchar_t strName[MAX_PATH];
wchar_t strTexture[MAX_PATH];
Material() :
vAmbient( 0.2f, 0.2f, 0.2f ),