Fixes a bug web_archive_bundle.php with regard to how the write_partition is incrememented, a=chris

Chris Pollett [2010-10-25 01:Oct:th]
Fixes a bug web_archive_bundle.php with regard to how the write_partition is incrememented, a=chris
Filename
lib/index_archive_bundle.php
lib/utility.php
lib/web_archive_bundle.php
tests/string_cat_experiment.php
diff --git a/lib/index_archive_bundle.php b/lib/index_archive_bundle.php
index 815e6a756..9f5462532 100644
--- a/lib/index_archive_bundle.php
+++ b/lib/index_archive_bundle.php
@@ -91,7 +91,7 @@ class IndexArchiveBundle implements CrawlConstants
     var $description;
     /**
      * Number of partitions in the summaries WebArchiveBundle
-     * @int
+     * @var int
      */
     var $num_partitions_summaries;

@@ -99,22 +99,22 @@ class IndexArchiveBundle implements CrawlConstants
      * structure contains info about the current generation:
      * its index (ACTIVE), and the number of words it contains
      * (NUM_WORDS).
-     * @array
+     * @var array
      */
     var $generation_info;
     /**
      * Number of docs before a new generation is started
-     * @int
+     * @var int
      */
     var $num_docs_per_generation;
     /**
      * WebArchiveBundle for web page summaries
-     * @object
+     * @var object
      */
     var $summaries;
     /**
      * Index Shard for current generation inverted word index
-     * @object
+     * @var object
      */
     var $current_shard;

diff --git a/lib/utility.php b/lib/utility.php
index 1694054be..9fbbf6918 100755
--- a/lib/utility.php
+++ b/lib/utility.php
@@ -36,7 +36,13 @@
 if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}

 /**
+ * Copies from $source string beginning at position $start, $length many
+ * bytes to destination string
  *
+ * @param string $source  string to copy from
+ * @param string &$destination string to copy to
+ * @param $start starting offset
+ * @param $length number of bytes to copy
  */
 function charCopy($source, &$destination, $start, $length)
 {
@@ -47,7 +53,10 @@ function charCopy($source, &$destination, $start, $length)
 }

 /**
+ *  Encodes an integer using variable byte coding.
  *
+ *  @param int $pos_int integer to encode
+ *  @return string a string of 1-5 chars depending on how bit $pos_int was
  */
 function vByteEncode($pos_int)
 {
@@ -61,7 +70,11 @@ function vByteEncode($pos_int)
 }

 /**
+ *  Decodes from a string using variable byte coding an integer.
  *
+ *  @param string &$str string to use for decoding
+ *  @param int $offset byte offset into string when var int stored
+ *  @return int the decoded integer
  */
 function vByteDecode(&$str, &$offset)
 {
diff --git a/lib/web_archive_bundle.php b/lib/web_archive_bundle.php
index c37806c78..1e571c9a2 100755
--- a/lib/web_archive_bundle.php
+++ b/lib/web_archive_bundle.php
@@ -220,7 +220,7 @@ class WebArchiveBundle
         $part_count = $partition->count;
         if($this->num_docs_per_partition > 0 &&
             $num_pages + $part_count > $this->num_docs_per_partition) {
-            $this->setWritePartition($this->writePartition + 1);
+            $this->setWritePartition($this->write_partition + 1);
             $partition = $this->getPartition($this->write_partition);
         }

diff --git a/tests/string_cat_experiment.php b/tests/string_cat_experiment.php
index da2f3441e..826412dd8 100644
--- a/tests/string_cat_experiment.php
+++ b/tests/string_cat_experiment.php
@@ -85,6 +85,16 @@ for($i = 10; $i< 10000000; $i *= 10) {
     echo "Num Hello Cats = $i Time =".changeInMicroTime($start)."secs \n";
 }

+/**
+ * Measures the change in time in seconds between two timestamps to microsecond
+ * precision
+ *
+ * @param string $start starting time with microseconds
+ * @param string $end ending time with microseconds
+ * @return float time difference in seconds
+ * @see SigninModel::changePassword()
+ * @see SigninModel::checkValidSignin()
+ */
 function changeInMicrotime( $start, $end=NULL )
 {
     if( !$end ) {
ViewGit