Changeset 62 for trunk

Show
Ignore:
Timestamp:
04.09.2006 10:53:26 (2 years ago)
Author:
m
Message:

Fixed PEAR Bug #5836. Closes #13.

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/File/Bittorrent/Decode.php

    r55 r62  
    365365    { 
    366366        $pos_e  = strpos($this->_source, 'e', $this->_position); 
    367         $return = intval(substr($this->_source, $this->_position, $pos_e - $this->_position)); 
     367        // The return value showld be automatically casted to float if the intval would 
     368        // overflow. The "+ 0" accomplishes exactly that, using the internal casting 
     369        // logic of PHP 
     370        $return = substr($this->_source, $this->_position, $pos_e - $this->_position) + 0; 
    368371        $this->_position = $pos_e + 1; 
    369372        return $return; 
  • trunk/File/Bittorrent/Encode.php

    r42 r62  
    7878        case is_null($mixed): 
    7979            return $this->encode_string(''); 
    80             break; 
    8180        case 'string': 
    8281            return $this->encode_string($mixed); 
    83             break; 
    8482        case 'integer': 
    85             return  $this->encode_int($mixed); 
    86             break; 
     83        case 'double': 
     84            return  $this->encode_int(round($mixed)); 
    8785        case 'array': 
    8886            return $this->encode_array($mixed); 
    89             break; 
    9087        default: 
    91             PEAR::raiseError('File_Bittorrent_Encode()::encode() - Unsupported type.', null, null, "Variable must be one of 'string', 'integer' or 'array'"); 
     88            PEAR::raiseError('File_Bittorrent_Encode::encode() - Unsupported type.', null, null, "Variable must be one of 'string', 'integer', 'double' or 'array'"); 
    9289        } 
    9390    } 
     
    105102    function encode_string($str) 
    106103    { 
    107         return sprintf('%s:%s', strlen($str), $str); 
     104        return strlen($str) . ':' . $str; 
    108105    } 
    109106 
     
    120117    function encode_int($int) 
    121118    { 
    122         return sprintf('i%se', $int); 
     119        return 'i' . $int . 'e'; 
    123120    } 
    124121 
  • trunk/package2.xml

    r61 r62  
    2323        <active>yes</active> 
    2424    </developer> 
    25     <date>2006-07-02</date> 
    26     <time>19:28:43</time> 
     25    <date>2006-09-04</date> 
     26    <time>00:00:00</time> 
    2727    <version> 
    28         <release>1.0.1</release> 
    29         <api>57</api> 
     28        <release>1.0.2</release> 
     29        <api>62</api> 
    3030    </version> 
    3131    <stability> 
     
    3535    <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> 
    3636    <notes> 
    37         * Updated dependencies to PEAR 1.4.2 / PHP 4.4. 
    38         * Fixed _addDir return value. Bug #7406. 
    39         * Changed announce_list behaviour. Bug #8085. 
     37        * Alexiev fixed bug #5836 
     38        * Added test for info hash 
    4039    </notes> 
    4140    <contents> 
     
    254253            </notes> 
    255254        </release> 
     255        <release> 
     256            <date>2006-09-04</date> 
     257            <version> 
     258                <release>1.0.2</release> 
     259                <api>62</api> 
     260            </version> 
     261            <stability> 
     262                <release>stable</release> 
     263                <api>stable</api> 
     264            </stability> 
     265            <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> 
     266            <notes> 
     267                * Alexiev fixed bug #5836 
     268                * Added test for info hash 
     269            </notes> 
     270        </release> 
    256271    </changelog> 
    257272</package>