Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 'nullptr' instead of 'false' for shared_ptr, add CRLF fix from master #36

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed Platform/Android/2
Empty file.
156 changes: 78 additions & 78 deletions UnitTests/UnitTests.1
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
.\"See Also:
.\"man mdoc.samples for a complete listing of options
.\"man mdoc for the short list of editing options
.\"/usr/share/misc/mdoc.template
.Dd 2013-01-02 \" DATE
.Dt UnitTests 1 \" Program name and manual section number
.Os Darwin
.Sh NAME \" Section Header - required - don't modify
.Nm UnitTests,
.\" The following lines are read in generating the apropos(man -k) database. Use only key
.\" words here as the database is built based on the words here and in the .ND line.
.Nm Other_name_for_same_program(),
.Nm Yet another name for the same program.
.\" Use .Nm macro to designate other names for the documented program.
.Nd This line parsed for whatis database.
.Sh SYNOPSIS \" Section Header - required - don't modify
.Nm
.Op Fl abcd \" [-abcd]
.Op Fl a Ar path \" [-a path]
.Op Ar file \" [file]
.Op Ar \" [file ...]
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
arg2 ... \" Arguments
.Sh DESCRIPTION \" Section Header - required - don't modify
Use the .Nm macro to refer to your program throughout the man page like such:
.Nm
Underlining is accomplished with the .Ar macro like this:
.Ar underlined text .
.Pp \" Inserts a space
A list of items with descriptions:
.Bl -tag -width -indent \" Begins a tagged list
.It item a \" Each item preceded by .It macro
Description of item a
.It item b
Description of item b
.El \" Ends the list
.Pp
A list of flags and their descriptions:
.Bl -tag -width -indent \" Differs from above in tag removed
.It Fl a \"-a flag as a list item
Description of -a flag
.It Fl b
Description of -b flag
.El \" Ends the list
.Pp
.\" .Sh ENVIRONMENT \" May not be needed
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
.\" .It Ev ENV_VAR_1
.\" Description of ENV_VAR_1
.\" .It Ev ENV_VAR_2
.\" Description of ENV_VAR_2
.\" .El
.Sh FILES \" File used or created by the topic of the man page
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
.It Pa /usr/share/file_name
FILE_1 description
.It Pa /Users/joeuser/Library/really_long_file_name
FILE_2 description
.El \" Ends the list
.\" .Sh DIAGNOSTICS \" May not be needed
.\" .Bl -diag
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .El
.Sh SEE ALSO
.\" List links in ascending order by section, alphabetically within a section.
.\" Please do not reference files that do not exist without filing a bug report
.Xr a 1 ,
.Xr b 1 ,
.Xr c 1 ,
.Xr a 2 ,
.Xr b 2 ,
.Xr a 3 ,
.Xr b 3
.\" .Sh BUGS \" Document known, unremedied bugs
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
.\"See Also:
.\"man mdoc.samples for a complete listing of options
.\"man mdoc for the short list of editing options
.\"/usr/share/misc/mdoc.template
.Dd 2013-01-02 \" DATE
.Dt UnitTests 1 \" Program name and manual section number
.Os Darwin
.Sh NAME \" Section Header - required - don't modify
.Nm UnitTests,
.\" The following lines are read in generating the apropos(man -k) database. Use only key
.\" words here as the database is built based on the words here and in the .ND line.
.Nm Other_name_for_same_program(),
.Nm Yet another name for the same program.
.\" Use .Nm macro to designate other names for the documented program.
.Nd This line parsed for whatis database.
.Sh SYNOPSIS \" Section Header - required - don't modify
.Nm
.Op Fl abcd \" [-abcd]
.Op Fl a Ar path \" [-a path]
.Op Ar file \" [file]
.Op Ar \" [file ...]
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
arg2 ... \" Arguments
.Sh DESCRIPTION \" Section Header - required - don't modify
Use the .Nm macro to refer to your program throughout the man page like such:
.Nm
Underlining is accomplished with the .Ar macro like this:
.Ar underlined text .
.Pp \" Inserts a space
A list of items with descriptions:
.Bl -tag -width -indent \" Begins a tagged list
.It item a \" Each item preceded by .It macro
Description of item a
.It item b
Description of item b
.El \" Ends the list
.Pp
A list of flags and their descriptions:
.Bl -tag -width -indent \" Differs from above in tag removed
.It Fl a \"-a flag as a list item
Description of -a flag
.It Fl b
Description of -b flag
.El \" Ends the list
.Pp
.\" .Sh ENVIRONMENT \" May not be needed
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
.\" .It Ev ENV_VAR_1
.\" Description of ENV_VAR_1
.\" .It Ev ENV_VAR_2
.\" Description of ENV_VAR_2
.\" .El
.Sh FILES \" File used or created by the topic of the man page
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
.It Pa /usr/share/file_name
FILE_1 description
.It Pa /Users/joeuser/Library/really_long_file_name
FILE_2 description
.El \" Ends the list
.\" .Sh DIAGNOSTICS \" May not be needed
.\" .Bl -diag
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .El
.Sh SEE ALSO
.\" List links in ascending order by section, alphabetically within a section.
.\" Please do not reference files that do not exist without filing a bug report
.Xr a 1 ,
.Xr b 1 ,
.Xr c 1 ,
.Xr a 2 ,
.Xr b 2 ,
.Xr a 3 ,
.Xr b 3
.\" .Sh BUGS \" Document known, unremedied bugs
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
52 changes: 52 additions & 0 deletions ePub3/ePub/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ EPUB3_BEGIN_NAMESPACE

