changeset 766:6a5117d68ac4

More sample fix Amazingly, it's still the same bit of code that is wrong, and this time I deserve to suffer shame from Chris Cannam, with whom just last month I had a discussion about the relative merits of signed- and unsigned integers by default: the error I made here was Chris' textbook example...
author mas01cr
date Thu, 02 Jun 2011 16:31:40 +0000
parents 337e72088f76
children 6d0d41604aba
files sample.cpp
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sample.cpp	Thu Jun 02 16:31:35 2011 +0000
+++ b/sample.cpp	Thu Jun 02 16:31:40 2011 +0000
@@ -187,11 +187,10 @@
 
   std::set<std::string>::iterator keys_end = qstate->allowed_keys->end();
   for(uint32_t i = 0; i < adb->header->numFiles; i++) {
-    uint32_t prev = i == 0 ? 0 : props[i-1];
     if(qstate->allowed_keys->find((*adb->keys)[i]) == keys_end) {
       props[i] = 0;
     } else {
-      uint32_t add = (*adb->track_lengths)[i] - spec->qid.sequence_length + 1;
+      int32_t add = (*adb->track_lengths)[i] - spec->qid.sequence_length + 1;
       props[i] = add > 0 ? add : 0;
       total += props[i];
     }