summaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2019-05-25 19:36:35 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2019-06-05 20:38:11 +0200
commite1f3aaea0cf7d404d44e0dbdf608b1260fae6e1a (patch)
tree135edd72c2eb5e32577522e887acf2f0726dc7da /docs/examples
parent992083b1abe2f19947abe1d5ba01c488458f6e66 (diff)
downloadcurl-e1f3aaea0cf7d404d44e0dbdf608b1260fae6e1a.tar.gz
examples/htmltitle: use C++ casts between pointer types
Compilers and static analyzers warn about using C-style casts here. Closes https://github.com/curl/curl/pull/3975
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/htmltitle.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/examples/htmltitle.cpp b/docs/examples/htmltitle.cpp
index 8148888a4..b81777736 100644
--- a/docs/examples/htmltitle.cpp
+++ b/docs/examples/htmltitle.cpp
@@ -136,9 +136,9 @@ static void StartElement(void *voidContext,
const xmlChar *name,
const xmlChar **attributes)
{
- Context *context = (Context *)voidContext;
+ Context *context = static_cast<Context *>(voidContext);
- if(COMPARE((char *)name, "TITLE")) {
+ if(COMPARE(reinterpret_cast<char *>(name), "TITLE")) {
context->title = "";
context->addTitle = true;
}
@@ -152,9 +152,9 @@ static void StartElement(void *voidContext,
static void EndElement(void *voidContext,
const xmlChar *name)
{
- Context *context = (Context *)voidContext;
+ Context *context = static_cast<Context *>(voidContext);
- if(COMPARE((char *)name, "TITLE"))
+ if(COMPARE(reinterpret_cast<char *>(name), "TITLE"))
context->addTitle = false;
}
@@ -167,7 +167,7 @@ static void handleCharacters(Context *context,
int length)
{
if(context->addTitle)
- context->title.append((char *)chars, length);
+ context->title.append(reinterpret_cast<char *>(chars), length);
}
//
@@ -178,7 +178,7 @@ static void Characters(void *voidContext,
const xmlChar *chars,
int length)
{
- Context *context = (Context *)voidContext;
+ Context *context = static_cast<Context *>(voidContext);
handleCharacters(context, chars, length);
}
@@ -191,7 +191,7 @@ static void cdata(void *voidContext,
const xmlChar *chars,
int length)
{
- Context *context = (Context *)voidContext;
+ Context *context = static_cast<Context *>(voidContext);
handleCharacters(context, chars, length);
}