feat: great beautiful fixes

This commit is contained in:
Krzysztof Rudnicki 2026-02-20 01:17:53 +01:00
parent 67da5c4fb9
commit ac7d678007
9 changed files with 41 additions and 39 deletions

View File

@ -39,11 +39,14 @@ void pauseForGivenTime(float given_time)
float calculateVelocity(float starting_velocity, unsigned int physics_time, int *acceleration) float calculateVelocity(float starting_velocity, unsigned int physics_time, int *acceleration)
{ {
// cppcheck-suppress nullPointer
return (*acceleration) * physics_time + starting_velocity; return (*acceleration) * physics_time + starting_velocity;
} }
int calculateDisplacement(float starting_velocity, int *acceleration, unsigned int physics_time) int calculateDisplacement(float starting_velocity, int *acceleration, unsigned int physics_time)
{ {
// cppcheck-suppress nullPointer
// cppcheck-suppress ctunullpointer
return starting_velocity * physics_time + ((1 / 2) * (*acceleration) * (physics_time ^ 2)); return starting_velocity * physics_time + ((1 / 2) * (*acceleration) * (physics_time ^ 2));
} }
@ -55,7 +58,7 @@ void printXPosition(int position)
void printClock(unsigned int *time) void printClock(unsigned int *time)
{ {
printf("%d seconds passed\n", *time); printf("%u seconds passed\n", *time);
return; return;
} }

View File

@ -1,6 +1,6 @@
# Clang-format configuration for imageViewer project # Clang-format configuration for imageViewer project
--- ---
Language: C Language: Cpp
# Base style # Base style
BasedOnStyle: LLVM BasedOnStyle: LLVM

View File

@ -447,6 +447,7 @@ static void find_longest_excerpt(int max_vocab)
rarest_word = word_sequence[i]->word; rarest_word = word_sequence[i]->word;
} }
} }
// cppcheck-suppress nullPointer
printf("Rarest word used: %s (#%d)\n", rarest_word, max_rank_used); printf("Rarest word used: %s (#%d)\n", rarest_word, max_rank_used);
/* Count unique words in excerpt */ /* Count unique words in excerpt */

View File

@ -63,6 +63,7 @@ bool validInput(const std::string s) {
return 1; return 1;
} }
// cppcheck-suppress missingReturn
std::vector<int> requiredShoots(const int pointsLeft) {} std::vector<int> requiredShoots(const int pointsLeft) {}
int main() { int main() {

View File

@ -43,14 +43,14 @@ bool errorUserInput(std::string userInput) {
std::string convertToTier(float nominator, float denominator) { std::string convertToTier(float nominator, float denominator) {
float fraction = nominator / denominator; float fraction = nominator / denominator;
int tierIndex; int tierIndex = 0;
for (int i = TIER_BASE; i > 0; i--) { for (int i = TIER_BASE; i > 0; i--) {
if (fraction >= (i / TIER_BASE)) { if (fraction >= (i / TIER_BASE)) {
tierIndex = i - 1; tierIndex = i - 1;
break; break;
} }
} }
if (tierIndex == 0 & fraction > (1.1 / 10.0)) if (tierIndex == 0 && fraction > (1.1 / 10.0))
return TIERS[1]; return TIERS[1];
return TIERS[tierIndex]; return TIERS[tierIndex];
} }

View File

@ -3,10 +3,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
my_application,
MY,
APPLICATION,
GtkApplication) GtkApplication)
/** /**