1 //========================================================================
5 // This file is licensed under the GPLv2 or later
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>
11 //========================================================================
15 #include "StdinCachedFile.h"
18 #include <fcntl.h> // for O_BINARY
19 #include <io.h> // for setmode
23 size_t StdinCacheLoader::init(GooString
*dummy
, CachedFile
*cachedFile
)
25 size_t read
, size
= 0;
26 char buf
[CachedFileChunkSize
];
29 setmode(fileno(stdin
), O_BINARY
);
32 CachedFileWriter writer
= CachedFileWriter (cachedFile
, NULL
);
34 read
= fread(buf
, 1, CachedFileChunkSize
, stdin
);
35 (writer
.write
) (buf
, CachedFileChunkSize
);
38 while (read
== CachedFileChunkSize
);
43 int StdinCacheLoader::load(const std::vector
<ByteRange
> &ranges
, CachedFileWriter
*writer
)