Skip to content

Commit

Permalink
AURORA: Check kGFF4G2DAColumnType fields in GDA files for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Nov 18, 2016
1 parent ea15b5a commit e86ab25
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/aurora/gdafile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,24 @@ GDAFile::Type GDAFile::identifyType(const Columns &columns, const Row &rows, siz
if (!columns || (column >= columns->size()) || !(*columns)[column])
return kTypeEmpty;

if ((*columns)[column]->hasField(kGFF4G2DAColumnType))
return (Type) (*columns)[column]->getUint(kGFF4G2DAColumnType, -1);
if ((*columns)[column]->hasField(kGFF4G2DAColumnType)) {
const Type type = (Type) (*columns)[column]->getUint(kGFF4G2DAColumnType, -1);

switch (type) {
case kTypeEmpty:
case kTypeString:
case kTypeInt:
case kTypeFloat:
case kTypeBool:
case kTypeResource:
break;

default:
throw Common::Exception("Invalid GDA column type %d", (int) type);
}

return type;
}

if (!rows || rows->empty() || !(*rows)[0])
return kTypeEmpty;
Expand Down

0 comments on commit e86ab25

Please sign in to comment.