From 709856621a1c95b9017ea5f1d1a44781b729ac93 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 17 Apr 2011 01:43:30 +0000 Subject: sbinfo: use a define instead of hardcoded values git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29731 a1c6a512-1295-4272-9138-f99709370657 --- utils/sbinfo/sb.h | 7 +++++-- utils/sbinfo/sbinfo.c | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/utils/sbinfo/sb.h b/utils/sbinfo/sb.h index 1d62aa4daa..29b7d7d894 100644 --- a/utils/sbinfo/sb.h +++ b/utils/sbinfo/sb.h @@ -72,8 +72,11 @@ struct sb_key_dictionary_entry_t uint8_t key[16]; /* Actual AES Key (encrypted by the global key) */ } __attribute__((packed)); -#define ROM_SECTION_BOOTABLE (1 << 0) -#define ROM_SECTION_CLEARTEXT (1 << 1) +#define IMAGE_MAJOR_VERSION 1 +#define IMAGE_MINOR_VERSION 1 + +#define SECTION_BOOTABLE (1 << 0) +#define SECTION_CLEARTEXT (1 << 1) #define SB_INST_NOP 0x0 #define SB_INST_TAG 0x1 diff --git a/utils/sbinfo/sbinfo.c b/utils/sbinfo/sbinfo.c index a79cf75e0f..f09bb79fe9 100644 --- a/utils/sbinfo/sbinfo.c +++ b/utils/sbinfo/sbinfo.c @@ -325,7 +325,8 @@ static void extract(unsigned long filesize) bugp("File size mismatch"); if(sb_header->header_size * BLOCK_SIZE != sizeof(struct sb_header_t)) bugp("Bad header size"); - if(sb_header->major_ver != 1 || sb_header->minor_ver != 1) + if(sb_header->major_ver != IMAGE_MAJOR_VERSION || + sb_header->minor_ver != IMAGE_MINOR_VERSION) bugp("Bad file format version"); if(sb_header->sec_hdr_size * BLOCK_SIZE != sizeof(struct sb_section_header_t)) bugp("Bad section header size"); @@ -489,8 +490,8 @@ static void extract(unsigned long filesize) name[4] = 0; int pos = sec_hdr->offset * BLOCK_SIZE; int size = sec_hdr->size * BLOCK_SIZE; - int data_sec = !(sec_hdr->flags & ROM_SECTION_BOOTABLE); - int encrypted = !(sec_hdr->flags & ROM_SECTION_CLEARTEXT); + int data_sec = !(sec_hdr->flags & SECTION_BOOTABLE); + int encrypted = !(sec_hdr->flags & SECTION_CLEARTEXT); color(GREEN); printf(" Chunk "); -- cgit v1.2.3