From: "Sven Eden" <sven.eden@gmx.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Fri, 20 Sep 2013 08:30:40 +0000 (UTC) [thread overview]
Message-ID: <1379594199.7f75f89ccdb4a80ed469db1a2fe81a12bad49450.yamakuzure@gentoo> (raw)
commit: 7f75f89ccdb4a80ed469db1a2fe81a12bad49450
Author: Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 12:36:39 2013 +0000
Commit: Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 12:36:39 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7f75f89c
Fixed stray 0-bytes that the wrapped description display accidently inserted.
---
ufed-curses-checklist.c | 30 ++++++++++++++++++------------
ufed-curses-types.c | 2 +-
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 6a48ba7..e5506c4 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -212,18 +212,20 @@ static int drawflag(sFlag* flag, bool highlight)
int lWidth = wWidth(List);
// Set up needed buffers
- char buf[lWidth + 1]; // Buffer for the line to print
- char desc[maxDescWidth]; // Buffer to assemble the description accoring to e_order and e_desc
- char special, *pBuf; // force/mask/none character, Helper to fill buf
- memset(buf, 0, sizeof(char) * (lWidth + 1));
- memset(desc, 0, sizeof(char) * maxDescWidth);
+ char buf[lWidth + 1]; // Buffer for the line to print
+ char desc[maxDescWidth + 1]; // Buffer to assemble the description accoring to e_order and e_desc
+ char special, *pBuf; // force/mask/none character, Helper to fill buf
+ memset(buf, ' ', sizeof(char) * lWidth);
+ memset(desc, ' ', sizeof(char) * maxDescWidth);
+ buf[lWidth] = 0x0;
+ desc[maxDescWidth] = 0x0;
// Description and wrapped lines state values
bool hasBlankLeft = false; // Set to true once the left side is blanked
bool hasBlankRight = false; // Set to true once the right (state) side is blanked
bool hasHead = false; // Set to true once the left side (flag name and states) are printed
- int maxDescWidth = lWidth - minwidth - 8; // Space on the right to print descriptions
- size_t length = maxDescWidth; // Characters to print when not wrapping
+ int rightwidth = lWidth - minwidth - 8; // Space on the right to print descriptions
+ size_t length = rightwidth; // Characters to print when not wrapping
bool newDesc = true; // Set to fals when wrapped parts advance
size_t pos = descriptionleft; // position in desc to start printing on
int leftover = 0; // When wrapping lines, this is left on the right
@@ -295,16 +297,16 @@ static int drawflag(sFlag* flag, bool highlight)
}
// The right side of buf can be added now:
- leftover = maxDescWidth - (int)length;
+ leftover = rightwidth - (int)length;
pBuf = buf + minwidth + (newDesc ? 8 : 10);
sprintf(pBuf, "%-*.*s",
(int)length, (int)length,
- strlen(desc) > pos ? &desc[pos] : "");
+ strlen(desc) > pos ? &desc[pos] : " ");
// Note: Follow up lines of wrapped descriptions are indented by 2
// Leftover characters on the right must be blanked:
if (leftover > 0)
- sprintf(pBuf + length, "%-*s", leftover, " ");
+ sprintf(pBuf + length, "%-*.*s", leftover, leftover, " ");
/* Set correct color set according to highlighting and status*/
if(highlight)
@@ -736,7 +738,7 @@ static char getFlagSpecialChar(sFlag* flag, int index)
static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName, bool printFlagState)
{
- if (printFlagName)
+ if (printFlagName) {
sprintf(buf, " %c%c%c %s%s%s%-*s ",
/* State of selection */
flag->stateConf == ' ' ? '(' : '[',
@@ -750,8 +752,10 @@ static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName,
(int)(minwidth
- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
- strlen(flag->name)), " ");
+ buf[minwidth] = ' '; // No automatic \0, please!
+ }
- if (printFlagState)
+ if (printFlagState) {
/* Display flag state
* The order in which the states are to be displayed is:
* 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
@@ -767,6 +771,8 @@ static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName,
flag->stateConf : flag->desc[index].statePkgUse,
flag->desc[index].isGlobal ? ' ' : 'L',
flag->desc[index].isInstalled ? 'i' : ' ');
+ buf[minwidth + 8] = ' '; // No automatic \0, please!
+ }
}
static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap)
diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 9d59234..e6b1139 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -573,7 +573,7 @@ static void calculateDescWrap(sDesc* desc)
end = wLen - 1;
// Step 2: Find last space character before end+1
- if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
+ if ((end > start) && (' ' != pch[end])) {
size_t newEnd = end;
for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
if (newEnd > start)
next reply other threads:[~2013-09-20 8:30 UTC|newest]
Thread overview: 238+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 8:30 Sven Eden [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-11-07 14:25 [gentoo-commits] proj/ufed:master commit in: / Sven Eden
2020-05-02 8:38 Ulrich Müller
2019-09-27 6:42 Sven Eden
2019-09-27 6:39 Sven Eden
2019-09-24 17:57 Sven Eden
2019-09-24 17:56 Sven Eden
2019-04-07 15:17 David Seifert
2019-04-07 13:56 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2015-02-12 15:47 Sven Eden
2015-02-11 9:03 Sven Eden
2014-11-10 9:59 Sven Eden
2014-10-28 11:43 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-25 8:18 Sven Eden
2014-02-25 8:18 Sven Eden
2014-02-25 8:18 Sven Eden
2014-02-25 8:18 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-20 8:30 Sven Eden
2013-09-11 7:09 Sven Eden
2013-09-11 6:31 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-11 6:04 Sven Eden
2013-09-10 12:37 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-09-10 6:36 Sven Eden
2013-07-22 9:34 Sven Eden
2013-07-22 6:09 Sven Eden
2013-07-22 6:09 Sven Eden
2013-04-09 7:22 Sven Eden
2013-04-09 7:22 Sven Eden
2013-04-09 7:22 Sven Eden
2013-04-08 7:18 Sven Eden
2013-04-03 13:39 Sven Eden
2013-03-05 16:53 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-02-21 10:02 Sven Eden
2013-02-19 15:16 Sven Eden
2013-02-19 13:34 Sven Eden
2013-02-18 7:22 Sven Eden
2013-02-15 8:36 Sven Eden
2013-02-15 8:36 Sven Eden
2013-02-15 8:36 Sven Eden
2013-02-14 8:35 Sven Eden
2013-02-14 8:35 Sven Eden
2013-02-14 8:35 Sven Eden
2013-02-13 9:23 Sven Eden
2013-02-13 9:23 Sven Eden
2013-02-13 9:23 Sven Eden
2013-02-13 9:23 Sven Eden
2013-02-13 9:23 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-12 9:01 Sven Eden
2013-02-06 9:09 Sven Eden
2013-02-06 9:09 Sven Eden
2013-02-05 18:06 Paul Varner
2013-02-05 13:53 Sven Eden
2013-02-05 13:53 Sven Eden
2013-02-05 11:24 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-02 20:49 Sven Eden
2013-02-02 10:11 Sven Eden
2013-02-02 9:47 Sven Eden
2013-02-02 9:47 Sven Eden
2013-02-02 9:47 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 16:04 Sven Eden
2013-02-01 15:55 Sven Eden
2013-02-01 15:26 Sven Eden
2013-02-01 14:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-23 14:44 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-16 13:43 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-08 11:02 Sven Eden
2013-01-02 8:47 Sven Eden
2013-01-02 8:01 Sven Eden
2013-01-02 8:01 Sven Eden
2012-11-20 17:31 Paul Varner
2012-11-20 17:25 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:01 Paul Varner
2012-10-22 20:42 Paul Varner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379594199.7f75f89ccdb4a80ed469db1a2fe81a12bad49450.yamakuzure@gentoo \
--to=sven.eden@gmx.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox