]> git.pld-linux.org Git - packages/fortune-mod.git/blob - fortune-mod-32bit-offset.patch
- always use 32 bit offsets in .dat files (they are in %%{_datadir})
[packages/fortune-mod.git] / fortune-mod-32bit-offset.patch
1 diff -ur fortune-mod-9708/fortune/fortune.c fortune-mod-9708-/fortune/fortune.c
2 --- fortune-mod-9708/fortune/fortune.c  Thu Aug 28 21:43:52 1997
3 +++ fortune-mod-9708-/fortune/fortune.c Tue Jun  4 17:20:25 2002
4 @@ -131,7 +131,7 @@
5  #define        MINW    6               /* minimum wait if desired */
6  #define        CPERS   20              /* # of chars for each sec */
7  
8 -#define        POS_UNKNOWN     ((off_t) -1)    /* pos for file unknown */
9 +#define        POS_UNKNOWN     ((uint32_t) -1) /* pos for file unknown */
10  #define        NO_PROB         (-1)    /* no prob specified for file */
11  
12  #ifdef DEBUG
13 @@ -146,7 +146,7 @@
14  {
15      int percent;
16      int fd, datfd;
17 -    off_t pos;
18 +    uint32_t pos;
19      FILE *inf;
20      char *name;
21      char *path;
22 @@ -184,7 +184,7 @@
23    Num_files, Num_kids,         /* totals of files and children. */
24    SLEN = 160;                  /* max. characters in a "short" fortune */
25  
26 -off_t Seekpts[2];              /* seek pointers to fortunes */
27 +uint32_t Seekpts[2];           /* seek pointers to fortunes */
28  
29  FILEDESC *File_list = NULL,    /* Head of file list */
30   *File_tail = NULL;            /* Tail of file list */
31 diff -ur fortune-mod-9708/util/strfile.c fortune-mod-9708-/util/strfile.c
32 --- fortune-mod-9708/util/strfile.c     Thu May  1 06:24:01 1997
33 +++ fortune-mod-9708-/util/strfile.c    Tue Jun  4 17:11:34 2002
34 @@ -135,7 +135,7 @@
35  typedef struct
36  {
37      char first;
38 -    off_t pos;
39 +    uint32_t pos;
40  }
41  STR;
42  
43 @@ -150,7 +150,7 @@
44  int Xflag = FALSE;             /* set rotated bit */
45  long Num_pts = 0;              /* number of pointers/strings */
46  
47 -off_t *Seekpts;
48 +uint32_t *Seekpts;
49  
50  FILE *Sort_1, *Sort_2;         /* pointers for sorting */
51  
52 @@ -228,9 +228,9 @@
53   * add_offset:
54   *      Add an offset to the list, or write it out, as appropriate.
55   */
56 -void add_offset(FILE * fp, off_t off)
57 +void add_offset(FILE * fp, uint32_t off)
58  {
59 -    off_t net;
60 +    uint32_t net;
61  
62      if (!STORING_PTRS)
63      {
64 @@ -249,9 +249,9 @@
65   * fix_last_offset:
66   *     Used when we have two separators in a row.
67   */
68 -void fix_last_offset(FILE * fp, off_t off)
69 +void fix_last_offset(FILE * fp, uint32_t off)
70  {
71 -    off_t net;
72 +    uint32_t net;
73  
74      if (!STORING_PTRS)
75      {
76 @@ -324,7 +324,7 @@
77    do_order(void)
78  {
79      register long i;
80 -    register off_t *lp;
81 +    register uint32_t *lp;
82      register STR *fp;
83  
84      Sort_1 = fopen(Infile, "r");
85 @@ -375,8 +375,8 @@
86  void randomize(void)
87  {
88      register int cnt, i;
89 -    register off_t tmp;
90 -    register off_t *sp;
91 +    register uint32_t tmp;
92 +    register uint32_t *sp;
93      extern time_t time(time_t *);
94  
95      srandom((int) (time((time_t *) NULL) + getpid()));
96 @@ -413,7 +413,7 @@
97  {
98      register unsigned char *sp;
99      register FILE *inf, *outf;
100 -    register off_t last_off, length, pos, *p;
101 +    register uint32_t last_off, length, pos, *p;
102      register int first, cnt;
103      register char *nsp;
104      register STR *fp;
105 diff -ur fortune-mod-9708/util/strfile.h fortune-mod-9708-/util/strfile.h
106 --- fortune-mod-9708/util/strfile.h     Thu Mar 23 12:04:08 1995
107 +++ fortune-mod-9708-/util/strfile.h    Tue Jun  4 17:04:32 2002
108 @@ -41,16 +41,18 @@
109  #define        STR_ENDSTRING(line,tbl) \
110         ((line)[0] == (tbl).str_delim && (line)[1] == '\n')
111  
112 +#include <inttypes.h>
113 +
114  typedef struct {                               /* information table */
115  #define        VERSION         1
116 -       unsigned long   str_version;            /* version number */
117 -       unsigned long   str_numstr;             /* # of strings in the file */
118 -       unsigned long   str_longlen;            /* length of longest string */
119 -       unsigned long   str_shortlen;           /* length of shortest string */
120 +       uint32_t        str_version;            /* version number */
121 +       uint32_t        str_numstr;             /* # of strings in the file */
122 +       uint32_t        str_longlen;            /* length of longest string */
123 +       uint32_t        str_shortlen;           /* length of shortest string */
124  #define        STR_RANDOM      0x1                     /* randomized pointers */
125  #define        STR_ORDERED     0x2                     /* ordered pointers */
126  #define        STR_ROTATED     0x4                     /* rot-13'd text */
127 -       unsigned long   str_flags;              /* bit field for flags */
128 +       uint32_t        str_flags;              /* bit field for flags */
129         unsigned char   stuff[4];               /* long aligned space */
130  #define        str_delim       stuff[0]                /* delimiting character */
131  } STRFILE;
132 diff -ur fortune-mod-9708/util/unstr.c fortune-mod-9708-/util/unstr.c
133 --- fortune-mod-9708/util/unstr.c       Fri Apr 18 08:27:01 1997
134 +++ fortune-mod-9708-/util/unstr.c      Tue Jun  4 17:18:25 2002
135 @@ -175,7 +175,7 @@
136  {
137      register int i;
138      register unsigned char *sp;
139 -    auto off_t pos;
140 +    auto uint32_t pos;
141      char buf[BUFSIZ];
142      int printedsome;
143  
144 diff -ur fortune-mod-9708-/util/strfile.8 fortune-mod-9708/util/strfile.8
145 --- fortune-mod-9708-/util/strfile.8    Thu Mar 23 12:04:07 1995
146 +++ fortune-mod-9708/util/strfile.8     Tue Jun  4 17:28:16 2002
147 @@ -104,18 +104,19 @@
148  The format of the header is:
149  .Bd -literal
150  #define        VERSION 1
151 -unsigned long  str_version;    /* version number */
152 -unsigned long  str_numstr;     /* # of strings in the file */
153 -unsigned long  str_longlen;    /* length of longest string */
154 -unsigned long  str_shortlen;   /* length of shortest string */
155 +uint32_t       str_version;    /* version number */
156 +uint32_t       str_numstr;     /* # of strings in the file */
157 +uint32_t       str_longlen;    /* length of longest string */
158 +uint32_t       str_shortlen;   /* length of shortest string */
159  #define        STR_RANDOM      0x1     /* randomized pointers */
160  #define        STR_ORDERED     0x2     /* ordered pointers */
161  #define        STR_ROTATED     0x4     /* rot-13'd text */
162 -unsigned long  str_flags;      /* bit field for flags */
163 +uint32_t       str_flags;      /* bit field for flags */
164  char str_delim;                        /* delimiting character */
165  .Ed
166  .Pp
167 -All fields are written in network byte order.
168 +All fields are written in network byte order. uint32_t is 32-bit wide
169 +unsigned integer, as defined in <inttypes.h>.
170  .Pp
171  The purpose of
172  .Nm unstr
This page took 0.06871 seconds and 3 git commands to generate.