[poppler] goo/GooString.cc goo/GooString.h qt5/tests utils/HtmlFonts.cc utils/HtmlOutputDev.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 18 10:11:10 UTC 2019
goo/GooString.cc | 9 ---------
goo/GooString.h | 3 ---
qt5/tests/check_goostring.cpp | 22 ----------------------
utils/HtmlFonts.cc | 8 ++++----
utils/HtmlOutputDev.cc | 8 ++++----
5 files changed, 8 insertions(+), 42 deletions(-)
New commits:
commit 66fd6879eb647e8349e9ea67258e2da8cf2ecf91
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date: Mon Nov 18 10:24:29 2019 +0100
Replace GooString::fromInt by std::to_string
diff --git a/goo/GooString.cc b/goo/GooString.cc
index 1fb622be..86fadf30 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -136,15 +136,6 @@ void formatDoubleSmallAware(double x, char *buf, int bufSize, int prec,
//------------------------------------------------------------------------
-GooString *GooString::fromInt(int x) {
- char buf[24]; // enough space for 64-bit ints plus a little extra
- const char *p;
- int len;
- formatInt(x, buf, sizeof(buf), false, 0, 10, &p, &len);
-
- return new GooString(p, len);
-}
-
GooString *GooString::format(const char *fmt, ...) {
auto *s = new GooString();
diff --git a/goo/GooString.h b/goo/GooString.h
index 38950aef..3bc8abbf 100644
--- a/goo/GooString.h
+++ b/goo/GooString.h
@@ -91,9 +91,6 @@ public:
static_cast<std::string&>(*this).append(*str2);
}
- // Convert an integer to a string.
- static GooString *fromInt(int x);
-
// Create a formatted string. Similar to printf, but without the
// string overflow issues. Formatting elements consist of:
// {<arg>:[<width>][.<precision>]<type>}
diff --git a/qt5/tests/check_goostring.cpp b/qt5/tests/check_goostring.cpp
index 4a18ad1f..3bdfcf77 100644
--- a/qt5/tests/check_goostring.cpp
+++ b/qt5/tests/check_goostring.cpp
@@ -14,8 +14,6 @@ private slots:
void testInsert();
void testFormat();
void testFromNullptr();
- void testFromInt_data();
- void testFromInt();
};
void TestGooString::testInsertData_data()
@@ -163,26 +161,6 @@ void TestGooString::testFromNullptr()
}
}
-void TestGooString::testFromInt_data()
-{
- QTest::addColumn<int>("inty");
- QTest::addColumn<QByteArray>("stringy");
-
- QTest::newRow("Natural") << 12345 << QByteArray("12345");
- QTest::newRow("Negative") << -1 << QByteArray("-1");
- QTest::newRow("Zero") << 0 << QByteArray("0");
- QTest::newRow("INT_MAX") << 0x7fffffff << QByteArray("2147483647");
- QTest::newRow("-INT_MAX-1") << (-0x7fffffff - 1) << QByteArray("-2147483648");
-}
-
-void TestGooString::testFromInt()
-{
- QFETCH(int, inty);
- QFETCH(QByteArray, stringy);
- QScopedPointer<GooString> str(GooString::fromInt(inty));
- QCOMPARE(str->c_str(), stringy.constData());
-}
-
QTEST_GUILESS_MAIN(TestGooString)
#include "check_goostring.moc"
diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index 597c2624..08d0b967 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -275,13 +275,13 @@ int HtmlFontAccu::AddFont(const HtmlFont& font){
// get CSS font definition for font #i
GooString* HtmlFontAccu::CSStyle(int i, int j){
GooString *tmp=new GooString();
- GooString *iStr=GooString::fromInt(i);
- GooString *jStr=GooString::fromInt(j);
+ GooString *iStr=new GooString(std::to_string(i));
+ GooString *jStr=new GooString(std::to_string(j));
std::vector<HtmlFont>::iterator g=accu->begin();
g+=i;
HtmlFont font=*g;
- GooString *Size=GooString::fromInt(font.getSize());
+ GooString *Size=new GooString(std::to_string(font.getSize()));
GooString *colorStr=font.getColor().toString();
GooString *fontName=(fontFullName ? font.getFullName() : font.getFontName());
GooString *lSize;
@@ -294,7 +294,7 @@ GooString* HtmlFontAccu::CSStyle(int i, int j){
tmp->append(Size);
if( font.getLineSize() != -1 && font.getLineSize() != 0 )
{
- lSize = GooString::fromInt(font.getLineSize());
+ lSize = new GooString(std::to_string(font.getLineSize()));
tmp->append("px;line-height:");
tmp->append(lSize);
delete lSize;
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 3f490ff6..306bb416 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -814,7 +814,7 @@ int HtmlPage::dumpComplexHeaders(FILE * const file, FILE *& pageFile, int page)
if( !noframes )
{
- GooString* pgNum=GooString::fromInt(page);
+ GooString* pgNum=new GooString(std::to_string(page));
tmp = new GooString(DocName);
if (!singleHtml){
tmp->append('-')->append(pgNum)->append(".html");
@@ -1577,7 +1577,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
delete dest;
- GooString *str=GooString::fromInt(destPage);
+ GooString *str=new GooString(std::to_string(destPage));
/* complex simple
frames file-4.html files.html#4
noframes file.html#4 file.html#4
@@ -1634,7 +1634,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
file->append(".html");
}
file->append('#');
- GooString *pgNum = GooString::fromInt(destPage);
+ GooString *pgNum = new GooString(std::to_string(destPage));
file->append(pgNum);
delete pgNum;
}
@@ -1777,7 +1777,7 @@ bool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const std::vector<OutlineI
noframes file.html#4 file.html#4
*/
linkName = new GooString(gbasename(Docname->c_str()));
- GooString *str=GooString::fromInt(itemPage);
+ GooString *str = new GooString(std::to_string(itemPage));
if (noframes) {
linkName->append(".html#");
linkName->append(str);
More information about the poppler
mailing list