mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-31 02:48:31 +00:00
Add a few minor enhancements to recent work
Test coverage case for new newStream method Expose decimal_places argument for double-based newReal All enhancements suggested by Tobias.
This commit is contained in:
parent
a167ce8120
commit
5f59c32f87
@ -36,8 +36,7 @@ static void doubleBoxSize(QPDFObjectHandle& page, char const* box_name)
|
||||
{
|
||||
doubled.push_back(
|
||||
QPDFObjectHandle::newReal(
|
||||
QUtil::double_to_string(
|
||||
box.getArrayItem(i).getNumericValue() * 2.0, 2)));
|
||||
box.getArrayItem(i).getNumericValue() * 2.0, 2));
|
||||
}
|
||||
page.replaceKey(box_name, QPDFObjectHandle::newArray(doubled));
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class QPDFObjectHandle
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newReal(std::string const& value);
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newReal(double value);
|
||||
static QPDFObjectHandle newReal(double value, int decimal_places = 0);
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newName(std::string const& name);
|
||||
QPDF_DLL
|
||||
|
@ -604,9 +604,9 @@ QPDFObjectHandle::newReal(std::string const& value)
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newReal(double value)
|
||||
QPDFObjectHandle::newReal(double value, int decimal_places)
|
||||
{
|
||||
return QPDFObjectHandle(new QPDF_Real(value));
|
||||
return QPDFObjectHandle(new QPDF_Real(value, decimal_places));
|
||||
}
|
||||
|
||||
QPDFObjectHandle
|
||||
@ -683,6 +683,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf, PointerHolder<Buffer> data)
|
||||
QPDFObjectHandle
|
||||
QPDFObjectHandle::newStream(QPDF* qpdf, std::string const& data)
|
||||
{
|
||||
QTC::TC("qpdf", "QPDFObjectHandle newStream with string");
|
||||
PointerHolder<Buffer> b = new Buffer(data.length());
|
||||
unsigned char* bp = b->getBuffer();
|
||||
memcpy(bp, (char*)data.c_str(), data.length());
|
||||
|
@ -213,3 +213,4 @@ QPDFObjectHandle ERR shallow copy stream 0
|
||||
QPDFObjectHandle shallow copy array 0
|
||||
QPDFObjectHandle shallow copy dictionary 0
|
||||
QPDFObjectHandle shallow copy scalar 0
|
||||
QPDFObjectHandle newStream with string 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user