summaryrefslogtreecommitdiff
path: root/src/slices.c
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2011-08-15 17:20:13 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2011-08-15 17:20:13 +0000
commitcd4fe3e06985f2d0b107abd301f704156a0489c2 (patch)
tree17feba4b024c36322062d4bc02fcf89e8b868809 /src/slices.c
parente9ef70cefa571bb1ada1ec515a433ed9a643a171 (diff)
download2011-ddhardrescue-cd4fe3e06985f2d0b107abd301f704156a0489c2.tar.gz
2011-ddhardrescue-cd4fe3e06985f2d0b107abd301f704156a0489c2.tar.bz2
2011-ddhardrescue-cd4fe3e06985f2d0b107abd301f704156a0489c2.zip
Ajout d'une gestion du zoom très primitive du dump dans curses. Il y avait un méchant bug dans le calcul des intervales pour le sb/se.
git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@22 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/slices.c')
-rw-r--r--src/slices.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/slices.c b/src/slices.c
index e84facf..36f7bb1 100644
--- a/src/slices.c
+++ b/src/slices.c
@@ -214,19 +214,21 @@ char *slicesDump(slices_t *slices, address_t *blockSize, unsigned int charCount,
//For each slice
while (curr != NULL) {
- // If is (partially) contained in the [begin,end] interval
- if ( (curr->begin >= begin && curr->begin <=end) || ( curr->end >= end && curr->end <= end ) ) {
-
+ // If "curr" slice is (partially) contained/visible in the [begin,end] display interval
+ if ( !(curr->end < begin) && !(curr->begin > end) ) {
// Draw the slice on the right number of characters
- sb=MAX(0, (curr->begin - begin) / *blockSize);
+ // Mathematically correct, but crashes because address_t is UNSIGNED
+ // sb=MAX(0, (curr->begin - begin) / *blockSize);
+ sb=(curr->begin < begin)?0:(curr->begin - begin) / *blockSize;
se=MIN((curr->end - begin) / *blockSize, charCount-1);
- // Debug assertion
+ /* Debug "assertion"
if (sb >= charCount || se >= charCount) {
printf("BUG : sb==%lli, se=%lli, charCount==%i\n", sb, se, charCount);
+ printf("BUG : MAX(0, (%lli - %lli) / %lli)", curr->begin, begin, *blockSize);
pthread_mutex_unlock(&(slices->writeOrConsistentReadMutex));
exit(42);
- }
+ }*/
// Choose from the current slice status the right char to draw
switch (curr->status) {