This repository has been archived by the owner. It is now read-only.
Browse files

typed arrays: fix sunos signed/unsigned char issue

The int8_t and uint8_t typedefs on sunos/smartos depend on a number of
compiler directives. Avoid ambiguity and specify signed and unsigned
char explicitly.

Fixes the following build error:

  ../src/ In static member function 'static void*
  node::WriteWrap::operator new(size_t)':
  ../src/ warning: no return statement in function
  returning non-void [-Wreturn-type]
  In file included from ../src/
  ../src/v8_typed_array_bswap.h: In function 'T
  v8_typed_array::SwapBytes(T) [with T = signed char]':
  ../src/v8_typed_array_bswap.h:150:23:   instantiated from 'T
  v8_typed_array::LoadAndSwapBytes(void*) [with T = signed char]'
  ../src/   instantiated from 'static
  v8::Handle<v8::Value> {anonymous}::DataView::getGeneric(const
  v8::Arguments&) [with T = signed char]'
  ../src/   instantiated from here
  ../src/v8_typed_array_bswap.h:125:16: error: size of array is
  • Loading branch information...
1 parent 3383d77 commit b509ae67b794898ff5a2249cf86c7c298e2f3831 @bnoordhuis bnoordhuis committed Jan 11, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/v8_typed_array_bswap.h
@@ -127,9 +127,9 @@ inline T SwapBytes(T x) {
template <>
-inline uint8_t SwapBytes(uint8_t x) { return x; }
+inline signed char SwapBytes(signed char x) { return x; }
template <>
-inline int8_t SwapBytes(int8_t x) { return x; }
+inline unsigned char SwapBytes(unsigned char x) { return x; }
template <>
inline uint16_t SwapBytes(uint16_t x) { return V8_TYPED_ARRAY_BSWAP16(x); }
template <>

1 comment on commit b509ae6


bnoordhuis commented on b509ae6 Jan 11, 2013

/cc @deanm

Please sign in to comment.