Skip to content

Commit 402f809

Browse files
committed
fix windows?
1 parent 77f0b99 commit 402f809

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Image.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,7 @@ class BufferReader : public Image::Reader {
773773
bool hasBytes(unsigned n) const override { return (_idx + n - 1 < _len); }
774774

775775
uint8_t getNext() override {
776-
if (_idx < _len) {
777-
return _buf[_idx++];
778-
}
776+
return _buf[_idx++];
779777
}
780778

781779
void skipBytes(unsigned n) override { _idx += n; }
@@ -789,9 +787,9 @@ class BufferReader : public Image::Reader {
789787
class StreamReader : public Image::Reader {
790788
public:
791789
StreamReader(FILE *stream) : _stream(stream), _len(0), _idx(0) {
792-
fseeko(_stream, 0, SEEK_END);
793-
_len = ftello(_stream);
794-
fseeko(_stream, 0, SEEK_SET);
790+
fseek(_stream, 0, SEEK_END);
791+
_len = ftell(_stream);
792+
fseek(_stream, 0, SEEK_SET);
795793
}
796794

797795
bool hasBytes(unsigned n) const override { return (_idx + n - 1 < _len); }
@@ -803,13 +801,13 @@ class StreamReader : public Image::Reader {
803801

804802
void skipBytes(unsigned n) override {
805803
_idx += n;
806-
fseeko(_stream, _idx, SEEK_SET);
804+
fseek(_stream, _idx, SEEK_SET);
807805
}
808806

809807
private:
810808
FILE* _stream;
811-
off_t _len;
812-
off_t _idx;
809+
unsigned _len;
810+
unsigned _idx;
813811
};
814812

815813
void Image::jpegToARGB(jpeg_decompress_struct* args, uint8_t* data, uint8_t* src, JPEGDecodeL decode) {

0 commit comments

Comments
 (0)