@@ -266,7 +266,7 @@ struct vfsShm
266
266
/* Lock array. Each of these lock has the following semantics:
267
267
* - 0 means unlocked;
268
268
* - -1 means exclusive locked;
269
- * - >0 means shared locked and the value is the count of
269
+ * - >0 means shared locked and the value is the count of
270
270
* shared locks taken.
271
271
*/
272
272
int lock [SQLITE_SHM_NLOCK ];
@@ -668,7 +668,7 @@ static void vfsAmendWalIndexHeader(struct vfsDatabase *d)
668
668
{
669
669
struct vfsShm * shm = & d -> shm ;
670
670
struct vfsWal * wal = & d -> wal ;
671
- _Alignas( 8 ) uint8_t index [VFS__WAL_INDEX_HEADER_SIZE * 2 ];
671
+ uint8_t index [VFS__WAL_INDEX_HEADER_SIZE * 2 ];
672
672
uint32_t frame_checksum [2 ] = { 0 , 0 };
673
673
uint32_t n_pages = (uint32_t )d -> n_pages ;
674
674
uint32_t checksum [2 ] = { 0 , 0 };
@@ -687,19 +687,21 @@ static void vfsAmendWalIndexHeader(struct vfsDatabase *d)
687
687
/* index is an alias for shm->regions[0] which is a void* that points to
688
688
* memory allocated by `sqlite3_malloc64` and has the required alignment
689
689
*/
690
- assert (* (uint32_t * )(& index [0 ]) == VFS__WAL_VERSION ); /* iVersion */
691
- assert (index [12 ] == 1 ); /* isInit */
692
- assert (index [13 ] == VFS__BIGENDIAN ); /* bigEndCksum */
690
+ uint32_t index0 ;
691
+ memcpy (& index0 , & index [0 ], sizeof (uint32_t ));
692
+ assert (index0 == VFS__WAL_VERSION ); /* iVersion */
693
+ assert (index [12 ] == 1 ); /* isInit */
694
+ assert (index [13 ] == VFS__BIGENDIAN ); /* bigEndCksum */
693
695
694
- * ( uint32_t * )( & index [16 ]) = wal -> n_frames ;
695
- * ( uint32_t * )( & index [20 ]) = n_pages ;
696
- * ( uint32_t * )( & index [24 ]) = frame_checksum [0 ];
697
- * ( uint32_t * )( & index [28 ]) = frame_checksum [1 ];
696
+ memcpy ( & index [16 ], & wal -> n_frames , sizeof ( uint32_t )) ;
697
+ memcpy ( & index [20 ], & n_pages , sizeof ( uint32_t )) ;
698
+ memcpy ( & index [24 ], & frame_checksum [0 ], sizeof ( uint32_t )) ;
699
+ memcpy ( & index [28 ], & frame_checksum [1 ], sizeof ( uint32_t )) ;
698
700
699
701
vfsChecksum (index , 40 , checksum , checksum );
700
702
701
- * ( uint32_t * )( & index [40 ]) = checksum [0 ];
702
- * ( uint32_t * )( & index [44 ]) = checksum [1 ];
703
+ memcpy ( & index [40 ], & checksum [0 ], sizeof ( uint32_t )) ;
704
+ memcpy ( & index [44 ], & checksum [1 ], sizeof ( uint32_t )) ;
703
705
704
706
/* Update the second copy of the first part of the WAL index header. */
705
707
memcpy (index + VFS__WAL_INDEX_HEADER_SIZE , index ,
@@ -1745,7 +1747,7 @@ static int vfsDiskFileWrite(sqlite3_file *file,
1745
1747
sqlite_int64 offset )
1746
1748
{
1747
1749
struct vfsDiskMainFile * f = (struct vfsDiskMainFile * )file ;
1748
-
1750
+
1749
1751
/* Write to the actual database file. */
1750
1752
vfsDiskDatabaseTrackNumPages (f -> base .database , offset );
1751
1753
int rv = f -> underlying -> pMethods -> xWrite (f -> underlying , buf , amount , offset );
@@ -2362,7 +2364,7 @@ static int vfsWalAppend(struct vfsDatabase *d,
2362
2364
goto oom_after_frames_alloc ;
2363
2365
}
2364
2366
2365
- /* When writing the SQLite database header, make sure to sync
2367
+ /* When writing the SQLite database header, make sure to sync
2366
2368
* the file size to the logical database size. */
2367
2369
if (page_number == 1 ) {
2368
2370
database_size = ByteGetBe32 (& page [VFS__IN_HEADER_DATABASE_SIZE_OFFSET ]);
0 commit comments