X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCdb_PHP.php;h=a38b9a86b8d6e1418ed3b8f2b76b8e5ab96ea020;hb=af94bc9c69db033c7308192b42a47a4f27e25878;hp=e16397b327eb2f39474ecfa32afc6960979139aa;hpb=e0f1be027b69e666ea315cd98795146a55fcabe9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php index e16397b327..a38b9a86b8 100644 --- a/includes/Cdb_PHP.php +++ b/includes/Cdb_PHP.php @@ -73,10 +73,10 @@ class CdbFunctions { public static function hash( $s ) { $h = 5381; for ( $i = 0; $i < strlen( $s ); $i++ ) { - $h5 = ($h << 5) & 0xffffffff; + $h5 = ( $h << 5 ) & 0xffffffff; // Do a 32-bit sum // Inlined here for speed - $sum = ($h & 0x3fffffff) + ($h5 & 0x3fffffff); + $sum = ( $h & 0x3fffffff ) + ( $h5 & 0x3fffffff ); $h = ( ( $sum & 0x40000000 ? 1 : 0 ) @@ -138,7 +138,7 @@ class CdbReader_PHP extends CdbReader { } function close() { - if( isset( $this->handle ) ) { + if ( isset( $this->handle ) ) { fclose( $this->handle ); } unset( $this->handle ); @@ -332,7 +332,7 @@ class CdbWriter_PHP extends CdbWriter { */ public function close() { $this->finish(); - if( isset( $this->handle ) ) { + if ( isset( $this->handle ) ) { fclose( $this->handle ); } if ( wfIsWindows() && file_exists( $this->realFileName ) ) { @@ -450,9 +450,11 @@ class CdbWriter_PHP extends CdbWriter { $hp = $packedTables[$starts[$i] + $u]; $where = CdbFunctions::unsignedMod( CdbFunctions::unsignedShiftRight( $hp['h'], 8 ), $len ); - while ( $hashtable[$where]['p'] ) - if ( ++$where == $len ) + while ( $hashtable[$where]['p'] ) { + if ( ++$where == $len ) { $where = 0; + } + } $hashtable[$where] = $hp; }