[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/kioslave/man
From: Nicolas Goutte <nicolasg () snafu ! de>
Date: 2005-06-11 10:17:57
Message-ID: 1118485077.087503.20690.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 424267 by goutte:
- Fix off-by-one error of the function strlimitcpy
(The qstr functions assumes that the lenght includes the NUL byte,
the function strlimitcpy excludes the NUL byte from the length)
- remove the function strmaxcpy
(which is basically qtrsncpy with another definition of the lenght)
(This fixes the macro .Nm, compared to old bug #32153)
M +2 -11 man2html.cpp
--- trunk/KDE/kdebase/kioslave/man/man2html.cpp #424266:424267
@@ -200,19 +200,10 @@
return news;
}
-// ### TODO: replace by either qstrncpy or strlcpy
-static char *strmaxcpy(char *to, const char *from, int n)
-{ /* Assumes space for n plus a null */
- int len = qstrlen(from);
- qstrncpy(to, from, n);
- to[(len <= n) ? len : n] = '\0';
- return to;
-}
-
static char *strlimitcpy(char *to, char *from, int n, int limit)
{ /* Assumes space for limit plus a null */
- int len = n > limit ? limit : n;
- strmaxcpy(to, from, len);
+ const int len = n > limit ? limit : n;
+ qstrncpy(to, from, len + 1);
to[len] = '\0';
return to;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic