Module Name:    src
Committed By:   riastradh
Date:           Sun Apr 16 23:43:57 UTC 2017

Modified Files:
        src/usr.bin/vndcompress: common.h

Log Message:
Emphasize that MAX_WINDOW_SIZE is bounded by the maximum uint32_t.

Since we store window sizes in uint32_t, the maximum had better fit
in uint32_t!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/vndcompress/common.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/vndcompress/common.h
diff -u src/usr.bin/vndcompress/common.h:1.6 src/usr.bin/vndcompress/common.h:1.7
--- src/usr.bin/vndcompress/common.h:1.6	Wed Jan 22 06:18:00 2014
+++ src/usr.bin/vndcompress/common.h	Sun Apr 16 23:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.h,v 1.6 2014/01/22 06:18:00 riastradh Exp $	*/
+/*	$NetBSD: common.h,v 1.7 2017/04/16 23:43:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -111,13 +111,13 @@
 #define	MAX_N_OFFSETS		(MAX_N_BLOCKS + 1)
 
 /*
- * The window size is at most the number of offsets, so it has the same
- * maximum bound.  The default window size is chosen so that windows
+ * The window size is at most the number of offsets, or the largest
+ * uint32_t value.  The default window size is chosen so that windows
  * fit in one 4096-byte page of memory.  We could use 64k bytes, or
  * st_blksize, to maximize I/O transfer size, but the transfers won't
  * be aligned without a lot of extra work.
  */
-#define	MAX_WINDOW_SIZE		MAX_N_OFFSETS
+#define	MAX_WINDOW_SIZE		MIN(UINT32_MAX, MAX_N_OFFSETS)
 #define	DEF_WINDOW_SIZE		512
 
 struct cloop2_header {

Reply via email to