JPEGDEC: Don't pass filename through std::string.

The result of GET_STR_DATA_LEN should be null terminated, so converting to a std::string and then using .c_str() is both redundant and need
s heap.
patch-jpegdec-filename
Phil Howard 2023-03-10 18:14:57 +00:00
rodzic d0e2425e07
commit b74b371d2b
1 zmienionych plików z 1 dodań i 3 usunięć

Wyświetl plik

@ -247,10 +247,8 @@ mp_obj_t _JPEG_decode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args
if(mp_obj_is_str_or_bytes(self->file)){
GET_STR_DATA_LEN(self->file, str, str_len);
std::string t((const char*)str);
result = self->jpeg->open(
t.c_str(),
(const char*)str,
jpegdec_open_callback,
jpegdec_close_callback,
jpegdec_read_callback,