src: add BE support to StringBytes::Encode()
authorBryon Leung <teslaslegacy@gmail.com>
Wed, 7 Oct 2015 17:47:57 +0000 (13:47 -0400)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
commitaa8a10c8c33064ef76e9846e7e9b9cc54ec5b947
tree2ae3a5c725d491228a4ecd3f90eaa0d25241ab87
parentc5bf35a5432ef46736afad60b4995fce347a0061
src: add BE support to StringBytes::Encode()

Versions of Node.js after v0.12 have relocated byte-swapping away from
the StringBytes::Encode function, thereby causing a nan test (which
accesses this function directly) to fail on big-endian machines.

This change re-introduces byte swapping in StringBytes::Encode,
done via a call to a function in util-inl. Another change in
NodeBuffer::StringSlice was necessary to avoid double byte swapping
in big-endian function calls to StringSlice.

PR-URL: https://github.com/nodejs/node/pull/3410
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
src/node_buffer.cc
src/string_bytes.cc
src/util-inl.h
src/util.h