X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ftarget%2Fimage.c;h=8a166d68f9dc1cee3dfd4fcfaa5deb549cf4790f;hb=7eeb3cfc47b8b6337453063e05dbf52a8ce7191e;hp=fb4d8915acdde57d35ab3b0004585b65d021170b;hpb=0cba0d4df3fe120f08945703506f8405760325c9;p=openocd diff --git a/src/target/image.c b/src/target/image.c index fb4d8915..8a166d68 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -113,7 +113,7 @@ static int autodetect_image_type(image_t *image, char *url) return ERROR_OK; } -int identify_image_type(image_t *image, char *type_string, char *url) +static int identify_image_type(image_t *image, char *type_string, char *url) { if (type_string) { @@ -154,7 +154,7 @@ int identify_image_type(image_t *image, char *type_string, char *url) return ERROR_OK; } -int image_ihex_buffer_complete(image_t *image) +static int image_ihex_buffer_complete(image_t *image) { image_ihex_t *ihex = image->type_private; fileio_t *fileio = &ihex->fileio; @@ -217,7 +217,9 @@ int image_ihex_buffer_complete(image_t *image) while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&ihex->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + ihex->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)ihex->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1; @@ -344,7 +346,7 @@ int image_ihex_buffer_complete(image_t *image) return ERROR_IMAGE_FORMAT_ERROR; } -int image_elf_read_headers(image_t *image) +static int image_elf_read_headers(image_t *image) { image_elf_t *elf = image->type_private; u32 read_bytes; @@ -445,7 +447,7 @@ int image_elf_read_headers(image_t *image) return ERROR_OK; } -int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read) +static int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read) { image_elf_t *elf = image->type_private; Elf32_Phdr *segment = (Elf32_Phdr *)image->sections[section].private; @@ -486,7 +488,7 @@ int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 return ERROR_OK; } -int image_mot_buffer_complete(image_t *image) +static int image_mot_buffer_complete(image_t *image) { image_mot_t *mot = image->type_private; fileio_t *fileio = &mot->fileio; @@ -594,7 +596,9 @@ int image_mot_buffer_complete(image_t *image) while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&mot->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + mot->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)mot->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1;