Browse Source

Add ORCA_ROW_MAX and ORCA_COL_MAX

master
cancel 6 years ago
parent
commit
0ad3b513a0
  1. 3
      base.h
  2. 4
      field.c

3
base.h

@ -8,6 +8,9 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#define ORCA_ROW_MAX UINT16_MAX
#define ORCA_COL_MAX UINT16_MAX
typedef char Term; typedef char Term;
typedef uint16_t U16; typedef uint16_t U16;
typedef int16_t I16; typedef int16_t I16;

4
field.c

@ -178,7 +178,7 @@ Field_load_error field_load_file(char const* filepath, Field* field) {
char* s = fgets(buf, Bufsize, file); char* s = fgets(buf, Bufsize, file);
if (s == NULL) if (s == NULL)
break; break;
if (rows == UINT16_MAX) { if (rows == ORCA_ROW_MAX) {
fclose(file); fclose(file);
return Field_load_error_too_many_rows; return Field_load_error_too_many_rows;
} }
@ -196,7 +196,7 @@ Field_load_error field_load_file(char const* filepath, Field* field) {
} }
if (len == 0) if (len == 0)
continue; continue;
if (len > UINT16_MAX) { if (len >= ORCA_ROW_MAX) {
fclose(file); fclose(file);
return Field_load_error_too_many_columns; return Field_load_error_too_many_columns;
} }

Loading…
Cancel
Save