@@ -42,18 +42,18 @@ namespace mraa {
4242class Spi ;
4343%typemap(out) uint8_t *
4444{
45- %#if SWIG_V8_VERSION > 0x040000
45+ %#if (V8_MAJOR_VERSION-0 ) < 4 && (SWIG_V8_VERSION <= 0x032870 )
46+ $result = node::Buffer::New ((char *) result, arg3)->handle_ ;
47+ free (result);
48+ %#elif (V8_MAJOR_VERSION-0 ) < 4
49+ $result = node::Buffer::New ((char *) result, arg3);
50+ free (result);
51+ %#else
4652 v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy (v8::Isolate::GetCurrent (), (char *) result, arg3);
4753 free (result);
4854 if (!objret.ToLocal (&$result)){
4955 SWIG_exception_fail (SWIG_ERROR, " Spi buffer failed" );
5056 }
51- %#elif SWIG_V8_VERSION > 0x032870
52- $result = node::Buffer::New ((char *) result, arg3);
53- free (result);
54- %#else
55- $result = node::Buffer::New ((char *) result, arg3)->handle_ ;
56- free (result);
5757%#endif
5858}
5959}
@@ -81,18 +81,18 @@ class Spi;
8181 free ($1 );
8282 SWIG_exception_fail (SWIG_ERROR, " Uart write failed" );
8383 }
84- %#if SWIG_V8_VERSION > 0x040000
85- v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy ( v8::Isolate::GetCurrent (), ( char *) $1 , result);
84+ %#if (V8_MAJOR_VERSION- 0 ) < 4 && ( SWIG_V8_VERSION <= 0x032870 )
85+ $result = node::Buffer::New (( char *) $1 , result)-> handle_ ;
8686 free ($1 );
87- if (!objret.ToLocal (&$result)) {
88- SWIG_exception_fail (SWIG_ERROR, " Uart buffer failed" );
89- }
90- %#elif SWIG_V8_VERSION > 0x032870
87+ %#elif (V8_MAJOR_VERSION-0 ) < 4
9188 $result = node::Buffer::New ((char *) $1 , result);
9289 free ($1 );
9390%#else
94- $result = node::Buffer::New (( char *) $1 , result)-> handle_ ;
91+ v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy ( v8::Isolate::GetCurrent (), ( char *) $1 , result);
9592 free ($1 );
93+ if (!objret.ToLocal (&$result)) {
94+ SWIG_exception_fail (SWIG_ERROR, " Uart buffer failed" );
95+ }
9696%#endif
9797
9898}
@@ -116,18 +116,18 @@ class Spi;
116116 free ($1 );
117117 SWIG_exception_fail (SWIG_ERROR, " I2c write failed" );
118118 }
119- %#if SWIG_V8_VERSION > 0x040000
120- v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy ( v8::Isolate::GetCurrent (), ( char *) $1 , result);
119+ %#if (V8_MAJOR_VERSION- 0 ) < 4 && ( SWIG_V8_VERSION <= 0x032870 )
120+ $result = node::Buffer::New (( char *) $1 , result)-> handle_ ;
121121 free ($1 );
122- if (!objret.ToLocal (&$result)) {
123- SWIG_exception_fail (SWIG_ERROR, " I2c buffer failed" );
124- }
125- %#elif SWIG_V8_VERSION > 0x032870
122+ %#elif (V8_MAJOR_VERSION-0 ) < 4
126123 $result = node::Buffer::New ((char *) $1 , result);
127124 free ($1 );
128125%#else
129- $result = node::Buffer::New (( char *) $1 , result)-> handle_ ;
126+ v8::MaybeLocal<v8::Object> objret = node::Buffer::Copy ( v8::Isolate::GetCurrent (), ( char *) $1 , result);
130127 free ($1 );
128+ if (!objret.ToLocal (&$result)) {
129+ SWIG_exception_fail (SWIG_ERROR, " I2c buffer failed" );
130+ }
131131%#endif
132132}
133133
0 commit comments