Skip to content

Commit

Permalink
Converting prints from %lu to %u where possible as per request in com…
Browse files Browse the repository at this point in the history
…ments related to (FreeRTOS#35)
  • Loading branch information
phelter committed Nov 1, 2022
1 parent 321db9e commit b583a73
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 74 deletions.
11 changes: 6 additions & 5 deletions ff_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ static FF_Error_t prvFormatWriteBPB( struct xFormatSet * pxSet,
FF_putLong( pxSet->pucSectorBuffer, OFS_BPB_HiddSec_32, ( uint32_t ) pxSet->ulHiddenSectors ); /* 0x01C / n.a. 0 for nonparitioned volume */

FF_putChar( pxSet->pucSectorBuffer, OFS_BPB_SecPerClus_8, ( uint32_t ) pxSet->ulSectorsPerCluster ); /* 0x00D / Only 1, 2, 4, 8, 16, 32, 64, 128 */
FF_PRINTF( "FF_Format: SecCluster %lu DatSec %lu DataClus %lu pxSet->ulClusterBeginLBA %lu\n",
pxSet->ulSectorsPerCluster, pxSet->ulUsableDataSectors, pxSet->ulUsableDataClusters, pxSet->ulClusterBeginLBA );
FF_PRINTF( "FF_Format: SecCluster %u DatSec %u DataClus %u pxSet->ulClusterBeginLBA %lu\n",
(unsigned) pxSet->ulSectorsPerCluster, (unsigned) pxSet->ulUsableDataSectors, (unsigned) pxSet->ulUsableDataClusters, pxSet->ulClusterBeginLBA );

/* This field is the new 32-bit total count of sectors on the volume. */
/* This count includes the count of all sectors in all four regions of the volume */
Expand Down Expand Up @@ -462,7 +462,7 @@ static FF_Error_t prvFormatInitialiseFAT( struct xFormatSet * pxSet,
xReturn = FF_BlockWrite( pxSet->pxIOManager, ( uint32_t ) lFatBeginLBA + pxSet->ulSectorsPerFAT, 1, pxSet->pucSectorBuffer, pdFALSE );
}

FF_PRINTF( "FF_Format: Clearing entire FAT (2 x %lu sectors):\n", pxSet->ulSectorsPerFAT );
FF_PRINTF( "FF_Format: Clearing entire FAT (2 x %u sectors):\n", (unsigned) pxSet->ulSectorsPerFAT );
{
int32_t addr;

Expand Down Expand Up @@ -636,8 +636,9 @@ FF_Error_t FF_FormatDisk( FF_Disk_t * pxDisk,
xSet.ulClustersPerFATSector = xSet.pxIOManager->usSectorSize / sizeof( uint16_t );
}

FF_PRINTF( "FF_Format: Secs %lu Rsvd %lu Hidden %lu Root %lu Data %lu\n",
xSet.ulSectorCount, xSet.ulFATReservedSectors, xSet.ulHiddenSectors, xSet.iFAT16RootSectors, xSet.ulSectorCount - xSet.ulNonDataSectors );
FF_PRINTF( "FF_Format: Secs %u Rsvd %u Hidden %u Root %u Data %u\n",
(unsigned) xSet.ulSectorCount, (unsigned) xSet.ulFATReservedSectors, (unsigned) xSet.ulHiddenSectors,
(unsigned) xSet.iFAT16RootSectors, (unsigned) xSet.ulSectorCount - xSet.ulNonDataSectors );

/*****************************/

Expand Down
22 changes: 11 additions & 11 deletions portable/ATSAM4E/ff_sddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,
else
{
/* Some error occurred. */
FF_PRINTF( "prvFFRead: %lu: %ld\n", ulSectorNumber, lResult );
FF_PRINTF( "prvFFRead: %u: %d\n", (unsigned) ulSectorNumber, (int) lResult );
}
}
else
Expand All @@ -219,7 +219,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFRead: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFRead: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned) ulSectorCount, (unsigned) pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -284,14 +284,14 @@ static int32_t prvFFWrite( uint8_t * pucBuffer,
}
else
{
FF_PRINTF( "prvFFWrite: %lu: %ld\n", ulSectorNumber, lResult );
FF_PRINTF( "prvFFWrite: %u: %d\n", (unsigned) ulSectorNumber, (int) lResult );
}
}
else
{
if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFWrite: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFWrite: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned)ulSectorCount, (unsigned)pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -511,7 +511,7 @@ BaseType_t FF_SDDiskMount( FF_Disk_t * pxDisk )
else
{
pxDisk->xStatus.bIsMounted = pdTRUE;
FF_PRINTF( "****** FreeRTOS+FAT initialized %lu sectors\n", pxDisk->pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "****** FreeRTOS+FAT initialized %u sectors\n", (unsigned)pxDisk->pxIOManager->xPartition.ulTotalSectors );
FF_SDDiskShowPartition( pxDisk );
xReturn = pdPASS;
}
Expand Down Expand Up @@ -615,10 +615,10 @@ BaseType_t FF_SDDiskShowPartition( FF_Disk_t * pxDisk )
FF_PRINTF( "Partition Nr %8u\n", pxDisk->xStatus.bPartitionNumber );
FF_PRINTF( "Type %8u (%s)\n", pxIOManager->xPartition.ucType, pcTypeName );
FF_PRINTF( "VolLabel '%8s' \n", pxIOManager->xPartition.pcVolumeLabel );
FF_PRINTF( "TotalSectors %8lu\n", pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8lu\n", pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8lu MB\n", ulTotalSizeMB );
FF_PRINTF( "FreeSize %8lu MB ( %d perc free )\n", ulFreeSizeMB, iPercentageFree );
FF_PRINTF( "TotalSectors %8u\n", (unsigned) pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8u\n", (unsigned) pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8u MB\n", (unsigned) ulTotalSizeMB );
FF_PRINTF( "FreeSize %8u MB ( %d perc free )\n", (unsigned) ulFreeSizeMB, iPercentageFree );
}