static const char * gContainerFilePath = "META-INF/container.xml";
static const char * gEncryptionFilePath = "META-INF/encryption.xml";
static const char * gDisplayOptionsFilePath = "META-INF/com.apple.ibooks.display-options.xml";
static const char * gRootfilesXPath = "/ocf:container/ocf:rootfiles/ocf:rootfile";
static const char * gRootfilePathsXPath = "/ocf:container/ocf:rootfiles/ocf:rootfile/@full-path";
static const char * gVersionXPath = "/ocf:container/@version";
Expand Down Expand Up @@ -105,6 +106,8 @@ bool Container::Open(const string& path)
_packages.push_back(pkg);
}

AmendDisplayOptions();

auto fm = FilterManager::Instance();
for (auto& pkg : _packages)
{
Expand Down Expand Up @@ -261,6 +264,55 @@ shared_ptr<EncryptionInfo> Container::EncryptionInfoForPath(const string &path)

return nullptr;
}
void Container::AmendDisplayOptions()
{
auto pkg = DefaultPackage();

if (!pkg)
return;

// IRI iri("http", "www.idpf.org", "/vocab/rendition/", "", "layout-pre-paginated");
auto iri = pkg->MakePropertyIRI("layout", "rendition");

if (iri.IsEmpty())
{
pkg->RegisterPrefixIRIStem("rendition", "http://www.idpf.org/vocab/rendition/#");
iri = pkg->MakePropertyIRI("layout", "rendition");
}

if (pkg->ContainsProperty(iri))
return;

unique_ptr<ArchiveReader> pZipReader = _archive->ReaderAtPath(gDisplayOptionsFilePath);
if ( !pZipReader )
return;

ArchiveXmlReader reader(std::move(pZipReader));
#if EPUB_USE(LIBXML2)
shared_ptr<xml::Document> opt = reader.xmlReadDocument(gDisplayOptionsFilePath, nullptr, XML_PARSE_RECOVER|XML_PARSE_NOENT|XML_PARSE_DTDATTR);
#elif EPUB_USE(WIN_XML)
auto opt = reader.ReadDocument(gDisplayOptionsFilePath, nullptr, 0);
#endif
if ( !bool(opt) )
return;

XPathWrangler xpath(opt);

xml::NodeSet nodes = xpath.Nodes("/display_options//option[@name='fixed-layout']");
for ( auto node : nodes )
{
// string a = node->AttributeValue("name", string());
if (node->BoolValue())
{
PropertyHolderPtr holderPtr = CastPtr<PropertyHolder>();

PropertyPtr prop = Property::New(holderPtr);
prop->SetPropertyIdentifier(iri);
prop->SetValue("pre-paginated");
pkg->AddProperty(prop);
}
}
}
bool Container::FileExistsAtPath(const string& path) const
{
return _archive->ContainsItem(path.stl_str());
Expand Down
4 changes: 4 additions & 0 deletions ePub3/ePub/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ class Container : public PointerType<Container>
/// Parses the file META-INF/encryption.xml into an EncryptionList.
void LoadEncryption();

///
/// Parses the file META-INF/com.apple.ibooks.display-options.xml.
void AmendDisplayOptions();

//////////////////////////////////////////////////////////////////////////////
// BLATANT HACK!
//
Expand Down