aboutsummaryrefslogtreecommitdiffstats
path: root/textproc
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2006-02-15 07:54:32 +0800
committermarcus <marcus@FreeBSD.org>2006-02-15 07:54:32 +0800
commitf679c6a8fc6fd8e591110cf340b8592f1e429d5b (patch)
tree4a8992411d86a79cc267078c3aa9cb2f83db4153 /textproc
parent67355e3a859e437175dc3c7e9bbe38b84331268e (diff)
downloadfreebsd-ports-gnome-f679c6a8fc6fd8e591110cf340b8592f1e429d5b.tar.gz
freebsd-ports-gnome-f679c6a8fc6fd8e591110cf340b8592f1e429d5b.tar.zst
freebsd-ports-gnome-f679c6a8fc6fd8e591110cf340b8592f1e429d5b.zip
* Fix some off-by-one errors
* Update our strndup implementation
Diffstat (limited to 'textproc')
-rw-r--r--textproc/scrollkeeper/Makefile2
-rw-r--r--textproc/scrollkeeper/files/patch-libs_i18n.c48
2 files changed, 44 insertions, 6 deletions
diff --git a/textproc/scrollkeeper/Makefile b/textproc/scrollkeeper/Makefile
index 7668752a9acb..eef73afe081c 100644
--- a/textproc/scrollkeeper/Makefile
+++ b/textproc/scrollkeeper/Makefile
@@ -7,7 +7,7 @@
PORTNAME= scrollkeeper
PORTVERSION= 0.3.14
-PORTREVISION= 2
+PORTREVISION= 3
PORTEPOCH= 1
CATEGORIES= textproc gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
diff --git a/textproc/scrollkeeper/files/patch-libs_i18n.c b/textproc/scrollkeeper/files/patch-libs_i18n.c
index b3add5185b26..3e5f387301e6 100644
--- a/textproc/scrollkeeper/files/patch-libs_i18n.c
+++ b/textproc/scrollkeeper/files/patch-libs_i18n.c
@@ -1,18 +1,18 @@
---- libs/i18n.c.orig Wed Apr 23 00:48:20 2003
-+++ libs/i18n.c Wed Apr 23 00:59:24 2003
-@@ -38,6 +38,19 @@
+--- libs/i18n.c.orig Sun Nov 9 18:05:36 2003
++++ libs/i18n.c Tue Feb 14 18:50:23 2006
+@@ -38,6 +38,19 @@ enum {
* All rights reserved.
*/
+/* XXX Implement strndup for FreeBSD. */
+static char *
-+strndup(const char *str, int len) {
++strndup(const char *str, size_t len) {
+ char *ret;
+
+ if ((str == NULL || len < 0)) return(NULL);
+ ret = (char *)malloc(len + 1);
+ if (ret == NULL) return(NULL);
-+ memcpy(ret, str, len);
++ strncpy(ret, str, len);
+ ret[len] = '\0';
+ return(ret);
+}
@@ -20,3 +20,41 @@
/* Support function for compute_locale_variants. */
static int explode_locale(const char *locale, char **language,
char **territory, char **codeset, char **modifier)
+@@ -118,7 +131,7 @@ static char **compute_locale_variants(co
+ if ((i & ~mask) == 0) {
+ int length = strlen(language) + strlen(territory)
+ + strlen(codeset) + strlen(modifier);
+- char *var = (char *) malloc(sizeof(char) * length);
++ char *var = (char *) malloc(sizeof(char) * (length + 1));
+ check_ptr(var, "");
+
+ strcpy(var, language);
+@@ -144,7 +157,8 @@ static char **compute_locale_variants(co
+ pos = 0;
+ for (i = 0; i <= mask; i++) {
+ if (progress[i] != NULL) {
+- retval[pos] = progress[i];
++ retval[pos] = strdup(progress[i]);
++ free(progress[i]);
+ ++pos;
+ }
+ }
+@@ -206,7 +220,7 @@ char **sk_get_language_list()
+ count++;
+ }
+
+- tab = (char ***)malloc(sizeof(char **) * count);
++ tab = (char ***)malloc(sizeof(char **) * (count + 1));
+
+ str = strdup(lang);
+ check_ptr(str, "");
+@@ -246,7 +260,8 @@ char **sk_get_language_list()
+ while (tab[j] != NULL) {
+ k = 0;
+ while (tab[j][k] != NULL) {
+- retval[pos] = tab[j][k];
++ retval[pos] = strdup(tab[j][k]);
++ free(tab[j][k]);
+ ++pos;
+ ++k;
+ }