diff --git a/libticonv/trunk/src/Makefile.am b/libticonv/trunk/src/Makefile.am index b97dbba4..6858532d 100644 --- a/libticonv/trunk/src/Makefile.am +++ b/libticonv/trunk/src/Makefile.am @@ -32,4 +32,5 @@ if OS_MAC libticonv_la_LDFLAGS += -L/usr/local/opt/libiconv/lib/ libticonv_la_LIBADD += -liconv endif + libticonv_la_CPPFLAGS += -DUSE_ICONV endif \ No newline at end of file diff --git a/libticonv/trunk/src/charset.cc b/libticonv/trunk/src/charset.cc index 45c897fb..3dc15cb2 100644 --- a/libticonv/trunk/src/charset.cc +++ b/libticonv/trunk/src/charset.cc @@ -127,14 +127,14 @@ static char * ticonv_utf16_to_nonusb(const unsigned long * charset, const unsign p++; } - *(q++) = c; + *(q++) = (unsigned char)c; // c < 256 if we come here... } else { *q = '?'; for (unsigned int i = 0; i < 256; i++) { if (charset[i] == c) { - *q = i; + *q = (unsigned char)i; break; } } diff --git a/libticonv/trunk/src/filename.cc b/libticonv/trunk/src/filename.cc index 2e86cedf..1cdb874b 100644 --- a/libticonv/trunk/src/filename.cc +++ b/libticonv/trunk/src/filename.cc @@ -57,7 +57,7 @@ char* TICALL ticonv_utf16_to_gfe(CalcModel model, const unsigned short *src) { const int is_utf8 = ticonv_environment_is_utf8(); const char *str; - unsigned short *utf16_src; + const unsigned short *utf16_src; unsigned short *utf16_dst; char *dst; @@ -67,7 +67,7 @@ char* TICALL ticonv_utf16_to_gfe(CalcModel model, const unsigned short *src) } // detokenization to UTF-16 - unsigned short* p = utf16_src = (unsigned short*)src; + const unsigned short* p = utf16_src = src; unsigned short* q = utf16_dst = (unsigned short*)g_malloc0(18 * ticonv_utf16_strlen(utf16_src) + 2); // conversion from UTF-16 to UTF-16 @@ -136,7 +136,7 @@ char* TICALL ticonv_utf16_to_gfe(CalcModel model, const unsigned short *src) { if (*p >= 0x2080 && *p <= 0x2089) { - *q++ = (*p++ - 0x2080) + '0'; + *q++ = (unsigned short)((*p++ - 0x2080) + '0'); } else { @@ -243,7 +243,7 @@ void TICALL ticonv_gfe_free(char *src) **/ char* TICALL ticonv_gfe_to_zfe(CalcModel model, const char *src_) { - char *src; + const char *src; char *dst; if (src_ == nullptr) @@ -256,7 +256,7 @@ char* TICALL ticonv_gfe_to_zfe(CalcModel model, const char *src_) // ticonv_utf16_to_gfe. if (!ticonv_environment_has_utf8_filenames()) return g_strdup(src_); - const char* p = src = (char*)src_; + const char* p = src = src_; char* q = dst = (char*)g_malloc0(18 * strlen(src) + 1); while(*p) diff --git a/libticonv/trunk/src/ticonv.cc b/libticonv/trunk/src/ticonv.cc index 02041d97..cc7d0e80 100644 --- a/libticonv/trunk/src/ticonv.cc +++ b/libticonv/trunk/src/ticonv.cc @@ -221,6 +221,7 @@ char* TICALL ticonv_charset_utf16_to_ti_s(CalcModel model, const unsigned short return ti; } break; + case CALC_NONE: case CALC_TIPRESENTER: default: { @@ -343,6 +344,7 @@ unsigned short* TICALL ticonv_charset_ti_to_utf16_s(CalcModel model, const char return utf16; } break; + case CALC_NONE: case CALC_TIPRESENTER: default: utf16[0] = 0; return utf16; } @@ -1284,6 +1286,7 @@ CalcProductIDs TICALL ticonv_model_to_product_id(CalcModel model) case CALC_CBR2: return PRODUCT_ID_NONE; case CALC_LABPRO: return PRODUCT_ID_LABPRO; case CALC_TIPRESENTER: return PRODUCT_ID_TIPRESENTER; + case CALC_NONE: default: return PRODUCT_ID_NONE; } } diff --git a/libticonv/trunk/src/tokens.cc b/libticonv/trunk/src/tokens.cc index 89d3662a..4532414e 100644 --- a/libticonv/trunk/src/tokens.cc +++ b/libticonv/trunk/src/tokens.cc @@ -172,7 +172,7 @@ static char *detokenize_varname(CalcModel model, const char *src, unsigned char { if (tok2 != 0x09) { - dst = g_strdup_printf("Image%d", tok2 + 1); + dst = g_strdup_printf("Image%u", tok2 + 1); } else { @@ -335,11 +335,11 @@ static char *detokenize_varname(CalcModel model, const char *src, unsigned char case 0x60: /* Pictures */ if (model == CALC_TI73) { - dst = g_strdup_printf("Pic%d", tok2); + dst = g_strdup_printf("Pic%u", tok2); } else if (tok2 != 0x09) { - dst = g_strdup_printf("Pic%d", tok2 + 1); + dst = g_strdup_printf("Pic%u", tok2 + 1); } else { @@ -350,11 +350,11 @@ static char *detokenize_varname(CalcModel model, const char *src, unsigned char case 0x61: /* GDB */ if (model == CALC_TI73) { - dst = g_strdup_printf("GDB%d", tok2); + dst = g_strdup_printf("GDB%u", tok2); } else if (tok2 != 0x09) { - dst = g_strdup_printf("GDB%d", tok2 + 1); + dst = g_strdup_printf("GDB%u", tok2 + 1); } else { @@ -489,11 +489,11 @@ static char *detokenize_varname(CalcModel model, const char *src, unsigned char case 0xAA: if (model == CALC_TI73) { - dst = g_strdup_printf("Str%d", tok2); + dst = g_strdup_printf("Str%u", tok2); } else if (tok2 != 0x09) { - dst = g_strdup_printf("Str%d", tok2 + 1); + dst = g_strdup_printf("Str%u", tok2 + 1); } else { @@ -555,6 +555,7 @@ char* TICALL ticonv_varname_detokenize(CalcModel model, const char *src, unsigne { return dst; } + return g_strdup(src); case CALC_TI89: case CALC_TI89T: case CALC_TI92: diff --git a/libticonv/trunk/tests/test_ticonv.cc b/libticonv/trunk/tests/test_ticonv.cc index b2c4c8b4..43d3d960 100644 --- a/libticonv/trunk/tests/test_ticonv.cc +++ b/libticonv/trunk/tests/test_ticonv.cc @@ -74,7 +74,7 @@ int main(int argc, char **argv) printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n"); - for(int i = 0; i < 16; i++) + for (unsigned int i = 0; i < 16; i++) { printf("%x ", i); for(int j = 0; j < 16; j++) diff --git a/libticonv/trunk/tests/torture_ticonv.c b/libticonv/trunk/tests/torture_ticonv.c index 87eaab22..92af2e55 100644 --- a/libticonv/trunk/tests/torture_ticonv.c +++ b/libticonv/trunk/tests/torture_ticonv.c @@ -14,7 +14,8 @@ fprintf(stderr, "%d\t" TYPE "\n", __LINE__, FUNCTION(__VA_ARGS__)) FUNCTION(__VA_ARGS__); fprintf(stderr, "%d\n", __LINE__) #define INT "%d" -#define SIZE "%zd" +#define UINT "%u" +#define SIZE "%zu" #define PTR "%p" #define STR "\"%s\"" @@ -84,7 +85,7 @@ int main(int argc, char **argv) PRINTF(ticonv_model_has_real_screen, INT, CALC_NONE); PRINTF(ticonv_model_has_monochrome_screen, INT, CALC_NONE); PRINTF(ticonv_model_has_color_screen, INT, CALC_NONE); - PRINTF(ticonv_model_to_product_id, INT, CALC_NONE); + PRINTF(ticonv_model_to_product_id, UINT, CALC_NONE); PRINTF(ticonv_varname_to_utf16_s, PTR, -1, NULL, (void *)0x12345678, 0); PRINTF(ticonv_varname_to_utf16_s, PTR, -1, (void *)0x12345678, NULL, 0); PRINTF(ticonv_varname_to_utf16, PTR, -1, NULL, 0); @@ -112,7 +113,7 @@ int main(int argc, char **argv) PRINTF(ticonv_varname_from_tifile, STR, -1, NULL, 0); PRINTF(ticonv_model_to_string, STR, CALC_NONE); - PRINTF(ticonv_string_to_model, INT, NULL); + PRINTF(ticonv_string_to_model, UINT, NULL); fprintf(stderr, "%d\t%p\n", __LINE__, ti73_charset); fprintf(stderr, "%d\t%p\n", __LINE__, ti80_charset); fprintf(stderr, "%d\t%p\n", __LINE__, ti82_charset); diff --git a/libtifiles/trunk/src/cert.cc b/libtifiles/trunk/src/cert.cc index 7e3dd8c4..ce6c878d 100644 --- a/libtifiles/trunk/src/cert.cc +++ b/libtifiles/trunk/src/cert.cc @@ -59,7 +59,7 @@ int TICALL tifiles_cert_field_get(const uint8_t *data, uint32_t length, uint16_t } // Retrieve field ID and number of additional bytes we need to read for the field's size. - const uint16_t field_id = (((uint16_t)data[0]) << 8) | data[1]; + const uint16_t field_id = (((uint16_t)data[0]) << 8) | (uint16_t)data[1]; switch (field_id & 0xF) { case 0xD: additional_len = 1; break; @@ -145,7 +145,7 @@ int TICALL tifiles_cert_field_next(const uint8_t **data, uint32_t *length) const int ret = tifiles_cert_field_get(*data, *length, nullptr, &contents, &field_size); if (!ret) { - *length -= contents + field_size - *data; + *length -= (uint32_t)((contents + field_size) - *data); *data = contents + field_size; } diff --git a/libtifiles/trunk/src/files8x.cc b/libtifiles/trunk/src/files8x.cc index aeb2c48d..da5019d9 100644 --- a/libtifiles/trunk/src/files8x.cc +++ b/libtifiles/trunk/src/files8x.cc @@ -65,33 +65,33 @@ static int is_ti83p(CalcModel model) static uint16_t compute_backup_sum(BackupContent* content, uint16_t header_size) { - uint16_t sum= 0; + uint16_t sum = 0; sum += header_size; - sum += tifiles_checksum((uint8_t *)&(content->data_length1), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length1), 2U); sum += content->type; if (header_size >= 12) { sum += content->version; } - sum += tifiles_checksum((uint8_t *)&(content->data_length2), 2); - sum += tifiles_checksum((uint8_t *)&(content->data_length3), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length2), 2U); + sum += tifiles_checksum((uint8_t *)&(content->data_length3), 2U); if (content->model != CALC_TI86) { - sum += tifiles_checksum((uint8_t *)&(content->mem_address), 2); + sum += tifiles_checksum((uint8_t *)&(content->mem_address), 2U); } else { - sum += tifiles_checksum((uint8_t *)&(content->data_length4), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length4), 2U); } - sum += tifiles_checksum((uint8_t *)&(content->data_length1), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length1), 2U); sum += tifiles_checksum(content->data_part1, content->data_length1); - sum += tifiles_checksum((uint8_t *)&(content->data_length2), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length2), 2U); sum += tifiles_checksum(content->data_part2, content->data_length2); - sum += tifiles_checksum((uint8_t *)&(content->data_length3), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length3), 2U); sum += tifiles_checksum(content->data_part3, content->data_length3); - sum += tifiles_checksum((uint8_t *)&(content->data_length4), 2); + sum += tifiles_checksum((uint8_t *)&(content->data_length4), 2U); sum += tifiles_checksum(content->data_part4, content->data_length4); return sum; @@ -295,7 +295,7 @@ int ti8x_file_read_regular(const char *filename, Ti8xRegular *content) { for (unsigned int j = 0; j < 8U - name_length; j++) { - sum += fgetc(f); + sum += (uint8_t)fgetc(f); } } if (ti83p_flag) @@ -312,7 +312,7 @@ int ti8x_file_read_regular(const char *filename, Ti8xRegular *content) else { entry->attr = ((attribute & 0x8000) ? ATTRB_ARCHIVED : ATTRB_NONE); - entry->version = attribute & 0xff; + entry->version = (uint8_t)(attribute & 0xff); } // Handle broken 84+CSE Pic files created by older versions of libtifiles. @@ -336,15 +336,15 @@ int ti8x_file_read_regular(const char *filename, Ti8xRegular *content) if (fread(entry->data, 1, entry->size, f) < entry->size) goto tfrr; sum += packet_length; - sum += tifiles_checksum((uint8_t *)&(entry->size), 2); + sum += tifiles_checksum((uint8_t *)&(entry->size), 2U); sum += entry->type; if (is_ti8586(content->model)) { - sum += strlen(entry->name); + sum += (uint16_t)strlen(entry->name); } sum += tifiles_checksum((uint8_t *)varname, name_length); sum += 0; // see above (file may be padded with garbage) - sum += tifiles_checksum((uint8_t *)&(entry->size), 2); + sum += tifiles_checksum((uint8_t *)&(entry->size), 2U); sum += tifiles_checksum(entry->data, entry->size); } @@ -575,7 +575,7 @@ static int check_data_type(uint8_t id) return 0; } -static int get_native_app_name(const FlashContent *content, char *buffer, size_t buffer_size) +static int get_native_app_name(const FlashContent *content, char *buffer, uint32_t buffer_size) { const uint8_t *data, *name; uint32_t size, n; @@ -859,7 +859,7 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real const VarEntry *entry = content->entries[i]; if (entry == nullptr) { - tifiles_warning("%s: skipping null content entry %d", __FUNCTION__, i); + tifiles_warning("%s: skipping null content entry %u", __FUNCTION__, i); continue; } @@ -873,7 +873,7 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real } else if (content->model == CALC_TI85) { - data_length += entry->size + 8 + strlen(entry->name); + data_length += entry->size + 8 + (uint32_t)strlen(entry->name); } else if (content->model == CALC_TI86) { @@ -941,7 +941,7 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real if (content->model == CALC_TI85) { - packet_length = 4 + strlen(entry->name); //offset to data length + packet_length = 4 + (uint16_t)strlen(entry->name); //offset to data length } else if (content->model == CALC_TI86) { @@ -963,7 +963,7 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real ticonv_varname_to_tifile_sn(content->model_dst, entry->name, varname, sizeof(varname), entry->type); if (is_ti8586(content->model)) { - name_length = strlen(varname); + name_length = (uint8_t)strlen(varname); if (fwrite_byte(f, (uint8_t)name_length) < 0) goto tfwr; if (content->model == CALC_TI85) { @@ -980,7 +980,7 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real } if (is_ti83p(content->model)) { - const uint16_t attr = (uint16_t)((entry->attr == ATTRB_ARCHIVED) ? 0x8000 : 0x00) + entry->version; + const uint16_t attr = (uint16_t)((entry->attr == ATTRB_ARCHIVED) ? 0x8000U : 0U) + (uint16_t)entry->version; if (fwrite_word(f, attr) < 0) goto tfwr; sum += MSB(attr); sum += LSB(attr); @@ -994,12 +994,12 @@ int ti8x_file_write_regular(const char *fname, Ti8xRegular *content, char **real sum += entry->type; if (is_ti8586(content->model)) { - sum += strlen(entry->name); + sum += (uint16_t)strlen(entry->name); } sum += tifiles_checksum((uint8_t *)varname, name_length); if (content->model == CALC_TI86) { - sum += (8 - name_length) * ' '; + sum += (uint16_t)((8U - name_length) * ' '); } sum += MSB(entry->size); sum += LSB(entry->size); @@ -1061,7 +1061,7 @@ int ti8x_file_write_backup(const char *filename, Ti8xBackup *content) if (fwrite_8_chars(f, tifiles_calctype2signature(content->model)) < 0) goto tfwb; if (fwrite(content->model == CALC_TI85 ? fsignature85 : fsignature8x, 1, 3, f) < 3) goto tfwb; if (fwrite_n_bytes(f, 42, (uint8_t *)content->comment) < 0) goto tfwb; - if (fwrite_word(f, data_length) < 0) goto tfwb; + if (fwrite_word(f, (uint16_t)data_length) < 0) goto tfwb; // Use the old-style header for versions 0 to 5 (84+ OS 2.48 and // earlier), for compatibility with older versions of libtifiles @@ -1245,7 +1245,7 @@ int ti8x_file_write_flash(const char *fname, Ti8xFlash *head, char **real_fname) { int extra_bytes = 0; - uint32_t page_length = content->pages[i]->size; + uint16_t page_length = content->pages[i]->size; if ( content->data_type == TI83p_APPL && i == content->num_pages - 1 && content->pages[0]->data[0] == 0x80 && content->pages[0]->data[1] == 0x0f) @@ -1270,7 +1270,7 @@ int ti8x_file_write_flash(const char *fname, Ti8xFlash *head, char **real_fname) page_length--; } - extra_bytes = app_length + 96 - i * 0x4000 - page_length; + extra_bytes = (int)app_length + 96 - i * 0x4000 - page_length; /* don't add padding beyond the end of the page */ if (page_length + extra_bytes >= 0x3fff) @@ -1291,7 +1291,7 @@ int ti8x_file_write_flash(const char *fname, Ti8xFlash *head, char **real_fname) bytes_written += hex_block_write(f, page_length, content->pages[i]->addr, content->pages[i]->flag, content->pages[i]->data, - content->pages[i]->page, extra_bytes); + content->pages[i]->page, (uint16_t)extra_bytes); // 0 <= extra_bytes <= 96, per the above. } // final block @@ -1341,7 +1341,7 @@ int ti8x_content_display_backup(Ti8xBackup *content) } tifiles_info("BackupContent for TI-8x: %p", content); - tifiles_info("Model: %02X (%u)", content->model, content->model); + tifiles_info("Model: %02X (%d)", (unsigned int)content->model, content->model); tifiles_info("Signature: %s", tifiles_calctype2signature(content->model)); tifiles_info("Comment: %s", content->comment); tifiles_info("Type: %02X (%s)", content->type, tifiles_vartype2string(content->model, content->type)); @@ -1379,9 +1379,9 @@ int ti8x_content_display_flash(Ti8xFlash *content) for (Ti8xFlash* ptr = content; ptr != nullptr; ptr = ptr->next) { tifiles_info("FlashContent for TI-8x: %p", ptr); - tifiles_info("Model: %02X (%u)", ptr->model, ptr->model); + tifiles_info("Model: %02X (%d)", (unsigned int)ptr->model, ptr->model); tifiles_info("Signature: %s", tifiles_calctype2signature(ptr->model)); - tifiles_info("model_dst: %02X (%u)", ptr->model_dst, ptr->model_dst); + tifiles_info("model_dst: %02X (%d)", (unsigned int)ptr->model_dst, ptr->model_dst); tifiles_info("Revision: %u.%u", ptr->revision_major, ptr->revision_minor); tifiles_info("Flags: %02X", ptr->flags); tifiles_info("Object type: %02X", ptr->object_type); @@ -1410,7 +1410,7 @@ int ti8x_content_display_flash(Ti8xFlash *content) tifiles_info("Hardware ID: %02X (%u)", ptr->hw_id, ptr->hw_id); tifiles_info("Length: %08X (%u)", ptr->data_length, ptr->data_length); tifiles_info("Data: %p", ptr->data_part); - tifiles_info("Number of pages: %i", ptr->num_pages); + tifiles_info("Number of pages: %u", ptr->num_pages); tifiles_info("Pages: %p", ptr->pages); tifiles_info("Next: %p", ptr->next); } diff --git a/libtifiles/trunk/src/files9x.cc b/libtifiles/trunk/src/files9x.cc index d4fdf5d5..a57d9568 100644 --- a/libtifiles/trunk/src/files9x.cc +++ b/libtifiles/trunk/src/files9x.cc @@ -646,7 +646,7 @@ int ti9x_file_write_regular(const char *fname, Ti9xRegular *content, char **real if (fentry == nullptr) { - tifiles_warning("%s: skipping null content entry %d", __FUNCTION__, i); + tifiles_warning("%s: skipping null content entry %u", __FUNCTION__, i); continue; } @@ -876,7 +876,7 @@ int ti9x_content_display_backup(Ti9xBackup *content) } tifiles_info("BackupContent for TI-9x: %p", content); - tifiles_info("Model: %02X (%u)", content->model, content->model); + tifiles_info("Model: %02X (%d)", (unsigned int)content->model, content->model); tifiles_info("Signature: %s", tifiles_calctype2signature(content->model)); tifiles_info("Comment: %s", content->comment); tifiles_info("ROM version: %s", content->rom_version); @@ -903,9 +903,9 @@ int ti9x_content_display_flash(Ti9xFlash *content) for (Ti9xFlash* ptr = content; ptr != nullptr; ptr = ptr->next) { tifiles_info("FlashContent for TI-9x: %p", ptr); - tifiles_info("Model: %02X (%u)", ptr->model, ptr->model); + tifiles_info("Model: %02X (%d)", (unsigned int)ptr->model, ptr->model); tifiles_info("Signature: %s", tifiles_calctype2signature(ptr->model)); - tifiles_info("model_dst: %02X (%u)", ptr->model_dst, ptr->model_dst); + tifiles_info("model_dst: %02X (%d)", (unsigned int)ptr->model_dst, ptr->model_dst); tifiles_info("Revision: %u.%u", ptr->revision_major, ptr->revision_minor); tifiles_info("Flags: %02X", ptr->flags); tifiles_info("Object type: %02X", ptr->object_type); diff --git a/libtifiles/trunk/src/filesnsp.cc b/libtifiles/trunk/src/filesnsp.cc index bb743878..aad34c5e 100644 --- a/libtifiles/trunk/src/filesnsp.cc +++ b/libtifiles/trunk/src/filesnsp.cc @@ -28,6 +28,8 @@ #include #include #include +#define __STDC_FORMAT_MACROS +#include #include #include "tifiles.h" @@ -89,7 +91,7 @@ int tnsp_file_read_regular(const char *filename, FileContent *content) VarEntry *entry = content->entries[0] = (VarEntry *)g_malloc0(sizeof(VarEntry)); gchar *basename = g_path_get_basename(filename); - gchar *ext = tifiles_fext_get(basename); + gchar *ext = const_cast(tifiles_fext_get(basename)); entry->type = tifiles_fext2vartype(content->model, ext); if (ext && ext[0]) *(ext-1) = '\0'; @@ -204,7 +206,7 @@ int tnsp_file_read_flash(const char *filename, FlashContent *content) { goto tfrf; } - content->revision_major = c; + content->revision_major = (uint8_t)c; // Skip char. c = fgetc(f); @@ -219,7 +221,7 @@ int tnsp_file_read_flash(const char *filename, FlashContent *content) { goto tfrf; } - content->revision_minor = c; + content->revision_minor = (uint8_t)c; // Skip chars. c = fgetc(f); @@ -237,7 +239,7 @@ int tnsp_file_read_flash(const char *filename, FlashContent *content) goto tfrf; } } - if (fscanf(f, "%i", &(content->data_length)) < 1) + if (fscanf(f, "%" SCNu32, &(content->data_length)) < 1) { goto tfrf; } @@ -365,16 +367,16 @@ int tnsp_content_display_flash(FlashContent *content) for (ptr = content; ptr != nullptr; ptr = ptr->next) { tifiles_info("FlashContent for TI-Nspire: %p", ptr); - tifiles_info("Model: %02X (%u)", ptr->model, ptr->model); + tifiles_info("Model: %02X (%d)", (unsigned int)ptr->model, ptr->model); tifiles_info("Signature: %s", tifiles_calctype2signature(ptr->model)); - tifiles_info("model_dst: %02X (%u)", ptr->model_dst, ptr->model_dst); + tifiles_info("model_dst: %02X (%d)", (unsigned int)ptr->model_dst, ptr->model_dst); tifiles_info("Revision: %u.%u", ptr->revision_major, ptr->revision_minor); tifiles_info("Flags: %02X", ptr->flags); tifiles_info("Object type: %02X", ptr->object_type); tifiles_info("Date: %02X/%02X/%02X%02X", ptr->revision_day, ptr->revision_month, ptr->revision_year & 0xff, (ptr->revision_year & 0xff00) >> 8); tifiles_info("Name: %s", ptr->name); tifiles_info("Data type: OS data"); - tifiles_info("Length: %08X (%i)", ptr->data_length, ptr->data_length); + tifiles_info("Length: %08X (%" PRIu32 ")", ptr->data_length, ptr->data_length); tifiles_info("Data part: %p", ptr->data_part); tifiles_info("Next: %p", ptr->next); } diff --git a/libtifiles/trunk/src/filesxx.cc b/libtifiles/trunk/src/filesxx.cc index 3292dfea..694cedab 100644 --- a/libtifiles/trunk/src/filesxx.cc +++ b/libtifiles/trunk/src/filesxx.cc @@ -297,7 +297,7 @@ int TICALL tifiles_file_display_regular(FileContent *content) return ERR_BAD_CALC; } - tifiles_info("Model: %02X (%u)", content->model, content->model); + tifiles_info("Model: %02X (%d)", (unsigned int)content->model, content->model); tifiles_info("Signature: %s", tifiles_calctype2signature(content->model)); tifiles_info("Comment: %s", content->comment); if (model_supports_folder) @@ -334,7 +334,7 @@ int TICALL tifiles_file_display_regular(FileContent *content) } tifiles_info("Checksum: %04X (%u)", content->checksum, content->checksum); - tifiles_info("Dest model: %02X (%u)", content->model_dst, content->model_dst); + tifiles_info("Dest model: %02X (%d)", (unsigned int)content->model_dst, content->model_dst); return 0; } diff --git a/libtifiles/trunk/src/filetypes.cc b/libtifiles/trunk/src/filetypes.cc index e50ad2e4..66ee5396 100644 --- a/libtifiles/trunk/src/filetypes.cc +++ b/libtifiles/trunk/src/filetypes.cc @@ -514,7 +514,7 @@ const char * TICALL tifiles_fext_of_certif(CalcModel model) * * Return value: a file extension without dot as string (like "89g"). **/ -char * TICALL tifiles_fext_get(const char *filename) +const char * TICALL tifiles_fext_get(const char *filename) { if (filename != nullptr) { diff --git a/libtifiles/trunk/src/tifiles.h b/libtifiles/trunk/src/tifiles.h index d006db52..86f0b151 100644 --- a/libtifiles/trunk/src/tifiles.h +++ b/libtifiles/trunk/src/tifiles.h @@ -357,7 +357,7 @@ typedef struct TIEXPORT2 const char* TICALL tifiles_fext_of_flash_os (CalcModel model); TIEXPORT2 const char* TICALL tifiles_fext_of_certif (CalcModel model); - TIEXPORT2 char* TICALL tifiles_fext_get (const char *filename); + TIEXPORT2 const char* TICALL tifiles_fext_get (const char *filename); TIEXPORT2 char* TICALL tifiles_fext_dup (const char *filename); TIEXPORT2 void TICALL tifiles_fext_free(char *filename);