Skip to content

Commit 09afb4d

Browse files
qiaohaijiaoxiaoxiang781216
authored andcommitted
sim/alsa: fix runtime warning.
sim/posix/sim_offload.c:369:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' #0 0x3a146c2 (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a146c2) #1 0x3a0ecb0 (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a0ecb0) #2 0x3a1193a (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a1193a) apache#3 0x3a13141 (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a13141) apache#4 0x39fc3ef (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc3ef) apache#5 0x38ca7f2 (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x38ca7f2) apache#6 0x39fc6cf (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc6cf) Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
1 parent b63cffe commit 09afb4d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/sim/src/sim/sim_offload.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ static int sim_audio_mad_decode(void *handle,
353353
struct sim_mad_s *codec = (struct sim_mad_s *)handle;
354354
const mad_fixed_t *right_ch;
355355
const mad_fixed_t *left_ch;
356+
uint32_t header;
356357
int nchannels;
357358
int nsamples;
358359
uint8_t *ptr;
359-
int header;
360360
int i = 0;
361361
int size;
362362
int ret;
@@ -366,7 +366,10 @@ static int sim_audio_mad_decode(void *handle,
366366
return -ENODATA;
367367
}
368368

369-
header = in[0] << 24 | in[1] << 16 | in[2] << 8 | in[3];
369+
header = ((uint32_t)in[0] << 24) |
370+
((uint32_t)in[1] << 16) |
371+
((uint32_t)in[2] << 8) |
372+
((uint32_t)in[3]);
370373
size = sim_mad_check(header);
371374
if (size < 0)
372375
{

0 commit comments

Comments
 (0)