| 55 | }; |
| 56 | |
| 57 | BOOL LASreaderLAS::open(const char* file_name, I32 io_buffer_size, BOOL peek_only, U32 decompress_selective) |
| 58 | { |
| 59 | if (file_name == 0) |
| 60 | { |
| 61 | laserror("file name pointer is zero"); |
| 62 | return FALSE; |
| 63 | } |
| 64 | file = LASfopen(file_name, "rb"); |
| 65 | |
| 66 | if (file == 0) |
| 67 | { |
| 68 | laserror("cannot open file '%s' for read", file_name); |
| 69 | return FALSE; |
| 70 | } |
| 71 | |
| 72 | // save file name for better ERROR message |
| 73 | |
| 74 | if (this->file_name) |
| 75 | { |
| 76 | free(this->file_name); |
| 77 | this->file_name = 0; |
| 78 | } |
| 79 | this->file_name = LASCopyString(file_name); |
| 80 | |
| 81 | if (setvbuf(file, NULL, _IOFBF, io_buffer_size) != 0) |
| 82 | { |
| 83 | LASMessage(LAS_WARNING, "setvbuf() failed with buffer size %d", io_buffer_size); |
| 84 | } |
| 85 | |
| 86 | // create input |
| 87 | ByteStreamIn* in; |
| 88 | if (Endian::IS_LITTLE_ENDIAN) |
| 89 | in = new ByteStreamInFileLE(file); |
| 90 | else |
| 91 | in = new ByteStreamInFileBE(file); |
| 92 | |
| 93 | return open(in, peek_only, decompress_selective); |
| 94 | } |
| 95 | |
| 96 | BOOL LASreaderLAS::open(FILE* file, BOOL peek_only, U32 decompress_selective) |
| 97 | { |
nothing calls this directly
no test coverage detected