- code format update in mms_server_common.c and additional NULL check after memory allocation

v1.6
Michael Zillgith 1 month ago
parent a4c750820b
commit 3a9833bad1

@ -46,10 +46,12 @@ mmsServer_createConfirmedResponse(uint32_t invokeId)
{ {
MmsPdu_t* mmsPdu = (MmsPdu_t*)GLOBAL_CALLOC(1, sizeof(MmsPdu_t)); MmsPdu_t* mmsPdu = (MmsPdu_t*)GLOBAL_CALLOC(1, sizeof(MmsPdu_t));
if (mmsPdu)
{
mmsPdu->present = MmsPdu_PR_confirmedResponsePdu; mmsPdu->present = MmsPdu_PR_confirmedResponsePdu;
asn_long2INTEGER(&(mmsPdu->choice.confirmedResponsePdu.invokeID), asn_long2INTEGER(&(mmsPdu->choice.confirmedResponsePdu.invokeID), invokeId);
invokeId); }
return mmsPdu; return mmsPdu;
} }
@ -57,8 +59,8 @@ mmsServer_createConfirmedResponse(uint32_t invokeId)
static void static void
mapErrorTypeToErrorClass(MmsError errorType, uint8_t* tag, uint8_t* value) mapErrorTypeToErrorClass(MmsError errorType, uint8_t* tag, uint8_t* value)
{ {
switch (errorType) { switch (errorType)
{
case MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED: case MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED:
*tag = 0x87; /* access */ *tag = 0x87; /* access */
*value = 1; *value = 1;
@ -361,24 +363,21 @@ exit_function:
int int
mmsServer_getLowIndex(AlternateAccess_t* alternateAccess) mmsServer_getLowIndex(AlternateAccess_t* alternateAccess)
{ {
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present ==
== AlternateAccessSelection__selectAccess_PR_index) AlternateAccessSelection__selectAccess_PR_index)
{ {
long index; long index;
asn_INTEGER2long( asn_INTEGER2long(&alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.choice.index, &index);
&alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.choice.index,
&index);
return (int)index; return (int)index;
} }
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present ==
== AlternateAccessSelection__selectAccess_PR_indexRange) AlternateAccessSelection__selectAccess_PR_indexRange)
{ {
long index; long index;
asn_INTEGER2long( asn_INTEGER2long(
&alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.choice.indexRange.lowIndex, &alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.choice.indexRange.lowIndex, &index);
&index);
return (int)index; return (int)index;
} }
@ -389,8 +388,8 @@ mmsServer_getLowIndex(AlternateAccess_t* alternateAccess)
int int
mmsServer_getNumberOfElements(AlternateAccess_t* alternateAccess) mmsServer_getNumberOfElements(AlternateAccess_t* alternateAccess)
{ {
if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present if (alternateAccess->list.array[0]->choice.unnamed->choice.selectAccess.present ==
== AlternateAccessSelection__selectAccess_PR_indexRange) AlternateAccessSelection__selectAccess_PR_indexRange)
{ {
long number; long number;

Loading…
Cancel
Save