Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

sbtools: more code refactoring

Factor all printf method with a unique one defined in misc.h

Change-Id: I58fbf8916b76e873a2e6678506d2c8aece7834ec

+69 -123
+3 -25
rbutil/mkimxboot/mkimxboot.c
··· 540 540 clear_keys(); 541 541 add_keys(imx_models[model].keys, imx_models[model].nr_keys); 542 542 *sb_file = sb_read_file_ex(file, imx_sums[md5_idx].fw_variants[opt.fw_variant].offset, 543 - imx_sums[md5_idx].fw_variants[opt.fw_variant].size, false, NULL, &sb_std_printf, &err); 543 + imx_sums[md5_idx].fw_variants[opt.fw_variant].size, false, NULL, generic_std_printf, &err); 544 544 if(*sb_file == NULL) 545 545 { 546 546 clear_keys(); ··· 595 595 size_t sz; 596 596 }; 597 597 598 - static bool elf_read(void *user, uint32_t addr, void *buf, size_t count) 599 - { 600 - struct elf_user_t *u = user; 601 - if(addr + count <= u->sz) 602 - { 603 - memcpy(buf, u->buf + addr, count); 604 - return true; 605 - } 606 - else 607 - return false; 608 - } 609 - 610 - static void elf_printf(void *user, bool error, const char *fmt, ...) 611 - { 612 - if(!g_debug && !error) 613 - return; 614 - (void) user; 615 - va_list args; 616 - va_start(args, fmt); 617 - vprintf(fmt, args); 618 - va_end(args); 619 - } 620 598 /* Load a rockbox firwmare from a buffer. Data is copied. Assume firmware is 621 599 * using ELF format. */ 622 600 static enum imx_error_t rb_fw_load_buf_elf(struct rb_fw_t *fw, uint8_t *buf, ··· 627 605 user.buf = buf; 628 606 user.sz = sz; 629 607 elf_init(&elf); 630 - if(!elf_read_file(&elf, &elf_read, &elf_printf, &user)) 608 + if(!elf_read_file(&elf, elf_std_read, generic_std_printf, &user)) 631 609 { 632 610 elf_release(&elf); 633 611 printf("[ERR] Error parsing ELF file\n"); ··· 744 722 ret = patch_firmware(model, opt.fw_variant, opt.output, 745 723 sb_file, boot_fw, opt.force_version); 746 724 if(ret == IMX_SUCCESS) 747 - ret = sb_write_file(sb_file, outfile, NULL, sb_std_printf); 725 + ret = sb_write_file(sb_file, outfile, NULL, generic_std_printf); 748 726 749 727 clear_keys(); 750 728 rb_fw_free(&boot_fw);
+12 -23
utils/imxtools/sbtools/elf.c
··· 430 430 } 431 431 432 432 void elf_write_file(struct elf_params_t *params, elf_write_fn_t write, 433 - elf_printf_fn_t printf, void *user) 433 + generic_printf_t printf, void *user) 434 434 { 435 435 (void) printf; 436 436 ··· 607 607 free(strtbl_content); 608 608 } 609 609 610 - static void *elf_load_section(Elf32_Shdr *sh, elf_read_fn_t read, elf_printf_fn_t printf, void *user) 610 + static void *elf_load_section(Elf32_Shdr *sh, elf_read_fn_t read, generic_printf_t printf, void *user) 611 611 { 612 612 void *data = xmalloc(sh->sh_size); 613 613 if(!read(user, sh->sh_offset, data, sh->sh_size)) 614 614 { 615 615 free(data); 616 - printf(user, true, "error reading elf section data\n"); 616 + printf(user, true, OFF, "error reading elf section data\n"); 617 617 return NULL; 618 618 } 619 619 return data; ··· 633 633 } 634 634 635 635 bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read, 636 - elf_printf_fn_t printf, void *user) 636 + generic_printf_t printf, void *user) 637 637 { 638 - #define error_printf(...) ({printf(user, true, __VA_ARGS__); return false;}) 638 + #define error_printf(...) ({printf(user, true, GREY, __VA_ARGS__); return false;}) 639 639 640 640 /* read header */ 641 641 Elf32_Ehdr ehdr; 642 642 if(!read(user, 0, &ehdr, sizeof(ehdr))) 643 643 { 644 - printf(user, true, "error reading elf header\n"); 644 + printf(user, true, GREY, "error reading elf header\n"); 645 645 return false; 646 646 } 647 647 /* basic checks */ ··· 667 667 elf_set_start_addr(params, ehdr.e_entry); 668 668 669 669 /* run through sections */ 670 - printf(user, false, "ELF file:\n"); 670 + printf(user, false, OFF, "ELF file:\n"); 671 671 Elf32_Shdr *shdr = xmalloc(sizeof(Elf32_Shdr) * ehdr.e_shnum); 672 672 if(!read(user, ehdr.e_shoff, shdr, sizeof(Elf32_Shdr) * ehdr.e_shnum)) 673 673 { 674 - printf(user, true, "cannot read elf section headers\n"); 674 + printf(user, true, GREY, "cannot read elf section headers\n"); 675 675 return false; 676 676 } 677 677 char *strtab = elf_load_section(&shdr[ehdr.e_shstrndx], read, printf, user); 678 678 if(!strtab) 679 - printf(user, false, "elf file has no valid section string table\n"); 679 + printf(user, false, OFF, "elf file has no valid section string table\n"); 680 680 for(int i = 1; i < ehdr.e_shnum; i++) 681 681 { 682 682 const char *sec_name = &strtab[shdr[i].sh_name]; ··· 688 688 void *data = elf_load_section(&shdr[i], read, printf, user); 689 689 if(!data) 690 690 { 691 - printf(user, true, "cannot read elf section %s\n", sec_name); 691 + printf(user, true, GREY, "cannot read elf section %s\n", sec_name); 692 692 goto Lerr; 693 693 } 694 694 elf_add_load_section(params, shdr[i].sh_addr, shdr[i].sh_size, data, sec_name); ··· 707 707 char *symstrtab = elf_load_section(&shdr[shdr[i].sh_link], read, printf, user); 708 708 if(!symstrtab) 709 709 { 710 - printf(user, true, "cannot load string table for symbol table %s\n", sec_name); 710 + printf(user, true, GREY, "cannot load string table for symbol table %s\n", sec_name); 711 711 goto Lerr; 712 712 } 713 713 // load symbol table data ··· 772 772 seg->paddr = phdr.p_paddr; 773 773 seg->vsize = phdr.p_memsz; 774 774 seg->psize = phdr.p_filesz; 775 - printf(user, false, "create segment [%#x,+%#x[ -> [%#x,+%#x[\n", 775 + printf(user, false, OFF, "create segment [%#x,+%#x[ -> [%#x,+%#x[\n", 776 776 seg->vaddr, seg->vsize, seg->paddr, seg->psize); 777 777 } 778 778 ··· 853 853 free(sym); 854 854 sym = next_sym; 855 855 } 856 - } 857 - 858 - void elf_std_printf(void *user, bool error, const char *fmt, ...) 859 - { 860 - if(!g_debug && !error) 861 - return; 862 - (void) user; 863 - va_list args; 864 - va_start(args, fmt); 865 - vprintf(fmt, args); 866 - va_end(args); 867 856 } 868 857 869 858 void elf_std_write(void *user, uint32_t addr, const void *buf, size_t count)
+3 -5
utils/imxtools/sbtools/elf.h
··· 27 27 #include <stdbool.h> 28 28 #include <stdlib.h> 29 29 #include <unistd.h> 30 + #include "misc.h" 30 31 31 32 /** 32 33 * API ··· 93 94 typedef bool (*elf_read_fn_t)(void *user, uint32_t addr, void *buf, size_t count); 94 95 /* write function manages it's own error state */ 95 96 typedef void (*elf_write_fn_t)(void *user, uint32_t addr, const void *buf, size_t count); 96 - typedef void (*elf_printf_fn_t)(void *user, bool error, const char *fmt, ...); 97 97 98 98 void elf_init(struct elf_params_t *params); 99 99 void elf_add_load_section(struct elf_params_t *params, ··· 103 103 uint32_t elf_translate_virtual_address(struct elf_params_t *params, uint32_t addr); 104 104 void elf_simplify(struct elf_params_t *params); 105 105 void elf_sort_by_address(struct elf_params_t *params); 106 - void elf_write_file(struct elf_params_t *params, elf_write_fn_t write, elf_printf_fn_t printf, void *user); 107 - bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read, elf_printf_fn_t printf, 108 - void *user); 106 + void elf_write_file(struct elf_params_t *params, elf_write_fn_t write, generic_printf_t printf, void *user); 107 + bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read, generic_printf_t printf, void *user); 109 108 bool elf_is_empty(struct elf_params_t *params); 110 109 void elf_set_start_addr(struct elf_params_t *params, uint32_t addr); 111 110 bool elf_get_start_addr(struct elf_params_t *params, uint32_t *addr); ··· 116 115 117 116 /* standard implementation of read/write/printf functions 118 117 * with user being a FILE* pointer */ 119 - void elf_std_printf(void *user, bool error, const char *fmt, ...); 120 118 void elf_std_write(void *user, uint32_t addr, const void *buf, size_t count); 121 119 bool elf_std_read(void *user, uint32_t addr, void *buf, size_t count); 122 120
+2 -2
utils/imxtools/sbtools/elftosb.c
··· 84 84 if(g_debug) 85 85 printf("Loading ELF file '%s'...\n", src->filename); 86 86 elf_init(&src->elf); 87 - src->loaded = elf_read_file(&src->elf, elf_std_read, elf_std_printf, fd); 87 + src->loaded = elf_read_file(&src->elf, elf_std_read, generic_std_printf, fd); 88 88 fclose(fd); 89 89 if(!src->loaded) 90 90 bug("error loading elf file '%s' (id '%s')\n", src->filename, id); ··· 430 430 sb_file->flags = 0; 431 431 sb_file->minor_version = 1; 432 432 433 - sb_write_file(sb_file, output_filename); 433 + sb_write_file(sb_file, output_filename, 0, generic_std_printf); 434 434 sb_free(sb_file); 435 435 clear_keys(); 436 436
+1 -19
utils/imxtools/sbtools/elftosb1.c
··· 68 68 return *(uu->argv - 1); 69 69 } 70 70 71 - static bool elf_read(void *user, uint32_t addr, void *buf, size_t count) 72 - { 73 - if(fseek((FILE *)user, addr, SEEK_SET) == -1) 74 - return false; 75 - return fread(buf, 1, count, (FILE *)user) == count; 76 - } 77 - 78 - static void elf_printf(void *user, bool error, const char *fmt, ...) 79 - { 80 - if(!g_debug && !error) 81 - return; 82 - (void) user; 83 - va_list args; 84 - va_start(args, fmt); 85 - vprintf(fmt, args); 86 - va_end(args); 87 - } 88 - 89 71 static int sb1_add_inst(struct sb1_file_t *sb, struct sb1_inst_t *insts, int nr_insts) 90 72 { 91 73 sb->insts = augment_array(sb->insts, sizeof(struct sb1_inst_t), sb->nr_insts, ··· 402 384 if(g_debug) 403 385 printf("Loading elf file '%s'...\n", filename); 404 386 elf_init(&elf); 405 - bool loaded = elf_read_file(&elf, elf_read, elf_printf, fd); 387 + bool loaded = elf_read_file(&elf, elf_std_read, generic_std_printf, fd); 406 388 fclose(fd); 407 389 if(!loaded) 408 390 bug("error loading elf file '%s'\n", filename);
+12
utils/imxtools/sbtools/misc.c
··· 316 316 printf("%s", (char *)c); 317 317 } 318 318 319 + void generic_std_printf(void *u, bool err, color_t c, const char *f, ...) 320 + { 321 + (void)u; 322 + if(!g_debug && !err) 323 + return; 324 + va_list args; 325 + va_start(args, f); 326 + color(c); 327 + vprintf(f, args); 328 + va_end(args); 329 + } 330 + 319 331 enum sb_version_guess_t guess_sb_version(const char *filename) 320 332 { 321 333 #define ret(x) do { if(f) fclose(f); return x; } while(0)
+4
utils/imxtools/sbtools/misc.h
··· 67 67 void color(color_t c); 68 68 void enable_color(bool enable); 69 69 70 + typedef void (*generic_printf_t)(void *u, bool err, color_t c, const char *f, ...); 71 + 72 + void generic_std_printf(void *u, bool err, color_t c, const char *f, ...); 73 + 70 74 enum sb_version_guess_t 71 75 { 72 76 SB_VERSION_1,
+9 -21
utils/imxtools/sbtools/sb.c
··· 45 45 } 46 46 } 47 47 48 - static void compute_sb_offsets(struct sb_file_t *sb, void *u, sb_color_printf cprintf) 48 + static void compute_sb_offsets(struct sb_file_t *sb, void *u, generic_printf_t cprintf) 49 49 { 50 50 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) 51 51 sb->image_size = 0; ··· 283 283 } 284 284 285 285 void produce_sb_instruction(struct sb_inst_t *inst, 286 - struct sb_instruction_common_t *cmd, void *u, sb_color_printf cprintf) 286 + struct sb_instruction_common_t *cmd, void *u, generic_printf_t cprintf) 287 287 { 288 288 memset(cmd, 0, sizeof(struct sb_instruction_common_t)); 289 289 cmd->hdr.opcode = inst->inst; ··· 318 318 } 319 319 320 320 enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename, void *u, 321 - sb_color_printf cprintf) 321 + generic_printf_t cprintf) 322 322 { 323 323 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) 324 324 struct crypto_key_t real_key; ··· 475 475 } 476 476 477 477 static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, 478 - int size, const char *indent, void *u, sb_color_printf cprintf, enum sb_error_t *err) 478 + int size, const char *indent, void *u, generic_printf_t cprintf, enum sb_error_t *err) 479 479 { 480 480 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) 481 481 #define fatal(e, ...) \ ··· 640 640 } 641 641 642 642 struct sb_file_t *sb_read_file(const char *filename, bool raw_mode, void *u, 643 - sb_color_printf cprintf, enum sb_error_t *err) 643 + generic_printf_t cprintf, enum sb_error_t *err) 644 644 { 645 645 return sb_read_file_ex(filename, 0, -1, raw_mode, u, cprintf, err); 646 646 } 647 647 648 648 struct sb_file_t *sb_read_file_ex(const char *filename, size_t offset, size_t size, bool raw_mode, void *u, 649 - sb_color_printf cprintf, enum sb_error_t *err) 649 + generic_printf_t cprintf, enum sb_error_t *err) 650 650 { 651 651 #define fatal(e, ...) \ 652 652 do { if(err) *err = e; \ ··· 681 681 struct printer_t 682 682 { 683 683 void *user; 684 - sb_color_printf cprintf; 684 + generic_printf_t cprintf; 685 685 const char *color; 686 686 bool error; 687 687 }; ··· 698 698 } 699 699 700 700 struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, void *u, 701 - sb_color_printf cprintf, enum sb_error_t *err) 701 + generic_printf_t cprintf, enum sb_error_t *err) 702 702 { 703 703 struct sb_file_t *sb_file = NULL; 704 704 uint8_t *buf = _buf; ··· 1158 1158 free(file); 1159 1159 } 1160 1160 1161 - void sb_dump(struct sb_file_t *file, void *u, sb_color_printf cprintf) 1161 + void sb_dump(struct sb_file_t *file, void *u, generic_printf_t cprintf) 1162 1162 { 1163 1163 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) 1164 1164 struct printer_t printer = {.user = u, .cprintf = cprintf, .color = OFF, .error = false }; ··· 1284 1284 key->method = CRYPTO_KEY; 1285 1285 memset(key->u.key, 0, sizeof(key->u.key)); 1286 1286 } 1287 - 1288 - void sb_std_printf(void *user, bool error, color_t c, const char *fmt, ...) 1289 - { 1290 - (void)user; 1291 - if(!g_debug && !error) 1292 - return; 1293 - va_list args; 1294 - va_start(args, fmt); 1295 - color(c); 1296 - vprintf(fmt, args); 1297 - va_end(args); 1298 - }
+5 -10
utils/imxtools/sbtools/sb.h
··· 231 231 SB_LAST_CRYPTO_ERROR = SB_FIRST_CRYPTO_ERROR - CRYPTO_NUM_ERRORS, 232 232 }; 233 233 234 - typedef void (*sb_color_printf)(void *u, bool err, color_t c, const char *f, ...); 235 - 236 234 enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename, void *u, 237 - sb_color_printf printf); 235 + generic_printf_t printf); 238 236 struct sb_file_t *sb_read_file(const char *filename, bool raw_mode, void *u, 239 - sb_color_printf printf, enum sb_error_t *err); 237 + generic_printf_t printf, enum sb_error_t *err); 240 238 /* use size_t(-1) to use maximum size */ 241 239 struct sb_file_t *sb_read_file_ex(const char *filename, size_t offset, size_t size, bool raw_mode, void *u, 242 - sb_color_printf printf, enum sb_error_t *err); 240 + generic_printf_t printf, enum sb_error_t *err); 243 241 struct sb_file_t *sb_read_memory(void *buffer, size_t size, bool raw_mode, void *u, 244 - sb_color_printf printf, enum sb_error_t *err); 242 + generic_printf_t printf, enum sb_error_t *err); 245 243 246 244 void sb_fill_section_name(char name[5], uint32_t identifier); 247 - void sb_dump(struct sb_file_t *file, void *u, sb_color_printf printf); 245 + void sb_dump(struct sb_file_t *file, void *u, generic_printf_t printf); 248 246 void sb_free_instruction(struct sb_inst_t inst); 249 247 void sb_free_section(struct sb_section_t file); 250 248 void sb_free(struct sb_file_t *file); 251 249 void sb_get_zero_key(struct crypto_key_t *key); 252 - 253 - /* standard implementation: user is unused*/ 254 - void sb_std_printf(void *user, bool error, color_t c, const char *fmt, ...); 255 250 256 251 #endif /* __SB_H__ */
+5 -5
utils/imxtools/sbtools/sb1.c
··· 189 189 } 190 190 191 191 struct sb1_file_t *sb1_read_file(const char *filename, void *u, 192 - sb1_color_printf cprintf, enum sb1_error_t *err) 192 + generic_printf_t cprintf, enum sb1_error_t *err) 193 193 { 194 194 return sb1_read_file_ex(filename, 0, -1, u, cprintf, err); 195 195 } 196 196 197 197 struct sb1_file_t *sb1_read_file_ex(const char *filename, size_t offset, size_t size, void *u, 198 - sb1_color_printf cprintf, enum sb1_error_t *err) 198 + generic_printf_t cprintf, enum sb1_error_t *err) 199 199 { 200 200 #define fatal(e, ...) \ 201 201 do { if(err) *err = e; \ ··· 270 270 return mark == *(uint32_t *)&sector[SECTOR_SIZE - 4 - header->header_size]; 271 271 } 272 272 273 - bool sb1_brute_force(const char *filename, void *u, sb1_color_printf cprintf, 273 + bool sb1_brute_force(const char *filename, void *u, generic_printf_t cprintf, 274 274 enum sb1_error_t *err, struct crypto_key_t *key) 275 275 { 276 276 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) ··· 358 358 } 359 359 360 360 struct sb1_file_t *sb1_read_memory(void *_buf, size_t filesize, void *u, 361 - sb1_color_printf cprintf, enum sb1_error_t *err) 361 + generic_printf_t cprintf, enum sb1_error_t *err) 362 362 { 363 363 struct sb1_file_t *file = NULL; 364 364 uint8_t *buf = _buf; ··· 606 606 free(file); 607 607 } 608 608 609 - void sb1_dump(struct sb1_file_t *file, void *u, sb1_color_printf cprintf) 609 + void sb1_dump(struct sb1_file_t *file, void *u, generic_printf_t cprintf) 610 610 { 611 611 #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) 612 612 #define print_hex(c, p, len, nl) \
+5 -6
utils/imxtools/sbtools/sb1.h
··· 145 145 146 146 enum sb1_error_t sb1_write_file(struct sb1_file_t *sb, const char *filename); 147 147 148 - typedef void (*sb1_color_printf)(void *u, bool err, color_t c, const char *f, ...); 149 148 struct sb1_file_t *sb1_read_file(const char *filename, void *u, 150 - sb1_color_printf printf, enum sb1_error_t *err); 149 + generic_printf_t printf, enum sb1_error_t *err); 151 150 /* use size_t(-1) to use maximum size */ 152 151 struct sb1_file_t *sb1_read_file_ex(const char *filename, size_t offset, size_t size, 153 - void *u, sb1_color_printf printf, enum sb1_error_t *err); 152 + void *u, generic_printf_t printf, enum sb1_error_t *err); 154 153 struct sb1_file_t *sb1_read_memory(void *buffer, size_t size, void *u, 155 - sb1_color_printf printf, enum sb1_error_t *err); 154 + generic_printf_t printf, enum sb1_error_t *err); 156 155 157 156 /* do as little checks as possible, make sure the image is valid (advance use only). 158 157 * Buffer should be of size SECTOR_SIZE at least. */ 159 158 bool sb1_is_key_valid_fast(void *buffer, union xorcrypt_key_t key[2]); 160 - bool sb1_brute_force(const char *filename, void *u, sb1_color_printf printf, 159 + bool sb1_brute_force(const char *filename, void *u, generic_printf_t printf, 161 160 enum sb1_error_t *err, struct crypto_key_t *key); 162 161 163 162 void sb1_get_default_key(struct crypto_key_t *key); 164 163 165 - void sb1_dump(struct sb1_file_t *file, void *u, sb1_color_printf printf); 164 + void sb1_dump(struct sb1_file_t *file, void *u, generic_printf_t printf); 166 165 void sb1_free(struct sb1_file_t *file); 167 166 168 167 #endif /* __SB1_H__ */
+8 -7
utils/imxtools/sbtools/sbtoelf.c
··· 27 27 */ 28 28 29 29 #define _ISOC99_SOURCE /* snprintf() */ 30 + #define _POSIX_C_SOURCE 200809L /* for strdup */ 30 31 #include <stdio.h> 31 32 #include <errno.h> 32 33 #include <stdlib.h> ··· 161 162 return; 162 163 if(g_elf_simplify) 163 164 elf_simplify(elf); 164 - elf_write_file(elf, elf_std_write, elf_std_printf, fd); 165 + elf_write_file(elf, elf_std_write, generic_std_printf, fd); 165 166 fclose(fd); 166 167 } 167 168 ··· 350 351 if(force_sb2 || ver == SB_VERSION_2) 351 352 { 352 353 enum sb_error_t err; 353 - struct sb_file_t *file = sb_read_file(sb_filename, raw_mode, NULL, sb_std_printf, &err); 354 + struct sb_file_t *file = sb_read_file(sb_filename, raw_mode, NULL, generic_std_printf, &err); 354 355 if(file == NULL) 355 356 { 356 357 color(OFF); ··· 365 366 { 366 367 color(GREY); 367 368 printf("[Debug output]\n"); 368 - sb_dump(file, NULL, sb_std_printf); 369 + sb_dump(file, NULL, generic_std_printf); 369 370 } 370 371 if(loopback) 371 372 { ··· 374 375 * garbage */ 375 376 file->override_real_key = false; 376 377 file->override_crypto_iv = false; 377 - sb_write_file(file, loopback); 378 + sb_write_file(file, loopback, 0, generic_std_printf); 378 379 } 379 380 sb_free(file); 380 381 } ··· 384 385 { 385 386 struct crypto_key_t key; 386 387 enum sb1_error_t err; 387 - if(!sb1_brute_force(sb_filename, NULL, sb_std_printf, &err, &key)) 388 + if(!sb1_brute_force(sb_filename, NULL, generic_std_printf, &err, &key)) 388 389 { 389 390 color(OFF); 390 391 printf("Brute force failed: %d\n", err); ··· 408 409 } 409 410 410 411 enum sb1_error_t err; 411 - struct sb1_file_t *file = sb1_read_file(sb_filename, NULL, sb_std_printf, &err); 412 + struct sb1_file_t *file = sb1_read_file(sb_filename, NULL, generic_std_printf, &err); 412 413 if(file == NULL) 413 414 { 414 415 color(OFF); ··· 423 424 { 424 425 color(GREY); 425 426 printf("[Debug output]\n"); 426 - sb1_dump(file, NULL, sb_std_printf); 427 + sb1_dump(file, NULL, generic_std_printf); 427 428 } 428 429 if(loopback) 429 430 sb1_write_file(file, loopback);