diff options
author | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | 2010-10-01 14:32:27 -0700 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | 2010-10-02 00:28:23 -0700 |
commit | 5b04cc2727667fbd4ed5b69776eb92b716d64734 (patch) | |
tree | 3757bb64d130d5d3ccf9309dca48e0117ac49262 | |
parent | 2dbe72ffede51a5fde325eccdbeaece74f0d122c (diff) |
cleanup: remove more warnings caused by static declarations
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
5 files changed, 50 insertions, 38 deletions
diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.c b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.c index 9832f1c..dda59e4 100644 --- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.c +++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.c @@ -315,21 +315,21 @@ ScannerState L4S_GetScannerState() // set the scanner to a new state void L4S_SetScannerState(ScannerState state) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetState = %s", ScannerStateStr[state]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetState = %s", ScannerStateStr(state)); FSM_SetState(&g_l4ScannerContext.fsm, state); } // set the scanner to a new state ONLY if its current state is equal to the source state parameter BOOL L4S_SetScannerStateIfEqual(ScannerState sourceState, ScannerState targetState) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetStateIfEqual - source = %s, target = %s", ScannerStateStr[sourceState], ScannerStateStr[targetState]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetStateIfEqual - source = %s, target = %s", ScannerStateStr(sourceState), ScannerStateStr(targetState)); return FSM_SetStateIfEqual(&g_l4ScannerContext.fsm, sourceState, targetState); } // set the scanner to a new state ONLY if its current state is NOT equal to the source state parameter BOOL L4S_SetScannerStateIfNotEqual(ScannerState sourceState, ScannerState targetState) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetStateIfNotEqual - source = %s, target = %s", ScannerStateStr[sourceState], ScannerStateStr[targetState]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_INFO, "L4 Scanner: SetStateIfNotEqual - source = %s, target = %s", ScannerStateStr(sourceState), ScannerStateStr(targetState)); return FSM_SetStateIfNotEqual(&g_l4ScannerContext.fsm, sourceState, targetState); } @@ -919,7 +919,7 @@ void L4S_StopRollBackScanner() { TRACE(TR_MOD_NDNS_AGENT, TR_SEV_DEBUG, "L4S_StopRollBackScanner(IN) Scanner state=%s.", - ScannerStateStr[L4S_GetScannerState()]); + ScannerStateStr(L4S_GetScannerState())); // scanner is stopped. no need for system update anymore wmx_UnregisterSystemStateUpdateCB(&HandleSystemState); diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.h b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.h index 1c32ae2..36bf158 100644 --- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.h +++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4Scanner/NDnS_L4Scanner.h @@ -52,13 +52,19 @@ typedef enum _ScannerState L4S_TRANSIENT // a special state that represents a "between states" state } ScannerState; -static char* ScannerStateStr[] = { - "L4S_READY", - "L4S_SCANNING", - "L4S_DISCOVER", - "L4S_DISCONNECT", - "L4S_STANDBY", - "L4S_TRANSIENT" +static inline +const char *ScannerStateStr(unsigned index) +{ + static const char* strs[] = { + "L4S_READY", + "L4S_SCANNING", + "L4S_DISCOVER", + "L4S_DISCONNECT", + "L4S_STANDBY", + "L4S_TRANSIENT" + }; + static const unsigned index_max = sizeof(strs) / sizeof(strs[0]); + return index < index_max? strs[index] : "Illegal"; }; // TODO: Oran - merge with Sivanne's version (L4P) @@ -166,4 +172,4 @@ void L4S_BsInfoUpdate(wmx_pBsInfo_t bsInfo); void L4S_SIIUpdate(wmx_pSII_t sii); void L4S_StopRollBackScanner(); -#endif // _NDNS_L4_SCANNER_H
\ No newline at end of file +#endif // _NDNS_L4_SCANNER_H diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent.c b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent.c index d789cf1..94414b8 100644 --- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent.c +++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent.c @@ -1207,7 +1207,7 @@ wmx_Status_t L4C_HandleReadyState(wmx_pSystemStateUpdate systemStateUpdate, BOOL while (!isHandled) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "Executing the current scheduled task: <%s>", L4C_TaskStr[g_ndnsContext.scheduledTask]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "Executing the current scheduled task: <%s>", L4C_TaskStr(g_ndnsContext.scheduledTask)); L4db_SetSwRfState(On); wmx_InternalRfOn(); @@ -3395,7 +3395,7 @@ void L4C_TaskHandler(UINT32 internalRequestID, void *buffer, UINT32 bufferLength systemState = g_ndnsContext.systemState; OSAL_exit_critical_section(&g_ndnsContext.lockSystemState); - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "L4C_TaskHandler(IN): Got '%s' task", L4C_TaskStr[internalRequestID]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "L4C_TaskHandler(IN): Got '%s' task", L4C_TaskStr(internalRequestID)); switch (internalRequestID) { @@ -3424,7 +3424,7 @@ void L4C_TaskHandler(UINT32 internalRequestID, void *buffer, UINT32 bufferLength TRACE(TR_MOD_NDNS_AGENT, TR_SEV_DEBUG, "State is not ready or scanner is stil scanning: system state=%s, scanner state=%s", NDnSSystemStates(systemState), - ScannerStateStr[L4S_GetScannerState()]); + ScannerStateStr(L4S_GetScannerState())); L4C_ScheduleTask(Task_StartManualScan); // start Connect on the next Ready state } break; @@ -3542,7 +3542,7 @@ wmx_Status_t NDnSAgent_SetConnectModePhase2() g_ndnsContext.scheduledTaskData.connectInfo.forceManualConnect = TRUE; g_ndnsContext.scheduledTaskData.connectInfo.nspIDs[0] = currentPreferredNsp.nspIDs[j]; - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_SetConnectModePhase2 - scheduling the task '%s' for the next Ready state", L4C_TaskStr[Task_AutoConnect]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_SetConnectModePhase2 - scheduling the task '%s' for the next Ready state", L4C_TaskStr(Task_AutoConnect)); //NDnSAgent_OnProgressDualFlush(Task_AutoConnect, NULL); L4C_ScheduleTask(Task_AutoConnect); OSAL_enter_critical_section(&g_ndnsContext.lockSystemState); @@ -4481,11 +4481,11 @@ wmx_Status_t NDnSAgent_InvokeDualFlushOp(L4C_Task task, void * paramsBuf, UINT32 Messenger_PostRequest(MEDIUM, task, paramsBuf, bufSize, &L4C_TaskHandler); - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "Task '%s' was scheduled for the L4C_TaskHandler", L4C_TaskStr[task]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "Task '%s' was scheduled for the L4C_TaskHandler", L4C_TaskStr(task)); if (OSAL_wait_event(g_ndnsContext.dualFlushOpEvent, L4C_TIMEOUT * 2) != WAIT_OBJECT_0) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_ERR, "Timout - task '%s' execution is too long (more than %d sec)", L4C_TaskStr[task], (L4C_TIMEOUT * 2 / 1000)); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_ERR, "Timout - task '%s' execution is too long (more than %d sec)", L4C_TaskStr(task), (L4C_TIMEOUT * 2 / 1000)); L4C_ScheduleTask(Task_StartScan); // reset the scheduler back to normal scan L4S_EnableScanner(TRUE); status = WMX_ST_FAIL; @@ -4503,7 +4503,7 @@ void NDnSAgent_OnProgressDualFlush(L4C_Task task, DualFlushOp ExecuteTask, UINT3 { wmx_SystemState_t systemState; - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush(IN) - task: '%s'", L4C_TaskStr[task]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush(IN) - task: '%s'", L4C_TaskStr(task)); // get the current system state OSAL_enter_critical_section(&g_ndnsContext.lockSystemState); systemState = g_ndnsContext.systemState; @@ -4521,7 +4521,7 @@ void NDnSAgent_OnProgressDualFlush(L4C_Task task, DualFlushOp ExecuteTask, UINT3 // (even if we are in Ready state - there could be a pending Scanning state indication from a previous scan) if ((systemState == Ready) && (!L4S_IsScanning())) { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - executing the task: '%s'", L4C_TaskStr[task]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - executing the task: '%s'", L4C_TaskStr(task)); // in case the scanner is active (and NOT scanning) - it means that // it is sleeping (LinkLoss / Standby state) - so we need to reset it if (L4S_READY != L4S_GetScannerState()) @@ -4542,13 +4542,13 @@ void NDnSAgent_OnProgressDualFlush(L4C_Task task, DualFlushOp ExecuteTask, UINT3 g_ndnsContext.scheduledTaskData.status = WMX_ST_OK; } - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - task: '%s' executed", L4C_TaskStr[task]); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - task: '%s' executed", L4C_TaskStr(task)); //Set Event to release the thread that is waiting for the answer (NDnSAgent_InvokeDualFlushOp()) OSAL_set_event(g_ndnsContext.dualFlushOpEvent); } else { - TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - scheduling the task '%s' for the next Ready state (current state=%s)", L4C_TaskStr[task], NDnSSystemStates(systemState)); + TRACE(TR_MOD_NDNS_AGENT, TR_SEV_NOTICE, "NDnSAgent_OnProgressDualFlush - scheduling the task '%s' for the next Ready state (current state=%s)", L4C_TaskStr(task), NDnSSystemStates(systemState)); // we are still not in Ready state - schedule the Connect task to be executed // only when getting to Ready state L4C_ScheduleTask(task); // start the task on the next Ready state diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h index bb1ed2d..e247d28 100644 --- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h +++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/Source/NDnSAgent_Internals.h @@ -105,14 +105,20 @@ typedef enum _L4C_Task Task_SetConnectMode } L4C_Task; -static char* L4C_TaskStr[] = { - "Start Scan", - "Start Manual Scan", - "Connect", - "Auto Connect", - "Reset", - "Stop Scan", - "Set Connect Mode" +static inline +const char* L4C_TaskStr(unsigned index) +{ + static const char *strs[] = { + "Start Scan", + "Start Manual Scan", + "Connect", + "Auto Connect", + "Reset", + "Stop Scan", + "Set Connect Mode" + }; + static const unsigned index_max = sizeof(strs) / sizeof(strs[0]); + return index < index_max? strs[index] : "Illegal"; }; typedef enum _L4C_ScanMode @@ -277,4 +283,4 @@ BOOL Ndns_GetLastConnectedState(); void l4db_CopyNapID(wmx_NAPid_t srcNapID, wmx_pNAPid_t pDstNapID); -#endif //_NDNS_AGENT_INTERNALS_Hchar
\ No newline at end of file +#endif //_NDNS_AGENT_INTERNALS_Hchar diff --git a/InfraStack/OSAgnostic/WiMax/Wrappers/Apdo/wmxSDK_Apdo_Internals.h b/InfraStack/OSAgnostic/WiMax/Wrappers/Apdo/wmxSDK_Apdo_Internals.h index 9a07ba3..e79e1b2 100644 --- a/InfraStack/OSAgnostic/WiMax/Wrappers/Apdo/wmxSDK_Apdo_Internals.h +++ b/InfraStack/OSAgnostic/WiMax/Wrappers/Apdo/wmxSDK_Apdo_Internals.h @@ -137,7 +137,7 @@ typedef struct _wmxApdo_FunctionParamStruct // Following binary data is for the simulated bootstrap // header "...j.-//SYNCML//DTD SyncML 1.1//ENmlq.1.2..r.DM/1.2"... -static UINT8 bootstrapHeader[] = {0x02, 0x00, 0x00, 0x6a, 0x1d, 0x2d, 0x2f, 0x2f, +static const UINT8 bootstrapHeader[] = {0x02, 0x00, 0x00, 0x6a, 0x1d, 0x2d, 0x2f, 0x2f, 0x53, 0x59, 0x4e, 0x43, 0x4d, 0x4c, 0x2f, 0x2f, 0x44, 0x54, 0x44, 0x20, 0x53, 0x79, 0x6e, 0x63, 0x4d, 0x4c, 0x20, 0x31, 0x2e, 0x31, 0x2f, 0x2f, @@ -147,22 +147,22 @@ static UINT8 bootstrapHeader[] = {0x02, 0x00, 0x00, 0x6a, 0x1d, 0x2d, 0x2f, 0x2f 0x00, 0x01, 0x5b, 0x03, 0x30, 0x00, 0x01, 0x6e, 0x57, 0x03}; #define BOOTSTRAP_HEADER_SIZE 66 -static UINT8 bootstrapDevIdSuffix[] = {0x00, 0x01, 0x01, 0x67, 0x57, 0x03}; +static const UINT8 bootstrapDevIdSuffix[] = {0x00, 0x01, 0x01, 0x67, 0x57, 0x03}; #define BOOTSTRAP_DEV_ID_SUFFIX_SIZE 6 -static UINT8 bootstrapServerUrlSuffix[] = {0x00, 0x01, 0x01, 0x01, 0x6b, 0x45, 0x4b, 0x03, +static const UINT8 bootstrapServerUrlSuffix[] = {0x00, 0x01, 0x01, 0x01, 0x6b, 0x45, 0x4b, 0x03, 0x31, 0x00, 0x01, 0x54, 0x6e, 0x57, 0x03, 0x2e}; #define BOOTSTRAP_SERVER_URL_SUFFIX_SIZE 16 #define DMACC_PATH "/DMAcc/" #define DMACC_PATH_SIZE 7 -static UINT8 bootstrapNodeDesc[] = {0x00, 0x01, 0x01, 0x5a, 0x00, 0x01, 0x47, 0x03, +static const UINT8 bootstrapNodeDesc[] = {0x00, 0x01, 0x01, 0x5a, 0x00, 0x01, 0x47, 0x03, 0x6e, 0x6f, 0x64, 0x65, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x54, 0x6e, 0x57, 0x03, 0x2e}; #define BOOTSTRAP_NODE_DESC_SIZE 23 #define APP_ID_PATH "/AppID" #define APP_ID_PATH_SIZE 6 -static UINT8 bootstrapLeafPrefix[] = {0x00, 0x01, 0x01, 0x4f, 0x03}; +static const UINT8 bootstrapLeafPrefix[] = {0x00, 0x01, 0x01, 0x4f, 0x03}; #define BOOTSTRAP_LEAF_PREFIX_SIZE 5 -static UINT8 bootstrapLeafSuffix[] = {0x00, 0x01, 0x01, 0x54, 0x6e, 0x57, 0x03, 0x2e}; +static const UINT8 bootstrapLeafSuffix[] = {0x00, 0x01, 0x01, 0x54, 0x6e, 0x57, 0x03, 0x2e}; #define BOOTSTRAP_LEAF_SUFFIX_SIZE 8 #define SERVER_ID_PATH "/ServerID" #define SERVER_ID_PATH_SIZE 9 @@ -176,7 +176,7 @@ static UINT8 bootstrapLeafSuffix[] = {0x00, 0x01, 0x01, 0x54, 0x6e, 0x57, 0x03, #define TOCONREF_PATH_SIZE 9 -static UINT8 bootstrapEnd[] = {0x2f, 0x44, 0x4d, 0x41, 0x63, 0x63, 0x2f, 0x78, 0x6f, 0x68, +static const UINT8 bootstrapEnd[] = {0x2f, 0x44, 0x4d, 0x41, 0x63, 0x63, 0x2f, 0x78, 0x6f, 0x68, 0x6d, 0x2f, 0x45, 0x78, 0x74, 0x00, 0x01, 0x01, 0x5a, 0x00, 0x01, 0x47, 0x03, 0x6e, 0x6f, 0x64, 0x65, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x12, 0x01, 0x01}; |