mirror of
https://github.com/FreeRTOS/Lab-Project-FreeRTOS-FAT.git
synced 2025-10-17 07:21:22 +08:00
Call memcpy to copy a struct (#25)
* Call memcpy to copy a struct * Insert 2 filler bytes to get better alignment. * Sorry, typo * Call sizeof with brackets - 1 Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> * Call sizeof with brackets - 2 Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Hein Tibosch <hein@htibosch.net> Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
This commit is contained in:
10
ff_stdio.c
10
ff_stdio.c
@@ -1489,8 +1489,14 @@ int ff_findnext( FF_FindData_t * pxFindData )
|
||||
pxFindData->xDirectoryEntry.xCreateTime.Hour = ( uint16_t ) xTimeStruct.tm_hour; /* Hour (0 - 23). */
|
||||
pxFindData->xDirectoryEntry.xCreateTime.Minute = ( uint16_t ) xTimeStruct.tm_min; /* Min (0 - 59). */
|
||||
pxFindData->xDirectoryEntry.xCreateTime.Second = ( uint16_t ) xTimeStruct.tm_sec; /* Second (0 - 59). */
|
||||
pxFindData->xDirectoryEntry.xModifiedTime = pxFindData->xDirectoryEntry.xCreateTime; /* Date and Time Modified. */
|
||||
pxFindData->xDirectoryEntry.xAccessedTime = pxFindData->xDirectoryEntry.xCreateTime; /* Date of Last Access. */
|
||||
/* Date and Time Modified. */
|
||||
memcpy( &( pxFindData->xDirectoryEntry.xModifiedTime ),
|
||||
&( pxFindData->xDirectoryEntry.xCreateTime ),
|
||||
sizeof( pxFindData->xDirectoryEntry.xModifiedTime ) );
|
||||
/* Date of Last Access. */
|
||||
memcpy( &( pxFindData->xDirectoryEntry.xAccessedTime ),
|
||||
&( pxFindData->xDirectoryEntry.xCreateTime ),
|
||||
sizeof( pxFindData->xDirectoryEntry.xAccessedTime ) );
|
||||
}
|
||||
}
|
||||
#endif /* ffconfigTIME_SUPPORT */
|
||||
|
@@ -64,6 +64,8 @@ typedef struct
|
||||
uint32_t ulAddrCurrentCluster;
|
||||
uint32_t ulDirCluster;
|
||||
uint16_t usCurrentItem;
|
||||
/* Insert 2 bytes to make the next struct 32-bit aligned. */
|
||||
uint16_t usFillerBytes;
|
||||
/* End Book Keeping. */
|
||||
|
||||
#if ( ffconfigTIME_SUPPORT != 0 )
|
||||
|
Reference in New Issue
Block a user