Closed the-grue closed 3 years ago
I'll fix these and add to the PR. It'll take me a bit of practice to hit all the style guidelines as some differ for how I naturally code. I remembered to remove all the tabs this time.
I left them in for now as I may wish to do more work on the app. I can easily remove them though, it seems the logic is working fine for those parts.
I didn't. I went looking for ltoa and found itoa but that was after I had already implemented accumulate_selection. I'll revisit and see if strtol can easily drop-in replace my code.
Alright with me!
I agree, my solution to this is a little hackish, however I was unable to get the button_set_text to work and I would get memory errors when trying to use it with anything other than a static string ("0" for example). Passing buf wasn't working and would throw an error. strdup would also throw an error. I found that even trying to read button->text would throw an error. I had some concerns there was some sort of translation error with addresses between user space and kernel space. I'll revisit it and put in a little more time to try to come up with a better solution.
Those crashes are due to my clumsiness I'm afraid. In the main function, text_field
is redefined, so the outer text_field
used everywhere else is never assigned anything... Removing that redeclaration will make it behave.
Also I had entirely forgotten the existence of button_set_text
, in fact I remembered wanting to write it and not doing it ^^
I've added clang-format support (here) fwiw, hopefully it can make style-related things less boring: you can write code the style you prefer, and then only before committing making it use this project's style in one command. It doesn't check every little thing but it seems to be more than enough.
@29jm I believe I have corrected all defects outlined above as requested. Please give it a look.
That looks great! Thanks again
Is there something you wished was done differently, or existed at all, in the ui library (or elsewhere)? I haven't been able to pinpoint what the next "highest impact" improvement to this library could be.
I'll fix these and add to the PR. It'll take me a bit of practice to hit all the style guidelines as some differ for how I naturally code. I remembered to remove all the tabs this time.
I left them in for now as I may wish to do more work on the app. I can easily remove them though, it seems the logic is working fine for those parts.
I didn't. I went looking for ltoa and found itoa but that was after I had already implemented accumulate_selection. I'll revisit and see if strtol can easily drop-in replace my code.
I agree, my solution to this is a little hackish, however I was unable to get the button_set_text to work and I would get memory errors when trying to use it with anything other than a static string ("0" for example). Passing buf wasn't working and would throw an error. strdup would also throw an error. I found that even trying to read button->text would throw an error. I had some concerns there was some sort of translation error with addresses between user space and kernel space. I'll revisit it and put in a little more time to try to come up with a better solution.
I appreciate the feedback!
Jim