[Pkg-javascript-commits] [node-expat] 320/371: update string usage to nan 1.3.0 style
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 10:00:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 66a83bb4c985b92201cf20e744ad5ab6353b4c49
Author: Astro <astro at spaceboyz.net>
Date: Thu Apr 23 02:19:46 2015 +0200
update string usage to nan 1.3.0 style
silences compilation warnings
---
node-expat.cc | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/node-expat.cc b/node-expat.cc
index 28bb51d..0728e0a 100644
--- a/node-expat.cc
+++ b/node-expat.cc
@@ -38,8 +38,9 @@ protected:
XML_Char *encoding = NULL;
if (args.Length() == 1 && args[0]->IsString())
{
- encoding = new XML_Char[32];
- NanRawString(args[0], Nan::ASCII, NULL, encoding, 32, 0);
+ NanAsciiString encodingArg(args[0]);
+ encoding = new XML_Char[encodingArg.length() + 1];
+ strcpy(encoding, *encodingArg);
}
Parser *parser = new Parser(encoding);
@@ -146,12 +147,8 @@ protected:
if (args.Length() == 1 && args[0]->IsString())
{
- XML_Char *encoding = new XML_Char[32];
- NanRawString(args[0], Nan::ASCII, NULL, encoding, 32, 0);
-
- int status = parser->setEncoding(encoding);
-
- delete[] encoding;
+ NanAsciiString encoding(args[0]);
+ int status = parser->setEncoding(*encoding);
NanReturnValue(status ? NanTrue() : NanFalse());
}
@@ -219,11 +216,14 @@ protected:
XML_Char *encoding = NULL;
if (args.Length() == 1 && args[0]->IsString())
{
- encoding = new XML_Char[32];
- NanRawString(args[0], Nan::ASCII, NULL, encoding, 32, 0);
+ NanAsciiString encodingArg(args[0]);
+ encoding = new XML_Char[encodingArg.length() + 1];
+ strcpy(encoding, *encodingArg);
}
int status = parser->reset(encoding);
+ if (encoding)
+ delete[] encoding;
if (status)
parser->attachHandlers();
NanReturnValue(status ? NanTrue() : NanFalse());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list