瀏覽代碼

Fixes for toolchain 28 / gcc 12 pt1

These are pretty obvious
Willy-JL 1 年之前
父節點
當前提交
25db1f08bb

+ 6 - 6
2048/game_2048.c

@@ -79,7 +79,7 @@ static void draw_digit(Canvas* canvas, uint8_t row, uint8_t column, uint8_t valu
     uint8_t top = FRAME_TOP + 1 + (row * (CELL_INNER_SIZE + 1));
 
     for(uint8_t r = 0; r < CELL_INNER_SIZE; r++) {
-        for(u_int8_t c = 0; c < CELL_INNER_SIZE; c++) {
+        for(uint8_t c = 0; c < CELL_INNER_SIZE; c++) {
             if(digits[value - 1][r][c] == 1) {
                 canvas_draw_dot(canvas, left + c, top + r);
             }
@@ -268,8 +268,8 @@ void move_down(uint8_t table[CELLS_COUNT][CELLS_COUNT], MoveResult* const move_r
 void add_new_digit(GameState* const game_state) {
     uint8_t empty_cell_indexes[CELLS_COUNT * CELLS_COUNT];
     uint8_t empty_cells_count = 0;
-    for(u_int8_t i = 0; i < CELLS_COUNT; i++) {
-        for(u_int8_t j = 0; j < CELLS_COUNT; j++) {
+    for(uint8_t i = 0; i < CELLS_COUNT; i++) {
+        for(uint8_t j = 0; j < CELLS_COUNT; j++) {
             if(game_state->table[i][j] == 0) {
                 empty_cell_indexes[empty_cells_count++] = i * CELLS_COUNT + j;
             }
@@ -278,8 +278,8 @@ void add_new_digit(GameState* const game_state) {
     if(empty_cells_count == 0) return;
 
     int random_empty_cell_index = empty_cell_indexes[random() % empty_cells_count];
-    u_int8_t row = random_empty_cell_index / CELLS_COUNT;
-    u_int8_t col = random_empty_cell_index % CELLS_COUNT;
+    uint8_t row = random_empty_cell_index / CELLS_COUNT;
+    uint8_t col = random_empty_cell_index % CELLS_COUNT;
 
     int random_value_percent = random() % 100;
     game_state->table[row][col] = random_value_percent < 90 ? 1 : 2; // 90% for 2, 25% for 4
@@ -334,7 +334,7 @@ bool is_game_over(GameState* const game_state) {
 
     // check if table contains at least one empty cell
     for(uint8_t i = 0; i < CELLS_COUNT; i++) {
-        for(u_int8_t j = 0; j < CELLS_COUNT; j++) {
+        for(uint8_t j = 0; j < CELLS_COUNT; j++) {
             if(game_state->table[i][j] == 0) {
                 FURI_LOG_I("is_game_over", "has empty cells");
                 return false;

+ 1 - 0
airmouse/tracking/util/vector.h

@@ -17,6 +17,7 @@
 #define CARDBOARD_SDK_UTIL_VECTOR_H_
 
 #include <array>
+#include <cstddef>
 
 namespace cardboard {
 

+ 1 - 1
chess/helpers/flipchess_file.c

@@ -16,10 +16,10 @@
 bool flipchess_has_file(const FlipChessFile file_type, const char* file_name, const bool remove) {
     bool ret = false;
     const char* path;
+    char path_buf[FILE_MAX_PATH_LEN] = {0};
     if(file_type == FlipChessFileBoard) {
         path = FLIPCHESS_BOARD_PATH;
     } else {
-        char path_buf[FILE_MAX_PATH_LEN] = {0};
         strcpy(path_buf, FLIPCHESS_APP_BASE_FOLDER); // 22
         strcpy(path_buf + strlen(path_buf), "/");
         strcpy(path_buf + strlen(path_buf), file_name);

+ 1 - 0
esubghz_chat/crypto_wrapper.c

@@ -1,6 +1,7 @@
 #include <furi_hal.h>
 #include <lib/mlib/m-dict.h>
 #include <mbedtls/sha256.h>
+#include <machine/endian.h>
 
 #ifndef FURI_HAL_CRYPTO_ADVANCED_AVAIL
 #include "crypto/gcm.h"

+ 1 - 1
flipbip/helpers/flipbip_file.c

@@ -96,12 +96,12 @@ bool flipbip_load_file(
 bool flipbip_has_file(const FlipBipFile file_type, const char* file_name, const bool remove) {
     bool ret = false;
     const char* path;
+    char path_buf[FILE_MAX_PATH_LEN] = {0};
     if(file_type == FlipBipFileKey) {
         path = FLIPBIP_KEY_PATH;
     } else if(file_type == FlipBipFileDat) {
         path = FLIPBIP_DAT_PATH;
     } else {
-        char path_buf[FILE_MAX_PATH_LEN] = {0};
         strcpy(path_buf, FLIPBIP_APP_BASE_FOLDER); // 22
         strcpy(path_buf + strlen(path_buf), "/");
         strcpy(path_buf + strlen(path_buf), file_name);

+ 1 - 1
heap_defence/heap_defence.c

@@ -50,7 +50,7 @@ typedef enum {
 
 static IconAnimation* animations[4];
 
-typedef u_int8_t byte;
+typedef uint8_t byte;
 
 typedef enum {
     GameStatusVibro = 1 << 0,

+ 3 - 3
nrf24mousejacker/mousejacker_ducky.c

@@ -96,7 +96,7 @@ static uint32_t mj_ducky_get_command_len(const char* line) {
 
 static bool mj_get_ducky_key(char* key, size_t keylen, MJDuckyKey* dk) {
     //FURI_LOG_D(TAG, "looking up key %s with length %d", key, keylen);
-    for(uint i = 0; i < sizeof(mj_ducky_keys) / sizeof(MJDuckyKey); i++) {
+    for(size_t i = 0; i < sizeof(mj_ducky_keys) / sizeof(MJDuckyKey); i++) {
         if(strlen(mj_ducky_keys[i].name) == keylen &&
            !strncmp(mj_ducky_keys[i].name, key, keylen)) {
             memcpy(dk, &mj_ducky_keys[i], sizeof(MJDuckyKey));
@@ -107,11 +107,11 @@ static bool mj_get_ducky_key(char* key, size_t keylen, MJDuckyKey* dk) {
     return false;
 }
 
-static void checksum(uint8_t* payload, uint len) {
+static void checksum(uint8_t* payload, size_t len) {
     // This is also from the KeyKeriki paper
     // Thanks Thorsten and Max!
     uint8_t cksum = 0xff;
-    for(uint n = 0; n < len - 2; n++) cksum = (cksum - payload[n]) & 0xff;
+    for(size_t n = 0; n < len - 2; n++) cksum = (cksum - payload[n]) & 0xff;
     cksum = (cksum + 1) & 0xff;
     payload[len - 1] = cksum;
 }