Skip to content

Commit 20e09aa

Browse files
committed
Fix formatting
1 parent de7bdb6 commit 20e09aa

File tree

7 files changed

+136
-119
lines changed

7 files changed

+136
-119
lines changed

source/FreeRTOS_DHCP.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
211211
int32_t lBytes;
212212
struct freertos_sockaddr xSourceAddress;
213213
BaseType_t xFristIter = pdTRUE;
214-
215-
memset(&xSourceAddress, 0, sizeof(xSourceAddress));
214+
215+
memset( &xSourceAddress, 0, sizeof( xSourceAddress ) );
216216

217217
while( EP_DHCPData.xDHCPSocket != NULL )
218218
{
@@ -242,7 +242,7 @@
242242

243243
if( xFristIter == pdTRUE )
244244
{
245-
memcpy(&xSourceAddress, &xSourceAddressCurrent, xSourceAddressCurrentLength);
245+
memcpy( &xSourceAddress, &xSourceAddressCurrent, xSourceAddressCurrentLength );
246246
xFristIter = pdFALSE;
247247
}
248248

@@ -260,9 +260,9 @@
260260
/* Find the end-point with given transaction ID and verify DHCP server address. */
261261
while( pxIterator != NULL )
262262
{
263-
if( (pxDHCPMessage->ulTransactionID == FreeRTOS_htonl( pxIterator->xDHCPData.ulTransactionId )) &&
264-
((xSourceAddress.sin_address.ulIP_IPv4 == xSourceAddressCurrent.sin_address.ulIP_IPv4) &&
265-
(xSourceAddress.sin_port == xSourceAddressCurrent.sin_port)))
263+
if( ( pxDHCPMessage->ulTransactionID == FreeRTOS_htonl( pxIterator->xDHCPData.ulTransactionId ) ) &&
264+
( ( xSourceAddress.sin_address.ulIP_IPv4 == xSourceAddressCurrent.sin_address.ulIP_IPv4 ) &&
265+
( xSourceAddress.sin_port == xSourceAddressCurrent.sin_port ) ) )
266266
{
267267
break;
268268
}

source/FreeRTOS_DHCPv6.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void vDHCPv6Process( BaseType_t xReset,
424424
struct freertos_sockaddr xSourceAddress;
425425
BaseType_t xFristIter = pdTRUE;
426426

427-
memset(&xSourceAddress, 0, sizeof(xSourceAddress));
427+
memset( &xSourceAddress, 0, sizeof( xSourceAddress ) );
428428

429429
for( ; ; )
430430
{
@@ -444,7 +444,7 @@ void vDHCPv6Process( BaseType_t xReset,
444444
FreeRTOS_printf( ( "vDHCPProcess: FreeRTOS_recvfrom returns %d\n", ( int ) lBytes ) );
445445
}
446446

447-
if((lBytes == 0) && (pucUDPPayload != NULL))
447+
if( ( lBytes == 0 ) && ( pucUDPPayload != NULL ) )
448448
{
449449
FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayload );
450450
}
@@ -454,15 +454,15 @@ void vDHCPv6Process( BaseType_t xReset,
454454

455455
if( xFristIter == pdTRUE )
456456
{
457-
memcpy(&xSourceAddress, &xSourceAddressCurrent, sizeof(xSourceAddress));
457+
memcpy( &xSourceAddress, &xSourceAddressCurrent, sizeof( xSourceAddress ) );
458458
xFristIter = pdFALSE;
459459
}
460460

461461
/* Verify DHCPv6 server address. */
462-
if((memcmp(&(xSourceAddress.sin_address.xIP_IPv6.ucBytes), \
463-
&(xSourceAddressCurrent.sin_address.xIP_IPv6.ucBytes), \
464-
sizeof(xSourceAddressCurrent.sin_address.xIP_IPv6.ucBytes) ) == 0) &&
465-
(xSourceAddress.sin_port == xSourceAddressCurrent.sin_port))
462+
if( ( memcmp( &( xSourceAddress.sin_address.xIP_IPv6.ucBytes ), \
463+
&( xSourceAddressCurrent.sin_address.xIP_IPv6.ucBytes ), \
464+
sizeof( xSourceAddressCurrent.sin_address.xIP_IPv6.ucBytes ) ) == 0 ) &&
465+
( xSourceAddress.sin_port == xSourceAddressCurrent.sin_port ) )
466466
{
467467
uxLength = ( size_t ) lBytes;
468468

test/cbmc/proofs/DHCPv6/DHCPv6Process/DHCPv6Process_harness.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,14 @@ int32_t FreeRTOS_recvfrom( Socket_t xSocket,
153153
return retVal;
154154
}
155155

156-
/* For the purpose of this proof we stub the
156+
/* For the purpose of this proof we stub the
157157
* implementation of FreeRTOS_ReleaseUDPPayloadBuffer here, but make sure that
158158
* the pvBuffer is not NULL, its not verified here if the pointer is a valid
159159
* payload buffer as its proved in other proofs */
160160
void FreeRTOS_ReleaseUDPPayloadBuffer( void * pvBuffer )
161161
{
162162
__CPROVER_assert( pvBuffer != NULL,
163163
"FreeRTOS precondition: pvBuffer != NULL" );
164-
165164
}
166165

167166
void harness()

test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_stubs.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ static int32_t FreeRTOS_recvfrom_ResetAndIncorrectStateWithSocketAlreadyCreated_
348348
*( ( uint8_t ** ) pvBuffer ) = pucUDPBuffer;
349349
}
350350

351-
if(pxSourceAddress != NULL)
351+
if( pxSourceAddress != NULL )
352352
{
353-
memcpy(pxSourceAddress, &xSourceAddress, sizeof(xSourceAddress));
353+
memcpy( pxSourceAddress, &xSourceAddress, sizeof( xSourceAddress ) );
354354
}
355355

356-
if(pxSourceAddressLength != NULL)
356+
if( pxSourceAddressLength != NULL )
357357
{
358-
*pxSourceAddressLength = sizeof(xSourceAddress);
358+
*pxSourceAddressLength = sizeof( xSourceAddress );
359359
}
360360

361361
memset( pucUDPBuffer, 0, xSizeofUDPBuffer );
@@ -368,21 +368,21 @@ static int32_t FreeRTOS_recvfrom_ResetAndIncorrectStateWithSocketAlreadyCreated_
368368
}
369369

370370
static int32_t FreeRTOS_recvfrom_LoopedCall( const ConstSocket_t xSocket,
371-
void * pvBuffer,
372-
size_t uxBufferLength,
373-
BaseType_t xFlags,
374-
struct freertos_sockaddr * pxSourceAddress,
375-
socklen_t * pxSourceAddressLength,
376-
int callbacks )
371+
void * pvBuffer,
372+
size_t uxBufferLength,
373+
BaseType_t xFlags,
374+
struct freertos_sockaddr * pxSourceAddress,
375+
socklen_t * pxSourceAddressLength,
376+
int callbacks )
377377
{
378378
NetworkEndPoint_t * pxIterator = pxNetworkEndPoints;
379379
size_t xSizeRetBufferSize = xSizeofUDPBuffer;
380380

381-
if(callbacks == 2)
381+
if( callbacks == 2 )
382382
{
383383
pxNetworkEndPoints->xDHCPData.eDHCPState = eInitialWait;
384384
}
385-
else if(callbacks == 4)
385+
else if( callbacks == 4 )
386386
{
387387
xSizeRetBufferSize = 200;
388388
}
@@ -392,18 +392,19 @@ static int32_t FreeRTOS_recvfrom_LoopedCall( const ConstSocket_t xSocket,
392392
*( ( uint8_t ** ) pvBuffer ) = pucUDPBuffer;
393393
}
394394

395-
if(pxSourceAddress != NULL)
395+
if( pxSourceAddress != NULL )
396396
{
397-
if(callbacks == 2)
397+
if( callbacks == 2 )
398398
{
399399
xSourceAddress2.sin_port = 6060;
400400
}
401-
memcpy(pxSourceAddress, &xSourceAddress2, sizeof(xSourceAddress2));
401+
402+
memcpy( pxSourceAddress, &xSourceAddress2, sizeof( xSourceAddress2 ) );
402403
}
403404

404-
if(pxSourceAddressLength != NULL)
405+
if( pxSourceAddressLength != NULL )
405406
{
406-
*pxSourceAddressLength = sizeof(xSourceAddress2);
407+
*pxSourceAddressLength = sizeof( xSourceAddress2 );
407408
}
408409

409410
memset( pucUDPBuffer, 0, xSizeofUDPBuffer );

0 commit comments

Comments
 (0)