diff --git a/include/core/bfttf.h b/include/core/bfttf.h index cbf15ea..214ce44 100644 --- a/include/core/bfttf.h +++ b/include/core/bfttf.h @@ -31,14 +31,13 @@ extern "C" { /// Loosely based on PlSharedFontType. typedef enum { - BfttfFontType_Standard = 0, ///< Japan, US and Europe - BfttfFontType_NintendoExt1 = 1, ///< Nintendo Extended (1). This font only has the special Nintendo-specific characters, which aren't available with the other fonts. - BfttfFontType_NintendoExt2 = 2, ///< Nintendo Extended (2). This font only has the special Nintendo-specific characters, which aren't available with the other fonts. - BfttfFontType_Korean = 3, ///< Korean (Hangul). - BfttfFontType_ChineseSimplified = 4, ///< Chinese Simplified. - BfttfFontType_ExtChineseSimplified = 5, ///< Extended Chinese Simplified. - BfttfFontType_ChineseTraditional = 6, ///< Chinese Traditional. - BfttfFontType_Total = 7 ///< Total fonts supported by this enum. + BfttfFontType_Standard = 0, ///< Japan, US and Europe. + BfttfFontType_NintendoExt = 1, ///< Extended Nintendo. This font contains special, Nintendo-specific characters, which aren't available in the other fonts. + BfttfFontType_Korean = 2, ///< Korean (Hangul). + BfttfFontType_ChineseSimplified = 3, ///< Simplified Chinese. + BfttfFontType_ExtChineseSimplified = 4, ///< Extended Simplified Chinese. + BfttfFontType_ChineseTraditional = 5, ///< Traditional Chinese. + BfttfFontType_Total = 6 ///< Total fonts supported by this enum. } BfttfFontType; /// Loosely based on PlFontData. diff --git a/include/core/nxdt_log.h b/include/core/nxdt_log.h index 821d2d9..3e697b3 100644 --- a/include/core/nxdt_log.h +++ b/include/core/nxdt_log.h @@ -37,14 +37,14 @@ extern "C" { void logWriteStringToLogFile(const char *src); /// Writes a formatted log string to the logfile. -void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...); +__attribute__((format(printf, 2, 3))) void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...); /// Writes a formatted log string to the provided buffer. /// If the buffer isn't big enough to hold both its current contents and the new formatted string, it will be resized. -void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...); +__attribute__((format(printf, 4, 5))) void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...); /// Writes a formatted log string + a hex string representation of the provided binary data to the logfile. -void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...); +__attribute__((format(printf, 4, 5))) void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...); /// Forces a flush operation on the logfile. void logFlushLogFile(void); diff --git a/include/core/nxdt_utils.h b/include/core/nxdt_utils.h index edafcd1..d661ce3 100644 --- a/include/core/nxdt_utils.h +++ b/include/core/nxdt_utils.h @@ -78,7 +78,7 @@ void utilsWaitForButtonPress(u64 flag); /// Formats a string and appends it to the provided buffer. /// If the buffer isn't big enough to hold both its current contents and the new formatted string, it will be resized. -bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...); +__attribute__((format(printf, 3, 4))) bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...); /// Replaces illegal FAT characters in the provided string with underscores. /// If 'ascii_only' is set to true, all characters outside the (0x20,0x7E] range will also be replaced with underscores. diff --git a/source/core/bfttf.c b/source/core/bfttf.c index 956de3e..6b4d561 100644 --- a/source/core/bfttf.c +++ b/source/core/bfttf.c @@ -41,8 +41,7 @@ static bool g_bfttfInterfaceInit = false; static BfttfFontInfo g_fontInfo[] = { { 0x0100000000000811, "/nintendo_udsg-r_std_003.bfttf", 0, NULL }, /* FontStandard. */ - { 0x0100000000000810, "/nintendo_ext_003.bfttf", 0, NULL }, /* FontNintendoExtension (1).*/ - { 0x0100000000000810, "/nintendo_ext2_003.bfttf", 0, NULL }, /* FontNintendoExtension (2).*/ + { 0x0100000000000810, "/nintendo_ext_003.bfttf", 0, NULL }, /* FontNintendoExtension. There's a secondary entry at "/nintendo_ext2_003.bfttf", but it's identical to this one. */ { 0x0100000000000812, "/nintendo_udsg-r_ko_003.bfttf", 0, NULL }, /* FontKorean. */ { 0x0100000000000814, "/nintendo_udsg-r_org_zh-cn_003.bfttf", 0, NULL }, /* FontChineseSimplified (1). */ { 0x0100000000000814, "/nintendo_udsg-r_ext_zh-cn_003.bfttf", 0, NULL }, /* FontChineseSimplified (2). */ diff --git a/source/core/cert.c b/source/core/cert.c index bd81b48..4332095 100644 --- a/source/core/cert.c +++ b/source/core/cert.c @@ -164,7 +164,7 @@ u8 *certRetrieveRawCertificateChainFromGameCardByRightsId(const FsRightsId *id, raw_chain = malloc(raw_chain_size); if (!raw_chain) { - LOG_MSG("Unable to allocate memory for raw \"%s\" certificate chain! (0x%lX).", raw_chain_size); + LOG_MSG("Unable to allocate memory for raw \"%s\" certificate chain! (0x%lX).", raw_chain_filename, raw_chain_size); return NULL; } diff --git a/source/core/nso.c b/source/core/nso.c index 4f4d540..769aabb 100644 --- a/source/core/nso.c +++ b/source/core/nso.c @@ -236,7 +236,7 @@ static u8 *nsoGetRodataSegment(NsoContext *nso_ctx) /* Read .rodata segment data. */ if (!pfsReadEntryData(nso_ctx->pfs_ctx, nso_ctx->pfs_entry, rodata_read_ptr, rodata_read_size, nso_ctx->nso_header.rodata_segment_info.file_offset)) { - LOG_MSG("Failed to read %s .rodata segment in NRO \"%s\"!", nso_ctx->nso_filename); + LOG_MSG("Failed to read .rodata segment in NRO \"%s\"!", nso_ctx->nso_filename); goto end; } diff --git a/source/core/nxdt_log.c b/source/core/nxdt_log.c index 2be0e5d..a81dae6 100644 --- a/source/core/nxdt_log.c +++ b/source/core/nxdt_log.c @@ -56,7 +56,7 @@ void logWriteStringToLogFile(const char *src) _logWriteStringToLogFile(src, true); } -void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...) +__attribute__((format(printf, 2, 3))) void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -64,7 +64,7 @@ void logWriteFormattedStringToLogFile(const char *func_name, const char *fmt, .. va_end(args); } -void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...) +__attribute__((format(printf, 4, 5))) void logWriteFormattedStringToBuffer(char **dst, size_t *dst_size, const char *func_name, const char *fmt, ...) { if (!dst || !dst_size || (!*dst && *dst_size) || (*dst && !*dst_size) || !func_name || !*func_name || !fmt || !*fmt) return; @@ -127,7 +127,7 @@ end: va_end(args); } -void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...) +__attribute__((format(printf, 4, 5))) void logWriteBinaryDataToLogFile(const void *data, size_t data_size, const char *func_name, const char *fmt, ...) { if (!data || !data_size || !func_name || !*func_name || !fmt || !*fmt) return; diff --git a/source/core/nxdt_utils.c b/source/core/nxdt_utils.c index 92e5453..6c47c37 100644 --- a/source/core/nxdt_utils.c +++ b/source/core/nxdt_utils.c @@ -355,7 +355,7 @@ void utilsWaitForButtonPress(u64 flag) } } -bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...) +__attribute__((format(printf, 3, 4))) bool utilsAppendFormattedStringToBuffer(char **dst, size_t *dst_size, const char *fmt, ...) { if (!dst || !dst_size || (!*dst && *dst_size) || (*dst && !*dst_size) || !fmt || !*fmt) { diff --git a/source/core/tik.c b/source/core/tik.c index 432c9f9..deaaab8 100644 --- a/source/core/tik.c +++ b/source/core/tik.c @@ -508,7 +508,7 @@ static bool tikRetrieveRightsIdsByTitleKeyType(FsRightsId **out, u32 *out_count, rc = (personalized ? esCountPersonalizedTicket((s32*)&count) : esCountCommonTicket((s32*)&count)); if (R_FAILED(rc)) { - LOG_MSG("esCount%c%sTicket failed! (0x%08X).", toupper(g_tikTitleKeyTypeStrings[str_idx][0]), g_tikTitleKeyTypeStrings[str_idx] + 1); + LOG_MSG("esCount%c%sTicket failed! (0x%08X).", toupper(g_tikTitleKeyTypeStrings[str_idx][0]), g_tikTitleKeyTypeStrings[str_idx] + 1, rc); return false; } @@ -647,7 +647,7 @@ static bool tikRetrieveTicketEntryFromTicketBin(save_ctx_t *save_ctx, u8 *buf, u /* Read ticket data. */ if ((br = save_allocation_table_storage_read(&fat_storage, buf, ticket_offset, SIGNED_TIK_MAX_SIZE)) != SIGNED_TIK_MAX_SIZE) { - LOG_MSG("Failed to read 0x%lX bytes long ticket at offset 0x%lX from \"%s\" in ES %s ticket system save!", SIGNED_TIK_MAX_SIZE, ticket_offset, TIK_DB_STORAGE_PATH, \ + LOG_MSG("Failed to read 0x%X-byte long ticket at offset 0x%lX from \"%s\" in ES %s ticket system save!", SIGNED_TIK_MAX_SIZE, ticket_offset, TIK_DB_STORAGE_PATH, \ g_tikTitleKeyTypeStrings[titlekey_type]); return false; } diff --git a/source/core/title.c b/source/core/title.c index 114f124..b3e0ae8 100644 --- a/source/core/title.c +++ b/source/core/title.c @@ -1269,7 +1269,7 @@ static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplica rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, title_id, g_nsAppControlData, sizeof(NsApplicationControlData), &write_size); if (R_FAILED(rc)) { - LOG_MSG("nsGetApplicationControlData failed for title ID \"%016lX\"! (0x%08X).", rc, title_id); + LOG_MSG("nsGetApplicationControlData failed for title ID \"%016lX\"! (0x%08X).", title_id, rc); return false; } @@ -1688,7 +1688,7 @@ static bool titleGetContentInfosFromTitle(u8 storage_id, const NcmContentMetaKey if (content_meta_header_read_size != sizeof(NcmContentMetaHeader)) { - LOG_MSG("Content meta header size mismatch! (0x%lX != 0x%lX).", rc, content_meta_header_read_size, sizeof(NcmContentMetaHeader)); + LOG_MSG("Content meta header size mismatch! (0x%lX != 0x%lX).", content_meta_header_read_size, sizeof(NcmContentMetaHeader)); goto end; }