Read a block of ints (ascii or binary) and return number read.
| 2703 | |
| 2704 | // Read a block of ints (ascii or binary) and return number read. |
| 2705 | int vtkMultiBlockPLOT3DReader::ReadIntBlock(FILE* fp, int n, int* block) |
| 2706 | { |
| 2707 | if (this->Internal->Settings.BinaryFile) |
| 2708 | { |
| 2709 | vtkIdType retVal = static_cast<vtkIdType>(fread(block, sizeof(int), n, fp)); |
| 2710 | if (this->Internal->Settings.ByteOrder == FILE_LITTLE_ENDIAN) |
| 2711 | { |
| 2712 | vtkByteSwap::Swap4LERange(block, n); |
| 2713 | } |
| 2714 | else |
| 2715 | { |
| 2716 | vtkByteSwap::Swap4BERange(block, n); |
| 2717 | } |
| 2718 | return retVal == n; |
| 2719 | } |
| 2720 | else |
| 2721 | { |
| 2722 | vtkIdType count = 0; |
| 2723 | for (int i = 0; i < n; i++) |
| 2724 | { |
| 2725 | if (auto result = vtk::scan_value<int>(fp)) |
| 2726 | { |
| 2727 | block[i] = result->value(); |
| 2728 | count++; |
| 2729 | } |
| 2730 | else |
| 2731 | { |
| 2732 | return 0; |
| 2733 | } |
| 2734 | } |
| 2735 | return count == n; |
| 2736 | } |
| 2737 | } |
| 2738 | |
| 2739 | vtkDataArray* vtkMultiBlockPLOT3DReader::NewFloatArray() |
| 2740 | { |
no test coverage detected