コード例 #1
0
bool CTLSStorageInstance::FindFreeStorageBlock(CTLSStorageBlock *&psbOutStorageBlock)
{
	bool bResult = false;
	
	do
	{
		if (!FindFreeStorageBlockInArrayList(psbOutStorageBlock))
		{
			CTLSStorageArray *psaStorageArray = AllocateStorageArray();
			
			if (!psaStorageArray)
			{
				break;
			}

			FindFreeStorageBlockFromArray(psbOutStorageBlock, psaStorageArray); // Must always succeed as array is not added to list yet

			AddStorageArrayToArrayList(psaStorageArray);
		}
	
		bResult = true;
	}
	while (false);
	
	return bResult;
}
コード例 #2
0
bool CTLSStorageInstance::Init(ESTORAGEINSTANCEKIND ikInstanceKind)
{
	bool bResult = false;

	bool bKeyAllocationResult = false;
	HTLSKEYVALUE hkvStorageKey;
	
	do
	{
		if (!AllocateStorageKey(hkvStorageKey, ikInstanceKind))
		{
			break;
		}

		bKeyAllocationResult = true;

		CTLSStorageArray *psaFirstStorageArray = AllocateStorageArray();
		
		if (!psaFirstStorageArray)
		{
			break;
		}

		SetStorageKey(hkvStorageKey);
		SetStorageKeyValidFlag();
		AddStorageArrayToArrayList(psaFirstStorageArray);

		bResult = true;
	}
	while (false);

	if (!bResult)
	{
		if (bKeyAllocationResult)
		{
			FreeStorageKey(hkvStorageKey);
		}
	}
	
	return bResult;
}
コード例 #3
0
bool CTLSStorageInstance::Init()
{
	bool bResult = false;

	bool bKeyAllocationResult = false;
	HTLSKEY hskStorageKey;
	
	do
	{
		if (!AllocateStorageKey(hskStorageKey))
		{
			break;
		}

		bKeyAllocationResult = true;

		CTLSStorageArray *psaFirstStorageArray = AllocateStorageArray();
		
		if (!psaFirstStorageArray)
		{
			break;
		}

		SetStorageKey(hskStorageKey);
		SetStorageKeyValidFlag();
		AddStorageArrayToArrayList(psaFirstStorageArray);

		bResult = true;
	}
	while (false);

	if (!bResult)
	{
		if (bKeyAllocationResult)
		{
			FreeStorageKey(hskStorageKey);
		}
	}
	
	return bResult;
}