Skip to content

fixed bugs and warnings - #3

Open
ZERICO2005 wants to merge 1 commit into
KhiCAS:mainfrom
ZERICO2005:bug_fixes
Open

fixed bugs and warnings#3
ZERICO2005 wants to merge 1 commit into
KhiCAS:mainfrom
ZERICO2005:bug_fixes

Conversation

@ZERICO2005

@ZERICO2005 ZERICO2005 commented Jan 26, 2026

Copy link
Copy Markdown
Contributor
  • changed (unsigned)ptr to (uintptr_t)ptr
  • added .c_str() to functions
  • fixed dangling else statements
  • fixed other logic bugs
  • corrected ustl::string --> std::string

These fixes could also be applied to other platforms

Comment thread kdisplay.cc Outdated
}

bool Graph2d::findij(const gen & e0,double x_scale,double y_scale,double & i0,double & j0,GIAC_CONTEXT) const {
if (display_mode&0xc00==0 && e0.type==_CPLX && e0.subtype==3){

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL BUG, this does display_mode & (0xc00 == 0), which is incorrect

Comment thread kdisplay.cc Outdated

bool Graph2d::findij(const gen & e0,double x_scale,double y_scale,double & i0,double & j0,GIAC_CONTEXT) const {
if (display_mode&0xc00==0 && e0.type==_CPLX && e0.subtype==3){
if ((display_mode & 0xc00) == 0 && e0.type == _CPLX && e0.subtype == 3){

@ZERICO2005 ZERICO2005 Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by adding parenthesis

Comment thread kprog.cc Outdated
else
evals += " | ";
}
if (!evals.size()==0){

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Bug also needed to be fixed

@adriweb

adriweb commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Nice.

I will let @parisseb review, maybe some things got changed upstream in the meantime too

@parisseb

Copy link
Copy Markdown
Contributor

I have committed the fix for graph2d::findij and in debug_loop, thank you, but I can't see what should really be applied in the other proposed changes. I'm very conservative because as we say in French "le mieux est l'ennemi du bien".
BTW, reformatting does not help, FYI I'm using emacs as editor with 2 spaces for indenting, and I do not apply systematic rules like adding a space before and after a binary operator because I find it's easier to read something like if (x==2 || x==3)

@ZERICO2005

ZERICO2005 commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

I have committed the fix for graph2d::findij and in debug_loop, thank you, but I can't see what should really be applied in the other proposed changes. I'm very conservative because as we say in French "le mieux est l'ennemi du bien".

I do believe that changing (unsigned)ptr to (uintptr_t)ptr would be valuable, as it improves portability.

I find it's easier to read something like if (x==2 || x==3)

fair enough, I will keep that in mind

Comment thread input_parser.cc
(yyval) = (yyvsp[-1])==at_binary_minus?minus_inf:plus_inf;
}
else {
if ((yyvsp[-1])==at_binary_minus)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes -Wdangling-else

Comment thread kdisplay.cc
Comment on lines -388 to -395
if (t.cmd_row!=t.cur_row || t.cmd_col!=t.cur_col)
if (t.cmd_row!=t.cur_row || t.cmd_col!=t.cur_col) {
#ifdef HP39
xend=os_draw_string_small(xend,sheety,COLOR_BLACK,COLOR_WHITE,printcell(t.cur_row,t.cur_col).c_str(),false);
#else
if (small)
xend=os_draw_string_small(xend,sheety,COLOR_BLACK,color_gris,printcell(t.cur_row,t.cur_col).c_str(),false);
else
xend=os_draw_string(xend,sheety,COLOR_BLACK,color_gris,printcell(t.cur_row,t.cur_col).c_str(),false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also fixed -Wdangling-else here

@ZERICO2005 ZERICO2005 changed the title fixed bugs and corrected ustl::string --> std::string fixed bugs and warnings Jan 27, 2026
@parisseb

Copy link
Copy Markdown
Contributor

I have committed the change in kdisplay.cc. I don't plan to make other changes since they do not seem to fix existing bugs. For uintptr_t, I'm not comfortable enough with integer types except char/short/int/long and long long (and unsigned variants). Portability is not really a concern, it's too hard (at least for me, because I'm not a computer scientist, my major is maths :-)) to have a full common code basis for all calculators (e.g. int with 24 bits vs 32, endianness, flash size considerations), therefore the tice branch is kept fully separate on my computer.

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

Successfully merging this pull request may close these issues.

3 participants