| 96 | } |
| 97 | |
| 98 | unsigned long long VSIImage::parseETSFile(std::ifstream& ets) { |
| 99 | // Read general file info |
| 100 | char* memblock = new char[4]; |
| 101 | char* memblockLong = new char[8]; |
| 102 | ets.read(memblock,4); |
| 103 | ets.read(memblock,4); |
| 104 | int headerSize = *reinterpret_cast<int*>(memblock); |
| 105 | ets.read(memblock,4); |
| 106 | int version = *reinterpret_cast<int*>(memblock); |
| 107 | ets.read(memblock,4); |
| 108 | int nDims = *reinterpret_cast<int*>(memblock); |
| 109 | ets.read(memblockLong,8); |
| 110 | long additionalHeaderOffset = *reinterpret_cast<long*>(memblockLong); |
| 111 | ets.read(memblock,4); |
| 112 | int additionalHeaderSize = *reinterpret_cast<int*>(memblock); |
| 113 | ets.seekg(4, ios::cur); |
| 114 | ets.read(memblockLong, 8); |
| 115 | unsigned long long usedChunkOffset = *reinterpret_cast<unsigned long long *>(memblockLong); |
| 116 | ets.read(memblock,4); |
| 117 | int nUsedChunks = *reinterpret_cast<int*>(memblock); |
| 118 | ets.seekg(additionalHeaderOffset); |
| 119 | ets.read(memblock,4); |
| 120 | ets.seekg(4, ios::cur); |
| 121 | ets.read(memblock,4); |
| 122 | int pixelType = *reinterpret_cast<int*>(memblock); |
| 123 | ets.read(memblock,4); |
| 124 | int nrColors = *reinterpret_cast<int*>(memblock); |
| 125 | ets.read(memblock,4); |
| 126 | int colorSpace = *reinterpret_cast<int*>(memblock); |
| 127 | ets.read(memblock,4); |
| 128 | _compressionType = *reinterpret_cast<int*>(memblock); |
| 129 | ets.read(memblock,4); |
| 130 | int compressionQuality = *reinterpret_cast<int*>(memblock); |
| 131 | ets.read(memblock,4); |
| 132 | _tileSizeX = *reinterpret_cast<int*>(memblock); |
| 133 | ets.read(memblock,4); |
| 134 | _tileSizeY = *reinterpret_cast<int*>(memblock); |
| 135 | ets.read(memblock,4); |
| 136 | int tileDepth = *reinterpret_cast<int*>(memblock); |
| 137 | bool isRGB = nrColors > 1; |
| 138 | |
| 139 | // Read locations of tiles and file offsets |
| 140 | ets.seekg(usedChunkOffset); |
| 141 | for (int tile = 0; tile < nUsedChunks; ++tile) { |
| 142 | ets.seekg(4,ios::cur); |
| 143 | vector<int> curTileCoords; |
| 144 | for (int i=0; i<nDims; i++) { |
| 145 | ets.read(memblock,4); |
| 146 | curTileCoords.push_back(*reinterpret_cast<int*>(memblock)); |
| 147 | } |
| 148 | ets.read(memblockLong,8); |
| 149 | _tileOffsets.push_back(*reinterpret_cast<unsigned long long*>(memblockLong)); |
| 150 | ets.read(memblock,4); |
| 151 | int nrBytes = *reinterpret_cast<int*>(memblock); |
| 152 | ets.seekg(4, ios::cur); |
| 153 | _tileCoords.push_back(curTileCoords); |
| 154 | } |
| 155 | int maxX = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected