From b9d7ec228b03e2978b0e1d9f21dadd56b2f405e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 29 Aug 2022 23:33:48 +0200 Subject: Small improvments. --- c/data.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'c/data.cpp') 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 bool WcharsFromXmlchars(wchar_t (&dst)[N], xmlChar* utf8_) { Unique 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 xpathCtx = xmlXPathNewContext(doc); - if (!xpathCtx.Not(0)) + if (!xpathCtx.Bad(0)) throw XmlError(); Unique xpathObj = xmlXPathEvalExpression( reinterpret_cast("//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 xpathCtx = xmlXPathNewContext(doc); - if (!xpathCtx.Not(0)) + if (!xpathCtx.Bad(0)) throw XmlError(); Unique xpathObj = xmlXPathEvalExpression(reinterpret_cast( "//th[contains(text(), 'Screenplay:')]/following-sibling::td"), xpathCtx.v); - if (!xpathObj.Not(0)) + if (!xpathObj.Bad(0)) throw XmlError(); xmlNodeSetPtr nodes = xpathObj.v->nodesetval; -- cgit v1.2.3