oops.. only build it when it _is_ valid.
[AROS-Contrib.git] / vpdf / poppler_io.cpp
blobc0d0602fa0fd9498f8250fded1c7aac4034239df
1 //========================================================================
2 //
3 // StdCachedFile.cc
4 //
5 // This file is licensed under the GPLv2 or later
6 //
7 // Copyright 2010 Michal Wozniak <wozniak_m@interia.pl>
8 //
9 //========================================================================
11 #include <config.h>
13 #include "poppler_io.h"
15 #include <stdio.h>
17 size_t StdCacheLoader::init(GooString *fname, CachedFile *cachedFile)
19 size_t read, size = 0;
20 FILE *f = fopen(fname->getCString(), "r");
21 if (f == NULL)
22 return 0;
24 char buf[CachedFileChunkSize];
26 CachedFileWriter writer = CachedFileWriter (cachedFile, NULL);
27 do {
28 read = fread(buf, 1, CachedFileChunkSize, f);
29 (writer.write) (buf, CachedFileChunkSize);
30 size += read;
32 while (read == CachedFileChunkSize);
34 fclose(f);
35 return size;
38 int StdCacheLoader::load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer)
40 return 0;