Merge pull request #3129 from malortie/fix-assimp-viewer-w4-compile-warnings

Fixed /W4 compile warnings in Assimp viewer.
pull/3125/head^2
Kim Kulling 2020-04-07 11:25:28 +02:00 committed by GitHub
commit b59e6a2df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 31 deletions

View File

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

View File

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

View File

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