Skip to content

Commit

Permalink
Changed out sprintf for snprintf for battery display
Browse files Browse the repository at this point in the history
  • Loading branch information
maodus committed Jun 23, 2024
1 parent 304a411 commit d7ca908
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions extras/menus/arkMenu/src/system_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ static void changeMenuState(){

static int getNumPageItems(){
int menuSize = common::getConf()->menusize % 3;
// + 1 the amount of the real # of items to predraw then next entry?
return 5 - (int)(menuSize == 0);
return 5 - (int)(menuSize == 0); // 5 for medium and small, 4 for large
}


Expand Down Expand Up @@ -244,8 +243,8 @@ static void drawBattery(){
}

if (common::getConf()->battery_percent) {
char batteryPercent[4];
sprintf(batteryPercent, "%d%%", percent);
char batteryPercent[5];
snprintf(batteryPercent, 5, "%d%%", percent);
common::printText(450-common::calcTextWidth(batteryPercent, SIZE_MEDIUM, 0), 13, batteryPercent, color, SIZE_MEDIUM, 0, 0, 0);
}

Expand Down

0 comments on commit d7ca908

Please sign in to comment.