Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark fBuffer content const #1603

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static void ProcessMacCommands( uint8_t* payload, uint8_t macIndex, uint8_t comm
* \param [IN] fBufferSize MAC data buffer size
* \retval status Status of the operation.
*/
LoRaMacStatus_t Send( LoRaMacHeader_t* macHdr, uint8_t fPort, void* fBuffer, uint16_t fBufferSize );
LoRaMacStatus_t Send( LoRaMacHeader_t* macHdr, uint8_t fPort, const void* fBuffer, uint16_t fBufferSize );

/*!
* \brief LoRaMAC layer send join/rejoin request
Expand All @@ -457,7 +457,7 @@ LoRaMacStatus_t SendReJoinReq( JoinReqIdentifier_t joinReqType );
* \param [IN] fBufferSize MAC data buffer size
* \retval status Status of the operation.
*/
LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl, uint8_t fPort, void* fBuffer, uint16_t fBufferSize );
LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl, uint8_t fPort, const void* fBuffer, uint16_t fBufferSize );

/*
* \brief Schedules the frame according to the duty cycle
Expand Down Expand Up @@ -2672,7 +2672,7 @@ static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t comm
}
}

LoRaMacStatus_t Send( LoRaMacHeader_t* macHdr, uint8_t fPort, void* fBuffer, uint16_t fBufferSize )
LoRaMacStatus_t Send( LoRaMacHeader_t* macHdr, uint8_t fPort, const void* fBuffer, uint16_t fBufferSize )
{
LoRaMacFrameCtrl_t fCtrl;
LoRaMacStatus_t status = LORAMAC_STATUS_PARAMETER_INVALID;
Expand Down Expand Up @@ -3291,7 +3291,7 @@ static void OpenContinuousRxCWindow( void )
}
}

LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl, uint8_t fPort, void* fBuffer, uint16_t fBufferSize )
LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl, uint8_t fPort, const void* fBuffer, uint16_t fBufferSize )
{
MacCtx.PktBufferLen = 0;
MacCtx.NodeAckRequested = false;
Expand All @@ -3304,7 +3304,7 @@ LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl
fBufferSize = 0;
}

memcpy1( MacCtx.AppData, ( uint8_t* ) fBuffer, fBufferSize );
memcpy1( MacCtx.AppData, ( const uint8_t* ) fBuffer, fBufferSize );
MacCtx.AppDataSize = fBufferSize;
MacCtx.PktBuffer[0] = macHdr->Value;

Expand Down Expand Up @@ -3385,7 +3385,7 @@ LoRaMacStatus_t PrepareFrame( LoRaMacHeader_t* macHdr, LoRaMacFrameCtrl_t* fCtrl
case FRAME_TYPE_PROPRIETARY:
if( ( fBuffer != NULL ) && ( MacCtx.AppDataSize > 0 ) )
{
memcpy1( MacCtx.PktBuffer + LORAMAC_MHDR_FIELD_SIZE, ( uint8_t* ) fBuffer, MacCtx.AppDataSize );
memcpy1( MacCtx.PktBuffer + LORAMAC_MHDR_FIELD_SIZE, ( const uint8_t* ) fBuffer, MacCtx.AppDataSize );
MacCtx.PktBufferLen = LORAMAC_MHDR_FIELD_SIZE + MacCtx.AppDataSize;
}
break;
Expand Down Expand Up @@ -5485,7 +5485,7 @@ LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t* mcpsRequest )
LoRaMacHeader_t macHdr;
VerifyParams_t verify;
uint8_t fPort = 0;
void* fBuffer;
const void* fBuffer;
uint16_t fBufferSize;
int8_t datarate = DR_0;
bool readyToSend = false;
Expand Down
6 changes: 3 additions & 3 deletions src/mac/LoRaMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ typedef struct sMcpsReqUnconfirmed
/*!
* Pointer to the buffer of the frame payload
*/
void* fBuffer;
const void* fBuffer;
/*!
* Size of the frame payload
*/
Expand All @@ -895,7 +895,7 @@ typedef struct sMcpsReqConfirmed
/*!
* Pointer to the buffer of the frame payload
*/
void* fBuffer;
const void* fBuffer;
/*!
* Size of the frame payload
*/
Expand All @@ -914,7 +914,7 @@ typedef struct sMcpsReqProprietary
/*!
* Pointer to the buffer of the frame payload
*/
void* fBuffer;
const void* fBuffer;
/*!
* Size of the frame payload
*/
Expand Down