mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
* FBT: cdefines to env, libs order * API: strtod, modf, itoa, calloc * Apps: elk js * Apps: mjs * JS: scripts as assets * mjs: composite resolver * mjs: stack trace * ELK JS example removed * MJS thread, MJS lib modified to support script interruption * JS console UI * Module system, BadUSB bindings rework * JS notifications, simple dialog, BadUSB demo * Custom dialogs, dialog demo * MJS as system library, some dirty hacks to make it compile * Plugin-based js modules * js_uart(BadUART) module * js_uart: support for byte array arguments * Script icon and various fixes * File browser: multiple extensions filter, running js scripts from app loader * Running js scripts from archive browser * JS Runner as system app * Example scripts moved to /ext/apps/Scripts * JS bytecode listing generation * MJS builtin printf cleanup * JS examples cleanup * mbedtls version fix * Unused lib cleanup * Making PVS happy & TODOs cleanup * TODOs cleanup #2 * MJS: initial typed arrays support * JS: fix mem leak in uart destructor Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
66 lines
1.6 KiB
C
66 lines
1.6 KiB
C
#include <furi.h>
|
|
#include <toolbox/stream/file_stream.h>
|
|
#include "../cs_dbg.h"
|
|
#include "../frozen/frozen.h"
|
|
|
|
char* cs_read_file(const char* path, size_t* size) {
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
Stream* stream = file_stream_alloc(storage);
|
|
char* data = NULL;
|
|
if(!file_stream_open(stream, path, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
|
} else {
|
|
*size = stream_size(stream);
|
|
data = (char*)malloc(*size + 1);
|
|
if(data != NULL) {
|
|
stream_rewind(stream);
|
|
if(stream_read(stream, (uint8_t*)data, *size) != *size) {
|
|
file_stream_close(stream);
|
|
furi_record_close(RECORD_STORAGE);
|
|
stream_free(stream);
|
|
free(data);
|
|
return NULL;
|
|
}
|
|
data[*size] = '\0';
|
|
}
|
|
}
|
|
file_stream_close(stream);
|
|
furi_record_close(RECORD_STORAGE);
|
|
stream_free(stream);
|
|
return data;
|
|
}
|
|
|
|
char* json_fread(const char* path) {
|
|
UNUSED(path);
|
|
return NULL;
|
|
}
|
|
|
|
int json_vfprintf(const char* file_name, const char* fmt, va_list ap) {
|
|
UNUSED(file_name);
|
|
UNUSED(fmt);
|
|
UNUSED(ap);
|
|
return 0;
|
|
}
|
|
|
|
int json_prettify_file(const char* file_name) {
|
|
UNUSED(file_name);
|
|
return 0;
|
|
}
|
|
|
|
int json_printer_file(struct json_out* out, const char* buf, size_t len) {
|
|
UNUSED(out);
|
|
UNUSED(buf);
|
|
UNUSED(len);
|
|
return 0;
|
|
}
|
|
|
|
int cs_log_print_prefix(enum cs_log_level level, const char* file, int ln) {
|
|
(void)level;
|
|
(void)file;
|
|
(void)ln;
|
|
return 0;
|
|
}
|
|
|
|
void cs_log_printf(const char* fmt, ...) {
|
|
(void)fmt;
|
|
}
|