return xReturn;
Expand Down Expand Up @@ -714,9 +714,9 @@ static BaseType_t prvSDMMCInit( BaseType_t xDriveNumber )
}
else
{
FF_PRINTF( "HAL_SD_Init: type: %s Capacity: %lu MB\n",
FF_PRINTF( "HAL_SD_Init: type: %s Capacity: %u MB\n",
xSDCardInfo.type & CARD_TYPE_HC ? "SDHC" : "SD",
( xSDCardInfo.capacity << 1 ) / 2048 );
(unsigned)(( xSDCardInfo.capacity << 1 ) / 2048U ));

xReturn = pdPASS;
}
Expand Down
22 changes: 11 additions & 11 deletions portable/ATSAM4E/ff_sddisk_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,
else
{
/* Some error occurred. */
FF_PRINTF( "prvFFRead: %lu: %lu\n", ulSectorNumber, lResult );
FF_PRINTF( "prvFFRead: %u: %u\n", (unsigned) ulSectorNumber, (unsigned) lResult );
}
}
else
Expand All @@ -110,7 +110,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFRead: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFRead: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned) ulSectorCount, (unsigned) pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -142,14 +142,14 @@ static int32_t prvFFWrite( uint8_t * pucBuffer,
}
else
{
FF_PRINTF( "prvFFWrite: %lu: %lu\n", ulSectorNumber, xResult );
FF_PRINTF( "prvFFWrite: %u: %u\n", ulSectorNumber, xResult );
}
}
else
{
if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFWrite: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFWrite: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned) ulSectorCount, (unsigned) pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -356,7 +356,7 @@ BaseType_t FF_SDDiskMount( FF_Disk_t * pxDisk )
else
{
pxDisk->xStatus.bIsMounted = pdTRUE;
FF_PRINTF( "****** FreeRTOS+FAT initialized %lu sectors\n", pxDisk->pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "****** FreeRTOS+FAT initialized %u sectors\n", (unsigned) pxDisk->pxIOManager->xPartition.ulTotalSectors );
xReturn = pdPASS;
}

Expand Down Expand Up @@ -459,10 +459,10 @@ BaseType_t FF_SDDiskShowPartition( FF_Disk_t * pxDisk )
FF_PRINTF( "Partition Nr %8u\n", pxDisk->xStatus.bPartitionNumber );
FF_PRINTF( "Type %8u (%s)\n", pxIOManager->xPartition.ucType, pcTypeName );
FF_PRINTF( "VolLabel '%8s' \n", pxIOManager->xPartition.pcVolumeLabel );
FF_PRINTF( "TotalSectors %8lu\n", pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8lu\n", pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8lu MB\n", ulTotalSizeMB );
FF_PRINTF( "FreeSize %8lu MB ( %d perc free )\n", ulFreeSizeMB, iPercentageFree );
FF_PRINTF( "TotalSectors %8u\n", (unsigned) pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8u\n", (unsigned) pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8u MB\n", (unsigned) ulTotalSizeMB );
FF_PRINTF( "FreeSize %8u MB ( %d perc free )\n", (unsigned) ulFreeSizeMB, iPercentageFree );
}

