diff options
Diffstat (limited to 'c/data.cpp')
-rw-r--r-- | c/data.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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; |