Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make v9 footer compilable with c++ #42

Open
tilchl opened this issue Feb 7, 2025 · 0 comments
Open

make v9 footer compilable with c++ #42

tilchl opened this issue Feb 7, 2025 · 0 comments

Comments

@tilchl
Copy link

tilchl commented Feb 7, 2025

Nested/duplicate designators are not allowed in C++20.
Reordering the designators is also necessary for adhering to the standard.
Changing these lines in the following way would make the image compilable in C and C++

lv_img_conv/lib/convert.ts

Lines 136 to 144 in 80ed17a

$c_footer = `\n};\n
const lv_image_dsc_t ${out_name} = {
.header.cf = ${header_cf},
.header.magic = LV_IMAGE_HEADER_MAGIC,
.header.w = ${this.w},
.header.h = ${this.h},
.data_size = ${data_size},
.data = ${out_name}_map,
};\n`;

Change to

             $c_footer = `\n};\n 
 const lv_image_dsc_t ${out_name} = {
   .header = {
       .magic = LV_IMAGE_HEADER_MAGIC, 
       .cf = ${header_cf}, 
       .w = ${this.w}, 
       .h = ${this.h},
    },
   .data_size = ${data_size}, 
   .data = ${out_name}_map, 
 };\n`; 

Thanks for the converter anyway, really handy 😍

ps: could also make a pull request for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant