Commit 958b04b1 authored by Hib Eris's avatar Hib Eris Committed by Albert Astals Cid

Add support for reading a cached file from stdin

parent 9539f75b
......@@ -265,6 +265,7 @@ set(poppler_SRCS
poppler/TextOutputDev.cc
poppler/PageLabelInfo.cc
poppler/SecurityHandler.cc
poppler/StdinCachedFile.cc
poppler/Sound.cc
poppler/XpdfPluginAPI.cc
poppler/Movie.cc
......@@ -409,6 +410,7 @@ if(ENABLE_XPDF_HEADERS)
poppler/PSOutputDev.h
poppler/TextOutputDev.h
poppler/SecurityHandler.h
poppler/StdinCachedFile.h
poppler/UTF8.h
poppler/XpdfPluginAPI.h
poppler/Sound.h
......
......@@ -205,6 +205,7 @@ poppler_include_HEADERS = \
PreScanOutputDev.h \
PSTokenizer.h \
Rendition.h \
StdinCachedFile.h \
Stream-CCITT.h \
Stream.h \
UnicodeMap.h \
......@@ -277,6 +278,7 @@ libpoppler_la_SOURCES = \
PreScanOutputDev.cc \
PSTokenizer.cc \
Rendition.cc \
StdinCachedFile.cc \
Stream.cc \
UnicodeMap.cc \
UnicodeTypeTable.cc \
......
//========================================================================
//
// StdinCachedFile.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
//
//========================================================================
#include <config.h>
#include "StdinCachedFile.h"
#include <stdio.h>
size_t StdinCacheLoader::init(GooString *dummy, CachedFile *cachedFile)
{
size_t read, size = 0;
char buf[CachedFileChunkSize];
CachedFileWriter writer = CachedFileWriter (cachedFile, NULL);
do {
read = fread(buf, 1, CachedFileChunkSize, stdin);
(writer.write) (buf, CachedFileChunkSize);
size += read;
}
while (read == CachedFileChunkSize);
return size;
}
int StdinCacheLoader::load(GooVector<ByteRange> *ranges, CachedFileWriter *writer)
{
return 0;
}
//========================================================================
//
// StdinCachedFile.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
//
//========================================================================
#ifndef STDINCACHELOADER_H
#define STDINCACHELOADER_H
#include "CachedFile.h"
class StdinCacheLoader : public CachedFileLoader {
public:
size_t init(GooString *dummy, CachedFile* cachedFile);
int load(GooVector<ByteRange> *ranges, CachedFileWriter *writer);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment