openwrt-packages/libs/libmraa/patches/0005-ramips_fixes.patch

48 lines
1.7 KiB
Diff

--- a/src/javascript/mraajs.i
+++ b/src/javascript/mraajs.i
@@ -42,7 +42,13 @@ namespace mraa {
class Spi;
%typemap(out) uint8_t*
{
-%#if SWIG_V8_VERSION > 0x032870
+%#if SWIG_V8_VERSION > 0x040000
+ v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) result, arg3);
+ free(result);
+ if(!objret.ToLocal(&$result)){
+ SWIG_exception_fail(SWIG_ERROR, "Spi buffer failed");
+ }
+%#elif SWIG_V8_VERSION > 0x032870
$result = node::Buffer::New((char*) $1, arg3);
%#else
$result = node::Buffer::New((char*) $1, arg3)->handle_;
@@ -76,7 +82,13 @@ class Spi;
SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
SWIGV8_RETURN(SWIGV8_UNDEFINED());
}
-%#if SWIG_V8_VERSION > 0x032870
+%#if SWIG_V8_VERSION > 0x040000
+ v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) $1, result);
+ free($1);
+ if(!objret.ToLocal(&$result)) {
+ SWIG_exception_fail(SWIG_ERROR, "Uart buffer failed");
+ }
+%#elif SWIG_V8_VERSION > 0x032870
$result = node::Buffer::New((char*) $1, result);
%#else
$result = node::Buffer::New((char*) $1, result)->handle_;
@@ -105,7 +117,13 @@ class Spi;
SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
SWIGV8_RETURN(SWIGV8_UNDEFINED());
}
-%#if SWIG_V8_VERSION > 0x032870
+%#if SWIG_V8_VERSION > 0x040000
+ v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy(v8::Isolate::GetCurrent(), (char*) $1, result);
+ free($1);
+ if(!objret.ToLocal(&$result)) {
+ SWIG_exception_fail(SWIG_ERROR, "I2c buffer failed");
+ }
+%#elif SWIG_V8_VERSION > 0x032870
$result = node::Buffer::New((char*) $1, result);
%#else
$result = node::Buffer::New((char*) $1, result)->handle_;