mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'OFW/dev' into dev
This commit is contained in:
@@ -192,6 +192,9 @@ void lp5562_execute_ramp(
|
||||
// Prepare command sequence
|
||||
uint16_t program[16];
|
||||
uint8_t diff = (val_end > val_start) ? (val_end - val_start) : (val_start - val_end);
|
||||
if(diff == 0) { // Making division below safer
|
||||
diff = 1;
|
||||
}
|
||||
uint16_t time_step = time * 2 / diff;
|
||||
uint8_t prescaller = 0;
|
||||
if(time_step > 0x3F) {
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef struct {
|
||||
uint8_t dots;
|
||||
} NoteBlock;
|
||||
|
||||
ARRAY_DEF(NoteBlockArray, NoteBlock, M_POD_OPLIST);
|
||||
ARRAY_DEF(NoteBlockArray, NoteBlock, M_POD_OPLIST); //-V658
|
||||
|
||||
struct MusicWorker {
|
||||
FuriThread* thread;
|
||||
|
||||
@@ -650,7 +650,7 @@ static int
|
||||
|
||||
// evaluate flags
|
||||
flags = 0U;
|
||||
do {
|
||||
do { //-V1044
|
||||
switch(*format) {
|
||||
case '0':
|
||||
flags |= FLAGS_ZEROPAD;
|
||||
|
||||
@@ -455,7 +455,7 @@ static bool
|
||||
|
||||
//sort by number of occurrences
|
||||
bool swap = true;
|
||||
while(swap) {
|
||||
while(swap) { //-V1044
|
||||
swap = false;
|
||||
for(size_t i = 1; i < BIN_RAW_SEARCH_CLASSES; i++) {
|
||||
if(classes[i].count > classes[i - 1].count) {
|
||||
@@ -571,7 +571,7 @@ static bool
|
||||
bit_count = 0;
|
||||
|
||||
if(data_markup_ind == BIN_RAW_MAX_MARKUP_COUNT) break;
|
||||
ind &= 0xFFFFFFF8; //jump to the pre whole byte
|
||||
ind &= 0xFFFFFFF8; //jump to the pre whole byte //-V784
|
||||
}
|
||||
} while(gap_ind != 0);
|
||||
if((data_markup_ind != BIN_RAW_MAX_MARKUP_COUNT) && (ind != 0)) {
|
||||
|
||||
@@ -8,7 +8,7 @@ typedef struct {
|
||||
SubGhzProtocolEncoderBase* base;
|
||||
} SubGhzReceiverSlot;
|
||||
|
||||
ARRAY_DEF(SubGhzReceiverSlotArray, SubGhzReceiverSlot, M_POD_OPLIST);
|
||||
ARRAY_DEF(SubGhzReceiverSlotArray, SubGhzReceiverSlot, M_POD_OPLIST); //-V658
|
||||
#define M_OPL_SubGhzReceiverSlotArray_t() ARRAY_OPLIST(SubGhzReceiverSlotArray, M_POD_OPLIST)
|
||||
|
||||
struct SubGhzReceiver {
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef struct {
|
||||
uint16_t type;
|
||||
} SubGhzKey;
|
||||
|
||||
ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST)
|
||||
ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST) //-V658
|
||||
|
||||
#define M_OPL_SubGhzKeyArray_t() ARRAY_OPLIST(SubGhzKeyArray, M_POD_OPLIST)
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ typedef struct {
|
||||
size_t custom_preset_data_size;
|
||||
} SubGhzSettingCustomPresetItem;
|
||||
|
||||
ARRAY_DEF(SubGhzSettingCustomPresetItemArray, SubGhzSettingCustomPresetItem, M_POD_OPLIST)
|
||||
ARRAY_DEF(SubGhzSettingCustomPresetItemArray, SubGhzSettingCustomPresetItem, M_POD_OPLIST) //-V658
|
||||
|
||||
#define M_OPL_SubGhzSettingCustomPresetItemArray_t() \
|
||||
ARRAY_OPLIST(SubGhzSettingCustomPresetItemArray, M_POD_OPLIST)
|
||||
|
||||
@@ -29,6 +29,7 @@ env.Append(
|
||||
File("version.h"),
|
||||
File("float_tools.h"),
|
||||
File("tar/tar_archive.h"),
|
||||
File("str_buffer.h"),
|
||||
File("stream/stream.h"),
|
||||
File("stream/file_stream.h"),
|
||||
File("stream/string_stream.h"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "cli_shell_completions.h"
|
||||
|
||||
ARRAY_DEF(CommandCompletions, FuriString*, FURI_STRING_OPLIST); // -V524
|
||||
ARRAY_DEF(CommandCompletions, FuriString*, FURI_STRING_OPLIST); // -V524 //-V658
|
||||
#define M_OPL_CommandCompletions_t() ARRAY_OPLIST(CommandCompletions)
|
||||
|
||||
struct CliShellCompletions {
|
||||
|
||||
18
lib/toolbox/str_buffer.c
Normal file
18
lib/toolbox/str_buffer.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "str_buffer.h"
|
||||
|
||||
const char* str_buffer_make_owned_clone(StrBuffer* buffer, const char* str) {
|
||||
char* owned = strdup(str);
|
||||
buffer->n_owned_strings++;
|
||||
buffer->owned_strings =
|
||||
realloc(buffer->owned_strings, buffer->n_owned_strings * sizeof(const char*)); // -V701
|
||||
buffer->owned_strings[buffer->n_owned_strings - 1] = owned;
|
||||
return owned;
|
||||
}
|
||||
|
||||
void str_buffer_clear_all_clones(StrBuffer* buffer) {
|
||||
for(size_t i = 0; i < buffer->n_owned_strings; i++) {
|
||||
free(buffer->owned_strings[i]);
|
||||
}
|
||||
free(buffer->owned_strings);
|
||||
buffer->owned_strings = NULL;
|
||||
}
|
||||
47
lib/toolbox/str_buffer.h
Normal file
47
lib/toolbox/str_buffer.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file str_buffer.h
|
||||
*
|
||||
* Allows you to create an owned clone of however many strings that you need,
|
||||
* then free all of them at once. Essentially the simplest possible append-only
|
||||
* unindexable array of owned C-style strings.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief StrBuffer instance
|
||||
*
|
||||
* Place this struct directly wherever you want, it doesn't have to be `alloc`ed
|
||||
* and `free`d.
|
||||
*/
|
||||
typedef struct {
|
||||
char** owned_strings;
|
||||
size_t n_owned_strings;
|
||||
} StrBuffer;
|
||||
|
||||
/**
|
||||
* @brief Makes a owned duplicate of the provided string
|
||||
*
|
||||
* @param[in] buffer StrBuffer instance
|
||||
* @param[in] str Input C-style string
|
||||
*
|
||||
* @returns C-style string that contains to be valid event after `str` becomes
|
||||
* invalid
|
||||
*/
|
||||
const char* str_buffer_make_owned_clone(StrBuffer* buffer, const char* str);
|
||||
|
||||
/**
|
||||
* @brief Clears all owned duplicates
|
||||
*
|
||||
* @param[in] buffer StrBuffer instance
|
||||
*/
|
||||
void str_buffer_clear_all_clones(StrBuffer* buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -80,7 +80,7 @@ StrintParseError strint_to_uint64_internal(
|
||||
|
||||
if(result > mul_limit) return StrintParseOverflowError;
|
||||
result *= base;
|
||||
if(result > limit - digit_value) return StrintParseOverflowError;
|
||||
if(result > limit - digit_value) return StrintParseOverflowError; //-V658
|
||||
result += digit_value;
|
||||
|
||||
read_total++;
|
||||
|
||||
Reference in New Issue
Block a user