Commit 817b0f12 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Rename GooString::getCString GooString::c_str

This is the name used by std::string.
parent fb7f34b1
Pipeline #8210 passed with stage
in 15 minutes and 31 seconds
......@@ -864,10 +864,10 @@ bool document::get_pdf_id(std::string *permanent_id, std::string *update_id) con
}
if (permanent_id) {
*permanent_id = goo_permanent_id.getCString();
*permanent_id = goo_permanent_id.c_str();
}
if (update_id) {
*update_id = goo_update_id.getCString();
*update_id = goo_update_id.c_str();
}
return true;
......
......@@ -80,7 +80,7 @@ bool embedded_file::is_valid() const
std::string embedded_file::name() const
{
const GooString *goo = d->file_spec->getFileName();
return goo ? std::string(goo->getCString()) : std::string();
return goo ? std::string(goo->c_str()) : std::string();
}
/**
......@@ -132,7 +132,7 @@ byte_array embedded_file::checksum() const
if (!cs) {
return byte_array();
}
const char *ccs = cs->getCString();
const char *ccs = cs->c_str();
byte_array data(cs->getLength());
for (int i = 0; i < cs->getLength(); ++i) {
data[i] = ccs[i];
......@@ -146,7 +146,7 @@ byte_array embedded_file::checksum() const
std::string embedded_file::mime_type() const
{
const GooString *goo = d->file_spec->getEmbeddedFile()->mimeType();
return goo ? std::string(goo->getCString()) : std::string();
return goo ? std::string(goo->c_str()) : std::string();
}
/**
......
......@@ -43,10 +43,10 @@ public:
, is_subset(fi->getSubset())
{
if (fi->getName()) {
font_name = fi->getName()->getCString();
font_name = fi->getName()->c_str();
}
if (fi->getFile()) {
font_file = fi->getFile()->getCString();
font_file = fi->getFile()->c_str();
}
}
......
......@@ -287,7 +287,7 @@ ustring page::text(const rectf &r, text_layout_enum layout_mode) const
} else {
s.reset(td.getText(r.left(), r.top(), r.right(), r.bottom()));
}
return ustring::from_utf8(s->getCString());
return ustring::from_utf8(s->c_str());
}
/*
......
......@@ -58,7 +58,7 @@ rectf detail::pdfrectangle_to_rectf(const PDFRectangle &pdfrect)
ustring detail::unicode_GooString_to_ustring(const GooString *str)
{
const char *data = str->getCString();
const char *data = str->c_str();
const int len = str->getLength();
int i = 0;
......
......@@ -530,7 +530,7 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding,
ok = true;
buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n",
(double)getS32BE(0, &ok) / 65536.0);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
// begin the font dictionary
......@@ -542,7 +542,7 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding,
(*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30);
buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n",
bbox[0], bbox[1], bbox[2], bbox[3]);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, "/PaintType 0 def\n", 17);
......@@ -590,7 +590,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
ok = true;
buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n",
(double)getS32BE(0, &ok) / 65536.0);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
// begin the font dictionary
......@@ -608,7 +608,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
(*outputFunc)(outputStream, "/GDBytes 2 def\n", 15);
if (cidMap) {
buf = GooString::format("/CIDCount {0:d} def\n", nCIDs);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
if (nCIDs > 32767) {
(*outputFunc)(outputStream, "/CIDMap [", 9);
......@@ -620,7 +620,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
cid = cidMap[i+j+k];
buf = GooString::format("{0:02x}{1:02x}",
(cid >> 8) & 0xff, cid & 0xff);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "\n", 1);
......@@ -637,7 +637,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
cid = cidMap[i+j];
buf = GooString::format("{0:02x}{1:02x}",
(cid >> 8) & 0xff, cid & 0xff);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "\n", 1);
......@@ -647,32 +647,32 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
} else {
// direct mapping - just fill the string(s) with s[i]=i
buf = GooString::format("/CIDCount {0:d} def\n", nGlyphs);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
if (nGlyphs > 32767) {
(*outputFunc)(outputStream, "/CIDMap [\n", 10);
for (i = 0; i < nGlyphs; i += 32767) {
j = nGlyphs - i < 32767 ? nGlyphs - i : 32767;
buf = GooString::format(" {0:d} string 0 1 {1:d} {{\n", 2 * j, j - 1);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
buf = GooString::format(" 2 copy dup 2 mul exch {0:d} add -8 bitshift put\n",
i);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
buf = GooString::format(" 1 index exch dup 2 mul 1 add exch {0:d} add"
" 255 and put\n", i);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, " } for\n", 8);
}
(*outputFunc)(outputStream, "] def\n", 6);
} else {
buf = GooString::format("/CIDMap {0:d} string\n", 2 * nGlyphs);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
buf = GooString::format(" 0 1 {0:d} {{\n", nGlyphs - 1);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream,
" 2 copy dup 2 mul exch -8 bitshift put\n", 42);
......@@ -685,7 +685,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
(*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30);
buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n",
bbox[0], bbox[1], bbox[2], bbox[3]);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, "/PaintType 0 def\n", 17);
(*outputFunc)(outputStream, "/Encoding [] readonly def\n", 26);
......@@ -775,13 +775,13 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
(*outputFunc)(outputStream, "/FontName /", 11);
(*outputFunc)(outputStream, psName, strlen(psName));
buf = GooString::format("_{0:02x} def\n", i >> 8);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, "/FontType 42 def\n", 17);
(*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30);
buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n",
bbox[0], bbox[1], bbox[2], bbox[3]);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, "/PaintType 0 def\n", 17);
(*outputFunc)(outputStream, "/sfnts ", 7);
......@@ -790,7 +790,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
(*outputFunc)(outputStream, "/Encoding 256 array\n", 20);
for (j = 0; j < 256 && i+j < n; ++j) {
buf = GooString::format("dup {0:d} /c{1:02x} put\n", j, j);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "readonly def\n", 13);
......@@ -799,7 +799,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
for (j = 0; j < 256 && i+j < n; ++j) {
buf = GooString::format("/c{0:02x} {1:d} def\n",
j, cidMap ? cidMap[i+j] : i+j);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "end readonly def\n", 17);
......@@ -818,7 +818,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
(*outputFunc)(outputStream, "/Encoding [\n", 12);
for (i = 0; i < n; i += 256) {
buf = GooString::format("{0:d}\n", i >> 8);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "] def\n", 6);
......@@ -827,7 +827,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
(*outputFunc)(outputStream, "/", 1);
(*outputFunc)(outputStream, psName, strlen(psName));
buf = GooString::format("_{0:02x} findfont\n", i >> 8);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
(*outputFunc)(outputStream, "] def\n", 6);
......@@ -865,7 +865,7 @@ void FoFiTrueType::cvtEncoding(char **encoding,
name = ".notdef";
}
buf = GooString::format("dup {0:d} /", i);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
(*outputFunc)(outputStream, name, strlen(name));
(*outputFunc)(outputStream, " put\n", 5);
......@@ -873,7 +873,7 @@ void FoFiTrueType::cvtEncoding(char **encoding,
} else {
for (i = 0; i < 256; ++i) {
buf = GooString::format("dup {0:d} /c{1:02x} put\n", i, i);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
}
......@@ -922,7 +922,7 @@ void FoFiTrueType::cvtCharStrings(char **encoding,
(*outputFunc)(outputStream, "/", 1);
(*outputFunc)(outputStream, name, strlen(name));
buf = GooString::format(" {0:d} def\n", k);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
}
......@@ -1193,7 +1193,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc,
// start the sfnts array
if (name) {
(*outputFunc)(outputStream, "/", 1);
(*outputFunc)(outputStream, name->getCString(), name->getLength());
(*outputFunc)(outputStream, name->c_str(), name->getLength());
(*outputFunc)(outputStream, " [\n", 3);
} else {
(*outputFunc)(outputStream, "/sfnts [\n", 9);
......@@ -1264,7 +1264,7 @@ void FoFiTrueType::dumpString(const Guchar *s, int length,
for (i = 0; i < length; i += 32) {
for (j = 0; j < 32 && i+j < length; ++j) {
buf = GooString::format("{0:02x}", s[i+j] & 0xff);
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
(*outputFunc)(outputStream, buf->c_str(), buf->getLength());
delete buf;
}
if (i % (65536 - 32) == 65536 - 64) {
......
This diff is collapsed.
......@@ -329,7 +329,7 @@ dest_new_named (const GooString *named_dest)
}
dest->type = POPPLER_DEST_NAMED;
dest->named_dest = g_strdup (named_dest->getCString ());
dest->named_dest = g_strdup (named_dest->c_str ());
return dest;
}
......@@ -392,10 +392,10 @@ build_launch (PopplerAction *action,
const LinkLaunch *link)
{
if (link->getFileName()) {
action->launch.file_name = g_strdup (link->getFileName()->getCString ());
action->launch.file_name = g_strdup (link->getFileName()->c_str ());
}
if (link->getParams()) {
action->launch.params = g_strdup (link->getParams()->getCString ());
action->launch.params = g_strdup (link->getParams()->c_str ());
}
}
......@@ -405,7 +405,7 @@ build_uri (PopplerAction *action,
{
const gchar *uri;
uri = link->getURI()->getCString ();
uri = link->getURI()->c_str ();
if (uri != nullptr)
action->uri.uri = g_strdup (uri);
}
......@@ -416,7 +416,7 @@ build_named (PopplerAction *action,
{
const gchar *name;
name = link->getName ()->getCString ();
name = link->getName ()->c_str ();
if (name != nullptr)
action->named.named_dest = g_strdup (name);
}
......
......@@ -115,7 +115,7 @@ _poppler_attachment_new (FileSpec *emb_file)
_poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
attachment->checksum = g_string_new_len (embFile->checksum ()->c_str (),
embFile->checksum ()->getLength ());
priv->obj_stream = embFile->streamObject()->copy();
}
......
......@@ -517,9 +517,9 @@ poppler_document_get_id (PopplerDocument *document,
if (document->doc->getID (permanent_id ? &permanent : nullptr, update_id ? &update : nullptr)) {
if (permanent_id)
*permanent_id = (gchar *)g_memdup (permanent.getCString(), 32);
*permanent_id = (gchar *)g_memdup (permanent.c_str(), 32);
if (update_id)
*update_id = (gchar *)g_memdup (update.getCString(), 32);
*update_id = (gchar *)g_memdup (update.c_str(), 32);
retval = TRUE;
}
......@@ -726,7 +726,7 @@ char *_poppler_goo_string_to_utf8(const GooString *s)
char *result;
if (s->hasUnicodeMarker()) {
result = g_convert (s->getCString () + 2,
result = g_convert (s->c_str () + 2,
s->getLength () - 2,
"UTF-8", "UTF-16BE", nullptr, nullptr, nullptr);
} else {
......@@ -1566,7 +1566,7 @@ poppler_document_get_metadata (PopplerDocument *document)
GooString *s = catalog->readMetadata ();
if (s != nullptr) {
retval = g_strdup (s->getCString());
retval = g_strdup (s->c_str());
delete s;
}
}
......@@ -2137,7 +2137,7 @@ unicode_to_char (const Unicode *unicode,
gstr.append(buf, n);
}
return g_strdup (gstr.getCString ());
return g_strdup (gstr.c_str ());
}
/**
......@@ -2256,7 +2256,7 @@ poppler_fonts_iter_get_full_name (PopplerFontsIter *iter)
name = info->getName();
if (name != nullptr) {
return info->getName()->getCString();
return info->getName()->c_str();
} else {
return nullptr;
}
......@@ -2311,7 +2311,7 @@ poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter)
name = info->getSubstituteName();
if (name != nullptr) {
return name->getCString();
return name->c_str();
} else {
return nullptr;
}
......@@ -2336,7 +2336,7 @@ poppler_fonts_iter_get_file_name (PopplerFontsIter *iter)
file = info->getFile();
if (file != nullptr) {
return file->getCString();
return file->c_str();
} else {
return nullptr;
}
......@@ -2382,7 +2382,7 @@ poppler_fonts_iter_get_encoding (PopplerFontsIter *iter)
encoding = info->getEncoding();
if (encoding != nullptr) {
return encoding->getCString();
return encoding->c_str();
} else {
return nullptr;
}
......@@ -3151,11 +3151,11 @@ _poppler_convert_pdf_date_to_gtime (const GooString *date,
gboolean retval;
if (date->hasUnicodeMarker()) {
date_string = g_convert (date->getCString () + 2,
date_string = g_convert (date->c_str () + 2,
date->getLength () - 2,
"UTF-8", "UTF-16BE", nullptr, nullptr, nullptr);
} else {
date_string = g_strndup (date->getCString (), date->getLength ());
date_string = g_strndup (date->c_str (), date->getLength ());
}
retval = poppler_date_parse (date_string, gdate);
......
......@@ -98,9 +98,9 @@ _poppler_media_new (const MediaRendition *poppler_media)
media->stream = poppler_media->getEmbbededStreamObject()->copy();
mime_type = poppler_media->getContentType();
if (mime_type)
media->mime_type = g_strdup (mime_type->getCString());
media->mime_type = g_strdup (mime_type->c_str());
} else {
media->filename = g_strdup (poppler_media->getFileName()->getCString());
media->filename = g_strdup (poppler_media->getFileName()->c_str());
}
return media;
......
......@@ -82,7 +82,7 @@ _poppler_movie_new (const Movie *poppler_movie)
movie = POPPLER_MOVIE (g_object_new (POPPLER_TYPE_MOVIE, nullptr));
movie->filename = g_strdup (poppler_movie->getFileName()->getCString());
movie->filename = g_strdup (poppler_movie->getFileName()->c_str());
if (poppler_movie->getShowPoster()) {
Object tmp = poppler_movie->getPoster();
movie->need_poster = (!tmp.isRef() && !tmp.isStream());
......
......@@ -818,7 +818,7 @@ poppler_page_get_selected_text (PopplerPage *page,
text = poppler_page_get_text_page (page);
sel_text = text->getSelectionText (&pdf_selection, selection_style);
result = g_strdup (sel_text->getCString ());
result = g_strdup (sel_text->c_str ());
delete sel_text;
return result;
......@@ -1710,7 +1710,7 @@ get_font_name_from_word (TextWord *word, gint word_i)
}
}
subset = i > 0 && i < font_name->getLength () && font_name->getChar (i) == '+';
name = font_name->getCString ();
name = font_name->c_str ();
if (subset)
name += i + 1;
......
......@@ -454,7 +454,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) {
reverseAlign = !reverseAlign;
break;
case fmtGooString:
str = arg.gs->getCString();
str = arg.gs->c_str();
len = arg.gs->getLength();
reverseAlign = !reverseAlign;
break;
......
......@@ -128,7 +128,7 @@ public:
int getLength() const { return size(); }
// Get C string.
const char *getCString() const { return c_str(); }
using std::string::c_str;
// Get <i>th character.
char getChar(int i) const { return (*this)[i]; }
......
......@@ -112,7 +112,7 @@ GooString *appendToPath(GooString *path, const char *fileName) {
char *p0, *p1, *p2;
char *q1;
p0 = path->getCString();
p0 = path->c_str();
p1 = p0 + path->getLength() - 1;
if (!strcmp(fileName, "-")) {
if (*p1 == ']') {
......@@ -154,7 +154,7 @@ GooString *appendToPath(GooString *path, const char *fileName) {
tmp = new GooString(path);
tmp->append('/');
tmp->append(fileName);
GetFullPathNameA(tmp->getCString(), sizeof(buf), buf, &fp);
GetFullPathNameA(tmp->c_str(), sizeof(buf), buf, &fp);
delete tmp;
path->clear();
path->append(buf);
......@@ -168,7 +168,7 @@ GooString *appendToPath(GooString *path, const char *fileName) {
path->append(".");
i = path->getLength();
path->append(fileName);
for (p = path->getCString() + i; *p; ++p) {
for (p = path->c_str() + i; *p; ++p) {
if (*p == '/') {
*p = '.';
} else if (*p == '.') {
......@@ -185,7 +185,7 @@ GooString *appendToPath(GooString *path, const char *fileName) {
path->append(":");
i = path->getLength();
path->append(fileName);
for (p = path->getCString() + i; *p; ++p) {
for (p = path->c_str() + i; *p; ++p) {
if (*p == '/') {
*p = ':';
} else if (*p == '.') {
......@@ -434,7 +434,7 @@ Goffset GooFile::size() const {
}
GooFile* GooFile::open(const GooString *fileName) {
HANDLE handle = CreateFileA(fileName->getCString(),
HANDLE handle = CreateFileA(fileName->c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
......@@ -483,9 +483,9 @@ Goffset GooFile::size() const {
GooFile* GooFile::open(const GooString *fileName) {
#ifdef VMS
int fd = ::open(fileName->getCString(), Q_RDONLY, "ctx=stm");
int fd = ::open(fileName->c_str(), Q_RDONLY, "ctx=stm");
#else
int fd = ::open(fileName->getCString(), O_RDONLY);
int fd = ::open(fileName->c_str(), O_RDONLY);
#endif
return fd < 0 ? nullptr : new GooFile(fd);
......@@ -535,10 +535,10 @@ GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) {
#elif defined(ACORN)
#else
#ifdef _WIN32
fa = GetFileAttributesA(fullPath->getCString());
fa = GetFileAttributesA(fullPath->c_str());
dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
#else
if (stat(fullPath->getCString(), &st) == 0)
if (stat(fullPath->c_str(), &st) == 0)
dir = S_ISDIR(st.st_mode);
#endif
#endif
......@@ -558,7 +558,7 @@ GDir::GDir(const char *name, bool doStatA) {
tmp = path->copy();
tmp->append("/*.*");
hnd = FindFirstFileA(tmp->getCString(), &ffd);
hnd = FindFirstFileA(tmp->c_str(), &ffd);
delete tmp;
#elif defined(ACORN)
#elif defined(MACOS)
......@@ -590,7 +590,7 @@ GDirEntry *GDir::getNextEntry() {
#if defined(_WIN32)
if (hnd != INVALID_HANDLE_VALUE) {
e = new GDirEntry(path->getCString(), ffd.cFileName, doStat);
e = new GDirEntry(path->c_str(), ffd.cFileName, doStat);
if (!FindNextFileA(hnd, &ffd)) {
FindClose(hnd);
hnd = INVALID_HANDLE_VALUE;
......@@ -602,13 +602,13 @@ GDirEntry *GDir::getNextEntry() {
struct dirent *ent;
if (dir) {
if (needParent) {
e = new GDirEntry(path->getCString(), "-", doStat);
e = new GDirEntry(path->c_str(), "-", doStat);
needParent = false;
return e;
}
ent = readdir(dir);
if (ent) {
e = new GDirEntry(path->getCString(), ent->d_name, doStat);
e = new GDirEntry(path->c_str(), ent->d_name, doStat);
}
}
#else
......@@ -619,7 +619,7 @@ GDirEntry *GDir::getNextEntry() {
}
while (ent && (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")));
if (ent) {
e = new GDirEntry(path->getCString(), ent->d_name, doStat);
e = new GDirEntry(path->c_str(), ent->d_name, doStat);
}
}
#endif
......@@ -635,7 +635,7 @@ void GDir::rewind() {
FindClose(hnd);
tmp = path->copy();
tmp->append("/*.*");
hnd = FindFirstFileA(tmp->getCString(), &ffd);
hnd = FindFirstFileA(tmp->c_str(), &ffd);
delete tmp;
#elif defined(ACORN)
#elif defined(MACOS)
......@@ -643,7 +643,7 @@ void GDir::rewind() {
if (dir)
rewinddir(dir);
#ifdef VMS
needParent = strchr(path->getCString(), '[') != NULL;
needParent = strchr(path->c_str(), '[') != NULL;
#endif
#endif
}
......@@ -759,7 +759,7 @@ DefaultAppearance::DefaultAppearance(GooString *da) {
int i = FormFieldText::tokenizeDA(da, daToks, "Tf");
if (i >= 1) {
fontPtSize = gatof(( (GooString *)daToks->get(i-1) )->getCString());
fontPtSize = gatof(( (GooString *)daToks->get(i-1) )->c_str());
}
if (i >= 2) {
// We are expecting a name, therefore the first letter should be '/'.
......@@ -772,16 +772,16 @@ DefaultAppearance::DefaultAppearance(GooString *da) {
for (i = daToks->getLength()-1; i >= 0; --i) {
if (!fontColor) {
if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) {
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-1) )->getCString()));
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-1) )->c_str()));
} else if (!((GooString *)daToks->get(i))->cmp("rg") && i >= 3) {
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-3) )->getCString()),
gatof(( (GooString *)daToks->get(i-2) )->getCString()),
gatof(( (GooString *)daToks->get(i-1) )->getCString()));
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-3) )->c_str()),
gatof(( (GooString *)daToks->get(i-2) )->c_str()),
gatof(( (GooString *)daToks->get(i-1) )->c_str()));
} else if (!((GooString *)daToks->get(i))->cmp("k") && i >= 4) {
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-4) )->getCString()),
gatof(( (GooString *)daToks->get(i-3) )->getCString()),
gatof(( (GooString *)daToks->get(i-2) )->getCString()),
gatof(( (GooString *)daToks->get(i-1) )->getCString()));
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-4) )->c_str()),
gatof(( (GooString *)daToks->get(i-3) )->c_str()),
gatof(( (GooString *)daToks->get(i-2) )->c_str()),
gatof(( (GooString *)daToks->get(i-1) )->c_str()));
}
}
}
......@@ -1279,7 +1279,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) {
//----- get the annotation appearance
if (appearStreams) {
appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString());
appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->c_str());
}
//----- parse the border style
......@@ -1464,7 +1464,7 @@ void Annot::setAppearanceState(const char *state) {
// The appearance state determines the current appearance stream
if (appearStreams) {
appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString());
appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->c_str());
} else {
appearance.setToNull();
}
......@@ -1762,7 +1762,7 @@ Object Annot::createForm(const GooString *appearBuf, double *bbox, bool transpar
if (resDictObject.isDict())
appearDict->set("Resources", std::move(resDictObject));
Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0,
Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->c_str()), 0,
appearBuf->getLength(), Object(appearDict));
return Object(mStream);
}
......@@ -2162,7 +2162,7 @@ void AnnotText::setIcon(GooString *new_icon) {
icon = std::make_unique<GooString>("Note");
}
update("Name", Object(objName, icon->getCString()));
update("Name", Object(objName, icon->c_str()));
invalidateAppearance();
}
......@@ -3922,7 +3922,7 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i,
// Compute width of character just output
if (outBuf->getLength() > last_o2) {
dx = 0.0;
font->getNextChar(outBuf->getCString() + last_o2,
font->getNextChar(outBuf->c_str() + last_o2,
outBuf->getLength() - last_o2,
&c, &uAux, &uLen, &dx, &dy, &ox, &oy);
w += dx;
......@@ -3977,7 +3977,7 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i,
// Compute the actual width and character count of the final string, based on
// breakpoint, if this information is requested by the caller.
if (width != nullptr || charCount != nullptr) {
const char *s = outBuf->getCString();
const char *s = outBuf->c_str();
int len = outBuf->getLength();
if (width != nullptr)
......@@ -4098,7 +4098,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
if (tfPos >= 0) {
tok = (GooString *)daToks->get(tfPos);
if (tok->getLength() >= 1 && tok->getChar(0) == '/') {
if (!resources || !(font = resources->lookupFont(tok->getCString() + 1))) {
if (!resources || !(font = resources->lookupFont(tok->c_str() + 1))) {