Skip to content

Commit

Permalink
Merge pull request #2 from dimpase/master
Browse files Browse the repository at this point in the history
Fix from Dima Pasechnik making long filenames possible in Leon's C-programs.
  • Loading branch information
osj1961 committed Jun 12, 2015
2 parents d16b09e + 119a604 commit 7f3b6de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
32 changes: 22 additions & 10 deletions lib/decoders.gi
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end);
InstallMethod(Decode, "method for linear code, codeword", true,
[IsLinearCode, IsCodeword], 0,
function(C, v)
local c, S, syn, index, corr, Gt, i, x, F;
local ok, c, S, syn, index, corr, Gt, i, x, F;
if v in C then
return InformationWord(C,v);
fi;
Expand All @@ -72,10 +72,16 @@ function(C, v)
F := LeftActingDomain(C);
S := SyndromeTable(C);
syn := Syndrome(C, c);
index := 0;
repeat
index := index + 1;
until S[index][2] = syn;
ok := false;
for index in [1..Length(S)] do
if IsBound(S[index]) and S[index][2] = syn then
ok := true;
break;
fi;
od;
if not ok then # this should never happen!
Error("In Decodeword: index not found");
fi;
#This is a hack. The subtraction operation for codewords is causing an error
#and rather than trying to understand the method selection process, I'm brute-
#forcing things...
Expand Down Expand Up @@ -135,7 +141,7 @@ end);
InstallMethod(Decodeword, "method for linear code, codeword", true,
[IsLinearCode, IsCodeword], 0,
function(C, v)
local c, c0, S, syn, index, corr, Gt, i, x, F;
local ok, c, c0, S, syn, index, corr, Gt, i, x, F;
if v in C then
return v;
fi;
Expand All @@ -153,10 +159,16 @@ function(C, v)
F := LeftActingDomain(C);
S := SyndromeTable(C);
syn := Syndrome(C, c);
index := 0;
repeat
index := index + 1;
until S[index][2] = syn;
ok := false;
for index in [1..Length(S)] do
if IsBound(S[index]) and S[index][2] = syn then
ok := true;
break;
fi;
od;
if not ok then # this should never happen!
Error("In Decodeword: index not found");
fi;
corr := VectorCodeword(c - S[index][1]); # correct codeword
return Codeword(corr,F);
end);
Expand Down
4 changes: 2 additions & 2 deletions src/leon/src/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ that special symbol. */
#define SCANF_Int_FORMAT "%u"

#ifndef MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 64
#define MAX_NAME_LENGTH 256
#endif

#ifndef MAX_FILE_NAME_LENGTH
#define MAX_FILE_NAME_LENGTH 60
#define MAX_FILE_NAME_LENGTH 256
#endif

#ifndef DEFAULT_MAX_BASE_SIZE
Expand Down

0 comments on commit 7f3b6de

Please sign in to comment.