From e50388e66e1378b8c6a93bbc331e27771bd3aedc Mon Sep 17 00:00:00 2001 From: Irina Iancu Date: Fri, 24 Feb 2017 13:04:14 +0100 Subject: Revert "Upgrade //third_party/protobuf to v3.2.0" This reverts commit 2346f5a01561f695a2b2ba7655359d5020105077. It breaks bazel build in freebsd[1]. The solution is to patch https://svnweb.freebsd.org/ports/head/devel/protobuf/files/. I rolled-back this since the other builds will not automatically start if Bazel is broken. [1] http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1312/ Change-Id: I7e939a4293d799ab6dd67f93d219d1efdf4cd901 --- .../src/Google/Protobuf/Internal/OutputStream.php | 164 --------------------- 1 file changed, 164 deletions(-) delete mode 100644 third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php (limited to 'third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php') diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php deleted file mode 100644 index 587ac352d8..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php +++ /dev/null @@ -1,164 +0,0 @@ -current = 0; - $this->buffer_size = $size; - $this->buffer = str_repeat(chr(0), $this->buffer_size); - } - - public function getData() - { - return $this->buffer; - } - - public function writeVarint32($value) - { - $bytes = str_repeat(chr(0), self::MAX_VARINT32_BYTES); - $size = self::writeVarintToArray($value, $bytes, true); - return $this->writeRaw($bytes, $size); - } - - public function writeVarint64($value) - { - $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); - $size = self::writeVarintToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeLittleEndian32($value) - { - $bytes = str_repeat(chr(0), 4); - $size = self::writeLittleEndian32ToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeLittleEndian64($value) - { - $bytes = str_repeat(chr(0), 8); - $size = self::writeLittleEndian64ToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeTag($tag) - { - return $this->writeVarint32($tag); - } - - public function writeRaw($data, $size) - { - if ($this->buffer_size < $size) { - trigger_error("Output stream doesn't have enough buffer."); - return false; - } - - for ($i = 0; $i < $size; $i++) { - $this->buffer[$this->current] = $data[$i]; - $this->current++; - $this->buffer_size--; - } - return true; - } - - private static function writeVarintToArray($value, &$buffer, $trim = false) - { - $current = 0; - - $high = 0; - $low = 0; - if (PHP_INT_SIZE == 4) { - GPBUtil::divideInt64ToInt32($value, $high, $low, $trim); - } else { - if ($trim) { - $low = $value & 0xFFFFFFFF; - } else { - $low = $value; - } - } - - while ($low >= 0x80 || $low < 0) { - $buffer[$current] = chr($low | 0x80); - $value = ($value >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); - $carry = ($high & 0x7F) << ((PHP_INT_SIZE << 3) - 7); - $high = ($high >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); - $low = (($low >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)) | $carry); - $current++; - } - $buffer[$current] = chr($low); - return $current + 1; - } - - private static function writeLittleEndian32ToArray($value, &$buffer) - { - $buffer[0] = chr($value & 0x000000FF); - $buffer[1] = chr(($value >> 8) & 0x000000FF); - $buffer[2] = chr(($value >> 16) & 0x000000FF); - $buffer[3] = chr(($value >> 24) & 0x000000FF); - return 4; - } - - private static function writeLittleEndian64ToArray($value, &$buffer) - { - $high = 0; - $low = 0; - if (PHP_INT_SIZE == 4) { - GPBUtil::divideInt64ToInt32($value, $high, $low); - } else { - $low = $value & 0xFFFFFFFF; - $high = ($value >> 32) & 0xFFFFFFFF; - } - - $buffer[0] = chr($low & 0x000000FF); - $buffer[1] = chr(($low >> 8) & 0x000000FF); - $buffer[2] = chr(($low >> 16) & 0x000000FF); - $buffer[3] = chr(($low >> 24) & 0x000000FF); - $buffer[4] = chr($high & 0x000000FF); - $buffer[5] = chr(($high >> 8) & 0x000000FF); - $buffer[6] = chr(($high >> 16) & 0x000000FF); - $buffer[7] = chr(($high >> 24) & 0x000000FF); - return 8; - } - -} -- cgit v1.2.3