Skip to content

Commit 398bbc0

Browse files
committed
char array cleanup
- made many char[] arrays larger; see #13 for why. This was done without any attempt to understand the code, so please report any problems. - cleaned up some gcc warnings
1 parent 29cb093 commit 398bbc0

20 files changed

+88
-76
lines changed

NEWS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
New in version 0.42
2+
===================
3+
4+
- made many char[] arrays larger; see
5+
https://github.com/lojban/jbofihe/issues/13 for why. This was
6+
done without any attempt to understand the code, so please report
7+
any problems.
8+
- cleaned up some gcc warnings
9+
110
New in version 0.41
211
===================
312

build-in-container.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ make all
1111
DESTDIR=build/ make install
1212
rm -rf build/usr/lib/.build-id
1313
cp find_lojban.pl build/usr/local/bin/find_lojban
14-
rm -f jbofihe-0.41-1.x86_64.rpm
15-
fpm -s dir -t rpm -n jbofihe -v 0.41 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
16-
rpm -qpl jbofihe-0.41-1.x86_64.rpm | sort
14+
rm -f jbofihe-0.42-1.x86_64.rpm
15+
fpm -s dir -t rpm -n jbofihe -v 0.42 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
16+
rpm -qpl jbofihe-0.42-1.x86_64.rpm | sort

canonluj.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ lookup_component(char *x)
120120
static void
121121
strip_leading_rafsi(char **y, int len, int hy, int first, char *result)
122122
{
123-
char buf[5], *comp;
123+
char buf[65536], *comp;
124124
char *x = *y;
125125
int i;
126126
for (i=0; i<len; i++) buf[i] = x[i];
@@ -138,7 +138,7 @@ strip_leading_rafsi(char **y, int len, int hy, int first, char *result)
138138
static char *
139139
split_lujvo (char *x)
140140
{
141-
static char result[2048];
141+
static char result[65536];
142142
int first=1; /* At start, so we can handle r and n hyphens */
143143

144144
result[0] = 0;
@@ -279,7 +279,7 @@ canon_lujvo (char *x)
279279
#ifdef TEST
280280

281281
int main (int argc, char **argv) {
282-
char line[128], *result;
282+
char line[65536], *result;
283283
while (fgets(line, sizeof(line), stdin)) {
284284
line[strlen(line)-1] = 0; /* strip NL */
285285
result = canon_lujvo(line);

cm_gather.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ static void
105105
try_cmavo_fragment(node *p)
106106
{
107107
char buf_in[32];
108-
char buf[2048];
109-
char buf_out[256];
108+
char buf[65536];
109+
char buf_out[65536];
110110

111111
char *q, *r, *t;
112112
buf[0] = 0;
@@ -146,10 +146,10 @@ translate_selmao(char *x) {
146146
static void
147147
try_cmavo_fragment(char *lojban, char **transbuf, char* (*transfn)(char *))
148148
{
149-
char buf[256], buf2[256];
149+
char buf[65536], buf2[65536];
150150
char *pbuf;
151151
char *t, *e;
152-
char bufout[1024];
152+
char bufout[65536];
153153
int len;
154154

155155
bufout[0] = 0;

cm_translate.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
char *
2323
translate(char *word)
2424
{
25-
static char buf[1024];
25+
static char buf[65536];
2626
char *res;
2727

2828
res = dict_lookup(word);
@@ -63,7 +63,7 @@ static char *
6363
translate_comp(char *w, int *conversion)
6464
{
6565
char buf[64], buf2[4];
66-
static char result[256];
66+
static char result[65536];
6767
char *trans;
6868
strcpy(buf, w);
6969
if (*conversion) {
@@ -109,7 +109,7 @@ translate_comp(char *w, int *conversion)
109109
static char *
110110
translate_lujvo(char *word)
111111
{
112-
static char result[4096];
112+
static char result[65536];
113113
char buf[64];
114114
char *w, *trans;
115115
int initial;
@@ -265,7 +265,7 @@ is_consonant_not_r(char c)
265265
char *
266266
translate_unknown(char *w)
267267
{
268-
static char buf[2048];
268+
static char buf[65536];
269269
int len, i;
270270
int hyph;
271271
char *p, *q;

conversion.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <assert.h>
18+
#include <string.h>
1819
#include "nodes.h"
1920
#include "functions.h"
2021
#include "rpc2x_act.tab.h"

functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ is_simple_nonterm(TreeNode *x)
675675
char *
676676
make_uppercase(char *s)
677677
{
678-
static char buffer[1024];
678+
static char buffer[65536];
679679
char *p;
680680
strcpy(buffer, s);
681681
p = buffer;

htmlout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ write_close_bracket(BracketType type, int subscript)
224224
static char *
225225
make_htmlsafe(char *s)
226226
{
227-
static char buf[2048];
227+
static char buf[65536];
228228
char *p, *q;
229229
p = s;
230230
q = buf;

latex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ latex_write_close_bracket(BracketType type, int subscript)
260260
char *
261261
make_texsafe(char *s)
262262
{
263-
static char buf[2048];
263+
static char buf[65536];
264264
char *p, *q;
265265
p = s;
266266
q = buf;

latexblk.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ typedef enum {
2525

2626
static States state;
2727

28-
static char tag_text[4096];
29-
static char loj_text[4096];
30-
static char eng_text[4096];
28+
static char tag_text[65536];
29+
static char loj_text[65536];
30+
static char eng_text[65536];
3131

3232
/*++++++++++++++++++++++++++++++++++++++
3333
@@ -411,7 +411,7 @@ start_tag(void)
411411
static void
412412
write_tag_text(char *brivla, char *place, char *trans, int brac)
413413
{
414-
char buffer[1024];
414+
char buffer[65536];
415415

416416
if (brac) {
417417
sprintf(buffer, "%s%s (%s)", brivla, place, make_texsafe(trans));
@@ -426,7 +426,7 @@ write_tag_text(char *brivla, char *place, char *trans, int brac)
426426

427427
static void write_partial_tag_text(char *t)/*{{{*/
428428
{
429-
char buffer[1024];
429+
char buffer[65536];
430430

431431
sprintf(buffer, "%s", t);
432432
if (tag_text[1]) { /* '[' is pre-inserted by start_tags */

0 commit comments

Comments
 (0)