diff options
author | Oliver Sander <oliver.sander@tu-dresden.de> | 2022-03-15 11:03:58 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2022-03-15 14:37:51 +0000 |
commit | efe7d77838896ddcefb838f382628ae31be54d99 (patch) | |
tree | f416b6baf0de5045778be74f7757847583ae34a2 /splash | |
parent | 27a6d29018817a2263d69aadeb965dee3f5bc927 (diff) |
Use std::string for filename in SplashFontSrc
Diffstat (limited to 'splash')
-rw-r--r-- | splash/SplashFTFontFile.cc | 6 | ||||
-rw-r--r-- | splash/SplashFontFile.cc | 8 | ||||
-rw-r--r-- | splash/SplashFontFile.h | 7 |
3 files changed, 9 insertions, 12 deletions
diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc index 5b8ef14f..bb2c098c 100644 --- a/splash/SplashFTFontFile.cc +++ b/splash/SplashFTFontFile.cc @@ -42,7 +42,7 @@ SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, Spl int i; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->c_str(), 0, &faceA)) { + if (FT_New_Face(engineA->lib, src->fileName.c_str(), 0, &faceA)) { return nullptr; } } else { @@ -72,7 +72,7 @@ SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, Splas FT_Face faceA; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->c_str(), 0, &faceA)) { + if (FT_New_Face(engineA->lib, src->fileName.c_str(), 0, &faceA)) { return nullptr; } } else { @@ -89,7 +89,7 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, FT_Face faceA; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->c_str(), faceIndexA, &faceA)) { + if (FT_New_Face(engineA->lib, src->fileName.c_str(), faceIndexA, &faceA)) { return nullptr; } } else { diff --git a/splash/SplashFontFile.cc b/splash/SplashFontFile.cc index 44de3340..ec101da5 100644 --- a/splash/SplashFontFile.cc +++ b/splash/SplashFontFile.cc @@ -80,10 +80,6 @@ SplashFontSrc::~SplashFontSrc() gfree(buf); } } - - if (isFile && fileName) { - delete fileName; - } } void SplashFontSrc::ref() @@ -98,10 +94,10 @@ void SplashFontSrc::unref() } } -void SplashFontSrc::setFile(const GooString *file) +void SplashFontSrc::setFile(const std::string &file) { isFile = true; - fileName = file->copy(); + fileName = file; } void SplashFontSrc::setBuf(char *bufA, int bufLenA) diff --git a/splash/SplashFontFile.h b/splash/SplashFontFile.h index d547d626..1e1e4fe1 100644 --- a/splash/SplashFontFile.h +++ b/splash/SplashFontFile.h @@ -23,10 +23,11 @@ #ifndef SPLASHFONTFILE_H #define SPLASHFONTFILE_H +#include <string> + #include "SplashTypes.h" #include "poppler_private_export.h" -class GooString; class SplashFontEngine; class SplashFont; class SplashFontFileID; @@ -43,14 +44,14 @@ public: SplashFontSrc(const SplashFontSrc &) = delete; SplashFontSrc &operator=(const SplashFontSrc &) = delete; - void setFile(const GooString *file); + void setFile(const std::string &file); void setBuf(char *bufA, int buflenA); void ref(); void unref(); bool isFile; - GooString *fileName; + std::string fileName; char *buf; int bufLen; |