Skip to content

Commit

Permalink
refactor: don't expose libxml2 headers, forward declare types instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jun 22, 2023
1 parent f220fce commit 85c6cd3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/DMGDisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include "SubReader.h"
#include "exceptions.h"

#include <libxml/parser.h>
#include <libxml/xpath.h>

DMGDisk::DMGDisk(std::shared_ptr<Reader> reader)
: m_reader(reader), m_zone(40000)
{
Expand Down
16 changes: 12 additions & 4 deletions src/DMGDisk.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#ifndef DMGDISK_H
#define DMGDISK_H

#include "PartitionedDisk.h"
#include "Reader.h"
#include "dmg.h"
#include "CacheZone.h"
#include <libxml/parser.h>
#include <libxml/xpath.h>

struct _xmlDoc;
typedef struct _xmlDoc xmlDoc;

struct _xmlXPathContext;
typedef struct _xmlXPathContext xmlXPathContext;

struct _xmlNodeSet;
typedef struct _xmlNodeSet xmlNodeSet;

class DMGDisk : public PartitionedDisk
{
Expand All @@ -19,7 +27,7 @@ class DMGDisk : public PartitionedDisk
static bool isDMG(std::shared_ptr<Reader> reader);
private:
void loadKoly(const UDIFResourceFile& koly);
bool loadPartitionElements(xmlXPathContextPtr xpathContext, xmlNodeSetPtr nodes);
bool loadPartitionElements(xmlXPathContext* xpathContext, xmlNodeSet* nodes);
static bool parseNameAndType(const std::string& nameAndType, std::string& name, std::string& type);
static bool base64Decode(const std::string& input, std::vector<uint8_t>& output);
BLKXTable* loadBLKXTableForPartition(int index);
Expand All @@ -28,7 +36,7 @@ class DMGDisk : public PartitionedDisk
std::shared_ptr<Reader> m_reader;
std::vector<Partition> m_partitions;
UDIFResourceFile m_udif;
xmlDocPtr m_kolyXML;
xmlDoc* m_kolyXML;
CacheZone m_zone;
};

Expand Down

0 comments on commit 85c6cd3

Please sign in to comment.