Skip to content

Commit 88fea63

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
system/fastboot: replace GETUINT32 with be32toh
Replace macro `FASTBOOT_GETUINT32` with function `be32toh()`. Signed-off-by: wangjianyu3 <[email protected]>
1 parent faea03f commit 88fea63

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

system/fastboot/fastboot.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <nuttx/mtd/mtd.h>
3030
#include <nuttx/version.h>
3131

32+
#include <endian.h>
3233
#include <errno.h>
3334
#include <fcntl.h>
3435
#include <inttypes.h>
@@ -72,11 +73,6 @@
7273
#define FASTBOOT_SPARSE_HEADER sizeof(struct fastboot_sparse_header_s)
7374
#define FASTBOOT_CHUNK_HEADER sizeof(struct fastboot_chunk_header_s)
7475

75-
#define FASTBOOT_GETUINT32(p) (((uint32_t)(p)[3] << 24) | \
76-
((uint32_t)(p)[2] << 16) | \
77-
((uint32_t)(p)[1] << 8) | \
78-
(uint32_t)(p)[0])
79-
8076
#define fb_info(...) syslog(LOG_INFO, ##__VA_ARGS__);
8177
#define fb_err(...) syslog(LOG_ERR, ##__VA_ARGS__);
8278

@@ -437,7 +433,7 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd)
437433
break;
438434
case FASTBOOT_CHUNK_FILL:
439435
{
440-
uint32_t fill_data = FASTBOOT_GETUINT32(chunk_ptr);
436+
uint32_t fill_data = be32toh(*(FAR uint32_t *)chunk_ptr);
441437
uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz;
442438
ret = ffastboot_flash_fill(fd, context->download_offset,
443439
fill_data, sparse->blk_sz,

0 commit comments

Comments
 (0)