[Pkg-javascript-commits] [node-expat] 42/371: node.js v0.3 Buffer compatibility
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 09:59:43 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 b464870243291076bc8cfce598ba4b973a6c7507
Author: Iein Valdez <ivaldez at gmail.com>
Date: Thu Nov 18 18:22:37 2010 +0100
node.js v0.3 Buffer compatibility
Patch has been modified to retain compatibility to v0.2
---
node-expat.cc | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/node-expat.cc b/node-expat.cc
index fd1c098..fbd6b0a 100644
--- a/node-expat.cc
+++ b/node-expat.cc
@@ -1,4 +1,5 @@
#include <node.h>
+#include <node_version.h>
#include <node_events.h>
#include <node_buffer.h>
extern "C" {
@@ -101,8 +102,12 @@ protected:
Local<Object> obj = args[0]->ToObject();
if (Buffer::HasInstance(obj))
{
+#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj);
return scope.Close(parser->parseBuffer(*buffer, isFinal) ? True() : False());
+#else
+ return scope.Close(parser->parseBuffer(obj, isFinal) ? True() : False());
+#endif
}
else
return ThrowException(
@@ -128,10 +133,17 @@ protected:
}
/** Parse a node.js Buffer directly */
+#if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION < 3
bool parseBuffer(Buffer &buffer, int isFinal)
{
return XML_Parse(parser, buffer.data(), buffer.length(), isFinal) != XML_STATUS_ERROR;
}
+#else
+ bool parseBuffer(Local<Object> buffer, int isFinal)
+ {
+ return XML_Parse(parser, Buffer::Data(buffer), Buffer::Length(buffer), isFinal) != XML_STATUS_ERROR;
+ }
+#endif
/*** setEncoding() ***/
--
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