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

Small Type and Qualifier Fixes #67

Merged
merged 2 commits into from
Apr 29, 2024
Merged

Small Type and Qualifier Fixes #67

merged 2 commits into from
Apr 29, 2024

Conversation

StefanBalt
Copy link
Contributor

Otherwise the condition is always true for 64-bit architectures.

GCC warned me about this when compiling AARCH64 (-Wtype-limits).

@StefanBalt StefanBalt changed the title Add explicit cast to uint32_t Small Type and Qualifier Fixes Apr 24, 2024
@StefanBalt
Copy link
Contributor Author

I also added a second commit where I add the const qualifiert to the FF_IsNameCompliant() argument.

This fixes a -Wdiscarded-qualifiers warning.

Copy link
Contributor

@htibosch htibosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @StefanBalt for these changes. I guess it saves a couple of warnings.
I approve it if you can remove the ul suffix.

ff_fat.c Outdated
@@ -1496,7 +1496,7 @@ uint32_t FF_CountFreeClusters( FF_IOManager_t * pxIOManager,
{
ulFreeClusters = FF_getLong( pxBuffer->pucBuffer, 488 );

if( ulFreeClusters != ~0ul )
if( ulFreeClusters != ( uint32_t ) ~0ul )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to avoid the use of the ambiguous 'ul' suffix and write the following:

-    if( ulFreeClusters != ( uint32_t ) ~0ul )
+    if( ulFreeClusters != ~( ( uint32_t ) 0U ) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the U suffix does not have any effect now but I guess it is FreeRTOS style

Otherwise the condition is always true for 64-bit architectures.
@moninom1 moninom1 merged commit f834aee into FreeRTOS:main Apr 29, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants