Small convention changes.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: isort.c,v 1.2 2004/12/22 09:41:58 rocky Exp $
|
$Id: isort.c,v 1.3 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -36,8 +36,10 @@
|
|||||||
#include "p_block.h"
|
#include "p_block.h"
|
||||||
#include "isort.h"
|
#include "isort.h"
|
||||||
|
|
||||||
sort_info *sort_alloc(long size){
|
sort_info_t *
|
||||||
sort_info *ret=calloc(1,sizeof(sort_info));
|
sort_alloc(long size)
|
||||||
|
{
|
||||||
|
sort_info_t *ret=calloc(1, sizeof(sort_info_t));
|
||||||
|
|
||||||
ret->vector=NULL;
|
ret->vector=NULL;
|
||||||
ret->sortbegin=-1;
|
ret->sortbegin=-1;
|
||||||
@@ -52,7 +54,9 @@ sort_info *sort_alloc(long size){
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort_unsortall(sort_info *i){
|
void
|
||||||
|
sort_unsortall(sort_info_t *i)
|
||||||
|
{
|
||||||
if(i->lastbucket>2000){ /* a guess */
|
if(i->lastbucket>2000){ /* a guess */
|
||||||
memset(i->head,0,65536*sizeof(sort_link *));
|
memset(i->head,0,65536*sizeof(sort_link *));
|
||||||
}else{
|
}else{
|
||||||
@@ -65,14 +69,18 @@ void sort_unsortall(sort_info *i){
|
|||||||
i->sortbegin=-1;
|
i->sortbegin=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort_free(sort_info *i){
|
void
|
||||||
|
sort_free(sort_info_t *i)
|
||||||
|
{
|
||||||
free(i->revindex);
|
free(i->revindex);
|
||||||
free(i->head);
|
free(i->head);
|
||||||
free(i->bucketusage);
|
free(i->bucketusage);
|
||||||
free(i);
|
free(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort_sort(sort_info *i,long sortlo,long sorthi){
|
static void
|
||||||
|
sort_sort(sort_info_t *i,long sortlo,long sorthi)
|
||||||
|
{
|
||||||
long j;
|
long j;
|
||||||
|
|
||||||
for(j=sorthi-1;j>=sortlo;j--){
|
for(j=sorthi-1;j>=sortlo;j--){
|
||||||
@@ -90,8 +98,10 @@ static void sort_sort(sort_info *i,long sortlo,long sorthi){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* size *must* be less than i->maxsize */
|
/* size *must* be less than i->maxsize */
|
||||||
void sort_setup(sort_info *i,int16_t *vector,long *abspos,
|
void
|
||||||
long size,long sortlo,long sorthi){
|
sort_setup(sort_info_t *i, int16_t *vector, long *abspos, long size,
|
||||||
|
long sortlo, long sorthi)
|
||||||
|
{
|
||||||
if(i->sortbegin!=-1)sort_unsortall(i);
|
if(i->sortbegin!=-1)sort_unsortall(i);
|
||||||
|
|
||||||
i->vector=vector;
|
i->vector=vector;
|
||||||
@@ -103,7 +113,7 @@ void sort_setup(sort_info *i,int16_t *vector,long *abspos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort_link *
|
sort_link *
|
||||||
sort_getmatch(sort_info *i,long post,long overlap,int value)
|
sort_getmatch(sort_info_t *i, long post, long overlap, int value)
|
||||||
{
|
{
|
||||||
sort_link *ret;
|
sort_link *ret;
|
||||||
|
|
||||||
@@ -130,7 +140,7 @@ sort_getmatch(sort_info *i,long post,long overlap,int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort_link *
|
sort_link *
|
||||||
sort_nextmatch(sort_info *i,sort_link *prev)
|
sort_nextmatch(sort_info_t *i, sort_link *prev)
|
||||||
{
|
{
|
||||||
sort_link *ret=prev->next;
|
sort_link *ret=prev->next;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: isort.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
$Id: isort.h,v 1.2 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,8 +26,8 @@ typedef struct sort_link{
|
|||||||
struct sort_link *next;
|
struct sort_link *next;
|
||||||
} sort_link;
|
} sort_link;
|
||||||
|
|
||||||
typedef struct sort_info{
|
typedef struct sort_info {
|
||||||
int16_t *vector; /* vector (storage doesn't belong to us) */
|
int16_t *vector; /* vector (storage doesn't belong to us) */
|
||||||
|
|
||||||
long *abspos; /* pointer for side effects */
|
long *abspos; /* pointer for side effects */
|
||||||
long size; /* vector size */
|
long size; /* vector size */
|
||||||
@@ -45,15 +45,16 @@ typedef struct sort_info{
|
|||||||
long lastbucket;
|
long lastbucket;
|
||||||
sort_link *revindex;
|
sort_link *revindex;
|
||||||
|
|
||||||
} sort_info;
|
} sort_info_t;
|
||||||
|
|
||||||
extern sort_info *sort_alloc(long size);
|
extern sort_info_t *sort_alloc(long size);
|
||||||
extern void sort_unsortall(sort_info *i);
|
extern void sort_unsortall(sort_info_t *i);
|
||||||
extern void sort_setup(sort_info *i,int16_t *vector,long *abspos,long size,
|
extern void sort_setup(sort_info_t *i,int16_t *vector,long *abspos,long size,
|
||||||
long sortlo, long sorthi);
|
long sortlo, long sorthi);
|
||||||
extern void sort_free(sort_info *i);
|
extern void sort_free(sort_info_t *i);
|
||||||
extern sort_link *sort_getmatch(sort_info *i,long post,long overlap,int value);
|
extern sort_link *sort_getmatch(sort_info_t *i, long post, long overlap,
|
||||||
extern sort_link *sort_nextmatch(sort_info *i,sort_link *prev);
|
int value);
|
||||||
|
extern sort_link *sort_nextmatch(sort_info_t *i, sort_link *prev);
|
||||||
|
|
||||||
#define is(i) (i->size)
|
#define is(i) (i->size)
|
||||||
#define ib(i) (*i->abspos)
|
#define ib(i) (*i->abspos)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: overlap.c,v 1.2 2004/12/22 09:41:58 rocky Exp $
|
$Id: overlap.c,v 1.3 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
void
|
void
|
||||||
paranoia_resetcache(cdrom_paranoia_t *p)
|
paranoia_resetcache(cdrom_paranoia_t *p)
|
||||||
{
|
{
|
||||||
c_block *c=c_first(p);
|
c_block_t *c=c_first(p);
|
||||||
v_fragment *v;
|
v_fragment *v;
|
||||||
|
|
||||||
while(c){
|
while(c){
|
||||||
@@ -98,9 +98,9 @@ i_paranoia_trim(cdrom_paranoia_t *p, long int beginword, long int endword)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
c_block *c=c_first(p);
|
c_block_t *c=c_first(p);
|
||||||
while(c){
|
while(c){
|
||||||
c_block *next=c_next(c);
|
c_block_t *next=c_next(c);
|
||||||
if(ce(c)<beginword-MAX_SECTOR_OVERLAP*CD_FRAMEWORDS)
|
if(ce(c)<beginword-MAX_SECTOR_OVERLAP*CD_FRAMEWORDS)
|
||||||
free_c_block(c);
|
free_c_block(c);
|
||||||
c=next;
|
c=next;
|
||||||
@@ -139,7 +139,7 @@ offset_adjust_settings(cdrom_paranoia_t *p,
|
|||||||
/* Adjust all the values in the cache otherwise we get a
|
/* Adjust all the values in the cache otherwise we get a
|
||||||
(potentially unstable) feedback loop */
|
(potentially unstable) feedback loop */
|
||||||
{
|
{
|
||||||
c_block *c=c_first(p);
|
c_block_t *c=c_first(p);
|
||||||
v_fragment *v=v_first(p);
|
v_fragment *v=v_first(p);
|
||||||
|
|
||||||
while(v && v->one){
|
while(v && v->one){
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: p_block.c,v 1.3 2005/01/05 04:16:11 rocky Exp $
|
$Id: p_block.c,v 1.4 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -117,15 +117,15 @@ linked_list *copy_list(linked_list *list)
|
|||||||
|
|
||||||
/**** C_block stuff ******************************************************/
|
/**** C_block stuff ******************************************************/
|
||||||
|
|
||||||
static c_block *
|
static c_block_t *
|
||||||
i_cblock_constructor(cdrom_paranoia_t *p)
|
i_cblock_constructor(cdrom_paranoia_t *p)
|
||||||
{
|
{
|
||||||
c_block *ret=calloc(1,sizeof(c_block));
|
c_block_t *ret=calloc(1,sizeof(c_block_t));
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
i_cblock_destructor(c_block *c)
|
i_cblock_destructor(c_block_t *c)
|
||||||
{
|
{
|
||||||
if(c){
|
if(c){
|
||||||
if(c->vector)free(c->vector);
|
if(c->vector)free(c->vector);
|
||||||
@@ -135,17 +135,17 @@ i_cblock_destructor(c_block *c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c_block *
|
c_block_t *
|
||||||
new_c_block(cdrom_paranoia_t *p)
|
new_c_block(cdrom_paranoia_t *p)
|
||||||
{
|
{
|
||||||
linked_element *e=new_elem(p->cache);
|
linked_element *e=new_elem(p->cache);
|
||||||
c_block *c=e->ptr;
|
c_block_t *c=e->ptr;
|
||||||
c->e=e;
|
c->e=e;
|
||||||
c->p=p;
|
c->p=p;
|
||||||
return(c);
|
return(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_c_block(c_block *c)
|
void free_c_block(c_block_t *c)
|
||||||
{
|
{
|
||||||
/* also rid ourselves of v_fragments that reference this block */
|
/* also rid ourselves of v_fragments that reference this block */
|
||||||
v_fragment *v=v_first(c->p);
|
v_fragment *v=v_first(c->p);
|
||||||
@@ -173,7 +173,7 @@ i_v_fragment_destructor(v_fragment *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
v_fragment *
|
v_fragment *
|
||||||
new_v_fragment(cdrom_paranoia_t *p, c_block *one,
|
new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||||
long int begin, long int end, int last)
|
long int begin, long int end, int last)
|
||||||
{
|
{
|
||||||
linked_element *e=new_elem(p->fragments);
|
linked_element *e=new_elem(p->fragments);
|
||||||
@@ -196,7 +196,7 @@ void free_v_fragment(v_fragment *v)
|
|||||||
free_elem(v->e,1);
|
free_elem(v->e,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_block *
|
c_block_t *
|
||||||
c_first(cdrom_paranoia_t *p)
|
c_first(cdrom_paranoia_t *p)
|
||||||
{
|
{
|
||||||
if(p->cache->head)
|
if(p->cache->head)
|
||||||
@@ -204,7 +204,7 @@ c_first(cdrom_paranoia_t *p)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_block *
|
c_block_t *
|
||||||
c_last(cdrom_paranoia_t *p)
|
c_last(cdrom_paranoia_t *p)
|
||||||
{
|
{
|
||||||
if(p->cache->tail)
|
if(p->cache->tail)
|
||||||
@@ -212,16 +212,16 @@ c_last(cdrom_paranoia_t *p)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_block *
|
c_block_t *
|
||||||
c_next(c_block *c)
|
c_next(c_block_t *c)
|
||||||
{
|
{
|
||||||
if(c->e->next)
|
if(c->e->next)
|
||||||
return(c->e->next->ptr);
|
return(c->e->next->ptr);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_block *
|
c_block_t *
|
||||||
c_prev(c_block *c)
|
c_prev(c_block_t *c)
|
||||||
{
|
{
|
||||||
if(c->e->prev)
|
if(c->e->prev)
|
||||||
return(c->e->prev->ptr);
|
return(c->e->prev->ptr);
|
||||||
@@ -282,22 +282,23 @@ v_buffer(v_fragment *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* alloc a c_block not on a cache list */
|
/* alloc a c_block not on a cache list */
|
||||||
c_block *
|
c_block_t *
|
||||||
c_alloc(int16_t *vector,long begin,long size)
|
c_alloc(int16_t *vector, long begin, long size)
|
||||||
{
|
{
|
||||||
c_block *c=calloc(1,sizeof(c_block));
|
c_block_t *c=calloc(1,sizeof(c_block_t));
|
||||||
c->vector=vector;
|
c->vector=vector;
|
||||||
c->begin=begin;
|
c->begin=begin;
|
||||||
c->size=size;
|
c->size=size;
|
||||||
return(c);
|
return(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void c_set(c_block *v,long begin){
|
void c_set(c_block_t *v,long begin){
|
||||||
v->begin=begin;
|
v->begin=begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pos here is vector position from zero */
|
/* pos here is vector position from zero */
|
||||||
void c_insert(c_block *v,long pos,int16_t *b,long size)
|
void
|
||||||
|
c_insert(c_block_t *v,long pos,int16_t *b,long size)
|
||||||
{
|
{
|
||||||
int vs=cs(v);
|
int vs=cs(v);
|
||||||
if(pos<0 || pos>vs)return;
|
if(pos<0 || pos>vs)return;
|
||||||
@@ -314,7 +315,8 @@ void c_insert(c_block *v,long pos,int16_t *b,long size)
|
|||||||
v->size+=size;
|
v->size+=size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void c_remove(c_block *v,long cutpos,long cutsize)
|
void
|
||||||
|
c_remove(c_block_t *v, long cutpos, long cutsize)
|
||||||
{
|
{
|
||||||
int vs=cs(v);
|
int vs=cs(v);
|
||||||
if(cutpos<0 || cutpos>vs)return;
|
if(cutpos<0 || cutpos>vs)return;
|
||||||
@@ -328,7 +330,9 @@ void c_remove(c_block *v,long cutpos,long cutsize)
|
|||||||
v->size-=cutsize;
|
v->size-=cutsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void c_overwrite(c_block *v,long pos,int16_t *b,long size){
|
void
|
||||||
|
c_overwrite(c_block_t *v,long pos,int16_t *b,long size)
|
||||||
|
{
|
||||||
int vs=cs(v);
|
int vs=cs(v);
|
||||||
|
|
||||||
if(pos<0)return;
|
if(pos<0)return;
|
||||||
@@ -338,7 +342,7 @@ void c_overwrite(c_block *v,long pos,int16_t *b,long size){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
c_append(c_block *v, int16_t *vector, long size)
|
c_append(c_block_t *v, int16_t *vector, long size)
|
||||||
{
|
{
|
||||||
int vs=cs(v);
|
int vs=cs(v);
|
||||||
|
|
||||||
@@ -352,7 +356,9 @@ c_append(c_block *v, int16_t *vector, long size)
|
|||||||
v->size+=size;
|
v->size+=size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void c_removef(c_block *v, long cut){
|
void
|
||||||
|
c_removef(c_block_t *v, long cut)
|
||||||
|
{
|
||||||
c_remove(v,0,cut);
|
c_remove(v,0,cut);
|
||||||
v->begin+=cut;
|
v->begin+=cut;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: p_block.h,v 1.2 2005/01/05 04:16:11 rocky Exp $
|
$Id: p_block.h,v 1.3 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) by Monty (xiphmont@mit.edu)
|
Copyright (C) by Monty (xiphmont@mit.edu)
|
||||||
@@ -69,7 +69,7 @@ extern void *get_elem(linked_element *e);
|
|||||||
extern linked_list *copy_list(linked_list *list); /* shallow; doesn't copy
|
extern linked_list *copy_list(linked_list *list); /* shallow; doesn't copy
|
||||||
contained structures */
|
contained structures */
|
||||||
|
|
||||||
typedef struct c_block{
|
typedef struct c_block {
|
||||||
/* The buffer */
|
/* The buffer */
|
||||||
int16_t *vector;
|
int16_t *vector;
|
||||||
long begin;
|
long begin;
|
||||||
@@ -91,14 +91,14 @@ typedef struct c_block{
|
|||||||
cdrom_paranoia_t *p;
|
cdrom_paranoia_t *p;
|
||||||
struct linked_element *e;
|
struct linked_element *e;
|
||||||
|
|
||||||
} c_block;
|
} c_block_t;
|
||||||
|
|
||||||
extern void free_c_block(c_block *c);
|
extern void free_c_block(c_block_t *c);
|
||||||
extern void i_cblock_destructor(c_block *c);
|
extern void i_cblock_destructor(c_block_t *c);
|
||||||
extern c_block *new_c_block(cdrom_paranoia_t *p);
|
extern c_block_t *new_c_block(cdrom_paranoia_t *p);
|
||||||
|
|
||||||
typedef struct v_fragment{
|
typedef struct v_fragment{
|
||||||
c_block *one;
|
c_block_t *one;
|
||||||
|
|
||||||
long begin;
|
long begin;
|
||||||
long size;
|
long size;
|
||||||
@@ -114,15 +114,15 @@ typedef struct v_fragment{
|
|||||||
} v_fragment;
|
} v_fragment;
|
||||||
|
|
||||||
extern void free_v_fragment(v_fragment *c);
|
extern void free_v_fragment(v_fragment *c);
|
||||||
extern v_fragment *new_v_fragment(cdrom_paranoia_t *p, c_block *one,
|
extern v_fragment *new_v_fragment(cdrom_paranoia_t *p, c_block_t *one,
|
||||||
long int begin, long int end,
|
long int begin, long int end,
|
||||||
int lastsector);
|
int lastsector);
|
||||||
extern int16_t *v_buffer(v_fragment *v);
|
extern int16_t *v_buffer(v_fragment *v);
|
||||||
|
|
||||||
extern c_block *c_first(cdrom_paranoia_t *p);
|
extern c_block_t *c_first(cdrom_paranoia_t *p);
|
||||||
extern c_block *c_last(cdrom_paranoia_t *p);
|
extern c_block_t *c_last(cdrom_paranoia_t *p);
|
||||||
extern c_block *c_next(c_block *c);
|
extern c_block_t *c_next(c_block_t *c);
|
||||||
extern c_block *c_prev(c_block *c);
|
extern c_block_t *c_prev(c_block_t *c);
|
||||||
|
|
||||||
extern v_fragment *v_first(cdrom_paranoia_t *p);
|
extern v_fragment *v_first(cdrom_paranoia_t *p);
|
||||||
extern v_fragment *v_last(cdrom_paranoia_t *p);
|
extern v_fragment *v_last(cdrom_paranoia_t *p);
|
||||||
@@ -134,7 +134,7 @@ typedef struct root_block{
|
|||||||
long lastsector;
|
long lastsector;
|
||||||
cdrom_paranoia_t *p;
|
cdrom_paranoia_t *p;
|
||||||
|
|
||||||
c_block *vector; /* doesn't use any sorting */
|
c_block_t *vector; /* doesn't use any sorting */
|
||||||
int silenceflag;
|
int silenceflag;
|
||||||
long silencebegin;
|
long silencebegin;
|
||||||
} root_block;
|
} root_block;
|
||||||
@@ -157,7 +157,7 @@ struct cdrom_paranoia_s {
|
|||||||
linked_list *cache; /* our data as read from the cdrom */
|
linked_list *cache; /* our data as read from the cdrom */
|
||||||
long int cache_limit;
|
long int cache_limit;
|
||||||
linked_list *fragments; /* fragments of blocks that have been 'verified' */
|
linked_list *fragments; /* fragments of blocks that have been 'verified' */
|
||||||
sort_info *sortcache;
|
sort_info_t *sortcache;
|
||||||
|
|
||||||
int readahead; /* sectors of readahead in each readop */
|
int readahead; /* sectors of readahead in each readop */
|
||||||
int jitter;
|
int jitter;
|
||||||
@@ -179,13 +179,13 @@ struct cdrom_paranoia_s {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern c_block *c_alloc(int16_t *vector,long begin,long size);
|
extern c_block_t *c_alloc(int16_t *vector,long begin,long size);
|
||||||
extern void c_set(c_block *v,long begin);
|
extern void c_set(c_block_t *v,long begin);
|
||||||
extern void c_insert(c_block *v,long pos,int16_t *b,long size);
|
extern void c_insert(c_block_t *v,long pos,int16_t *b,long size);
|
||||||
extern void c_remove(c_block *v,long cutpos,long cutsize);
|
extern void c_remove(c_block_t *v,long cutpos,long cutsize);
|
||||||
extern void c_overwrite(c_block *v,long pos,int16_t *b,long size);
|
extern void c_overwrite(c_block_t *v,long pos,int16_t *b,long size);
|
||||||
extern void c_append(c_block *v, int16_t *vector, long size);
|
extern void c_append(c_block_t *v, int16_t *vector, long size);
|
||||||
extern void c_removef(c_block *v, long cut);
|
extern void c_removef(c_block_t *v, long cut);
|
||||||
|
|
||||||
#define ce(v) (v->begin+v->size)
|
#define ce(v) (v->begin+v->size)
|
||||||
#define cb(v) (v->begin)
|
#define cb(v) (v->begin)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: paranoia.c,v 1.4 2005/01/06 01:15:51 rocky Exp $
|
$Id: paranoia.c,v 1.5 2005/01/07 02:42:29 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -191,10 +191,10 @@ afterward. */
|
|||||||
#define OVERLAP_ADJ (MIN_WORDS_OVERLAP/2-1)
|
#define OVERLAP_ADJ (MIN_WORDS_OVERLAP/2-1)
|
||||||
|
|
||||||
static inline long int
|
static inline long int
|
||||||
do_const_sync(c_block *A,
|
do_const_sync(c_block_t *A,
|
||||||
sort_info *B,char *flagB,
|
sort_info_t *B, char *flagB,
|
||||||
long posA,long posB,
|
long posA, long posB,
|
||||||
long *begin,long *end,long *offset)
|
long *begin, long *end, long *offset)
|
||||||
{
|
{
|
||||||
char *flagA=A->flags;
|
char *flagA=A->flags;
|
||||||
long ret=0;
|
long ret=0;
|
||||||
@@ -223,8 +223,8 @@ do_const_sync(c_block *A,
|
|||||||
|
|
||||||
static inline long int
|
static inline long int
|
||||||
try_sort_sync(cdrom_paranoia_t *p,
|
try_sort_sync(cdrom_paranoia_t *p,
|
||||||
sort_info *A,char *Aflags,
|
sort_info_t *A, char *Aflags,
|
||||||
c_block *B,
|
c_block_t *B,
|
||||||
long int post,
|
long int post,
|
||||||
long int *begin,
|
long int *begin,
|
||||||
long int *end,
|
long int *end,
|
||||||
@@ -241,11 +241,11 @@ try_sort_sync(cdrom_paranoia_t *p,
|
|||||||
/* always try absolute offset zero first! */
|
/* always try absolute offset zero first! */
|
||||||
{
|
{
|
||||||
long zeropos=post-ib(A);
|
long zeropos=post-ib(A);
|
||||||
if(zeropos>=0 && zeropos<is(A)){
|
if (zeropos>=0 && zeropos<is(A)) {
|
||||||
if ( cv(B)[post-cb(B)] == iv(A)[zeropos] ) {
|
if ( cv(B)[post-cb(B)] == iv(A)[zeropos] ) {
|
||||||
if(do_const_sync(B,A,Aflags,
|
if (do_const_sync(B, A, Aflags,
|
||||||
post-cb(B),zeropos,
|
post-cb(B), zeropos,
|
||||||
begin,end,offset)){
|
begin, end, offset) ) {
|
||||||
|
|
||||||
offset_add_value(p,&(p->stage1),*offset,callback);
|
offset_add_value(p,&(p->stage1),*offset,callback);
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ try_sort_sync(cdrom_paranoia_t *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
stage1_matched(c_block *old,c_block *new,
|
stage1_matched(c_block_t *old, c_block_t *new,
|
||||||
long matchbegin,long matchend,
|
long matchbegin,long matchend,
|
||||||
long matchoffset,
|
long matchoffset,
|
||||||
void (*callback)(long int, paranoia_cb_mode_t))
|
void (*callback)(long int, paranoia_cb_mode_t))
|
||||||
@@ -326,7 +326,7 @@ stage1_matched(c_block *old,c_block *new,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long int
|
static long int
|
||||||
i_iterate_stage1(cdrom_paranoia_t *p, c_block *old, c_block *new,
|
i_iterate_stage1(cdrom_paranoia_t *p, c_block_t *old, c_block_t *new,
|
||||||
void(*callback)(long int, paranoia_cb_mode_t))
|
void(*callback)(long int, paranoia_cb_mode_t))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ i_iterate_stage1(cdrom_paranoia_t *p, c_block *old, c_block *new,
|
|||||||
long searchend=min(ce(old),ce(new));
|
long searchend=min(ce(old),ce(new));
|
||||||
long searchbegin=max(cb(old),cb(new));
|
long searchbegin=max(cb(old),cb(new));
|
||||||
long searchsize=searchend-searchbegin;
|
long searchsize=searchend-searchbegin;
|
||||||
sort_info *i=p->sortcache;
|
sort_info_t *i=p->sortcache;
|
||||||
long ret=0;
|
long ret=0;
|
||||||
long j;
|
long j;
|
||||||
|
|
||||||
@@ -380,16 +380,16 @@ i_iterate_stage1(cdrom_paranoia_t *p, c_block *old, c_block *new,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long int
|
static long int
|
||||||
i_stage1(cdrom_paranoia_t *p, c_block *new,
|
i_stage1(cdrom_paranoia_t *p, c_block_t *new,
|
||||||
void (*callback)(long int, paranoia_cb_mode_t))
|
void (*callback)(long int, paranoia_cb_mode_t))
|
||||||
{
|
{
|
||||||
long size=cs(new);
|
long size=cs(new);
|
||||||
c_block *ptr=c_last(p);
|
c_block_t *ptr=c_last(p);
|
||||||
int ret=0;
|
int ret=0;
|
||||||
long begin=0,end;
|
long begin=0,end;
|
||||||
|
|
||||||
if(ptr)sort_setup(p->sortcache,cv(new),&cb(new),cs(new),
|
if (ptr)
|
||||||
cb(new),ce(new));
|
sort_setup( p->sortcache, cv(new), &cb(new), cs(new), cb(new), ce(new) );
|
||||||
|
|
||||||
while(ptr && ptr!=new){
|
while(ptr && ptr!=new){
|
||||||
|
|
||||||
@@ -461,10 +461,10 @@ i_iterate_stage2(cdrom_paranoia_t *p,
|
|||||||
must strictly adhere to root */
|
must strictly adhere to root */
|
||||||
long searchend=min(fev+p->dynoverlap,re(root));
|
long searchend=min(fev+p->dynoverlap,re(root));
|
||||||
long searchbegin=max(fbv-p->dynoverlap,rb(root));
|
long searchbegin=max(fbv-p->dynoverlap,rb(root));
|
||||||
sort_info *i=p->sortcache;
|
sort_info_t *i=p->sortcache;
|
||||||
long j;
|
long j;
|
||||||
|
|
||||||
sort_setup(i,fv(v),&fb(v),fs(v),fbv,fev);
|
sort_setup(i, fv(v), &fb(v), fs(v), fbv, fev);
|
||||||
for(j=searchbegin;j<searchend;j+=23){
|
for(j=searchbegin;j<searchend;j+=23){
|
||||||
while(j<searchend && rv(root)[j-rb(root)]==0)j++;
|
while(j<searchend && rv(root)[j-rb(root)]==0)j++;
|
||||||
if(j==searchend)break;
|
if(j==searchend)break;
|
||||||
@@ -593,7 +593,7 @@ i_stage2_each(root_block *root, v_fragment *v,
|
|||||||
long end=r.end-rb(root);
|
long end=r.end-rb(root);
|
||||||
long offset=r.begin+r.offset-fb(v)-begin;
|
long offset=r.begin+r.offset-fb(v)-begin;
|
||||||
long temp;
|
long temp;
|
||||||
c_block *l=NULL;
|
c_block_t *l=NULL;
|
||||||
|
|
||||||
/* we have a match! We don't rematch off rift, we chase the
|
/* we have a match! We don't rematch off rift, we chase the
|
||||||
match all the way to both extremes doing rift analysis. */
|
match all the way to both extremes doing rift analysis. */
|
||||||
@@ -982,7 +982,7 @@ verify_skip_case(cdrom_paranoia_t *p,
|
|||||||
{
|
{
|
||||||
|
|
||||||
root_block *root=&(p->root);
|
root_block *root=&(p->root);
|
||||||
c_block *graft=NULL;
|
c_block_t *graft=NULL;
|
||||||
int vflag=0;
|
int vflag=0;
|
||||||
int gend=0;
|
int gend=0;
|
||||||
long post;
|
long post;
|
||||||
@@ -1004,7 +1004,7 @@ verify_skip_case(cdrom_paranoia_t *p,
|
|||||||
preferrably a verified area */
|
preferrably a verified area */
|
||||||
|
|
||||||
{
|
{
|
||||||
c_block *c=c_first(p);
|
c_block_t *c=c_first(p);
|
||||||
while(c){
|
while(c){
|
||||||
long cbegin=cb(c);
|
long cbegin=cb(c);
|
||||||
long cend=ce(c);
|
long cend=ce(c);
|
||||||
@@ -1121,7 +1121,7 @@ paranoia_seek(cdrom_paranoia_t *p, off_t seek, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns last block read, -1 on error */
|
/* returns last block read, -1 on error */
|
||||||
static c_block *
|
static c_block_t *
|
||||||
i_read_c_block(cdrom_paranoia_t *p,long beginword,long endword,
|
i_read_c_block(cdrom_paranoia_t *p,long beginword,long endword,
|
||||||
void(*callback)(long, paranoia_cb_mode_t))
|
void(*callback)(long, paranoia_cb_mode_t))
|
||||||
{
|
{
|
||||||
@@ -1136,7 +1136,7 @@ i_read_c_block(cdrom_paranoia_t *p,long beginword,long endword,
|
|||||||
long totaltoread=p->readahead;
|
long totaltoread=p->readahead;
|
||||||
long sectatonce=p->d->nsectors;
|
long sectatonce=p->d->nsectors;
|
||||||
long driftcomp=(float)p->dyndrift/CD_FRAMEWORDS+.5;
|
long driftcomp=(float)p->dyndrift/CD_FRAMEWORDS+.5;
|
||||||
c_block *new=NULL;
|
c_block_t *new=NULL;
|
||||||
root_block *root=&p->root;
|
root_block *root=&p->root;
|
||||||
int16_t *buffer=NULL;
|
int16_t *buffer=NULL;
|
||||||
char *flags=NULL;
|
char *flags=NULL;
|
||||||
@@ -1322,7 +1322,7 @@ paranoia_read_limited(cdrom_paranoia_t *p,
|
|||||||
/* Hmm, need more. Read another block */
|
/* Hmm, need more. Read another block */
|
||||||
|
|
||||||
{
|
{
|
||||||
c_block *new=i_read_c_block(p,beginword,endword,callback);
|
c_block_t *new=i_read_c_block(p,beginword,endword,callback);
|
||||||
|
|
||||||
if(new){
|
if(new){
|
||||||
if(p->enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){
|
if(p->enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){
|
||||||
|
|||||||
Reference in New Issue
Block a user