aboutsummaryrefslogtreecommitdiff
path: root/c/data.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-29 23:33:48 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-29 23:33:48 +0200
commitb9d7ec228b03e2978b0e1d9f21dadd56b2f405e3 (patch)
treeb909da04cba0bcaada3c5fa16c474c49c684ef12 /c/data.cpp
parentaabdb17f29216e03b9821fb99b57e9287ee46d6d (diff)
downloadEpisodeBrowser-b9d7ec228b03e2978b0e1d9f21dadd56b2f405e3.tar.gz
Small improvments.
Diffstat (limited to 'c/data.cpp')
-rw-r--r--c/data.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/c/data.cpp b/c/data.cpp
index 4db294c..8c26138 100644
--- a/c/data.cpp
+++ b/c/data.cpp
@@ -24,15 +24,15 @@ struct ParsedDoc
ParsedDoc(const wchar_t* wszUrl, const char* szUrl)
{
- if (!s_hi.Not(0))
+ if (!s_hi.Bad(0))
throw Win32Error();
hiUrl = InternetOpenUrlW(s_hi.v, wszUrl, nullptr, 0, INTERNET_FLAG_NO_UI, 0);
- if (!hiUrl.Not(0))
+ if (!hiUrl.Bad(0))
throw InternetError();
ctxt = htmlCreatePushParserCtxt(nullptr, nullptr, bufX, sizeof(bufX), szUrl, XML_CHAR_ENCODING_UTF8);
- if (!ctxt.Not(0))
+ if (!ctxt.Bad(0))
throw XmlError();
htmlCtxtUseOptions(ctxt.v, HTML_PARSE_RECOVER|HTML_PARSE_NOERROR|HTML_PARSE_NOWARNING);
@@ -57,7 +57,7 @@ template <size_t N>
bool WcharsFromXmlchars(wchar_t (&dst)[N], xmlChar* utf8_)
{
Unique<xmlChar*, XmlFree> utf8 = utf8_;
- if (!utf8.Not(0))
+ if (!utf8.Bad(0))
throw XmlError();
/* Truncate if source is larger than destination. */
@@ -171,13 +171,13 @@ void FetchData(unsigned char* sig)
"https://www.detectiveconanworld.com/wiki/Anime");
Unique<xmlXPathContextPtr, xmlXPathFreeContext> xpathCtx = xmlXPathNewContext(doc);
- if (!xpathCtx.Not(0))
+ if (!xpathCtx.Bad(0))
throw XmlError();
Unique<xmlXPathObjectPtr, xmlXPathFreeObject> xpathObj = xmlXPathEvalExpression(
reinterpret_cast<const xmlChar*>("//tr[./td[1] != '' and ./td[3][@style='background:#f2fde9;']]"),
xpathCtx.v);
- if (!xpathObj.Not(0))
+ if (!xpathObj.Bad(0))
throw XmlError();
xmlNodeSetPtr nodes = xpathObj.v->nodesetval;
@@ -271,14 +271,14 @@ void FetchScreenwriters(unsigned char* sig)
/* Retrieve screenwriter from HTML. */
ParsedDoc doc(url, nullptr);
Unique<xmlXPathContextPtr, xmlXPathFreeContext> xpathCtx = xmlXPathNewContext(doc);
- if (!xpathCtx.Not(0))
+ if (!xpathCtx.Bad(0))
throw XmlError();
Unique<xmlXPathObjectPtr, xmlXPathFreeObject> xpathObj =
xmlXPathEvalExpression(reinterpret_cast<const xmlChar*>(
"//th[contains(text(), 'Screenplay:')]/following-sibling::td"),
xpathCtx.v);
- if (!xpathObj.Not(0))
+ if (!xpathObj.Bad(0))
throw XmlError();
xmlNodeSetPtr nodes = xpathObj.v->nodesetval;