source: trunk/poppler/mypoppler/poppler/StdinCachedFile.cc @ 470

Last change on this file since 470 was 470, checked in by Silvan Scherrer, 11 years ago

poppler, jpeg, freetype lib updates

File size: 1.1 KB
Line 
1//========================================================================
2//
3// StdinCachedFile.cc
4//
5// This file is licensed under the GPLv2 or later
6//
7// Copyright 2010 Hib Eris <hib@hiberis.nl>
8// Copyright 2010 Albert Astals Cid <aacid@kde.org>
9// Copyright 2010 Jonathan Liu <net147@gmail.com>
10//
11//========================================================================
12
13#include <config.h>
14
15#include "StdinCachedFile.h"
16
17#ifdef _WIN32
18#include <fcntl.h> // for O_BINARY
19#include <io.h>    // for setmode
20#endif
21#include <stdio.h>
22
23size_t StdinCacheLoader::init(GooString *dummy, CachedFile *cachedFile)
24{
25  size_t read, size = 0;
26  char buf[CachedFileChunkSize];
27
28#ifdef _WIN32
29  setmode(fileno(stdin), O_BINARY);
30#endif
31
32  CachedFileWriter writer = CachedFileWriter (cachedFile, NULL);
33  do {
34    read = fread(buf, 1, CachedFileChunkSize, stdin);
35    (writer.write) (buf, CachedFileChunkSize);
36    size += read;
37  }
38  while (read == CachedFileChunkSize);
39
40  return size;
41}
42
43int StdinCacheLoader::load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer)
44{
45  return 0;
46}
47
Note: See TracBrowser for help on using the repository browser.