fixed l_reserveobj (thanks to Marcel F. Krüger zauguin@gmail.com )
[luatex.git] / source / libs / poppler / poppler-0.34.0 / splash / SplashFontFile.cc
blob68e8608b6a70a0e1d003862906111406ff233b50
1 //========================================================================
2 //
3 // SplashFontFile.cc
4 //
5 //========================================================================
7 //========================================================================
8 //
9 // Modified under the Poppler project - http://poppler.freedesktop.org
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
14 // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
15 // Copyright (C) 2008 Albert Astals Cid <aacid@kde.org>
17 // To see a description of the changes please see the Changelog file that
18 // came with your tarball or type make ChangeLog if you are building from git
20 //========================================================================
22 #include <config.h>
24 #ifdef USE_GCC_PRAGMAS
25 #pragma implementation
26 #endif
28 #include <stdio.h>
29 #ifdef HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
32 #include "goo/gmem.h"
33 #include "goo/GooString.h"
34 #include "SplashFontFile.h"
35 #include "SplashFontFileID.h"
37 #ifdef VMS
38 #if (__VMS_VER < 70000000)
39 extern "C" int unlink(char *filename);
40 #endif
41 #endif
43 //------------------------------------------------------------------------
44 // SplashFontFile
45 //------------------------------------------------------------------------
47 SplashFontFile::SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA) {
48 id = idA;
49 src = srcA;
50 src->ref();
51 refCnt = 0;
52 doAdjustMatrix = gFalse;
55 SplashFontFile::~SplashFontFile() {
56 src->unref();
57 delete id;
60 void SplashFontFile::incRefCnt() {
61 ++refCnt;
64 void SplashFontFile::decRefCnt() {
65 if (!--refCnt) {
66 delete this;
72 SplashFontSrc::SplashFontSrc() {
73 isFile = gFalse;
74 deleteSrc = gFalse;
75 fileName = NULL;
76 buf = NULL;
77 refcnt = 1;
80 SplashFontSrc::~SplashFontSrc() {
81 if (deleteSrc) {
82 if (isFile) {
83 if (fileName)
84 unlink(fileName->getCString());
85 } else {
86 if (buf)
87 gfree(buf);
91 if (isFile && fileName)
92 delete fileName;
95 void SplashFontSrc::ref() {
96 refcnt++;
99 void SplashFontSrc::unref() {
100 if (! --refcnt)
101 delete this;
104 void SplashFontSrc::setFile(GooString *file, GBool del)
106 isFile = gTrue;
107 fileName = file->copy();
108 deleteSrc = del;
111 void SplashFontSrc::setFile(const char *file, GBool del)
113 isFile = gTrue;
114 fileName = new GooString(file);
115 deleteSrc = del;
118 void SplashFontSrc::setBuf(char *bufA, int bufLenA, GBool del)
120 isFile = gFalse;
121 buf = bufA;
122 bufLen = bufLenA;
123 deleteSrc = del;