From 88fea63ff474b65b3e3a0ba98831e5c60989b650 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Tue, 17 Jun 2025 16:08:14 +0800 Subject: [PATCH] system/fastboot: replace GETUINT32 with be32toh Replace macro `FASTBOOT_GETUINT32` with function `be32toh()`. Signed-off-by: wangjianyu3 --- system/fastboot/fastboot.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index 18b2b0e68..773ea2328 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -72,11 +73,6 @@ #define FASTBOOT_SPARSE_HEADER sizeof(struct fastboot_sparse_header_s) #define FASTBOOT_CHUNK_HEADER sizeof(struct fastboot_chunk_header_s) -#define FASTBOOT_GETUINT32(p) (((uint32_t)(p)[3] << 24) | \ - ((uint32_t)(p)[2] << 16) | \ - ((uint32_t)(p)[1] << 8) | \ - (uint32_t)(p)[0]) - #define fb_info(...) syslog(LOG_INFO, ##__VA_ARGS__); #define fb_err(...) syslog(LOG_ERR, ##__VA_ARGS__); @@ -437,7 +433,7 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) break; case FASTBOOT_CHUNK_FILL: { - uint32_t fill_data = FASTBOOT_GETUINT32(chunk_ptr); + uint32_t fill_data = be32toh(*(FAR uint32_t *)chunk_ptr); uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz; ret = ffastboot_flash_fill(fd, context->download_offset, fill_data, sparse->blk_sz,