fileio: improve API types
[openocd.git] / src / target / image.c
index bba4675ff2806476f7d5a5a261e9238e1f62013c..8774c2517ba6e1f500e1f353466d348503e1595a 100644 (file)
@@ -48,7 +48,7 @@ static int autodetect_image_type(struct image *image, const char *url)
 {
        int retval;
        struct fileio fileio;
-       uint32_t read_bytes;
+       size_t read_bytes;
        uint8_t buffer[9];
 
        /* read the first 4 bytes of image */
@@ -175,7 +175,7 @@ static int image_ihex_buffer_complete(struct image *image)
                uint32_t record_type;
                uint32_t checksum;
                uint8_t cal_checksum = 0;
-               uint32_t bytes_read = 0;
+               size_t bytes_read = 0;
 
                if (sscanf(&lpszLine[bytes_read], ":%2" SCNx32 "%4" SCNx32 "%2" SCNx32 , &count, &address, &record_type) != 3)
                {
@@ -360,7 +360,7 @@ static int image_ihex_buffer_complete(struct image *image)
 static int image_elf_read_headers(struct image *image)
 {
        struct image_elf *elf = image->type_private;
-       uint32_t read_bytes;
+       size_t read_bytes;
        uint32_t i,j;
        int retval;
 
@@ -458,11 +458,11 @@ static int image_elf_read_headers(struct image *image)
        return ERROR_OK;
 }
 
-static int image_elf_read_section(struct image *image, int section, uint32_t offset, uint32_t size, uint8_t *buffer, uint32_t *size_read)
+static int image_elf_read_section(struct image *image, int section, uint32_t offset, uint32_t size, uint8_t *buffer, size_t *size_read)
 {
        struct image_elf *elf = image->type_private;
        Elf32_Phdr *segment = (Elf32_Phdr *)image->sections[section].private;
-       uint32_t read_size,really_read;
+       size_t read_size,really_read;
        int retval;
 
        *size_read = 0;
@@ -474,7 +474,7 @@ static int image_elf_read_section(struct image *image, int section, uint32_t off
        {
                /* maximal size present in file for the current segment */
                read_size = MIN(size, field32(elf,segment->p_filesz)-offset);
-               LOG_DEBUG("read elf: size = 0x%" PRIx32 " at 0x%" PRIx32 "",read_size,
+               LOG_DEBUG("read elf: size = 0x%zu at 0x%" PRIx32 "", read_size,
                        field32(elf,segment->p_offset) + offset);
                /* read initialized area of the segment */
                if ((retval = fileio_seek(&elf->fileio, field32(elf,segment->p_offset) + offset)) != ERROR_OK)
@@ -797,7 +797,7 @@ int image_open(struct image *image, const char *url, const char *type_string)
        return retval;
 };
 
-int image_read_section(struct image *image, int section, uint32_t offset, uint32_t size, uint8_t *buffer, uint32_t *size_read)
+int image_read_section(struct image *image, int section, uint32_t offset, uint32_t size, uint8_t *buffer, size_t *size_read)
 {
        int retval;
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)