# HG changeset patch # User Mychaela Falconia # Date 1605328030 0 # Node ID 1c4536a30e326b2e7b9ec14935cc5b1e5aad6425 # Parent 66e0b6a40e0911d98c28290c95bbb805a04a9970 mmiBlkManager.c: bogotab fixes diff -r 66e0b6a40e09 -r 1c4536a30e32 src/ui/bmi/mmiBlkManager.c --- a/src/ui/bmi/mmiBlkManager.c Sat Nov 14 04:19:37 2020 +0000 +++ b/src/ui/bmi/mmiBlkManager.c Sat Nov 14 04:27:10 2020 +0000 @@ -1,6 +1,6 @@ /******************************************************************************* - CONDAT (UK) + CONDAT (UK) ******************************************************************************** @@ -9,21 +9,21 @@ ******************************************************************************** - $Project name: Basic MMI - $Project code: BMI (6349) - $Module: PhoneBook - $File: MmiBlkManager.c - $Revision: 1.0 + $Project name: Basic MMI + $Project code: BMI (6349) + $Module: PhoneBook + $File: MmiBlkManager.c + $Revision: 1.0 - $Author: Condat(UK) - $Date: 25/10/00 + $Author: Condat(UK) + $Date: 25/10/00 ******************************************************************************** Description: This module, in conjunction with the MmiBlkResources module, - provides the access to block resources for the MMI. + provides the access to block resources for the MMI. The block manager is responsible for creating and initialising the structures and tables to allow access to the strings, icons @@ -37,7 +37,7 @@ $History: MmiBlkManager.c - 25/10/00 Original Condat(UK) BMI version. + 25/10/00 Original Condat(UK) BMI version. $End @@ -93,18 +93,18 @@ typedef struct _tManagerEntry_ { - tBlkId Id; - int NumEntries; - tBlkHandle EntryBase; + tBlkId Id; + int NumEntries; + tBlkHandle EntryBase; } tManagerEntry, *pManagerEntry; typedef struct _tManagerControl_ { long int BlkKey; - tBlkHandle BaseAddress; - int BlkLength; - tBlkHandle RsrcList[BLOCK_MANAGER_ENTRY_COUNT]; - pManagerEntry EntryPtr; + tBlkHandle BaseAddress; + int BlkLength; + tBlkHandle RsrcList[BLOCK_MANAGER_ENTRY_COUNT]; + pManagerEntry EntryPtr; } tManagerControl, *pManagerControl; @@ -116,24 +116,24 @@ /******************************************************************************* - $Function: ValidManagerResource + $Function: ValidManagerResource - $Description: Determines if the resource indicated by the handle is valid + $Description: Determines if the resource indicated by the handle is valid - $Returns: Zero if failure, non-zero if valid resource + $Returns: Zero if failure, non-zero if valid resource - $Arguments: ManagerRsrc, handle of resource manager + $Arguments: ManagerRsrc, handle of resource manager *******************************************************************************/ static int ValidManagerResource( tBlkHandle ManagerRsrc ) { - pManagerControl ManagerControl = (pManagerControl) ManagerRsrc; + pManagerControl ManagerControl = (pManagerControl) ManagerRsrc; - if ( ManagerControl == NULL ) - return 0; + if ( ManagerControl == NULL ) + return 0; - return ( ManagerControl->BlkKey == BLOCK_MANAGER_KEY ); + return ( ManagerControl->BlkKey == BLOCK_MANAGER_KEY ); } @@ -146,89 +146,89 @@ /******************************************************************************* - $Function: mmibm_Initialise + $Function: mmibm_Initialise - $Description: Initialise a block manager object + $Description: Initialise a block manager object - $Returns: Handle of block manager object, NULL if failure + $Returns: Handle of block manager object, NULL if failure - $Arguments: BlkBase, base address of the block manager data + $Arguments: BlkBase, base address of the block manager data NumEntries, number of entries to be dealt with by the - block manager + block manager *******************************************************************************/ tBlkHandle mmibm_Initialise( tBlkHandle BlkBase, int NumEntries ) { - pManagerControl MyControl; - tBlkId Entry; - int i; + pManagerControl MyControl; + tBlkId Entry; + int i; - if ( ( MyControl = (pManagerControl) ALLOC_MEMORY( sizeof(tManagerControl) ) ) != NULL ) - { - /* Fill in the bits we know are pretty constant - */ - MyControl->BlkKey = BLOCK_MANAGER_KEY; - MyControl->BaseAddress = BlkBase; - MyControl->BlkLength = NumEntries; - MyControl->EntryPtr = (pManagerEntry) BlkBase; + if ( ( MyControl = (pManagerControl) ALLOC_MEMORY( sizeof(tManagerControl) ) ) != NULL ) + { + /* Fill in the bits we know are pretty constant + */ + MyControl->BlkKey = BLOCK_MANAGER_KEY; + MyControl->BaseAddress = BlkBase; + MyControl->BlkLength = NumEntries; + MyControl->EntryPtr = (pManagerEntry) BlkBase; - /* Initialise the handle array to empty initially - */ - for ( i = 0; i < BLOCK_MANAGER_ENTRY_COUNT; i++ ) - MyControl->RsrcList[i] = NULL; + /* Initialise the handle array to empty initially + */ + for ( i = 0; i < BLOCK_MANAGER_ENTRY_COUNT; i++ ) + MyControl->RsrcList[i] = NULL; - /* Now for each entry in the incoming block list we can create - a handler instance - */ - for ( i = 0; i < NumEntries; i++ ) - if ( ( Entry = MyControl->EntryPtr[i].Id ) < BLOCK_MANAGER_ENTRY_COUNT ) - MyControl->RsrcList[ Entry ] = mmibr_Initialise( - MyControl->EntryPtr[i].EntryBase, MyControl->EntryPtr[i].NumEntries ); - } + /* Now for each entry in the incoming block list we can create + a handler instance + */ + for ( i = 0; i < NumEntries; i++ ) + if ( ( Entry = MyControl->EntryPtr[i].Id ) < BLOCK_MANAGER_ENTRY_COUNT ) + MyControl->RsrcList[ Entry ] = mmibr_Initialise( + MyControl->EntryPtr[i].EntryBase, MyControl->EntryPtr[i].NumEntries ); + } - return MyControl; + return MyControl; } /******************************************************************************* - $Function: mmibm_ShutDown + $Function: mmibm_ShutDown - $Description: Shutdown routine to deallocate resources ina controlled manner + $Description: Shutdown routine to deallocate resources ina controlled manner - $Returns: none. + $Returns: none. - $Arguments: *BlkHandle, pointer to resource manager handle + $Arguments: *BlkHandle, pointer to resource manager handle *******************************************************************************/ void mmibm_ShutDown( tBlkHandle *BlkHandle ) { - /* Convert and verify the incoming handle - */ - pManagerControl MyControl = (pManagerControl) *BlkHandle; - int i; + /* Convert and verify the incoming handle + */ + pManagerControl MyControl = (pManagerControl) *BlkHandle; + int i; - if ( ValidManagerResource( *BlkHandle ) ) - { - /* Clear down the allocated resource managers - */ - for ( i = 0; i < BLOCK_MANAGER_ENTRY_COUNT; i++ ) - if ( MyControl->RsrcList[i] != NULL ) - mmibr_ShutDown( &MyControl->RsrcList[i] ); + if ( ValidManagerResource( *BlkHandle ) ) + { + /* Clear down the allocated resource managers + */ + for ( i = 0; i < BLOCK_MANAGER_ENTRY_COUNT; i++ ) + if ( MyControl->RsrcList[i] != NULL ) + mmibr_ShutDown( &MyControl->RsrcList[i] ); - /* and free the resource manager handle - */ + /* and free the resource manager handle + */ free( *BlkHandle ); - *BlkHandle = NULL; - } + *BlkHandle = NULL; + } } /******************************************************************************* - $Function: mmibm_SupplyResourceHandler + $Function: mmibm_SupplyResourceHandler $Description: @@ -236,30 +236,30 @@ for each of the resources, we need to be able to supply the appropriate handle for any given type to the calling routine. - $Returns: Handle to requesteb block resource handler, NULL if failure + $Returns: Handle to requesteb block resource handler, NULL if failure - $Arguments: ManagerHandle, handle of the block manager + $Arguments: ManagerHandle, handle of the block manager Id, identifier of the resource table for which the resource - handler is required + handler is required *******************************************************************************/ tBlkHandle mmibm_SupplyResourceHandler( tBlkHandle ManagerHandle, tBlkId Id ) { - /* Convert and verify the incoming handle - */ - pManagerControl MyControl = (pManagerControl) ManagerHandle; - if ( ! ValidManagerResource( ManagerHandle ) ) - return NULL; + /* Convert and verify the incoming handle + */ + pManagerControl MyControl = (pManagerControl) ManagerHandle; + if ( ! ValidManagerResource( ManagerHandle ) ) + return NULL; - /* Verify the id is within the range we expect - */ - if ( ( Id >= 0 ) && ( Id < BLOCK_MANAGER_ENTRY_COUNT ) ) - return MyControl->RsrcList[Id]; + /* Verify the id is within the range we expect + */ + if ( ( Id >= 0 ) && ( Id < BLOCK_MANAGER_ENTRY_COUNT ) ) + return MyControl->RsrcList[Id]; - /* Okay, we have something invalid, so return NULL - */ - return NULL; + /* Okay, we have something invalid, so return NULL + */ + return NULL; } @@ -269,4 +269,3 @@ End of File *******************************************************************************/ -