[
https://issues.apache.org/jira/browse/THRIFT-3767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aki Sukegawa updated THRIFT-3767:
---------------------------------
Component/s: (was: Python - Library)
Perl - Library
> Read error value in TCompactProtocol when reading a compact Bool value
> ------------------------------------------------------------------------
>
> Key: THRIFT-3767
> URL: https://issues.apache.org/jira/browse/THRIFT-3767
> Project: Thrift
> Issue Type: Bug
> Components: Perl - Library
> Affects Versions: 0.9.1
> Reporter: Dongchao Ding
> Priority: Critical
>
> In TCompactProtocol, bool-value and FieldBegin(TFiled)will be encoded in one
> byte(00010001/00010010, express TRUE and FALSE) .
> In python client lib,the code for decoding is as follows :
> $result = $this->readUByte($field_type);
> if (($field_type & 0x0f) == TType::STOP) {
> $field_id = 0;
> return $result;
> }
> $delta = $field_type >> 4;
> if ($delta == 0) {
> $result += $this->readI16($field_id);
> } else {
> $field_id = $this->lastFid + $delta;
> }
> $this->lastFid = $field_id;
> // Error , this method always returns a constant value(TType::BOOL).
> $field_type = $this->getTType($field_type & 0x0f);
> if ($field_type == TCompactProtocol::COMPACT_TRUE) {
> $this->state = TCompactProtocol::STATE_BOOL_READ;
> $this->boolValue = true;
> } elseif ($field_type == TCompactProtocol::COMPACT_FALSE) {
> $this->state = TCompactProtocol::STATE_BOOL_READ;
> $this->boolValue = false;
> } else {
> $this->state = TCompactProtocol::STATE_VALUE_READ;
> }
> return $result;
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)