Fixed /W4 compile warnings in Assimp viewer.

pull/3129/head
Marc-Antoine Lortie 2020-04-03 14:36:44 -04:00
parent 085212e58a
commit 1cb564aa4b
5 changed files with 31 additions and 31 deletions

View File

@ -275,7 +275,7 @@ int CDisplay::ReplaceCurrentTexture(const char* szPath)
IDirect3DTexture9* piTexture = NULL; IDirect3DTexture9* piTexture = NULL;
aiString szString; aiString szString;
strcpy(szString.data,szPath); strcpy(szString.data,szPath);
szString.length = strlen(szPath); szString.length = static_cast<ai_uint32>(strlen(szPath));
CMaterialManager::Instance().LoadTexture(&piTexture,&szString); CMaterialManager::Instance().LoadTexture(&piTexture,&szString);
if (!piTexture) { if (!piTexture) {
@ -388,8 +388,8 @@ int CDisplay::AddTextureToDisplayList(unsigned int iType,
{ {
if ('*' == *szPath->data) if ('*' == *szPath->data)
{ {
int iIndex = atoi(szPath->data+1); int iIndex2 = atoi(szPath->data+1);
ai_snprintf(chTempEmb,256,"Embedded #%i",iIndex); ai_snprintf(chTempEmb,256,"Embedded #%i",iIndex2);
sz = chTempEmb; sz = chTempEmb;
} }
else else
@ -1308,7 +1308,7 @@ int CALLBACK TreeViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
return 0; return 0;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam) int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM /*lParam*/)
{ {
char szFileName[MAX_PATH]; char szFileName[MAX_PATH];
DWORD dwTemp = MAX_PATH; DWORD dwTemp = MAX_PATH;
@ -1795,11 +1795,11 @@ int CDisplay::RenderFullScene()
g_piDevice->SetVertexDeclaration( gDefaultVertexDecl); g_piDevice->SetVertexDeclaration( gDefaultVertexDecl);
// this is very similar to the code in SetupMaterial() // this is very similar to the code in SetupMaterial()
ID3DXEffect* piEnd = g_piNormalsEffect; ID3DXEffect* piEnd = g_piNormalsEffect;
aiMatrix4x4 pcProj = m * mViewProjection; aiMatrix4x4 pcProj2 = m * mViewProjection;
D3DXVECTOR4 vVector(1.f,0.f,0.f,1.f); D3DXVECTOR4 vVector(1.f,0.f,0.f,1.f);
piEnd->SetVector("OUTPUT_COLOR",&vVector); piEnd->SetVector("OUTPUT_COLOR",&vVector);
piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj); piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj2);
UINT dwPasses = 0; UINT dwPasses = 0;
piEnd->Begin(&dwPasses,0); piEnd->Begin(&dwPasses,0);

View File

@ -70,7 +70,7 @@ static const char* AI_VIEW_RTF_LOG_HEADER =
// Message procedure for the log window // Message procedure for the log window
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg, INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
WPARAM wParam,LPARAM lParam) WPARAM /*wParam*/,LPARAM lParam)
{ {
(void)lParam; (void)lParam;
switch (uMsg) switch (uMsg)

View File

@ -287,7 +287,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
size_t iLen2 = iLen+1; size_t iLen2 = iLen+1;
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2; iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
memcpy(p_szString->data,szTempB,iLen2); memcpy(p_szString->data,szTempB,iLen2);
p_szString->length = iLen; p_szString->length = static_cast<ai_uint32>(iLen);
return true; return true;
} }
} }
@ -301,7 +301,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
size_t iLen2 = iLen+1; size_t iLen2 = iLen+1;
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2; iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
memcpy(p_szString->data,szTempB,iLen2); memcpy(p_szString->data,szTempB,iLen2);
p_szString->length = iLen; p_szString->length = static_cast<ai_uint32>(iLen);
return true; return true;
} }
} }
@ -389,10 +389,10 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
if( !q ) q=strrchr( tmp2,'\\' ); if( !q ) q=strrchr( tmp2,'\\' );
if( q ){ if( q ){
strcpy( q+1,p+1 ); strcpy( q+1,p+1 );
if((pFile=fopen( tmp2,"r" ))){ if((pFile=fopen( tmp2,"r" )) != nullptr){
fclose( pFile ); fclose( pFile );
strcpy(p_szString->data,tmp2); strcpy(p_szString->data,tmp2);
p_szString->length = strlen(tmp2); p_szString->length = static_cast<ai_uint32>(strlen(tmp2));
return 1; return 1;
} }
} }
@ -407,7 +407,7 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
size_t iLen2 = iLen+1; size_t iLen2 = iLen+1;
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2; iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
memcpy(p_szString->data,szTemp,iLen2); memcpy(p_szString->data,szTemp,iLen2);
p_szString->length = iLen; p_szString->length = static_cast<ai_uint32>(iLen);
} }
return 1; return 1;
@ -627,7 +627,7 @@ void CMaterialManager::HMtoNMIfNecessary(
{ {
union union
{ {
struct {unsigned char b,g,r,a;}; struct {unsigned char b,g,r,a;} _data;
char _array[4]; char _array[4];
}; };
}; };
@ -646,7 +646,7 @@ void CMaterialManager::HMtoNMIfNecessary(
{ {
for (unsigned int x = 0; x < sDesc.Width;++x) for (unsigned int x = 0; x < sDesc.Width;++x)
{ {
if (pcPointer->b != pcPointer->r || pcPointer->b != pcPointer->g) if (pcPointer->_data.b != pcPointer->_data.r || pcPointer->_data.b != pcPointer->_data.g)
{ {
bIsEqual = false; bIsEqual = false;
break; break;
@ -705,9 +705,9 @@ void CMaterialManager::HMtoNMIfNecessary(
aiColor3D clrColorLine; aiColor3D clrColorLine;
for (unsigned int x = 0; x < sDesc.Width;++x) for (unsigned int x = 0; x < sDesc.Width;++x)
{ {
clrColorLine.r += pcPointer->r; clrColorLine.r += pcPointer->_data.r;
clrColorLine.g += pcPointer->g; clrColorLine.g += pcPointer->_data.g;
clrColorLine.b += pcPointer->b; clrColorLine.b += pcPointer->_data.b;
pcPointer++; pcPointer++;
} }
clrColor.r += clrColorLine.r /= (float)sDesc.Width; clrColor.r += clrColorLine.r /= (float)sDesc.Width;
@ -739,17 +739,17 @@ void CMaterialManager::HMtoNMIfNecessary(
// need to convert it NOW // need to convert it NOW
if (bMustConvert) if (bMustConvert)
{ {
D3DSURFACE_DESC sDesc; D3DSURFACE_DESC sDesc2;
piTexture->GetLevelDesc(0, &sDesc); piTexture->GetLevelDesc(0, &sDesc2);
IDirect3DTexture9* piTempTexture; IDirect3DTexture9* piTempTexture;
if(FAILED(g_piDevice->CreateTexture( if(FAILED(g_piDevice->CreateTexture(
sDesc.Width, sDesc2.Width,
sDesc.Height, sDesc2.Height,
piTexture->GetLevelCount(), piTexture->GetLevelCount(),
sDesc.Usage, sDesc2.Usage,
sDesc.Format, sDesc2.Format,
sDesc.Pool, &piTempTexture, NULL))) sDesc2.Pool, &piTempTexture, NULL)))
{ {
CLogDisplay::Instance().AddEntry( CLogDisplay::Instance().AddEntry(
"[ERROR] Unable to create normal map texture", "[ERROR] Unable to create normal map texture",

View File

@ -107,7 +107,7 @@ void MakeFileAssociations() {
RegCreateKeyEx(HKEY_CURRENT_USER,buf,0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL); RegCreateKeyEx(HKEY_CURRENT_USER,buf,0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1); RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1);
RegCloseKey(hRegistry); RegCloseKey(hRegistry);
} while ((sz = strtok(NULL,";"))); } while ((sz = strtok(NULL,";")) != nullptr);
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL); RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
RegCloseKey(hRegistry); RegCloseKey(hRegistry);

View File

@ -505,7 +505,7 @@ int CreateAssetData()
if (g_pcAsset->apcMeshes[i]->piOpacityTexture || 1.0f != g_pcAsset->apcMeshes[i]->fOpacity) if (g_pcAsset->apcMeshes[i]->piOpacityTexture || 1.0f != g_pcAsset->apcMeshes[i]->fOpacity)
dwUsage |= D3DUSAGE_DYNAMIC; dwUsage |= D3DUSAGE_DYNAMIC;
unsigned int nidx; unsigned int nidx = 0;
switch (mesh->mPrimitiveTypes) { switch (mesh->mPrimitiveTypes) {
case aiPrimitiveType_POINT: case aiPrimitiveType_POINT:
nidx = 1; nidx = 1;
@ -639,7 +639,7 @@ int CreateAssetData()
ai_assert( weightsPerVertex[x].size() <= 4); ai_assert( weightsPerVertex[x].size() <= 4);
for( unsigned int a = 0; a < weightsPerVertex[x].size(); a++) for( unsigned int a = 0; a < weightsPerVertex[x].size(); a++)
{ {
boneIndices[a] = weightsPerVertex[x][a].mVertexId; boneIndices[a] = static_cast<unsigned char>(weightsPerVertex[x][a].mVertexId);
boneWeights[a] = (unsigned char) (weightsPerVertex[x][a].mWeight * 255.0f); boneWeights[a] = (unsigned char) (weightsPerVertex[x][a].mWeight * 255.0f);
} }
@ -802,10 +802,10 @@ int ShutdownD3D(void)
template<class TComPtr> template<class TComPtr>
inline inline
void SafeRelease(TComPtr *ptr) { void SafeRelease(TComPtr *&ptr) {
if (nullptr != g_piPassThroughEffect) { if (nullptr != ptr) {
g_piPassThroughEffect->Release(); ptr->Release();
g_piPassThroughEffect = nullptr; ptr = nullptr;
} }
} }