diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-01 01:03:22 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-10-01 12:10:41 +0100 |
commit | 18fc68401ca075980ea7739df65bcddb9e4a8ef3 (patch) | |
tree | 52c00260799338eb71f1cd183818d8e4d1b00f62 /apps/talk.c | |
parent | 1131320d4877ba390906d3f9cda7e3897b58d68b (diff) | |
download | rockbox-18fc68401ca075980ea7739df65bcddb9e4a8ef3.tar.gz rockbox-18fc68401ca075980ea7739df65bcddb9e4a8ef3.zip |
Remove structec API from talk.c
Change-Id: I6e3bae2a893c932b67b4b5a7c4bf46060e5dc32a
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/apps/talk.c b/apps/talk.c index 5d6e7ac0b6..fb2f9cf3df 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -41,7 +41,6 @@ | |||
41 | /*#define LOGF_ENABLE*/ | 41 | /*#define LOGF_ENABLE*/ |
42 | #include "logf.h" | 42 | #include "logf.h" |
43 | #include "bitswap.h" | 43 | #include "bitswap.h" |
44 | #include "structec.h" | ||
45 | #include "plugin.h" /* plugin_get_buffer() */ | 44 | #include "plugin.h" /* plugin_get_buffer() */ |
46 | #include "debug.h" | 45 | #include "debug.h" |
47 | #include "panic.h" | 46 | #include "panic.h" |
@@ -502,23 +501,24 @@ static bool load_index_table(int fd, const struct voicefile_header *hdr) | |||
502 | return false; | 501 | return false; |
503 | 502 | ||
504 | ret = read_to_handle(fd, index_handle, 0, alloc_size); | 503 | ret = read_to_handle(fd, index_handle, 0, alloc_size); |
505 | 504 | if (ret != alloc_size) | |
506 | if (ret == alloc_size) | ||
507 | { | 505 | { |
506 | index_handle = core_free(index_handle); | ||
507 | return false; | ||
508 | } | ||
509 | |||
508 | #ifdef ROCKBOX_LITTLE_ENDIAN | 510 | #ifdef ROCKBOX_LITTLE_ENDIAN |
509 | struct clip_entry *buf; | 511 | struct clip_entry *buf, *end; |
510 | buf = core_get_data(index_handle); | 512 | buf = core_get_data(index_handle); |
511 | for (int i = 0; i < hdr->id1_max + hdr->id2_max; i++) | 513 | end = buf + hdr->id1_max + hdr->id2_max; |
512 | { | 514 | for (; buf != end; buf++) |
513 | /* doesn't yield() */ | 515 | { |
514 | structec_convert(&buf[i], "ll", 1, true); | 516 | buf->offset = swap32(buf->offset); |
515 | } | 517 | buf->size = swap32(buf->size); |
516 | #endif | ||
517 | } | 518 | } |
518 | else | 519 | #endif |
519 | index_handle = core_free(index_handle); | ||
520 | 520 | ||
521 | return ret == alloc_size; | 521 | return true; |
522 | } | 522 | } |
523 | 523 | ||
524 | static bool load_header(int fd, struct voicefile_header *hdr) | 524 | static bool load_header(int fd, struct voicefile_header *hdr) |
@@ -528,8 +528,11 @@ static bool load_header(int fd, struct voicefile_header *hdr) | |||
528 | return false; | 528 | return false; |
529 | 529 | ||
530 | #ifdef ROCKBOX_LITTLE_ENDIAN | 530 | #ifdef ROCKBOX_LITTLE_ENDIAN |
531 | logf("Byte swapping voice file"); | 531 | hdr->version = swap32(hdr->version); |
532 | structec_convert(&voicefile, "lllll", 1, true); | 532 | hdr->target_id = swap32(hdr->target_id); |
533 | hdr->table = swap32(hdr->table); | ||
534 | hdr->id1_max = swap32(hdr->id1_max); | ||
535 | hdr->id2_max = swap32(hdr->id2_max); | ||
533 | #endif | 536 | #endif |
534 | return true; | 537 | return true; |
535 | } | 538 | } |