Changeset 5d57155 for GenericIO.cxx
- Timestamp:
- 09/25/17 16:15:39 (7 years ago)
- Branches:
- master, pympi
- Children:
- b02d091
- Parents:
- fb69232
- git-author:
- Hal Finkel <hfinkel@…> (09/25/17 16:15:39)
- git-committer:
- Hal Finkel <hfinkel@…> (09/25/17 16:15:39)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GenericIO.cxx
r14e73bb r5d57155 322 322 endian_specific_value<uint64_t, IsBigEndian> Flags; 323 323 endian_specific_value<uint64_t, IsBigEndian> Size; 324 endian_specific_value<uint64_t, IsBigEndian> ElementSize; 324 325 }; 325 326 … … 583 584 VH->Flags = VFlags; 584 585 RecordSize += VH->Size = Vars[i].Size; 586 VH->ElementSize = Vars[i].ElementSize; 585 587 } 586 588 … … 1379 1381 } 1380 1382 1383 size_t ElementSize = VH->Size; 1384 if (offsetof_safe(VH, ElementSize) < GH->VarsSize) 1385 ElementSize = VH->ElementSize; 1386 1381 1387 VarFound = true; 1382 1388 bool IsFloat = (bool) (VH->Flags & FloatValue), … … 1387 1393 " in: " << OpenFileName << ": current: " << Vars[i].Size << 1388 1394 ", file: " << VH->Size; 1395 throw runtime_error(ss.str()); 1396 } else if (ElementSize != Vars[i].ElementSize) { 1397 stringstream ss; 1398 ss << "Element size mismatch for variable " << Vars[i].Name << 1399 " in: " << OpenFileName << ": current: " << Vars[i].ElementSize << 1400 ", file: " << ElementSize; 1389 1401 throw runtime_error(ss.str()); 1390 1402 } else if (IsFloat != Vars[i].IsFloat) { … … 1565 1577 // Byte swap the data if necessary. 1566 1578 if (IsBigEndian != isBigEndian()) 1567 for (size_t j = 0; j < RH->NElems; ++j) { 1568 char *Offset = ((char *) VarData) + j*Vars[i].Size; 1569 bswap(Offset, Vars[i].Size); 1579 for (size_t j = 0; 1580 j < RH->NElems*(Vars[i].Size/Vars[i].ElementSize); ++j) { 1581 char *Offset = ((char *) VarData) + j*Vars[i].ElementSize; 1582 bswap(Offset, Vars[i].ElementSize); 1570 1583 } 1571 1584 … … 1625 1638 if (VNameNull < NameSize) 1626 1639 VName.resize(VNameNull); 1640 1641 size_t ElementSize = VH->Size; 1642 if (offsetof_safe(VH, ElementSize) < GH->VarsSize) 1643 ElementSize = VH->ElementSize; 1627 1644 1628 1645 bool IsFloat = (bool) (VH->Flags & FloatValue), … … 1634 1651 VI.push_back(VariableInfo(VName, (size_t) VH->Size, IsFloat, IsSigned, 1635 1652 IsPhysCoordX, IsPhysCoordY, IsPhysCoordZ, 1636 MaybePhysGhost ));1653 MaybePhysGhost, ElementSize)); 1637 1654 } 1638 1655 }
Note: See TracChangeset
for help on using the changeset viewer.