summaryrefslogtreecommitdiffstats
path: root/kpdf/xpdf/fofi/FoFiBase.cc
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2020-12-13 19:22:19 +0900
committerMichele Calgaro <[email protected]>2020-12-13 21:14:47 +0900
commitc57343e948aa9f3346ad866ad88d4b1330d098b8 (patch)
tree143dc455ce45167d0ae2809678967eeeb1e62ac6 /kpdf/xpdf/fofi/FoFiBase.cc
parentd56dba4d2f900eb73d5ee00586c1b2d84b132b3f (diff)
downloadtdegraphics-c57343e948aa9f3346ad866ad88d4b1330d098b8.tar.gz
tdegraphics-c57343e948aa9f3346ad866ad88d4b1330d098b8.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit 14d0fbe96c6abdb9da80e99953aec672f999948c)
Diffstat (limited to 'kpdf/xpdf/fofi/FoFiBase.cc')
-rw-r--r--kpdf/xpdf/fofi/FoFiBase.cc156
1 files changed, 0 insertions, 156 deletions
diff --git a/kpdf/xpdf/fofi/FoFiBase.cc b/kpdf/xpdf/fofi/FoFiBase.cc
deleted file mode 100644
index 28d0b8ca..00000000
--- a/kpdf/xpdf/fofi/FoFiBase.cc
+++ /dev/null
@@ -1,156 +0,0 @@
-//========================================================================
-//
-// FoFiBase.cc
-//
-// Copyright 1999-2003 Glyph & Cog, LLC
-//
-//========================================================================
-
-#include <aconf.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <stdio.h>
-#include "gmem.h"
-#include "FoFiBase.h"
-
-//------------------------------------------------------------------------
-// FoFiBase
-//------------------------------------------------------------------------
-
-FoFiBase::FoFiBase(char *fileA, int lenA, GBool freeFileDataA) {
- fileData = file = (Guchar *)fileA;
- len = lenA;
- freeFileData = freeFileDataA;
-}
-
-FoFiBase::~FoFiBase() {
- if (freeFileData) {
- gfree(fileData);
- }
-}
-
-char *FoFiBase::readFile(char *fileName, int *fileLen) {
- FILE *f;
- char *buf;
- int n;
-
- if (!(f = fopen(fileName, "rb"))) {
- return NULL;
- }
- fseek(f, 0, SEEK_END);
- n = (int)ftell(f);
- fseek(f, 0, SEEK_SET);
- buf = (char *)gmalloc(n);
- if ((int)fread(buf, 1, n, f) != n) {
- gfree(buf);
- fclose(f);
- return NULL;
- }
- fclose(f);
- *fileLen = n;
- return buf;
-}
-
-int FoFiBase::getS8(int pos, GBool *ok) {
- int x;
-
- if (pos < 0 || pos >= len) {
- *ok = gFalse;
- return 0;
- }
- x = file[pos];
- if (x & 0x80) {
- x |= ~0xff;
- }
- return x;
-}
-
-int FoFiBase::getU8(int pos, GBool *ok) {
- if (pos < 0 || pos >= len) {
- *ok = gFalse;
- return 0;
- }
- return file[pos];
-}
-
-int FoFiBase::getS16BE(int pos, GBool *ok) {
- int x;
-
- if (pos < 0 || pos+1 >= len) {
- *ok = gFalse;
- return 0;
- }
- x = file[pos];
- x = (x << 8) + file[pos+1];
- if (x & 0x8000) {
- x |= ~0xffff;
- }
- return x;
-}
-
-int FoFiBase::getU16BE(int pos, GBool *ok) {
- int x;
-
- if (pos < 0 || pos+1 >= len) {
- *ok = gFalse;
- return 0;
- }
- x = file[pos];
- x = (x << 8) + file[pos+1];
- return x;
-}
-
-int FoFiBase::getS32BE(int pos, GBool *ok) {
- int x;
-
- if (pos < 0 || pos+3 >= len) {
- *ok = gFalse;
- return 0;
- }
- x = file[pos];
- x = (x << 8) + file[pos+1];
- x = (x << 8) + file[pos+2];
- x = (x << 8) + file[pos+3];
- if (x & 0x80000000) {
- x |= ~0xffffffff;
- }
- return x;
-}
-
-Guint FoFiBase::getU32BE(int pos, GBool *ok) {
- Guint x;
-
- if (pos < 0 || pos+3 >= len) {
- *ok = gFalse;
- return 0;
- }
- x = file[pos];
- x = (x << 8) + file[pos+1];
- x = (x << 8) + file[pos+2];
- x = (x << 8) + file[pos+3];
- return x;
-}
-
-Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) {
- Guint x;
- int i;
-
- if (pos < 0 || pos + size > len) {
- *ok = gFalse;
- return 0;
- }
- x = 0;
- for (i = 0; i < size; ++i) {
- x = (x << 8) + file[pos + i];
- }
- return x;
-}
-
-GBool FoFiBase::checkRegion(int pos, int size) {
- return pos >= 0 &&
- pos + size >= pos &&
- pos + size <= len;
-}