Permalink
Browse files

removes whitespace

  • Loading branch information...
videlalvaro committed Nov 14, 2011
1 parent 31278bd commit 77199422e5e62eeb2403dbeec68646a8db5bcd5f
Showing with 27 additions and 27 deletions.
  1. +27 −27 amqp_wire.inc
View
@@ -67,7 +67,7 @@ class AMQPWriter
if($x<0)
$x = sprintf("%u", $x);
}
-
+
$res = array();
for($i=0;$i<$bytes;$i++)
{
@@ -79,7 +79,7 @@ class AMQPWriter
throw new Exception("Value too big!");
return $res;
}
-
+
private function flushbits()
{
if(count($this->bits))
@@ -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;
}
@@ -275,7 +275,7 @@ class AMQPReader
if(!function_exists("bcmul"))
throw new Exception("'bc math' module required");
-
+
$this->buffer_read_timeout = 5; // in seconds
}
@@ -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))))
@@ -307,8 +307,8 @@ class AMQPReader
usleep(100);
}
else
- $start = time();
-
+ $start = time();
+
$read += strlen($buf);
$res .= $buf;
}
@@ -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()
@@ -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);
}
@@ -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
@@ -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.
@@ -488,12 +488,12 @@ class AMQPReader
return $result;
}
-
+
protected function tell()
{
return $this->offset;
}
-
+
}
@@ -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");
}
@@ -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),
@@ -616,7 +616,7 @@ class GenericContent
foreach($flags as $flag_bits)
$result->write_short($flag_bits);
$result->write($raw_bytes->getvalue());
-
+
return $result->getvalue();
}
}
@@ -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))
@@ -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);
@@ -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)
{

0 comments on commit 7719942

Please sign in to comment.