63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
#include "sqltypes.h"
|
|
|
|
#pragma warning(disable:4100)
|
|
|
|
//Support functions for 64 bit conversion project
|
|
class WAI64bit
|
|
{
|
|
public:
|
|
WAI64bit()
|
|
{};
|
|
~WAI64bit()
|
|
{};
|
|
|
|
inline static int to32bit(size_t inSizeT,char *File, long lineNum)
|
|
{
|
|
int mySizeT = (int)inSizeT;
|
|
#if(_WIN64)
|
|
if(mySizeT!=inSizeT) // Check if we've chopped something off
|
|
DisplayError(File, lineNum);
|
|
#endif
|
|
return mySizeT;
|
|
};
|
|
inline static int to32bit(INT_PTR inInt,char *File, long lineNum)
|
|
{
|
|
int myInt = (int)inInt;
|
|
#if(_WIN64)
|
|
if(myInt!=inInt) // Check if we've chopped something off
|
|
DisplayError(File, lineNum);
|
|
#endif
|
|
return myInt;
|
|
};
|
|
inline static unsigned int to32bit(SQLUINTEGER inUInt,char *File, long lineNum)
|
|
{
|
|
unsigned int myUInt = (unsigned int)inUInt;
|
|
#if(_WIN64)
|
|
if(myUInt!=inUInt) // Check if we've chopped something off
|
|
DisplayError(File, lineNum);
|
|
#endif
|
|
return myUInt;
|
|
};
|
|
inline static DWORD toDWORD(DWORD_PTR inDword,char *File, long lineNum)
|
|
{
|
|
DWORD myDword = (DWORD)inDword;
|
|
#if(_WIN64)
|
|
if(myDword!=inDword) // Check if we've chopped something off
|
|
DisplayError(File, lineNum);
|
|
#endif
|
|
return myDword;
|
|
};
|
|
|
|
private:
|
|
inline static void DisplayError(char *fileName, long lineNum)
|
|
{
|
|
CString lineNumStr;
|
|
CString fileNameStr(fileName);
|
|
lineNumStr.Format(_T("%ld"), lineNum );
|
|
MessageBox(NULL,_T("64 bit loss of resolution in ") + fileNameStr + _T(" (") + lineNumStr + _T(").\nPlease file a Problem Report quoting the file and line #.\nThank you."),_T("PC-DMIS"),MB_OK);
|
|
};
|
|
};
|