Skip to content

Commit 7f3b6de

Browse files
committed
Merge pull request #2 from dimpase/master
Fix from Dima Pasechnik making long filenames possible in Leon's C-programs.
2 parents d16b09e + 119a604 commit 7f3b6de

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

lib/decoders.gi

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ end);
6161
InstallMethod(Decode, "method for linear code, codeword", true,
6262
[IsLinearCode, IsCodeword], 0,
6363
function(C, v)
64-
local c, S, syn, index, corr, Gt, i, x, F;
64+
local ok, c, S, syn, index, corr, Gt, i, x, F;
6565
if v in C then
6666
return InformationWord(C,v);
6767
fi;
@@ -72,10 +72,16 @@ function(C, v)
7272
F := LeftActingDomain(C);
7373
S := SyndromeTable(C);
7474
syn := Syndrome(C, c);
75-
index := 0;
76-
repeat
77-
index := index + 1;
78-
until S[index][2] = syn;
75+
ok := false;
76+
for index in [1..Length(S)] do
77+
if IsBound(S[index]) and S[index][2] = syn then
78+
ok := true;
79+
break;
80+
fi;
81+
od;
82+
if not ok then # this should never happen!
83+
Error("In Decodeword: index not found");
84+
fi;
7985
#This is a hack. The subtraction operation for codewords is causing an error
8086
#and rather than trying to understand the method selection process, I'm brute-
8187
#forcing things...
@@ -135,7 +141,7 @@ end);
135141
InstallMethod(Decodeword, "method for linear code, codeword", true,
136142
[IsLinearCode, IsCodeword], 0,
137143
function(C, v)
138-
local c, c0, S, syn, index, corr, Gt, i, x, F;
144+
local ok, c, c0, S, syn, index, corr, Gt, i, x, F;
139145
if v in C then
140146
return v;
141147
fi;
@@ -153,10 +159,16 @@ function(C, v)
153159
F := LeftActingDomain(C);
154160
S := SyndromeTable(C);
155161
syn := Syndrome(C, c);
156-
index := 0;
157-
repeat
158-
index := index + 1;
159-
until S[index][2] = syn;
162+
ok := false;
163+
for index in [1..Length(S)] do
164+
if IsBound(S[index]) and S[index][2] = syn then
165+
ok := true;
166+
break;
167+
fi;
168+
od;
169+
if not ok then # this should never happen!
170+
Error("In Decodeword: index not found");
171+
fi;
160172
corr := VectorCodeword(c - S[index][1]); # correct codeword
161173
return Codeword(corr,F);
162174
end);

src/leon/src/group.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ that special symbol. */
103103
#define SCANF_Int_FORMAT "%u"
104104

105105
#ifndef MAX_NAME_LENGTH
106-
#define MAX_NAME_LENGTH 64
106+
#define MAX_NAME_LENGTH 256
107107
#endif
108108

109109
#ifndef MAX_FILE_NAME_LENGTH
110-
#define MAX_FILE_NAME_LENGTH 60
110+
#define MAX_FILE_NAME_LENGTH 256
111111
#endif
112112

113113
#ifndef DEFAULT_MAX_BASE_SIZE

0 commit comments

Comments
 (0)