return xReturn;
Expand Down Expand Up @@ -559,9 +559,9 @@ static BaseType_t prvSDMMCInit( BaseType_t xDriveNumber )
}
else
{
FF_PRINTF( "HAL_SD_Init: type: %s Capacity: %lu MB\n",
FF_PRINTF( "HAL_SD_Init: type: %s Capacity: %u MB\n",
xSDCardInfo.type & CARD_TYPE_HC ? "SDHC" : "SD",
( xSDCardInfo.capacity << 1 ) / 2048 );
(unsigned) ( xSDCardInfo.capacity << 1 ) / 2048 );

xReturn = pdPASS;
}
Expand Down
22 changes: 11 additions & 11 deletions portable/STM32F4xx/ff_sddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,
else
{
/* Some error occurred. */
FF_PRINTF( "prvFFRead: %lu: %u (%s)\n", ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
FF_PRINTF( "prvFFRead: %u: %u (%s)\n", (unsigned) ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
}
}
else
Expand All @@ -266,7 +266,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFRead: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFRead: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned) ulSectorCount, (unsinged) pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -353,14 +353,14 @@ static int32_t prvFFWrite( uint8_t * pucBuffer,
}
else
{
FF_PRINTF( "prvFFWrite: %lu: %u (%s)\n", ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
FF_PRINTF( "prvFFWrite: %u: %u (%s)\n", (unsigned) ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
}
}
else
{
if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFWrite: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFWrite: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned)ulSectorCount, (unsigned)pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -608,7 +608,7 @@ BaseType_t FF_SDDiskMount( FF_Disk_t * pxDisk )
else
{
pxDisk->xStatus.bIsMounted = pdTRUE;
FF_PRINTF( "****** FreeRTOS+FAT initialized %lu sectors\n", pxDisk->pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "****** FreeRTOS+FAT initialized %u sectors\n", (unsigned) pxDisk->pxIOManager->xPartition.ulTotalSectors );
xReturn = pdPASS;
}

Expand Down Expand Up @@ -711,10 +711,10 @@ BaseType_t FF_SDDiskShowPartition( FF_Disk_t * pxDisk )
FF_PRINTF( "Partition Nr %8u\n", pxDisk->xStatus.bPartitionNumber );
FF_PRINTF( "Type %8u (%s)\n", pxIOManager->xPartition.ucType, pcTypeName );
FF_PRINTF( "VolLabel '%8s' \n", pxIOManager->xPartition.pcVolumeLabel );
FF_PRINTF( "TotalSectors %8lu\n", pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8lu\n", pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8lu MB\n", ulTotalSizeMB );
FF_PRINTF( "FreeSize %8lu MB ( %d perc free )\n", ulFreeSizeMB, iPercentageFree );
FF_PRINTF( "TotalSectors %8u\n", (unsigned) pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8u\n", (unsigned) pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8u MB\n", (unsigned) ulTotalSizeMB );
FF_PRINTF( "FreeSize %8u MB ( %d perc free )\n", (unsigned) ulFreeSizeMB, iPercentageFree );
}

return xReturn;
Expand Down Expand Up @@ -866,11 +866,11 @@ static BaseType_t prvSDMMCInit( BaseType_t xDriveNumber )
}
}
#endif /* if ( BUS_4BITS != 0 ) */
FF_PRINTF( "HAL_SD_Init: %d: %s type: %s Capacity: %lu MB\n",
FF_PRINTF( "HAL_SD_Init: %d: %s type: %s Capacity: %u MB\n",
SD_state,
prvSDCodePrintable( ( uint32_t ) SD_state ),
xSDHandle.CardType == HIGH_CAPACITY_SD_CARD ? "SDHC" : "SD",
xSDCardInfo.CardCapacity / ( 1024 * 1024 ) );
(unsigned)(xSDCardInfo.CardCapacity / ( 1024 * 1024 ) ));

