Mercurial > repos > blastem
comparison render_sdl.c @ 2346:0111c8344477
Fix some issues identified by asan/ubsan
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 07 Oct 2023 18:04:35 -0700 |
parents | 1c7329ac7f3f |
children | d6a207861cc8 |
comparison
equal
deleted
inserted
replaced
2345:c76c81c21ae5 | 2346:0111c8344477 |
---|---|
277 } | 277 } |
278 | 278 |
279 uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) | 279 uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) |
280 { | 280 { |
281 #ifdef USE_GLES | 281 #ifdef USE_GLES |
282 return 255 << 24 | b << 16 | g << 8 | r; | 282 return 255UL << 24 | b << 16 | g << 8 | r; |
283 #else | 283 #else |
284 return 255 << 24 | r << 16 | g << 8 | b; | 284 return 255UL << 24 | r << 16 | g << 8 | b; |
285 #endif | 285 #endif |
286 } | 286 } |
287 | 287 |
288 static uint8_t external_sync; | 288 static uint8_t external_sync; |
289 void render_set_external_sync(uint8_t ext_sync_on) | 289 void render_set_external_sync(uint8_t ext_sync_on) |
423 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 423 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
424 if (i < 2) { | 424 if (i < 2) { |
425 //TODO: Fixme for PAL + invalid display mode | 425 //TODO: Fixme for PAL + invalid display mode |
426 glTexImage2D(GL_TEXTURE_2D, 0, INTERNAL_FORMAT, tex_width, tex_height, 0, SRC_FORMAT, GL_UNSIGNED_BYTE, texture_buf); | 426 glTexImage2D(GL_TEXTURE_2D, 0, INTERNAL_FORMAT, tex_width, tex_height, 0, SRC_FORMAT, GL_UNSIGNED_BYTE, texture_buf); |
427 } else { | 427 } else { |
428 uint32_t blank = 255 << 24; | 428 uint32_t blank = 255UL << 24; |
429 glTexImage2D(GL_TEXTURE_2D, 0, INTERNAL_FORMAT, 1, 1, 0, SRC_FORMAT, GL_UNSIGNED_BYTE, &blank); | 429 glTexImage2D(GL_TEXTURE_2D, 0, INTERNAL_FORMAT, 1, 1, 0, SRC_FORMAT, GL_UNSIGNED_BYTE, &blank); |
430 } | 430 } |
431 } | 431 } |
432 glGenBuffers(2, buffers); | 432 glGenBuffers(2, buffers); |
433 glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); | 433 glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); |