Skip to content

Commit

Permalink
removes whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
videlalvaro committed Nov 14, 2011
1 parent 31278bd commit 7719942
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions amqp_wire.inc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AMQPWriter
if($x<0)
$x = sprintf("%u", $x);
}

$res = array();
for($i=0;$i<$bytes;$i++)
{
Expand All @@ -79,7 +79,7 @@ class AMQPWriter
throw new Exception("Value too big!");
return $res;
}

private function flushbits()
{
if(count($this->bits))
Expand Down Expand Up @@ -122,10 +122,10 @@ class AMQPWriter
$last = 0;
else
$last = array_pop($this->bits);

$last |= ($b << $shift);
array_push($this->bits, $last);

$this->bitcount += 1;
}

Expand Down Expand Up @@ -275,7 +275,7 @@ class AMQPReader

if(!function_exists("bcmul"))
throw new Exception("'bc math' module required");

$this->buffer_read_timeout = 5; // in seconds
}

Expand All @@ -290,14 +290,14 @@ class AMQPReader
$this->bitcount = $this->bits = 0;
return $this->rawread($n);
}

private function rawread($n)
{
if($this->sock)
{
$res = '';
$read = 0;

$start = time();
while($read < $n && !feof($this->sock->real_sock()) &&
(false !== ($buf = fread($this->sock->real_sock(), $n - $read))))
Expand All @@ -307,8 +307,8 @@ class AMQPReader
usleep(100);
}
else
$start = time();
$start = time();

$read += strlen($buf);
$res .= $buf;
}
Expand Down Expand Up @@ -378,7 +378,7 @@ class AMQPReader
return $res;
}
}

// PHP does not have unsigned 32 bit int,
// so we return it as a string
public function read_long()
Expand Down Expand Up @@ -410,7 +410,7 @@ class AMQPReader
// workaround signed/unsigned braindamage in php
$hi = sprintf ( "%u", $hi[1] );
$lo = sprintf ( "%u", $lo[1] );

return bcadd(bcmul($hi, "4294967296" ), $lo);
}

Expand All @@ -424,7 +424,7 @@ class AMQPReader
list(,$slen) = unpack('C', $this->rawread(1));
return $this->rawread($slen);
}

/**
* Read a string that's up to 2**32 bytes, the encoding
* isn't specified in the AMQP spec, so just return it as
Expand All @@ -438,7 +438,7 @@ class AMQPReader
throw new Exception("Strings longer than supported on this platform");
return $this->rawread($slen);
}

/**
* Read and AMQP timestamp, which is a 64-bit integer representing
* seconds since the Unix epoch in 1-second resolution.
Expand Down Expand Up @@ -488,12 +488,12 @@ class AMQPReader
return $result;
}


protected function tell()
{
return $this->offset;
}

}


Expand Down Expand Up @@ -530,11 +530,11 @@ class GenericContent
{
if(array_key_exists($name,$this->properties))
return $this->properties[$name];

if(isset($this->delivery_info))
if(array_key_exists($name,$this->delivery_info))
return $this->delivery_info[$name];

throw new Exception("No such property");
}

Expand Down Expand Up @@ -603,7 +603,7 @@ class GenericContent
$flag_bits = 0;
$shift = 15;
}

$flag_bits |= (1 << $shift);
if($proptype != "bit")
call_user_func(array($raw_bytes, "write_" . $proptype),
Expand All @@ -616,7 +616,7 @@ class GenericContent
foreach($flags as $flag_bits)
$result->write_short($flag_bits);
$result->write($raw_bytes->getvalue());

return $result->getvalue();
}
}
Expand All @@ -629,14 +629,14 @@ class BufferedInput

$this->sock = $sock;
$this->reset("");

}

public function real_sock()
{
return $this->sock;
}

public function read($n)
{
if ($this->offset >= strlen($this->buffer))
Expand All @@ -648,13 +648,13 @@ class BufferedInput
}
return $this->read_buffer($n);
}

public function close()
{
fclose($this->sock);
$this->reset("");
}

private function read_buffer($n)
{
$n = min($n, strlen($this->buffer) - $this->offset);
Expand All @@ -669,21 +669,21 @@ class BufferedInput
$this->offset += $n;
return $block;
}

private function reset($block)
{
$this->buffer = $block;
$this->offset = 0;
}

private function populate_buffer()
{
if(feof($this->sock))
{
$this->reset("");
return FALSE;
}

$block = fread($this->sock, $this->block_size);
if ($block !== FALSE)
{
Expand Down

0 comments on commit 7719942

Please sign in to comment.