I'm not to keen on removing these warnings, so I would appreciate some help in sorting them out:
UNSOLVED WARNINGS:
---START---
Code:
pBuffer = (T*)THROW_ERROR;
Generates warning C4312: 'type cast' : conversion from 'const int' to 'int *' of greater size.
Basically, it's a cast of INT to INT*, as you can see. This is simply because pBuffer wants a pointer (because it's a buffer!), but I'm throwing a value at it (on purpose of course).
---END---
---START---
Code:
PROCESS_STATUS( UpdateStatus(NULL, (pp<::CError>)pError) );
Generates the warning C4239: nonstandard extension used : 'argument' : conversion from 'CMemoryManager<T>' to 'CMemoryManager<T> &'
PROCESS_STATUS macro:
Code:
#define PROCESS_STATUS(exp) TempStatus = exp; \
switch(TempStatus) \
{ \
case STATUS_BAD: goto Next; \
case STATUS_CANCEL: bCancel = true; goto Next; \
}
UpdateStatus declaration:
Code:
UpdateStatusEnum UpdateStatus(CFileMap* pFile, ppdef<::CError> pError = NULL);
pp = class CMemoryManager<T>
ppdef = class CMemoryManagerDefault<T>
And declaration of pError:
Code:
pp<CKantanAnime::CError> pError;
---END---
---START---
Code:
return ReturnError(pFile, (CString)"Failed to write avisynth file because:\n\n" + GetError(pErrorLocal->dwError));
Generates warning C4239: nonstandard extension used : 'argument' : conversion from 'ATL::CStringT<BaseType,StringTraits>' to 'CString &'
Declaration of ReturnError:
Code:
CString& ReturnError(CFileMap* pFile, CString& strError);
---END---
---START---
And the last warning is:
warning C4244: '+=' : conversion from 'int' to 'BYTE', possible loss of data
Example line:
Code:
posDst[j]+=(BYTE)(rand() / grainx2);
Declarations:
Code:
BYTE *iDst ,*posDst;
long sXSize,sYSize,bytes,j,i,k,h;
int grainx2 = RAND_MAX/(max(1,2*granularity));
And in case you've forgotten how rand() looks like:
Code:
_CRTIMP __checkReturn int __cdecl rand(void);
As you see, I already tried truncating the result to BYTE at the end, but it doesn't seem to help.
I don't know if I have to truncate rand() and grainx2 to BYTE for it to work. But then again, wouldn't truncating them throw this warning too?
---END---
---START---
Code:
return MapHandle((HANDLE)0xFFFFFFFF);
Generates warning C4312: 'type cast' : conversion from 'const int' to 'int *' of greater size.
---END---
And a last question:
The DX sdk headers seem to use a lot of the old, deprecated functions, like sprint (instead of sprint_f). Okay, so I just made that up, but it goes to show it uses old, depracted functions. I disabled warnings before including the header and then re-enabling them, but should this be? Are there no DX headers that includes the newer, safer versions?
Using Visual Studio 2005. Appreciate answers. Thanks.
---SOLVED WARNINGS, BUT WAITING FOR AN EXPLANATION AS TO WHY---
SOLVED WARNINGS:
---START---
Code:
void AddTool(CWnd * pWnd, DWORD dwIdString, DWORD dwIdIcon, CSize & szIcon = CSize(0, 0), LPCRECT lpRectBounds = NULL, DWORD dwIDTool = 0);
This generates warning C4239: nonstandard extension used : 'default argument' : conversion from 'CSize' to 'CSize &'
---END---