return SD_state == SD_OK ? 1 : 0;
}
Expand Down
22 changes: 11 additions & 11 deletions portable/STM32F7xx/ff_sddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,
else
{
/* Some error occurred. */
FF_PRINTF( "prvFFRead: %lu: %lu (%s)\n", ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
FF_PRINTF( "prvFFRead: %u: %lu (%s)\n", (unsigned) ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
}
}
else
Expand All @@ -352,7 +352,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFRead: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFRead: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned)ulSectorCount, (unsigned)pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -441,14 +441,14 @@ static int32_t prvFFWrite( uint8_t * pucBuffer,
}
else
{
FF_PRINTF( "prvFFWrite: %lu: %lu (%s)\n", ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
FF_PRINTF( "prvFFWrite: %u: %lu (%s)\n", (unsigned)ulSectorNumber, sd_result, prvSDCodePrintable( sd_result ) );
}
}
else
{
if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFWrite: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFWrite: warning: %u + %u > %u\n", (unsigned) ulSectorNumber, (unsigned) ulSectorCount, (unsigned) pxDisk->ulNumberOfSectors );
}
}

Expand Down Expand Up @@ -727,7 +727,7 @@ BaseType_t FF_SDDiskMount( FF_Disk_t * pxDisk )
else
{
pxDisk->xStatus.bIsMounted = pdTRUE;
FF_PRINTF( "****** FreeRTOS+FAT initialized %lu sectors\n", pxDisk->pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "****** FreeRTOS+FAT initialized %u sectors\n", (unsigned) pxDisk->pxIOManager->xPartition.ulTotalSectors );
xReturn = pdPASS;
}

Expand Down Expand Up @@ -830,10 +830,10 @@ BaseType_t FF_SDDiskShowPartition( FF_Disk_t * pxDisk )
FF_PRINTF( "Partition Nr %8u\n", pxDisk->xStatus.bPartitionNumber );
FF_PRINTF( "Type %8u (%s)\n", pxIOManager->xPartition.ucType, pcTypeName );
FF_PRINTF( "VolLabel '%8s' \n", pxIOManager->xPartition.pcVolumeLabel );
FF_PRINTF( "TotalSectors %8lu\n", pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8lu\n", pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8lu MB\n", ulTotalSizeMB );
FF_PRINTF( "FreeSize %8lu MB ( %d perc free )\n", ulFreeSizeMB, iPercentageFree );
FF_PRINTF( "TotalSectors %8u\n", (unsigned) pxIOManager->xPartition.ulTotalSectors );
FF_PRINTF( "SecsPerCluster %8u\n", (unsigned) pxIOManager->xPartition.ulSectorsPerCluster );
FF_PRINTF( "Size %8u MB\n", (unsigned) ulTotalSizeMB );
FF_PRINTF( "FreeSize %8u MB ( %d perc free )\n", (unsigned) ulFreeSizeMB, iPercentageFree );
}

return xReturn;
Expand Down Expand Up @@ -985,10 +985,10 @@ static BaseType_t prvSDMMCInit( BaseType_t xDriveNumber )
}
}
#endif /* if ( BUS_4BITS != 0 ) */
FF_PRINTF( "HAL_SD_Init: %d: %s type: %s Capacity: %lu MB\n",
FF_PRINTF( "HAL_SD_Init: %d: %s type: %s Capacity: %u MB\n",
SD_state, prvSDCodePrintable( ( uint32_t ) SD_state ),
xSDHandle.CardType == HIGH_CAPACITY_SD_CARD ? "SDHC" : "SD",
xSDCardInfo.CardCapacity / ( 1024 * 1024 ) );
(unsigned)(xSDCardInfo.CardCapacity / ( 1024 * 1024 ) ));

return ( SD_state == SD_OK ) ? pdPASS : pdFAIL;
}
Expand Down
6 changes: 3 additions & 3 deletions portable/Zynq.2019.3/ff_sddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int32_t prvFFRead( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised != pdFALSE )
{
FF_PRINTF( "prvFFRead: warning: %lu + %lu > %lu\n", ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFRead: warning: %u + %u > %u\n", (unsigned)ulSectorNumber, (unsigned)ulSectorCount, (unsigned)pxDisk->ulNumberOfSectors );
}

lReturnCode = FF_ERR_IOMAN_OUT_OF_BOUNDS_READ | FF_ERRFLAG;
Expand Down Expand Up @@ -334,8 +334,8 @@ static int32_t prvFFWrite( uint8_t * pucBuffer,

if( pxDisk->xStatus.bIsInitialised )
{
FF_PRINTF( "prvFFWrite::read: warning: %lu + %lu > %lu\n",
ulSectorNumber, ulSectorCount, pxDisk->ulNumberOfSectors );
FF_PRINTF( "prvFFWrite::read: warning: %u + %u > %u\n",
(unsigned)ulSectorNumber, (unsigned)ulSectorCount, (unsigned)pxDisk->ulNumberOfSectors );
}
}

Expand Down
Loading

0 comments on commit b583a73

Please sign in to comment.