Compare commits

...

2 commits

Author SHA1 Message Date
DataHoarder 9b391a3ee2 Added several const values, and other static analysis fixes
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-29 03:23:58 +02:00
DataHoarder 1c92f55c6d Added fm_ctext for const char* 2021-10-29 01:05:25 +02:00
13 changed files with 34 additions and 38 deletions

View file

@ -71,11 +71,11 @@ typedef struct _fm_semaphore
} fm_semaphore;
fm_status fmCreateSemaphore(fm_text semName,
fm_status fmCreateSemaphore(fm_ctext semName,
fm_semType semType,
fm_semaphore *semHandle,
fm_int initial);
fm_status fmFindSemaphore(fm_text semName, fm_semaphore *semHandle);
fm_status fmFindSemaphore(fm_ctext semName, fm_semaphore *semHandle);
fm_status fmDeleteSemaphore(fm_semaphore *semHandle);
fm_status fmCaptureSemaphore(fm_semaphore *semHandle, fm_timestamp *timeout);
fm_status fmReleaseSemaphore(fm_semaphore *semHandle);

View file

@ -237,7 +237,7 @@ fm_status fm10000AnGetMaxSpeedAbilityAndMode(fm_int sw,
fm_status fm10000AnGetNextPageExtTechAbilityIndex(fm_int sw,
fm_int port,
fm_uint64 *nextPages,
const fm_uint64 *nextPages,
fm_int numPages,
fm_uint *extTechAbIndex,
fm_text dbgStr);

View file

@ -108,6 +108,7 @@ typedef char fm_char;
/** A pointer to a string of text characters. */
typedef char *fm_text;
typedef const char *fm_ctext;
/** A floating point value */
typedef double fm_float;

View file

@ -254,7 +254,7 @@ fm_status fmAlosSemInit(void)
* \return FM_FAIL if general failure
*
**********************************************************************/
fm_status fmCreateSemaphore(fm_text semName,
fm_status fmCreateSemaphore(fm_ctext semName,
fm_semType semType,
fm_semaphore *semHandle,
fm_int initial)
@ -410,7 +410,7 @@ fm_status fmCreateSemaphore(fm_text semName,
* \return FM_FAIL if sempahore not found
*
**********************************************************************/
fm_status fmFindSemaphore(fm_text semName, fm_semaphore *semHandle)
fm_status fmFindSemaphore(fm_ctext semName, fm_semaphore *semHandle)
{
FM_NOT_USED(semName);
FM_NOT_USED(semHandle);

View file

@ -973,8 +973,8 @@ fm_status fmAddIpAbstractKey(fm_tree * abstractKey,
fm_status fmAddDeepInsAbstractKey(fm_tree * abstractKey,
fm_byte * abstractTable,
fm_byte tableSize,
fm_byte * mask,
fm_byte * value);
const fm_byte * mask,
const fm_byte * value);
fm_status fmFillAbstractPortSetKeyTree(fm_aclErrorReporter * errReport,
fm_aclRule * rule,
@ -987,7 +987,7 @@ fm_status fmFillAbstractKeyTree(fm_int sw,
fm_tree * abstractKey,
fm_tree * portSetId);
fm_int fmCountConditionSliceUsage(fm_byte *muxSelect);
fm_int fmCountConditionSliceUsage(const fm_byte *muxSelect);
void fmInitializeConcreteKey(fm_byte *muxSelect);
fm_status fmConvertAbstractToConcreteKey(fm_tree * abstractKeyTree,
fm_byte * muxSelect,
@ -1026,7 +1026,7 @@ fm_status fmUpdateMasterValid(fm_int sw, fm_fm10000CompiledAcls *cacls);
fm_status fmUpdateBstMasterValid(fm_int sw, fm_fm10000CompiledAcls *cacls);
fm_status fmApplyMapSrcPortId(fm_int sw,
fm_tree * portSetIdTree);
void fmInitializeMuxSelect(fm_byte *srcArray,
void fmInitializeMuxSelect(const fm_byte *srcArray,
fm_byte *dstArray);
fm_status fmSetEaclChunkCfg(fm_int sw,
@ -1874,7 +1874,7 @@ static fm_bool FoundFree8BitsMux(fm_uint64 abstractKey,
*
*****************************************************************************/
static fm_bool FoundExisting8BitsMux(fm_uint64 abstractKey,
fm_byte *muxSelect,
const fm_byte *muxSelect,
fm_uint16 *muxUsed)
{
fm_int i;
@ -3121,8 +3121,8 @@ fm_status fmAddIpAbstractKey(fm_tree * abstractKey,
fm_status fmAddDeepInsAbstractKey(fm_tree * abstractKey,
fm_byte * abstractTable,
fm_byte tableSize,
fm_byte * mask,
fm_byte * value)
const fm_byte * mask,
const fm_byte * value)
{
fm_status err;
fm_int i;
@ -3978,7 +3978,7 @@ fm_status fmFillAbstractKeyTree(fm_int sw,
* \return Number of slices needed.
*
*****************************************************************************/
fm_int fmCountConditionSliceUsage(fm_byte *muxSelect)
fm_int fmCountConditionSliceUsage(const fm_byte *muxSelect)
{
fm_int i;
fm_int j;
@ -5642,7 +5642,7 @@ fm_status fmApplyMapSrcPortId(fm_int sw,
* \return None.
*
*****************************************************************************/
void fmInitializeMuxSelect(fm_byte *srcArray,
void fmInitializeMuxSelect(const fm_byte *srcArray,
fm_byte *dstArray)
{
fm_int i;

View file

@ -105,7 +105,7 @@
*****************************************************************************/
static fm_status FindBestIndex(fm_int sw,
fm_macAddressEntry *entry,
fm_uint16 * indexes,
const fm_uint16 * indexes,
fm_int * bestIndex,
fm_uint32 * dupMask,
fm_bool * ageOld)

View file

@ -1623,7 +1623,7 @@ ABORT:
*****************************************************************************/
fm_status fm10000AnGetNextPageExtTechAbilityIndex(fm_int sw,
fm_int port,
fm_uint64 *nextPages,
const fm_uint64 *nextPages,
fm_int numPages,
fm_uint *extTechAbIndex,
fm_text dbgStr)

View file

@ -1607,6 +1607,8 @@ static fm_text fm10000SmTypeStr(fm_int type)
return "STUB";
case FM10000_BASIC_SERDES_DFE_STATE_MACHINE:
return "DFE";
default:
return "UNKN";
}
return "UNKN";

View file

@ -547,8 +547,8 @@ static fm_bool RemoveSliceFromRoute(fm_int sw,
fm_bool updateHardware);
static fm_int ComparePrefixRoutes(const void *pFirstRoute,
const void *pSecondRoute);
static fm_int ComparePrefix(const void *first,
const void *second);
static fm_int ComparePrefix(const void *pFirstPrefix,
const void *pSecondPrefix);
static void InsertTcamRouteCallback(const void *pKey,
void * pValue,
const void *pPrevKey,
@ -676,7 +676,7 @@ static fm_bool UpdateTcamSliceRow(fm_int sw,
fm10000_RoutingState * pStateTable,
fm10000_RouteSlice * pSlice,
fm_int row,
fm10000_TcamRouteEntry *pRouteEntry);
fm10000_TcamRouteEntry *pRouteTcamEntry);
static void UpdateTcamSliceRowInfoAfterRemoveRoute(fm_int sw,
fm10000_RouteSlice * pOldSlice,
fm_int oldRow,
@ -757,18 +757,11 @@ static fm_bool FindEmptyRowInSliceWithinSliceRange(fm_int sw,
fm10000_RouteSlice * pCurSlice,
fm_int * pDestRow,
fm_int * pUnauthRow);
static fm_bool MoveFirstRowDownWithinPrefix(fm_int sw,
fm10000_RoutingTable *pRouteTable,
fm10000_RoutePrefix * pRoutePrefix,
fm_bool unauthSliceOK,
fm_bool optimize);
static fm_bool MoveRouteElsewhereWithinPrefix(fm_int sw,
fm10000_RoutingTable * routeTable,
fm10000_TcamRouteEntry *route,
fm_bool unauthSliceOK,
fm_bool optimize);
static fm_int ComparePrefix(const void *pFirstPrefix,
const void *pSecondPrefix);
static fm_bool InvalidateRouteSliceRow(fm_int sw,
fm10000_RouteSlice *pRouteSlice,
fm_int row);

View file

@ -752,11 +752,11 @@ static fm_status DbgDumpSchedulerConfig(fm_int sw, fm_int active, fm_bool dumpQP
fm_int preReservedTotal;
fm_int preReserved;
const fm_text scheduleFormat = "%-5d %-4d %-4d %-4s %-4s %6d\n";
const fm_text scheduleFormatIdle = "%-5d %-4s %-4s %-4s %-4s %6s\n";
const fm_text speedStatFormat = "%6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
const fm_text qpcStatFormat = "%6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
const fm_text portStatFormat = "%-4d %6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
fm_ctext scheduleFormat = "%-5d %-4d %-4d %-4s %-4s %6d\n";
fm_ctext scheduleFormatIdle = "%-5d %-4s %-4s %-4s %-4s %6s\n";
fm_ctext speedStatFormat = "%6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
fm_ctext qpcStatFormat = "%6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
fm_ctext portStatFormat = "%-4d %6d %-4d %-5d %-5d %-3d(%-3d) %-3d(%-3d) %-6.2f %-6d\n";
FM_LOG_ENTRY(FM_LOG_CAT_SWITCH, "sw = %d\n", sw);

View file

@ -381,7 +381,7 @@ static void CopyTlvStr(fm_text dest, fm_int destSize, fm_byte *src, fm_int srcSi
* \return Integer equivalent of the TLV bytes.
*
*****************************************************************************/
static fm_int GetTlvInt(fm_byte *tlv, fm_int tlvLen)
static fm_int GetTlvInt(const fm_byte *tlv, fm_int tlvLen)
{
fm_int j;
fm_int value;
@ -418,7 +418,7 @@ static fm_int GetTlvInt(fm_byte *tlv, fm_int tlvLen)
* \return Unsigned integer equivalent of the TLV bytes.
*
*****************************************************************************/
static fm_uint64 GetTlvUint64(fm_byte *tlv, fm_int tlvLen)
static fm_uint64 GetTlvUint64(const fm_byte *tlv, fm_int tlvLen)
{
fm_int j;
fm_uint64 value;
@ -453,7 +453,7 @@ static fm_uint64 GetTlvUint64(fm_byte *tlv, fm_int tlvLen)
* \return Integer equivalent of the TLV bytes.
*
*****************************************************************************/
static fm_bool GetTlvBool(fm_byte *tlv)
static fm_bool GetTlvBool(const fm_byte *tlv)
{
return ((*tlv) ? TRUE : FALSE);

View file

@ -1807,7 +1807,7 @@ void CopyTlvStr(fm_text dest, fm_int destSize, fm_byte *src, fm_int srcSize)
* \return Integer equivalent of the TLV bytes.
*
*****************************************************************************/
static fm_int GetTlvInt(fm_byte *tlv, fm_int tlvLen)
static fm_int GetTlvInt(const fm_byte *tlv, fm_int tlvLen)
{
fm_int j;
fm_int value;
@ -1842,7 +1842,7 @@ static fm_int GetTlvInt(fm_byte *tlv, fm_int tlvLen)
* \return Integer equivalent of the TLV bytes.
*
*****************************************************************************/
static fm_bool GetTlvBool(fm_byte *tlv)
static fm_bool GetTlvBool(const fm_byte *tlv)
{
return ((*tlv) ? TRUE : FALSE);

View file

@ -1823,7 +1823,7 @@ static fm_status GetStringValueU64(fm_text name,
* failure.
*
*****************************************************************************/
static fm_status GetTlvValue(fm_byte *tlv,
static fm_status GetTlvValue(const fm_byte *tlv,
fm_int tlvLen,
fm_int * value)
{
@ -1865,7 +1865,7 @@ static fm_status GetTlvValue(fm_byte *tlv,
* failure.
*
*****************************************************************************/
static fm_status GetTlvValueU64(fm_byte * tlv,
static fm_status GetTlvValueU64(const fm_byte * tlv,
fm_int tlvLen,
fm_uint64 *value)
{