diff --git a/Makefile b/Makefile index cec8e4e..0141186 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ INCLUDES := common source source/common source/font source/filesys source/crypto #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -ARCH := -DARM9 -march=armv5te -mthumb -mthumb-interwork -flto +ARCH := -DARM9 -march=armv5te -mthumb -mthumb-interwork ASFLAGS := $(ARCH) -g -x assembler-with-cpp $(INCLUDE) CFLAGS := $(ARCH) -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2 \ diff --git a/source/godmode.c b/source/godmode.c index b67258a..024149e 100644 --- a/source/godmode.c +++ b/source/godmode.c @@ -60,6 +60,7 @@ #define BOOTFIRM_TEMPS 0x1 // bits mark paths as temporary #ifdef SALTMODE // ShadowHand's own bootmenu key override +#undef BOOTMENU_KEY #define BOOTMENU_KEY BUTTON_START #endif @@ -387,12 +388,12 @@ u32 FileHexViewer(const char* path) { u8* bottom_cpy = TEMP_BUFFER + 0xC0000; // a copy of the bottom screen framebuffer u32 fsize = FileGetSize(path); - bool dual_screen; - int x_off, x_hex, x_ascii; - u32 vpad, hlpad, hrpad; - u32 rows, cols; - u32 total_shown; - u32 total_data; + bool dual_screen = 0; + int x_off = 0, x_hex = 0, x_ascii = 0; + u32 vpad = 0, hlpad = 0, hrpad = 0; + u32 rows = 0, cols = 0; + u32 total_shown = 0; + u32 total_data = 0; u32 last_mode = 0xFF; u32 last_offset = (u32) -1; @@ -405,7 +406,7 @@ u32 FileHexViewer(const char* path) { bool edit_mode = false; u8* edit_buffer = TEMP_BUFFER; u8* edit_buffer_cpy = TEMP_BUFFER + edit_bsize; - u32 edit_start; + u32 edit_start = 0; int cursor = 0; static bool show_instr = true; @@ -1681,7 +1682,7 @@ u32 GodMode(bool is_b9s) { // get mode string for splash screen const char* disp_mode = NULL; - if (bootloader) disp_mode = "bootloader mode\nR+LEFT for menu"; + if (bootloader) disp_mode = "bootloader mode\nR+LEFT for menu"; else if (!is_b9s && !IS_SIGHAX) disp_mode = "oldloader mode"; else if (!is_b9s && IS_SIGHAX && (boot_origin & BOOT_NTRBOOT)) disp_mode = "ntrboot mode"; // else if (!is_b9s || !IS_SIGHAX) disp_mode = "unknown mode"; diff --git a/source/qrcodegen/qrcodegen.c b/source/qrcodegen/qrcodegen.c index 3ad4bec..59f1056 100644 --- a/source/qrcodegen/qrcodegen.c +++ b/source/qrcodegen/qrcodegen.c @@ -425,7 +425,7 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { static void drawFormatBits(enum qrcodegen_Ecc ecl, enum qrcodegen_Mask mask, uint8_t qrcode[]) { // Calculate error correction code and pack bits assert(0 <= (int)mask && (int)mask <= 7); - int data; + int data = 0; switch (ecl) { case qrcodegen_Ecc_LOW : data = 1; break; case qrcodegen_Ecc_MEDIUM : data = 0; break; @@ -530,7 +530,7 @@ static void applyMask(const uint8_t functionModules[], uint8_t qrcode[], enum qr for (int x = 0; x < qrsize; x++) { if (getModule(functionModules, x, y)) continue; - bool invert; + bool invert = false; switch ((int)mask) { case 0: invert = (x + y) % 2 == 0; break; case 1: invert = y % 2 == 0; break; @@ -920,7 +920,7 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz int bitLen = 0; for (size_t i = 0; i < len; i++) { const struct qrcodegen_Segment *seg = &segs[i]; - unsigned int modeBits; + unsigned int modeBits = 0; switch (seg->mode) { case qrcodegen_Mode_NUMERIC : modeBits = 0x1; break; case qrcodegen_Mode_ALPHANUMERIC: modeBits = 0x2; break; @@ -1007,7 +1007,7 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int // given mode at the given version number. The result is in the range [0, 16]. static int numCharCountBits(enum qrcodegen_Mode mode, int version) { assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); - int i; + int i = 0; if ( 1 <= version && version <= 9) i = 0; else if (10 <= version && version <= 26) i = 1; else if (27 <= version && version <= 40) i = 2; diff --git a/source/utils/scripting.c b/source/utils/scripting.c index 8037028..1f424e6 100644 --- a/source/utils/scripting.c +++ b/source/utils/scripting.c @@ -844,7 +844,7 @@ void MemTextView(const char* text, u32 len, char* line0, int off_disp, int lno, bool ar = !ww && ((int) llen > off_disp + TV_LLEN_DISP); // set text color / find start of comment of scripts - u32 color_text = (nln == mno) ? script_color_active : (is_script) ? script_color_code : COLOR_TVTEXT; + u32 color_text = (nln == mno) ? script_color_active : (is_script) ? script_color_code : (u32) COLOR_TVTEXT; int cmt_start = TV_LLEN_DISP; // start of comment in current displayed line (may be negative) if (is_script && (nln != mno)) { char* hash = line_seek(text, len, 0, ptr, 0); diff --git a/source/virtual/vgame.c b/source/virtual/vgame.c index 062d9fe..fdd2d9d 100644 --- a/source/virtual/vgame.c +++ b/source/virtual/vgame.c @@ -909,7 +909,7 @@ bool ReadVGameDirNitro(VirtualFile* vfile, VirtualDir* vdir) { } bool ReadVGameDir(VirtualFile* vfile, VirtualDir* vdir) { - VirtualFile* templates; + VirtualFile* templates = NULL; int n = 0; if (vdir->flags & VFLAG_FIRM) { diff --git a/source/virtual/vnand.c b/source/virtual/vnand.c index 322783e..f2c04e8 100644 --- a/source/virtual/vnand.c +++ b/source/virtual/vnand.c @@ -63,7 +63,7 @@ bool ReadVNandDir(VirtualFile* vfile, VirtualDir* vdir) { // uses a generic vdir prt_info.keyslot = 0xFF; } else if (GetNandPartitionInfo(&prt_info, template->type, template->subtype, template->index, nand_src) != 0) continue; - snprintf(vfile->name, 32, "%s%s", template->name, (nand_src == VRT_XORPAD) ? ".xorpad" : ""); + snprintf(vfile->name, 32, "%.24s%s", template->name, (nand_src == VRT_XORPAD) ? ".xorpad" : ""); vfile->offset = ((u64) prt_info.sector) * 0x200; vfile->size = ((u64) prt_info.count) * 0x200; vfile->keyslot = prt_info.keyslot; diff --git a/source/virtual/vtickdb.c b/source/virtual/vtickdb.c index e1156de..565b9f7 100644 --- a/source/virtual/vtickdb.c +++ b/source/virtual/vtickdb.c @@ -52,7 +52,7 @@ u32 AddTickDbInfo(TickDbInfo* info, Ticket* ticket, u32 offset) { for (; t < info->n_entries; t++) { TickDbEntry* entry0 = info->entries + t; if (memcmp(entry->title_id, entry0->title_id, 8) != 0) continue; - if (!getbe64(entry0->console_id)) // replace this + if (!getbe32(entry0->console_id)) // replace this memcpy(entry0, entry, sizeof(TickDbEntry)); break; }