示例#1
0
BOOL DBCFile::OpenFromMemory(const CHAR* pMemory, const CHAR* pDeadEnd, const CHAR* szFileName)
{
	//assert(pMemory && pDeadEnd);
	//----------------------------------------------------
	//判断是否是二进制格式
	if(pDeadEnd - pMemory >=sizeof(FILE_HEAD) && *((UINT*)pMemory)==0XDDBBCC00)
	{
		return OpenFromMemoryImpl_Binary(pMemory, pDeadEnd, szFileName);
	}
	else
	{
		return OpenFromMemoryImpl_Text(pMemory, pDeadEnd, szFileName);
	}
}
示例#2
0
	BOOL DBCFile::OpenFromMemory(const CHAR* pMemory, const CHAR* pDeadEnd, const CHAR* szFileName)
	{
		assert(pMemory && pDeadEnd);
		//判断是否是二进制格式
		UINT uHeader = *((UINT*)pMemory);
		if((pDeadEnd - pMemory) >=sizeof(FILE_HEAD) && uHeader==0XDDBBCC00) //lint !e826 !e574
		{
			return OpenFromMemoryImpl_Binary(pMemory, pDeadEnd, szFileName);
		}
		else
		{
			USHORT sHeader = *((USHORT*)pMemory);
			if(sHeader==0xFEFF || sHeader==0xBBEF)
			{
				return NULL;
			}

			return OpenFromMemoryImpl_Text(pMemory, pDeadEnd, szFileName);
		}
	}