Skip to content

Commit 0f10921

Browse files
committed
fix for new c version
1 parent 45798c6 commit 0f10921

File tree

11 files changed

+35
-33
lines changed

11 files changed

+35
-33
lines changed

base_pack/doom/application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ App(
1313
fap_category="Games",
1414
fap_icon_assets="assets",
1515
fap_author="@xMasterX & @Svarich & @hedger (original code by @p4nic4ttack)",
16-
fap_version="1.2",
16+
fap_version="1.3",
1717
fap_description="Will it run Doom?",
1818
)

base_pack/doom/assets.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define bmp_font_width_pxs 192
1010
#define bmp_font_height_pxs 48
1111
#define CHAR_MAP " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-_(){}[]#"
12-
#define CHAR_WIDTH 4
12+
#define UICHAR_WIDTH 4
1313
#define CHAR_HEIGHT 6
1414

1515
#define BMP_GUN_WIDTH 32

base_pack/doom/display.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void drawTextSpace(int8_t x, int8_t y, char* txt, uint8_t space, Canvas* const c
117117
while((ch = txt[i]) != '\0') {
118118
drawChar(pos, y, ch, canvas);
119119
i++;
120-
pos += CHAR_WIDTH + space;
120+
pos += UICHAR_WIDTH + space;
121121

122122
// shortcut on end of screen
123123
if(pos > SCREEN_WIDTH) return;

base_pack/unitemp/Sensors.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,14 @@ Sensor* unitemp_sensor_alloc(char* name, const SensorType* type, char* args) {
493493
Sensor* sensor = malloc(sizeof(Sensor));
494494
if(sensor == NULL) {
495495
FURI_LOG_E(APP_NAME, "Sensor %s allocation error", name);
496-
return false;
496+
return NULL;
497497
}
498498

499499
//Выделение памяти под имя
500500
sensor->name = malloc(11);
501501
if(sensor->name == NULL) {
502502
FURI_LOG_E(APP_NAME, "Sensor %s name allocation error", name);
503-
return false;
503+
return NULL;
504504
}
505505
//Запись имени датчка
506506
strcpy(sensor->name, name);

non_catalog_apps/FlipBIP/lib/crypto/base32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ char* base32_encode(
5151
int ret = base32_encode_character(out[i], alphabet);
5252

5353
if(ret == -1) {
54-
return false;
54+
return NULL;
5555
} else {
5656
out[i] = ret;
5757
}

non_catalog_apps/air_mouse_ofw/air_mouse_app.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define TAG "SensorModule"
1717

18-
#define BLE_HID_KEYS_PATH "/ext/apps_data/hid_ble/.bt_hid.keys"
18+
#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys"
1919

2020
typedef struct {
2121
Gui* gui;

non_catalog_apps/crypto_dictionary_book/constants/constants.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#define WIDGET_WIDTH 126
55
#define WIDGET_HEIGHT 64
6-
#define CHAR_WIDTH 1
6+
#define UICHAR_WIDTH 1
77

88
#endif // CONSTANTS_H

non_catalog_apps/crypto_dictionary_book/scenes/scenes.c

+21-21
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ char* wrap_text(const char* text, size_t max_line_width) {
7070
// More realistic initial size estimation
7171
size_t allocated_size = len + len / max_line_width + 1;
7272
char* wrapped = malloc(allocated_size);
73-
if (!wrapped) return NULL;
73+
if(!wrapped) return NULL;
7474

7575
size_t cur_line_len = 0;
7676
size_t wrapped_index = 0;
7777
size_t word_len = 0;
7878

79-
for (size_t i = 0; i < len; ++i) {
79+
for(size_t i = 0; i < len; ++i) {
8080
word_len++;
81-
if (text[i] == '\n') {
82-
for (size_t j = i - word_len + 1; j <= i; ++j) {
81+
if(text[i] == '\n') {
82+
for(size_t j = i - word_len + 1; j <= i; ++j) {
8383
// Check and reallocate if necessary before writing to the buffer
84-
if (wrapped_index >= allocated_size) {
84+
if(wrapped_index >= allocated_size) {
8585
allocated_size *= 2;
8686
char* new_wrapped = realloc(wrapped, allocated_size);
87-
if (!new_wrapped) {
87+
if(!new_wrapped) {
8888
free(wrapped);
8989
return NULL;
9090
}
@@ -97,41 +97,41 @@ char* wrap_text(const char* text, size_t max_line_width) {
9797
continue;
9898
}
9999

100-
if (text[i] == ' ' || i == len - 1) {
101-
if (word_len >= max_line_width) {
102-
if (cur_line_len > 0) {
100+
if(text[i] == ' ' || i == len - 1) {
101+
if(word_len >= max_line_width) {
102+
if(cur_line_len > 0) {
103103
wrapped[wrapped_index++] = '\n';
104104
cur_line_len = 0;
105105
}
106-
for (size_t j = i - word_len + 1; j <= i; ++j) {
106+
for(size_t j = i - word_len + 1; j <= i; ++j) {
107107
// Check and reallocate if necessary before writing to the buffer
108-
if (wrapped_index >= allocated_size) {
108+
if(wrapped_index >= allocated_size) {
109109
allocated_size *= 2;
110110
char* new_wrapped = realloc(wrapped, allocated_size);
111-
if (!new_wrapped) {
111+
if(!new_wrapped) {
112112
free(wrapped);
113113
return NULL;
114114
}
115115
wrapped = new_wrapped;
116116
}
117117
wrapped[wrapped_index++] = text[j];
118-
if (++cur_line_len >= max_line_width && text[j] != '\n') {
118+
if(++cur_line_len >= max_line_width && text[j] != '\n') {
119119
wrapped[wrapped_index++] = '\n';
120120
cur_line_len = 0;
121121
}
122122
}
123-
} else if (cur_line_len + word_len > max_line_width) {
124-
if (cur_line_len > 0) {
123+
} else if(cur_line_len + word_len > max_line_width) {
124+
if(cur_line_len > 0) {
125125
wrapped[wrapped_index++] = '\n';
126126
cur_line_len = 0;
127127
}
128128
}
129-
for (size_t j = i - word_len + 1; j <= i; ++j) {
129+
for(size_t j = i - word_len + 1; j <= i; ++j) {
130130
// Check and reallocate if necessary before writing to the buffer
131-
if (wrapped_index >= allocated_size) {
131+
if(wrapped_index >= allocated_size) {
132132
allocated_size *= 2;
133133
char* new_wrapped = realloc(wrapped, allocated_size);
134-
if (!new_wrapped) {
134+
if(!new_wrapped) {
135135
free(wrapped);
136136
return NULL;
137137
}
@@ -148,7 +148,6 @@ char* wrap_text(const char* text, size_t max_line_width) {
148148
return wrapped;
149149
}
150150

151-
152151
void topic_scene_on_enter(void* context) {
153152
furi_assert(context);
154153
App* app = (App*)context;
@@ -162,13 +161,14 @@ void topic_scene_on_enter(void* context) {
162161
if(file_stream_open(app->file_stream, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
163162
FuriString* line = furi_string_alloc();
164163
while(stream_read_line(app->file_stream, line)) {
165-
dynamic_buffer_append(&dynamic_content, furi_string_get_cstr(line), furi_string_size(line));
164+
dynamic_buffer_append(
165+
&dynamic_content, furi_string_get_cstr(line), furi_string_size(line));
166166
dynamic_buffer_append(&dynamic_content, "\r\n", 1);
167167
}
168168
dynamic_buffer_append(&dynamic_content, "\0", 1);
169169
furi_string_free(line);
170170
file_stream_close(app->file_stream);
171-
size_t max_line_width = WIDGET_WIDTH / CHAR_WIDTH;
171+
size_t max_line_width = WIDGET_WIDTH / UICHAR_WIDTH;
172172
char* wrapped_text = wrap_text(dynamic_content.data, max_line_width);
173173
dynamic_buffer_free(&dynamic_content);
174174

non_catalog_apps/hid_file_transfer/main.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ static void dispatch_view(void* contextd, uint32_t index) {
390390
}
391391
}
392392

393-
bool eventCallback() {
393+
static bool eventCallback(void* context) {
394+
UNUSED(context);
394395
return false;
395396
}
396397

non_catalog_apps/the_c_programming_language_book/constants/constants.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#define WIDGET_WIDTH 128
55
#define WIDGET_HEIGHT 64
6-
#define CHAR_WIDTH 5
6+
#define UICHAR_WIDTH 5
77

88
#endif // CONSTANTS_H

non_catalog_apps/the_c_programming_language_book/scenes/scenes.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,14 @@ void topic_scene_on_enter(void* context) {
157157
if(file_stream_open(app->file_stream, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
158158
FuriString* line = furi_string_alloc();
159159
while(stream_read_line(app->file_stream, line)) {
160-
dynamic_buffer_append(&dynamic_content, furi_string_get_cstr(line), furi_string_size(line));
160+
dynamic_buffer_append(
161+
&dynamic_content, furi_string_get_cstr(line), furi_string_size(line));
161162
dynamic_buffer_append(&dynamic_content, "\r\n", 1);
162163
}
163164
dynamic_buffer_append(&dynamic_content, "\0", 1);
164165
furi_string_free(line);
165166
file_stream_close(app->file_stream);
166-
size_t max_line_width = WIDGET_WIDTH / CHAR_WIDTH;
167+
size_t max_line_width = WIDGET_WIDTH / UICHAR_WIDTH;
167168
char* wrapped_text = wrap_text(dynamic_content.data, max_line_width);
168169
dynamic_buffer_free(&dynamic_content);
169170

0 commit comments

Comments
 (0)