Skip to content

Commit

Permalink
Fix all compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
santhoshtr committed May 21, 2021
1 parent 2a99dbd commit 2722a3a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ else()
endif()

if(FLEX_FOUND)
FLEX_TARGET(sfst default-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/default-scanner.cpp)
FLEX_TARGET(sfst utf8-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/utf8-scanner.cpp)
FLEX_TARGET(sfst default-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/default-scanner.cpp COMPILE_FLAGS --nounput)
FLEX_TARGET(sfst utf8-scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/utf8-scanner.cpp COMPILE_FLAGS --nounput)
else()
message(STATUS "Flex not found, so executables won't be generated.")
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/compact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ void CompactTransducer::read_probs(FILE *file)

{
size_t n, m;
fread(&n, sizeof(n), 1, file);
(void)!fread(&n, sizeof(n), 1, file);
if (fread(&m, sizeof(n), 1, file) != 1 || n != node_count() ||
m != arc_count()) {
fprintf(stderr, "Error: incompatible probability file!\n");
exit(1);
}
final_logprob = new float[n];
arc_logprob = new float[m];
fread(final_logprob, sizeof(float), n, file);
(void)!fread(final_logprob, sizeof(float), n, file);
if (fread(arc_logprob, sizeof(float), n, file) != n) {
fprintf(stderr, "Error: in probability file!\n");
exit(1);
Expand Down
12 changes: 6 additions & 6 deletions src/fst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,18 +863,18 @@ void Transducer::store(FILE *file)

static void read_node(FILE *file, Node *node, Node **p, Transducer *a) {
char c;
fread(&c, sizeof(c), 1, file);
(void)!fread(&c, sizeof(c), 1, file);
node->set_final(c);

unsigned short n;
fread(&n, sizeof(n), 1, file);
(void)!fread(&n, sizeof(n), 1, file);

for (int i = 0; i < n; i++) {
Character lc, uc;
unsigned int t;
fread(&lc, sizeof(lc), 1, file);
fread(&uc, sizeof(uc), 1, file);
fread(&t, sizeof(t), 1, file);
(void)!fread(&lc, sizeof(lc), 1, file);
(void)!fread(&uc, sizeof(uc), 1, file);
(void)!fread(&t, sizeof(t), 1, file);
if (ferror(file))
throw "Error encountered while reading transducer from file";
if (p[t])
Expand All @@ -901,7 +901,7 @@ void Transducer::read_transducer_binary(FILE *file)

vmark = deterministic = 0;
unsigned int n;
fread(&n, sizeof(n), 1, file); // number of nodes
(void)!fread(&n, sizeof(n), 1, file); // number of nodes
if (ferror(file))
throw "Error encountered while reading transducer from file";

Expand Down
10 changes: 5 additions & 5 deletions src/lowmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class LMNode {

LMNode(long pos, FILE *lmafile) {
fseek(lmafile, pos, SEEK_SET);
fread(&finalp, sizeof(finalp), 1, lmafile);
fread(&number_of_arcs, sizeof(number_of_arcs), 1, lmafile);
(void)!fread(&finalp, sizeof(finalp), 1, lmafile);
(void)!fread(&number_of_arcs, sizeof(number_of_arcs), 1, lmafile);
arc = new LMArc[number_of_arcs];
for (int i = 0; i < (int)number_of_arcs; i++) {
Character lc, uc;
unsigned int tpos;
fread(&lc, sizeof(lc), 1, lmafile);
fread(&uc, sizeof(uc), 1, lmafile);
fread(&tpos, sizeof(tpos), 1, lmafile);
(void)!fread(&lc, sizeof(lc), 1, lmafile);
(void)!fread(&uc, sizeof(uc), 1, lmafile);
(void)!fread(&tpos, sizeof(tpos), 1, lmafile);
arc[i].label = Label(lc, uc);
arc[i].tnodepos = tpos;
}
Expand Down
14 changes: 7 additions & 7 deletions src/utf8-scanner.ll
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace SFST;

#define MAX_INCLUDE_DEPTH 10

int Include_Stack_Ptr = 0;
YY_BUFFER_STATE Include_Stack[MAX_INCLUDE_DEPTH];
char *Name_Stack[MAX_INCLUDE_DEPTH];
Expand All @@ -34,9 +34,9 @@ char *FileName=NULL;

bool UTF8=true;

static void unmatched( char sym ) {
fprintf(stderr,"Warning: unmatched symbol \"%c\". You might want to quote it.\n", sym);
}
// static void unmatched( char sym ) {
// fprintf(stderr,"Warning: unmatched symbol \"%c\". You might want to quote it.\n", sym);
//}
static char *unquote(char *string, bool del_quote=true) {
char *s=string, *result=string;
Expand Down Expand Up @@ -155,13 +155,13 @@ FN [A-Za-z0-9._/\-*+]
\<({C5}|\\.)*\> { yylval.name = unquote(yytext,false); return SYMBOL; }
\"<{FN}+>\" {
\"<{FN}+>\" {
yylval.value = fst_strdup(yytext+2);
yylval.value[strlen(yylval.value)-2] = 0;
return STRING2;
}
\"{FN}+\" {
\"{FN}+\" {
yylval.value = fst_strdup(yytext+1);
yylval.value[strlen(yylval.value)-1] = 0;
return STRING;
Expand All @@ -171,7 +171,7 @@ FN [A-Za-z0-9._/\-*+]
\\[ \t]*([ \t]\%.*)?\r?\n { print_lineno(); /* ignored */ }
\r?\n { print_lineno(); return NEWLINE; }
\\[0-9]+ { long l=atol(yytext+1);
\\[0-9]+ { long l=atol(yytext+1);
if (l <= 1114112) { yylval.value=fst_strdup(int2utf8((unsigned)l)); return UTF8CHAR; }
yyerror("invalid expression");
}
Expand Down

0 comments on commit 2722a3a

Please sign in to comment.