INN commit: trunk (4 files)
INN Commit
rra at isc.org
Tue Aug 3 18:40:24 UTC 2010
Date: Tuesday, August 3, 2010 @ 11:40:23
Author: iulius
Revision: 9092
Use a constant (ARTNUMPRINTSIZE) for the length of a water mark.
It will be of help if we ever switch from 32-bit to 64-bit
article numbers.
Modified:
trunk/backends/actsync.c
trunk/include/inn/options.h
trunk/innd/art.c
trunk/nnrpd/list.c
-----------------------+
backends/actsync.c | 21 ++++++++++-----------
include/inn/options.h | 3 +++
innd/art.c | 4 ++--
nnrpd/list.c | 1 +
4 files changed, 16 insertions(+), 13 deletions(-)
Modified: backends/actsync.c
===================================================================
--- backends/actsync.c 2010-08-01 10:12:14 UTC (rev 9091)
+++ backends/actsync.c 2010-08-03 18:40:23 UTC (rev 9092)
@@ -226,7 +226,6 @@
#define DEF_HI "0000000000" /* default hi string value for new groups */
#define DEF_LOW "0000000001" /* default low string value for new groups */
-#define WATER_LEN 10 /* string length of hi/low water mark */
#define DEF_NAME "actsync" /* default name to use for ctlinnd newgroup */
@@ -962,10 +961,10 @@
/*
* check for excessive hi water length
*/
- if (i > WATER_LEN) {
+ if (i > ARTNUMPRINTSIZE) {
if (!QUIET(hostid))
warn("line %d <%s> from %s hi water len: %d < %d",
- cnt + 1, cur->name, cur->hi, i, WATER_LEN);
+ cnt + 1, cur->name, cur->hi, i, ARTNUMPRINTSIZE);
cur->ignore |= ERROR_FORMAT;
continue;
}
@@ -973,9 +972,9 @@
/*
* if the hi water length is too small, malloc and resize
*/
- if (i != WATER_LEN) {
- p = xmalloc(WATER_LEN + 1);
- memcpy(p, cur->hi, ((i > WATER_LEN) ? WATER_LEN : i)+1);
+ if (i != ARTNUMPRINTSIZE) {
+ p = xmalloc(ARTNUMPRINTSIZE + 1);
+ memcpy(p, cur->hi, ((i > ARTNUMPRINTSIZE) ? ARTNUMPRINTSIZE : i)+1);
}
/*
@@ -994,10 +993,10 @@
/*
* check for excessive low water length
*/
- if (i > WATER_LEN) {
+ if (i > ARTNUMPRINTSIZE) {
if (!QUIET(hostid))
warn("line %d <%s> from %s low water len: %d < %d",
- cnt + 1, cur->name, cur->hi, i, WATER_LEN);
+ cnt + 1, cur->name, cur->hi, i, ARTNUMPRINTSIZE);
cur->ignore |= ERROR_FORMAT;
continue;
}
@@ -1005,9 +1004,9 @@
/*
* if the low water length is too small, malloc and resize
*/
- if (i != WATER_LEN) {
- p = xmalloc(WATER_LEN + 1);
- memcpy(p, cur->low, ((i > WATER_LEN) ? WATER_LEN : i)+1);
+ if (i != ARTNUMPRINTSIZE) {
+ p = xmalloc(ARTNUMPRINTSIZE + 1);
+ memcpy(p, cur->low, ((i > ARTNUMPRINTSIZE) ? ARTNUMPRINTSIZE : i)+1);
}
/* check for a bad group type */
Modified: include/inn/options.h
===================================================================
--- include/inn/options.h 2010-08-01 10:12:14 UTC (rev 9091)
+++ include/inn/options.h 2010-08-03 18:40:23 UTC (rev 9092)
@@ -110,6 +110,9 @@
/* The maximum length of a single header or body line, including CRLF. */
#define MAXARTLINELENGTH 1000
+/* String length of high/low watermark. Currently for 32-bit article numbers. */
+#define ARTNUMPRINTSIZE 10
+
/* The size of a small buffer. */
#define SMBUF 256
Modified: innd/art.c
===================================================================
--- innd/art.c 2010-08-01 10:12:14 UTC (rev 9091)
+++ innd/art.c 2010-08-03 18:40:23 UTC (rev 9092)
@@ -1447,13 +1447,13 @@
ngp->Filenum = ngp->Last;
/* len ' ' "news_groupname" ':' "#" "\r\n"
plus an extra 2 bytes for "\r\n" in case of a continuation line. */
- if (len + 1 + ngp->NameLength + 1 + 10 + 2 + 2 > data->XrefBufLength) {
+ if (len + 1 + ngp->NameLength + 1 + ARTNUMPRINTSIZE + 2 + 2 > data->XrefBufLength) {
data->XrefBufLength += MED_BUFFER;
data->Xref = xrealloc(data->Xref, data->XrefBufLength);
p = data->Xref + len;
}
/* Trailing CRLF is counted in the maximum length. */
- if (linelen + 1 + ngp->NameLength + 1 + 10 + 2 > MAXARTLINELENGTH) {
+ if (linelen + 1 + ngp->NameLength + 1 + ARTNUMPRINTSIZE + 2 > MAXARTLINELENGTH) {
/* Line exceeded. */
sprintf(p, "\r\n %s:%lu", ngp->Name, ngp->Filenum);
buflen = strlen(p);
Modified: nnrpd/list.c
===================================================================
--- nnrpd/list.c 2010-08-01 10:12:14 UTC (rev 9091)
+++ nnrpd/list.c 2010-08-03 18:40:23 UTC (rev 9092)
@@ -160,6 +160,7 @@
if (count == 0)
lo = hi + 1;
Reply("%d %s\r\n", NNTP_OK_LIST, INFOactive.Format);
+ /* 10 is ARTNUMPRINTSIZE. */
Printf("%s %010u %010u %c\r\n", group, hi, lo, flag);
Printf(".\r\n");
return true;
More information about the inn-committers
mailing list