Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 1 | From e301f7dd650c9e56f954a7c49661d938079e1a9b Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex@linutronix.de> |
| 3 | Date: Mon, 25 Oct 2021 17:27:51 +0200 |
| 4 | Subject: [PATCH] gptcurses: correct ncurses 6.3 errors |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 8 | --- |
| 9 | gptcurses.cc | 28 ++++++++++++++-------------- |
| 10 | 1 file changed, 14 insertions(+), 14 deletions(-) |
| 11 | |
| 12 | diff --git a/gptcurses.cc b/gptcurses.cc |
| 13 | index d0de024..70be999 100644 |
| 14 | --- a/gptcurses.cc |
| 15 | +++ b/gptcurses.cc |
| 16 | @@ -235,22 +235,22 @@ Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) { |
| 17 | ClearLine(lineNum); |
| 18 | if (space->partNum == -1) { // space is empty |
| 19 | move(lineNum, 12); |
| 20 | - printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str()); |
| 21 | + printw("%s",BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str()); |
| 22 | move(lineNum, 24); |
| 23 | - printw("free space"); |
| 24 | + printw("%s","free space"); |
| 25 | } else { // space holds a partition |
| 26 | move(lineNum, 3); |
| 27 | printw("%d", space->partNum + 1); |
| 28 | move(lineNum, 12); |
| 29 | - printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str()); |
| 30 | + printw("%s",BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str()); |
| 31 | move(lineNum, 24); |
| 32 | - printw(space->origPart->GetTypeName().c_str()); |
| 33 | + printw("%s",space->origPart->GetTypeName().c_str()); |
| 34 | move(lineNum, 50); |
| 35 | #ifdef USE_UTF16 |
| 36 | space->origPart->GetDescription().extract(0, 39, temp, 39); |
| 37 | - printw(temp); |
| 38 | + printw("%s",temp); |
| 39 | #else |
| 40 | - printw(space->origPart->GetDescription().c_str()); |
| 41 | + printw("%s",space->origPart->GetDescription().c_str()); |
| 42 | #endif |
| 43 | } // if/else |
| 44 | } // if |
| 45 | @@ -267,10 +267,10 @@ int GPTDataCurses::DisplayParts(int selected) { |
| 46 | |
| 47 | move(lineNum++, 0); |
| 48 | theLine = "Part. # Size Partition Type Partition Name"; |
| 49 | - printw(theLine.c_str()); |
| 50 | + printw("%s",theLine.c_str()); |
| 51 | move(lineNum++, 0); |
| 52 | theLine = "----------------------------------------------------------------"; |
| 53 | - printw(theLine.c_str()); |
| 54 | + printw("%s",theLine.c_str()); |
| 55 | numToShow = LINES - RESERVED_TOP - RESERVED_BOTTOM; |
| 56 | pageNum = selected / numToShow; |
| 57 | for (i = pageNum * numToShow; i <= (pageNum + 1) * numToShow - 1; i++) { |
| 58 | @@ -284,7 +284,7 @@ int GPTDataCurses::DisplayParts(int selected) { |
| 59 | } else { |
| 60 | currentSpace = ShowSpace(i, lineNum); |
| 61 | move(lineNum++, 0); |
| 62 | - printw(">"); |
| 63 | + printw("%s",">"); |
| 64 | } |
| 65 | DisplayOptions(i); |
| 66 | retval = selected; |
| 67 | @@ -632,7 +632,7 @@ void GPTDataCurses::DisplayOptions(char selectedKey) { |
| 68 | } // if/else |
| 69 | } // for |
| 70 | move(LINES - 1, (COLS - optionDesc.length()) / 2); |
| 71 | - printw(optionDesc.c_str()); |
| 72 | + printw("%s",optionDesc.c_str()); |
| 73 | currentKey = selectedKey; |
| 74 | } // if |
| 75 | } // GPTDataCurses::DisplayOptions() |
| 76 | @@ -744,11 +744,11 @@ void GPTDataCurses::DrawMenu(void) { |
| 77 | |
| 78 | clear(); |
| 79 | move(0, (COLS - title.length()) / 2); |
| 80 | - printw(title.c_str()); |
| 81 | + printw("%s",title.c_str()); |
| 82 | move(2, (COLS - drive.length()) / 2); |
| 83 | - printw(drive.c_str()); |
| 84 | + printw("%s",drive.c_str()); |
| 85 | move(3, (COLS - size.str().length()) / 2); |
| 86 | - printw(size.str().c_str()); |
| 87 | + printw("%s",size.str().c_str()); |
| 88 | DisplayParts(currentSpaceNum); |
| 89 | } // DrawMenu |
| 90 | |
| 91 | @@ -798,7 +798,7 @@ void PromptToContinue(void) { |
| 92 | void Report(string theText) { |
| 93 | clear(); |
| 94 | move(0, 0); |
| 95 | - printw(theText.c_str()); |
| 96 | + printw("%s", theText.c_str()); |
| 97 | move(LINES - 2, (COLS - 29) / 2); |
| 98 | printw("Press any key to continue...."); |
| 99 | cbreak(); |