~ubuntu-branches/debian/sid/gnome-chess/sid

« back to all changes in this revision

Viewing changes to debian/patches/019-assertions.diff

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Rittau
  • Date: 2005-09-04 18:16:43 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050904181643-qfph33u3pa4azz5h
Tags: 0.3.3-6
* Fix problems with gcc 4.0:
  + debian/patches/021-gcc-4.0-fixes.diff: New patch.
  + Closes: #258798 "FTBFS with gcc-3.4: label at end of compound statement"
* Fix wrong Debian patch:
  + debian/patch/019-assertions.diff: Fixed.
  + Partly addresses bug #247846 "Crashes after a few moves (assertion
    failed)". This fix is not perfect. As Göran Weinholt notes in the
    bug report, assertions are not the way to go, but are a temporary
    stop-gap measure. (Better assertions than unpredicable results.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- src/notation.h.old  2001-05-31 19:16:03.000000000 +0200
 
2
+++ src/notation.h      2003-06-12 03:44:17.000000000 +0200
 
3
@@ -14,6 +14,9 @@
 
4
  * You should have received a copy of the GNU General Public License
 
5
  * along with this program; if not, write to the Free Software
 
6
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
7
+ *
 
8
+ * Changed in 2003 by Sebastian Rittau <srittau@debian.org>
 
9
+ * for Debian GNU/Linux (bug fixes).
 
10
  */
 
11
 
 
12
 #ifndef _NOTATION_H_
 
13
@@ -35,7 +38,7 @@
 
14
 
 
15
 /* Standard Algebraic Notation Functions */
 
16
 char * move_to_san (Position *pos, Square from, Square to);
 
17
-int san_to_move (Position *pos, char *p, Square *from, Square *to);
 
18
+gboolean san_to_move (Position *pos, char *p, Square *from, Square *to);
 
19
 
 
20
 #ifdef __cplusplus
 
21
 }
 
22
--- src/notation.c.old  2001-06-28 22:59:39.000000000 +0200
 
23
+++ src/notation.c      2003-06-12 03:44:01.000000000 +0200
 
24
@@ -14,6 +14,9 @@
 
25
  * You should have received a copy of the GNU General Public License
 
26
  * along with this program; if not, write to the Free Software
 
27
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
28
+ *
 
29
+ * Changed in 2003 by Sebastian Rittau <srittau@debian.org> for
 
30
+ * Debian GNU/Linux (bug fixes).
 
31
  */
 
32
 
 
33
 #include <stdlib.h>
 
34
@@ -215,8 +218,15 @@
 
35
                return;
 
36
        }
 
37
 
 
38
+       g_assert(*p >= 'a' && *p <= 'h');
 
39
+       g_assert(*(p + 1) >= '1' && *(p + 1) <= '8');
 
40
+
 
41
        *from = (*p - 'a' + 1) + (*(p + 1) - '1' + 2 ) * 10;
 
42
        p += 2;
 
43
+
 
44
+       g_assert(*p >= 'a' && *p <= 'h');
 
45
+       g_assert(*(p + 1) >= '1' && *(p + 1) <= '8');
 
46
+
 
47
        *to = (*p - 'a' + 1) + (*(p + 1) - '1' + 2 ) * 10;
 
48
        p += 2;
 
49
        
 
50
@@ -232,7 +242,7 @@
 
51
        }
 
52
 }
 
53
 
 
54
-int 
 
55
+gboolean
 
56
 san_to_move (Position *pos, char *str, Square *from, Square *to)
 
57
 {
 
58
        Square zugliste[AB_ZUGL];
 
59
@@ -263,7 +273,7 @@
 
60
                        if (!strcmp (p, str)) {
 
61
                                *from = *aq;
 
62
                                *to   = *(aq+1);
 
63
-                               return 0;
 
64
+                               return FALSE;
 
65
                        }
 
66
 
 
67
                         /* e.g. ed5 */                 
 
68
@@ -277,7 +287,7 @@
 
69
                                if (!strcmp(p,str)) {
 
70
                                        *from = *aq;
 
71
                                        *to   = *(aq+1);
 
72
-                                       return 0;
 
73
+                                       return FALSE;
 
74
                                }
 
75
 
 
76
                         /* e.g. d5 */
 
77
@@ -285,7 +295,7 @@
 
78
                        if (!strcmp(p,str)) {
 
79
                                *from = *aq;
 
80
                                *to   = *(aq+1);
 
81
-                               return 0;
 
82
+                               return FALSE;
 
83
                        }
 
84
 
 
85
                } else {
 
86
@@ -296,7 +306,7 @@
 
87
                        if (!strcmp (p, str)) {
 
88
                                *from = *aq;
 
89
                                *to   = *(aq+1);
 
90
-                               return 0;
 
91
+                               return FALSE;
 
92
                        }
 
93
 
 
94
                         /* Ngf3 */
 
95
@@ -308,7 +318,7 @@
 
96
                        if (!strcmp(p,str)) {
 
97
                                *from = *aq;
 
98
                                *to   = *(aq+1);
 
99
-                               return 0;
 
100
+                               return FALSE;
 
101
                        }
 
102
 
 
103
                        /* N1f3 */
 
104
@@ -317,7 +327,7 @@
 
105
                        if (!strcmp(p,str)) {
 
106
                                *from = *aq;
 
107
                                *to   = *(aq+1);
 
108
-                               return 0;
 
109
+                               return FALSE;
 
110
                        }
 
111
 
 
112
                        /* Nf3 */
 
113
@@ -328,12 +338,12 @@
 
114
                        if (!strcmp(p,str)) {
 
115
                                *from = *aq;
 
116
                                *to   = *(aq+1);
 
117
-                               return 0;
 
118
+                               return FALSE;
 
119
                        }
 
120
                }
 
121
        }
 
122
 
 
123
-       return 1;
 
124
+       return TRUE;
 
125
 }
 
126
 
 
127
 static int