r9429 - in packages/trunk/xmahjongg/debian: . patches
Peter Pentchev
roam-guest at alioth.debian.org
Mon Apr 6 14:43:05 UTC 2009
Author: roam-guest
Date: 2009-04-06 14:43:04 +0000 (Mon, 06 Apr 2009)
New Revision: 9429
Added:
packages/trunk/xmahjongg/debian/patches/05-feof.patch
Modified:
packages/trunk/xmahjongg/debian/changelog
packages/trunk/xmahjongg/debian/patches/series
Log:
Fix reading the layout files.
The problem was that xmahjongg assumed that when fgets() reads a line
containing the final newline of a file, the file's EOF indicator would
be set. However, this seems not to be the case on recent Debian
versions, so a patch is needed to explicitly distinguish between feof()
and ferror() *after* the fgets() call.
Closes: #522740
Modified: packages/trunk/xmahjongg/debian/changelog
===================================================================
--- packages/trunk/xmahjongg/debian/changelog 2009-04-06 01:44:45 UTC (rev 9428)
+++ packages/trunk/xmahjongg/debian/changelog 2009-04-06 14:43:04 UTC (rev 9429)
@@ -1,3 +1,9 @@
+xmahjongg (3.7-3) unstable; urgency=low
+
+ * Unbreak reading layout files. Closes: #522740
+
+ -- Peter Pentchev <roam at ringlet.net> Mon, 06 Apr 2009 17:35:18 +0300
+
xmahjongg (3.7-2) unstable; urgency=low
* New maintainer. Closes: #519355
Added: packages/trunk/xmahjongg/debian/patches/05-feof.patch
===================================================================
--- packages/trunk/xmahjongg/debian/patches/05-feof.patch (rev 0)
+++ packages/trunk/xmahjongg/debian/patches/05-feof.patch 2009-04-06 14:43:04 UTC (rev 9429)
@@ -0,0 +1,24 @@
+Do not break if fgets() detects EOF when invoked *at* EOF instead of
+setting the EOF flag at the end of the previous invocation, after
+the final newline has been read.
+
+--- a/src/game.cc
++++ b/src/game.cc
+@@ -498,7 +498,7 @@
+ while (!feof(f)) {
+ buffer[0] = 0;
+ if (fgets(buffer, BUFSIZ, f) == NULL)
+- return false;
++ return feof(f)? true: false;
+ int r, c, l;
+ if (sscanf(buffer, " %d %d %d", &r, &c, &l) == 3)
+ if (!place_tile(r+2, c+2, l))
+@@ -527,7 +527,7 @@
+ for (int r = 0; r < 16 && !feof(f); r++) {
+ buf[0] = 0;
+ if (fgets(buf, BUFSIZ, f) == NULL)
+- return false;
++ return feof(f)? true: false;
+ for (int c = 0; c < TILE_COLS - 3 && buf[c] && !isspace(buf[c]); c++)
+ if (buf[c] == '1') {
+ if (!place_tile(r + 2, c + 2, l))
Modified: packages/trunk/xmahjongg/debian/patches/series
===================================================================
--- packages/trunk/xmahjongg/debian/patches/series 2009-04-06 01:44:45 UTC (rev 9428)
+++ packages/trunk/xmahjongg/debian/patches/series 2009-04-06 14:43:04 UTC (rev 9429)
@@ -2,3 +2,4 @@
02-manpage-typo.patch
03-compiler-warnings.patch
04-gif-read-errors.patch
+05-feof.patch
More information about the Pkg-games-commits
mailing list