src/lib: Use tabs instead of spaces
Fix the following errors and warnings detected by checkpatch.pl: ERROR: code indent should use tabs where possible ERROR: switch and case should be at the same indent WARNING: Statements should start on a tabstop WARNING: please, no spaces at the start of a line WARNING: please, no space before tabs WARNING: suspect code indent for conditional statements WARNING: labels should not be indented TEST=Build and run on Galileo Gen2 Change-Id: Iebcff26ad41ab6eb0027b871a1c06f3b52dd207c Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com> Reviewed-on: https://review.coreboot.org/18732 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
@ -875,11 +875,9 @@ parse_cea(struct edid *out, unsigned char *x, struct edid_context *c)
|
|||||||
if (offset < 4)
|
if (offset < 4)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (version < 3) {
|
if (version < 3)
|
||||||
printk(BIOS_SPEW, "%d 8-byte timing descriptors\n", (offset - 4) / 8);
|
printk(BIOS_SPEW, "%d 8-byte timing descriptors\n", (offset - 4) / 8);
|
||||||
if (offset - 4 > 0)
|
else if (version == 3) {
|
||||||
/* do stuff */ ;
|
|
||||||
} else if (version == 3) {
|
|
||||||
int i;
|
int i;
|
||||||
printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4);
|
printk(BIOS_SPEW, "%d bytes of CEA data\n", offset - 4);
|
||||||
for (i = 4; i < offset; i += (x[i] & 0x1f) + 1)
|
for (i = 4; i < offset; i += (x[i] & 0x1f) + 1)
|
||||||
|
@ -36,8 +36,7 @@ static void gcov_allocate(unsigned int);
|
|||||||
static inline gcov_unsigned_t from_file(gcov_unsigned_t value)
|
static inline gcov_unsigned_t from_file(gcov_unsigned_t value)
|
||||||
{
|
{
|
||||||
#if !IN_LIBGCOV
|
#if !IN_LIBGCOV
|
||||||
if (gcov_var.endian)
|
if (gcov_var.endian) {
|
||||||
{
|
|
||||||
value = (value >> 16) | (value << 16);
|
value = (value >> 16) | (value << 16);
|
||||||
value = ((value & 0xff00ff) << 8) | ((value >> 8) & 0xff00ff);
|
value = ((value & 0xff00ff) << 8) | ((value >> 8) & 0xff00ff);
|
||||||
}
|
}
|
||||||
@ -84,14 +83,11 @@ gcov_open(const char *name, int mode)
|
|||||||
gcov_var.endian = 0;
|
gcov_var.endian = 0;
|
||||||
#endif
|
#endif
|
||||||
#if GCOV_LOCKED
|
#if GCOV_LOCKED
|
||||||
if (mode > 0)
|
if (mode > 0) {
|
||||||
{
|
|
||||||
/* Read-only mode - acquire a read-lock. */
|
/* Read-only mode - acquire a read-lock. */
|
||||||
s_flock.l_type = F_RDLCK;
|
s_flock.l_type = F_RDLCK;
|
||||||
fd = open(name, O_RDONLY);
|
fd = open(name, O_RDONLY);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Write mode - acquire a write-lock. */
|
/* Write mode - acquire a write-lock. */
|
||||||
s_flock.l_type = F_WRLCK;
|
s_flock.l_type = F_WRLCK;
|
||||||
fd = open(name, O_RDWR | O_CREAT, 0666);
|
fd = open(name, O_RDWR | O_CREAT, 0666);
|
||||||
@ -104,20 +100,17 @@ gcov_open(const char *name, int mode)
|
|||||||
|
|
||||||
gcov_var.file = fdopen(fd, (mode > 0) ? "rb" : "r+b");
|
gcov_var.file = fdopen(fd, (mode > 0) ? "rb" : "r+b");
|
||||||
|
|
||||||
if (!gcov_var.file)
|
if (!gcov_var.file) {
|
||||||
{
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode > 0)
|
if (mode > 0)
|
||||||
gcov_var.mode = 1;
|
gcov_var.mode = 1;
|
||||||
else if (mode == 0)
|
else if (mode == 0) {
|
||||||
{
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (fstat(fd, &st) < 0)
|
if (fstat(fd, &st) < 0) {
|
||||||
{
|
|
||||||
fclose(gcov_var.file);
|
fclose(gcov_var.file);
|
||||||
gcov_var.file = 0;
|
gcov_var.file = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -126,8 +119,7 @@ gcov_open(const char *name, int mode)
|
|||||||
gcov_var.mode = 1;
|
gcov_var.mode = 1;
|
||||||
else
|
else
|
||||||
gcov_var.mode = mode * 2 + 1;
|
gcov_var.mode = mode * 2 + 1;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gcov_var.mode = mode * 2 + 1;
|
gcov_var.mode = mode * 2 + 1;
|
||||||
#else
|
#else
|
||||||
if (mode >= 0)
|
if (mode >= 0)
|
||||||
@ -135,8 +127,7 @@ gcov_open(const char *name, int mode)
|
|||||||
|
|
||||||
if (gcov_var.file)
|
if (gcov_var.file)
|
||||||
gcov_var.mode = 1;
|
gcov_var.mode = 1;
|
||||||
else if (mode <= 0)
|
else if (mode <= 0) {
|
||||||
{
|
|
||||||
gcov_var.file = fopen(name, "w+b");
|
gcov_var.file = fopen(name, "w+b");
|
||||||
if (gcov_var.file)
|
if (gcov_var.file)
|
||||||
gcov_var.mode = mode * 2 + 1;
|
gcov_var.mode = mode * 2 + 1;
|
||||||
@ -156,8 +147,7 @@ gcov_open(const char *name, int mode)
|
|||||||
GCOV_LINKAGE int
|
GCOV_LINKAGE int
|
||||||
gcov_close(void)
|
gcov_close(void)
|
||||||
{
|
{
|
||||||
if (gcov_var.file)
|
if (gcov_var.file) {
|
||||||
{
|
|
||||||
#if !IN_GCOV
|
#if !IN_GCOV
|
||||||
if (gcov_var.offset && gcov_var.mode < 0)
|
if (gcov_var.offset && gcov_var.mode < 0)
|
||||||
gcov_write_block(gcov_var.offset);
|
gcov_write_block(gcov_var.offset);
|
||||||
@ -187,8 +177,7 @@ gcov_magic(gcov_unsigned_t magic, gcov_unsigned_t expected)
|
|||||||
return 1;
|
return 1;
|
||||||
magic = (magic >> 16) | (magic << 16);
|
magic = (magic >> 16) | (magic << 16);
|
||||||
magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
|
magic = ((magic & 0xff00ff) << 8) | ((magic >> 8) & 0xff00ff);
|
||||||
if (magic == expected)
|
if (magic == expected) {
|
||||||
{
|
|
||||||
gcov_var.endian = 1;
|
gcov_var.endian = 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -208,7 +197,8 @@ gcov_allocate(unsigned int length)
|
|||||||
new_size *= 2;
|
new_size *= 2;
|
||||||
|
|
||||||
gcov_var.alloc = new_size;
|
gcov_var.alloc = new_size;
|
||||||
gcov_var.buffer = XRESIZEVAR(gcov_unsigned_t, gcov_var.buffer, new_size << 2);
|
gcov_var.buffer = XRESIZEVAR(gcov_unsigned_t, gcov_var.buffer,
|
||||||
|
new_size << 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -234,13 +224,12 @@ gcov_write_words(unsigned int words)
|
|||||||
|
|
||||||
gcc_assert(gcov_var.mode < 0);
|
gcc_assert(gcov_var.mode < 0);
|
||||||
#if IN_LIBGCOV
|
#if IN_LIBGCOV
|
||||||
if (gcov_var.offset >= GCOV_BLOCK_SIZE)
|
if (gcov_var.offset >= GCOV_BLOCK_SIZE) {
|
||||||
{
|
|
||||||
gcov_write_block(GCOV_BLOCK_SIZE);
|
gcov_write_block(GCOV_BLOCK_SIZE);
|
||||||
if (gcov_var.offset)
|
if (gcov_var.offset) {
|
||||||
{
|
|
||||||
gcc_assert(gcov_var.offset == 1);
|
gcc_assert(gcov_var.offset == 1);
|
||||||
memcpy(gcov_var.buffer, gcov_var.buffer + GCOV_BLOCK_SIZE, 4);
|
memcpy(gcov_var.buffer, gcov_var.buffer
|
||||||
|
+ GCOV_BLOCK_SIZE, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -292,8 +281,7 @@ gcov_write_string(const char *string)
|
|||||||
unsigned int alloc = 0;
|
unsigned int alloc = 0;
|
||||||
gcov_unsigned_t *buffer;
|
gcov_unsigned_t *buffer;
|
||||||
|
|
||||||
if (string)
|
if (string) {
|
||||||
{
|
|
||||||
length = strlen(string);
|
length = strlen(string);
|
||||||
alloc = (length + 4) >> 2;
|
alloc = (length + 4) >> 2;
|
||||||
}
|
}
|
||||||
@ -369,8 +357,7 @@ gcov_write_summary(gcov_unsigned_t tag, const struct gcov_summary *summary)
|
|||||||
|
|
||||||
gcov_write_tag_length(tag, GCOV_TAG_SUMMARY_LENGTH);
|
gcov_write_tag_length(tag, GCOV_TAG_SUMMARY_LENGTH);
|
||||||
gcov_write_unsigned(summary->checksum);
|
gcov_write_unsigned(summary->checksum);
|
||||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
|
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++) {
|
||||||
{
|
|
||||||
gcov_write_unsigned(csum->num);
|
gcov_write_unsigned(csum->num);
|
||||||
gcov_write_unsigned(csum->runs);
|
gcov_write_unsigned(csum->runs);
|
||||||
gcov_write_counter(csum->sum_all);
|
gcov_write_counter(csum->sum_all);
|
||||||
@ -392,17 +379,17 @@ gcov_read_words(unsigned int words)
|
|||||||
unsigned int excess = gcov_var.length - gcov_var.offset;
|
unsigned int excess = gcov_var.length - gcov_var.offset;
|
||||||
|
|
||||||
gcc_assert(gcov_var.mode > 0);
|
gcc_assert(gcov_var.mode > 0);
|
||||||
if (excess < words)
|
if (excess < words) {
|
||||||
{
|
|
||||||
gcov_var.start += gcov_var.offset;
|
gcov_var.start += gcov_var.offset;
|
||||||
#if IN_LIBGCOV
|
#if IN_LIBGCOV
|
||||||
if (excess)
|
if (excess) {
|
||||||
{
|
|
||||||
gcc_assert(excess == 1);
|
gcc_assert(excess == 1);
|
||||||
memcpy(gcov_var.buffer, gcov_var.buffer + gcov_var.offset, 4);
|
memcpy(gcov_var.buffer, gcov_var.buffer
|
||||||
|
+ gcov_var.offset, 4);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memmove(gcov_var.buffer, gcov_var.buffer + gcov_var.offset, excess * 4);
|
memmove(gcov_var.buffer, gcov_var.buffer
|
||||||
|
+ gcov_var.offset, excess * 4);
|
||||||
#endif
|
#endif
|
||||||
gcov_var.offset = 0;
|
gcov_var.offset = 0;
|
||||||
gcov_var.length = excess;
|
gcov_var.length = excess;
|
||||||
@ -417,8 +404,7 @@ gcov_read_words(unsigned int words)
|
|||||||
excess = fread(gcov_var.buffer + gcov_var.length,
|
excess = fread(gcov_var.buffer + gcov_var.length,
|
||||||
1, excess << 2, gcov_var.file) >> 2;
|
1, excess << 2, gcov_var.file) >> 2;
|
||||||
gcov_var.length += excess;
|
gcov_var.length += excess;
|
||||||
if (gcov_var.length < words)
|
if (gcov_var.length < words) {
|
||||||
{
|
|
||||||
gcov_var.overread += words - gcov_var.length;
|
gcov_var.overread += words - gcov_var.length;
|
||||||
gcov_var.length = 0;
|
gcov_var.length = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -488,8 +474,7 @@ gcov_read_summary(struct gcov_summary *summary)
|
|||||||
struct gcov_ctr_summary *csum;
|
struct gcov_ctr_summary *csum;
|
||||||
|
|
||||||
summary->checksum = gcov_read_unsigned();
|
summary->checksum = gcov_read_unsigned();
|
||||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
|
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++) {
|
||||||
{
|
|
||||||
csum->num = gcov_read_unsigned();
|
csum->num = gcov_read_unsigned();
|
||||||
csum->runs = gcov_read_unsigned();
|
csum->runs = gcov_read_unsigned();
|
||||||
csum->sum_all = gcov_read_counter();
|
csum->sum_all = gcov_read_counter();
|
||||||
@ -509,8 +494,7 @@ gcov_sync(gcov_position_t base, gcov_unsigned_t length)
|
|||||||
base += length;
|
base += length;
|
||||||
if (base - gcov_var.start <= gcov_var.length)
|
if (base - gcov_var.start <= gcov_var.length)
|
||||||
gcov_var.offset = base - gcov_var.start;
|
gcov_var.offset = base - gcov_var.start;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
gcov_var.offset = gcov_var.length = 0;
|
gcov_var.offset = gcov_var.length = 0;
|
||||||
fseek(gcov_var.file, base << 2, SEEK_SET);
|
fseek(gcov_var.file, base << 2, SEEK_SET);
|
||||||
gcov_var.start = ftell(gcov_var.file) >> 2;
|
gcov_var.start = ftell(gcov_var.file) >> 2;
|
||||||
|
@ -464,8 +464,8 @@ struct gcov_info
|
|||||||
unused) */
|
unused) */
|
||||||
|
|
||||||
unsigned int n_functions; /* number of functions */
|
unsigned int n_functions; /* number of functions */
|
||||||
const struct gcov_fn_info *const *functions; /* pointer to pointers
|
const struct gcov_fn_info *const *functions; /* pointer to pointers to
|
||||||
to function information */
|
function information */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Register a new object file module. */
|
/* Register a new object file module. */
|
||||||
@ -527,14 +527,16 @@ GCOV_LINKAGE struct gcov_var
|
|||||||
int mode; /* < 0 writing, > 0 reading */
|
int mode; /* < 0 writing, > 0 reading */
|
||||||
#if IN_LIBGCOV
|
#if IN_LIBGCOV
|
||||||
/* Holds one block plus 4 bytes, thus all coverage reads & writes
|
/* Holds one block plus 4 bytes, thus all coverage reads & writes
|
||||||
fit within this buffer and we always can transfer GCOV_BLOCK_SIZE
|
* fit within this buffer and we always can transfer GCOV_BLOCK_SIZE
|
||||||
to and from the disk. libgcov never backtracks and only writes 4
|
* to and from the disk. libgcov never backtracks and only writes 4
|
||||||
or 8 byte objects. */
|
* or 8 byte objects.
|
||||||
|
*/
|
||||||
gcov_unsigned_t buffer[GCOV_BLOCK_SIZE + 1];
|
gcov_unsigned_t buffer[GCOV_BLOCK_SIZE + 1];
|
||||||
#else
|
#else
|
||||||
int endian; /* Swap endianness. */
|
int endian; /* Swap endianness. */
|
||||||
/* Holds a variable length block, as the compiler can write
|
/* Holds a variable length block, as the compiler can write
|
||||||
strings and needs to backtrack. */
|
* strings and needs to backtrack.
|
||||||
|
*/
|
||||||
size_t alloc;
|
size_t alloc;
|
||||||
gcov_unsigned_t *buffer;
|
gcov_unsigned_t *buffer;
|
||||||
#endif
|
#endif
|
||||||
|
@ -480,7 +480,7 @@ static int dec_readmarker(struct in *in)
|
|||||||
(le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
|
(le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
|
||||||
(le -= (n)), \
|
(le -= (n)), \
|
||||||
bi >> le & ((1 << (n)) - 1) \
|
bi >> le & ((1 << (n)) - 1) \
|
||||||
)
|
)
|
||||||
|
|
||||||
#define UNGETBITS(in, n) ( \
|
#define UNGETBITS(in, n) ( \
|
||||||
le += (n) \
|
le += (n) \
|
||||||
@ -652,7 +652,7 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
|
|||||||
XPP(t5, t6), \
|
XPP(t5, t6), \
|
||||||
XMP(t5, t7), \
|
XMP(t5, t7), \
|
||||||
t5 = IMULT(t5, IC4), \
|
t5 = IMULT(t5, IC4), \
|
||||||
ROT(t4, t6, S22, C22),\
|
ROT(t4, t6, S22, C22), \
|
||||||
t6 -= t7, \
|
t6 -= t7, \
|
||||||
t5 -= t6, \
|
t5 -= t6, \
|
||||||
t4 -= t5, \
|
t4 -= t5, \
|
||||||
@ -913,9 +913,9 @@ static void initcol(PREC q[][64])
|
|||||||
#define PIC221111_32(xin) \
|
#define PIC221111_32(xin) \
|
||||||
( \
|
( \
|
||||||
CBCRCG(0, xin), \
|
CBCRCG(0, xin), \
|
||||||
PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0),\
|
PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
|
||||||
PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1),\
|
PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
|
||||||
PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0),\
|
PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
|
||||||
PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
|
PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -147,8 +147,7 @@ create_file_directory(char *filename)
|
|||||||
if (IS_DIR_SEPARATOR(*s))
|
if (IS_DIR_SEPARATOR(*s))
|
||||||
++s;
|
++s;
|
||||||
for (; *s != '\0'; s++)
|
for (; *s != '\0'; s++)
|
||||||
if (IS_DIR_SEPARATOR(*s))
|
if (IS_DIR_SEPARATOR(*s)) {
|
||||||
{
|
|
||||||
char sep = *s;
|
char sep = *s;
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
@ -159,10 +158,12 @@ create_file_directory(char *filename)
|
|||||||
#else
|
#else
|
||||||
&& mkdir(filename) == -1
|
&& mkdir(filename) == -1
|
||||||
#endif
|
#endif
|
||||||
/* The directory might have been made by another process. */
|
/* The directory might have been made by another
|
||||||
&& errno != EEXIST)
|
* process.
|
||||||
{
|
*/
|
||||||
fprintf(stderr, "profiling:%s:Cannot create directory\n",
|
&& errno != EEXIST) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"profiling:%s:Cannot create directory\n",
|
||||||
filename);
|
filename);
|
||||||
*s = sep;
|
*s = sep;
|
||||||
return -1;
|
return -1;
|
||||||
@ -217,16 +218,14 @@ buffer_fn_data(const char *filename, const struct gcov_info *gi_ptr,
|
|||||||
fn_buffer->info.lineno_checksum = gcov_read_unsigned();
|
fn_buffer->info.lineno_checksum = gcov_read_unsigned();
|
||||||
fn_buffer->info.cfg_checksum = gcov_read_unsigned();
|
fn_buffer->info.cfg_checksum = gcov_read_unsigned();
|
||||||
|
|
||||||
for (n_ctrs = ix = 0; ix != GCOV_COUNTERS; ix++)
|
for (n_ctrs = ix = 0; ix != GCOV_COUNTERS; ix++) {
|
||||||
{
|
|
||||||
gcov_unsigned_t length;
|
gcov_unsigned_t length;
|
||||||
gcov_type *values;
|
gcov_type *values;
|
||||||
|
|
||||||
if (!gi_ptr->merge[ix])
|
if (!gi_ptr->merge[ix])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (gcov_read_unsigned() != GCOV_TAG_FOR_COUNTER(ix))
|
if (gcov_read_unsigned() != GCOV_TAG_FOR_COUNTER(ix)) {
|
||||||
{
|
|
||||||
len = 0;
|
len = 0;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -262,8 +261,7 @@ crc32_unsigned(gcov_unsigned_t crc32, gcov_unsigned_t value)
|
|||||||
{
|
{
|
||||||
unsigned int ix;
|
unsigned int ix;
|
||||||
|
|
||||||
for (ix = 32; ix--; value <<= 1)
|
for (ix = 32; ix--; value <<= 1) {
|
||||||
{
|
|
||||||
unsigned int feedback;
|
unsigned int feedback;
|
||||||
|
|
||||||
feedback = (value ^ crc32) & 0x80000000 ? 0x04c11db7 : 0;
|
feedback = (value ^ crc32) & 0x80000000 ? 0x04c11db7 : 0;
|
||||||
@ -283,8 +281,7 @@ static int
|
|||||||
gcov_version(struct gcov_info *ptr, gcov_unsigned_t version,
|
gcov_version(struct gcov_info *ptr, gcov_unsigned_t version,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
if (version != GCOV_VERSION)
|
if (version != GCOV_VERSION) {
|
||||||
{
|
|
||||||
char v[4], e[4];
|
char v[4], e[4];
|
||||||
|
|
||||||
GCOV_UNSIGNED2STRING(v, version);
|
GCOV_UNSIGNED2STRING(v, version);
|
||||||
@ -326,27 +323,26 @@ gcov_exit(void)
|
|||||||
memset(&all_prg, 0, sizeof(all_prg));
|
memset(&all_prg, 0, sizeof(all_prg));
|
||||||
/* Find the totals for this execution. */
|
/* Find the totals for this execution. */
|
||||||
memset(&this_prg, 0, sizeof(this_prg));
|
memset(&this_prg, 0, sizeof(this_prg));
|
||||||
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
|
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) {
|
||||||
{
|
|
||||||
crc32 = crc32_unsigned(crc32, gi_ptr->stamp);
|
crc32 = crc32_unsigned(crc32, gi_ptr->stamp);
|
||||||
crc32 = crc32_unsigned(crc32, gi_ptr->n_functions);
|
crc32 = crc32_unsigned(crc32, gi_ptr->n_functions);
|
||||||
|
|
||||||
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++)
|
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions;
|
||||||
{
|
f_ix++) {
|
||||||
gfi_ptr = gi_ptr->functions[f_ix];
|
gfi_ptr = gi_ptr->functions[f_ix];
|
||||||
|
|
||||||
if (gfi_ptr && gfi_ptr->key != gi_ptr)
|
if (gfi_ptr && gfi_ptr->key != gi_ptr)
|
||||||
gfi_ptr = 0;
|
gfi_ptr = 0;
|
||||||
|
|
||||||
crc32 = crc32_unsigned(crc32, gfi_ptr ? gfi_ptr->cfg_checksum : 0);
|
crc32 = crc32_unsigned(crc32, gfi_ptr
|
||||||
|
? gfi_ptr->cfg_checksum : 0);
|
||||||
crc32 = crc32_unsigned(crc32,
|
crc32 = crc32_unsigned(crc32,
|
||||||
gfi_ptr ? gfi_ptr->lineno_checksum : 0);
|
gfi_ptr ? gfi_ptr->lineno_checksum : 0);
|
||||||
if (!gfi_ptr)
|
if (!gfi_ptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ci_ptr = gfi_ptr->ctrs;
|
ci_ptr = gfi_ptr->ctrs;
|
||||||
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++)
|
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++) {
|
||||||
{
|
|
||||||
if (!gi_ptr->merge[t_ix])
|
if (!gi_ptr->merge[t_ix])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -354,11 +350,13 @@ gcov_exit(void)
|
|||||||
cs_ptr->num += ci_ptr->num;
|
cs_ptr->num += ci_ptr->num;
|
||||||
crc32 = crc32_unsigned(crc32, ci_ptr->num);
|
crc32 = crc32_unsigned(crc32, ci_ptr->num);
|
||||||
|
|
||||||
for (c_num = 0; c_num < ci_ptr->num; c_num++)
|
for (c_num = 0; c_num < ci_ptr->num; c_num++) {
|
||||||
{
|
cs_ptr->sum_all +=
|
||||||
cs_ptr->sum_all += ci_ptr->values[c_num];
|
ci_ptr->values[c_num];
|
||||||
if (cs_ptr->run_max < ci_ptr->values[c_num])
|
if (cs_ptr->run_max
|
||||||
cs_ptr->run_max = ci_ptr->values[c_num];
|
< ci_ptr->values[c_num])
|
||||||
|
cs_ptr->run_max =
|
||||||
|
ci_ptr->values[c_num];
|
||||||
}
|
}
|
||||||
ci_ptr++;
|
ci_ptr++;
|
||||||
}
|
}
|
||||||
@ -369,8 +367,7 @@ gcov_exit(void)
|
|||||||
{
|
{
|
||||||
/* Check if the level of dirs to strip off specified. */
|
/* Check if the level of dirs to strip off specified. */
|
||||||
char *tmp = getenv("GCOV_PREFIX_STRIP");
|
char *tmp = getenv("GCOV_PREFIX_STRIP");
|
||||||
if (tmp)
|
if (tmp) {
|
||||||
{
|
|
||||||
gcov_prefix_strip = atoi(tmp);
|
gcov_prefix_strip = atoi(tmp);
|
||||||
/* Do not consider negative values. */
|
/* Do not consider negative values. */
|
||||||
if (gcov_prefix_strip < 0)
|
if (gcov_prefix_strip < 0)
|
||||||
@ -380,22 +377,19 @@ gcov_exit(void)
|
|||||||
|
|
||||||
/* Get file name relocation prefix. Non-absolute values are ignored. */
|
/* Get file name relocation prefix. Non-absolute values are ignored. */
|
||||||
gcov_prefix = getenv("GCOV_PREFIX");
|
gcov_prefix = getenv("GCOV_PREFIX");
|
||||||
if (gcov_prefix)
|
if (gcov_prefix) {
|
||||||
{
|
|
||||||
prefix_length = strlen(gcov_prefix);
|
prefix_length = strlen(gcov_prefix);
|
||||||
|
|
||||||
/* Remove an unnecessary trailing '/' */
|
/* Remove an unnecessary trailing '/' */
|
||||||
if (IS_DIR_SEPARATOR(gcov_prefix[prefix_length - 1]))
|
if (IS_DIR_SEPARATOR(gcov_prefix[prefix_length - 1]))
|
||||||
prefix_length--;
|
prefix_length--;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
prefix_length = 0;
|
prefix_length = 0;
|
||||||
|
|
||||||
/* If no prefix was specified and a prefix strip, then we assume
|
/* If no prefix was specified and a prefix strip, then we assume
|
||||||
relative. */
|
relative. */
|
||||||
if (gcov_prefix_strip != 0 && prefix_length == 0)
|
if (gcov_prefix_strip != 0 && prefix_length == 0) {
|
||||||
{
|
|
||||||
gcov_prefix = ".";
|
gcov_prefix = ".";
|
||||||
prefix_length = 1;
|
prefix_length = 1;
|
||||||
}
|
}
|
||||||
@ -406,8 +400,7 @@ gcov_exit(void)
|
|||||||
gi_filename_up = gi_filename + prefix_length;
|
gi_filename_up = gi_filename + prefix_length;
|
||||||
|
|
||||||
/* Now merge each file. */
|
/* Now merge each file. */
|
||||||
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
|
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) {
|
||||||
{
|
|
||||||
unsigned int n_counts;
|
unsigned int n_counts;
|
||||||
struct gcov_summary prg; /* summary for this object over all
|
struct gcov_summary prg; /* summary for this object over all
|
||||||
program. */
|
program. */
|
||||||
@ -427,56 +420,55 @@ gcov_exit(void)
|
|||||||
fname += 2;
|
fname += 2;
|
||||||
|
|
||||||
/* Build relocated filename, stripping off leading
|
/* Build relocated filename, stripping off leading
|
||||||
directories from the initial filename if requested. */
|
* directories from the initial filename if requested.
|
||||||
if (gcov_prefix_strip > 0)
|
*/
|
||||||
{
|
if (gcov_prefix_strip > 0) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
s = fname;
|
s = fname;
|
||||||
if (IS_DIR_SEPARATOR(*s))
|
if (IS_DIR_SEPARATOR(*s))
|
||||||
++s;
|
++s;
|
||||||
|
|
||||||
/* Skip selected directory levels. */
|
/* Skip selected directory levels. */
|
||||||
for (; (*s != '\0') && (level < gcov_prefix_strip); s++)
|
for (; (*s != '\0') && (level < gcov_prefix_strip); s++)
|
||||||
if (IS_DIR_SEPARATOR(*s))
|
if (IS_DIR_SEPARATOR(*s)) {
|
||||||
{
|
|
||||||
fname = s;
|
fname = s;
|
||||||
level++;
|
level++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update complete filename with stripped original. */
|
/* Update complete filename with stripped original. */
|
||||||
if (prefix_length != 0 && !IS_DIR_SEPARATOR(*fname))
|
if (prefix_length != 0 && !IS_DIR_SEPARATOR(*fname)) {
|
||||||
{
|
/* If prefix is given, add directory separator.
|
||||||
/* If prefix is given, add directory separator. */
|
*/
|
||||||
strcpy(gi_filename_up, "/");
|
strcpy(gi_filename_up, "/");
|
||||||
strcpy(gi_filename_up + 1, fname);
|
strcpy(gi_filename_up + 1, fname);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
strcpy(gi_filename_up, fname);
|
strcpy(gi_filename_up, fname);
|
||||||
|
|
||||||
if (!gcov_open(gi_filename))
|
if (!gcov_open(gi_filename)) {
|
||||||
{
|
|
||||||
/* Open failed likely due to missed directory.
|
/* Open failed likely due to missed directory.
|
||||||
Create directory and retry to open file. */
|
* Create directory and retry to open file.
|
||||||
if (create_file_directory(gi_filename))
|
*/
|
||||||
{
|
if (create_file_directory(gi_filename)) {
|
||||||
fprintf(stderr, "profiling:%s:Skip\n", gi_filename);
|
fprintf(stderr, "profiling:%s:Skip\n",
|
||||||
|
gi_filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!gcov_open(gi_filename))
|
if (!gcov_open(gi_filename)) {
|
||||||
{
|
fprintf(stderr,
|
||||||
fprintf(stderr, "profiling:%s:Cannot open\n", gi_filename);
|
"profiling:%s:Cannot open\n",
|
||||||
|
gi_filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tag = gcov_read_unsigned();
|
tag = gcov_read_unsigned();
|
||||||
if (tag)
|
if (tag) {
|
||||||
{
|
|
||||||
/* Merge data from file. */
|
/* Merge data from file. */
|
||||||
if (tag != GCOV_DATA_MAGIC)
|
if (tag != GCOV_DATA_MAGIC) {
|
||||||
{
|
fprintf(stderr,
|
||||||
fprintf(stderr, "profiling:%s:Not a gcov data file\n",
|
"profiling:%s:Not a gcov data file\n",
|
||||||
gi_filename);
|
gi_filename);
|
||||||
goto read_fatal;
|
goto read_fatal;
|
||||||
}
|
}
|
||||||
@ -486,12 +478,13 @@ gcov_exit(void)
|
|||||||
|
|
||||||
length = gcov_read_unsigned();
|
length = gcov_read_unsigned();
|
||||||
if (length != gi_ptr->stamp)
|
if (length != gi_ptr->stamp)
|
||||||
/* Read from a different compilation. Overwrite the file. */
|
/* Read from a different compilation.
|
||||||
|
* Overwrite the file.
|
||||||
|
*/
|
||||||
goto rewrite;
|
goto rewrite;
|
||||||
|
|
||||||
/* Look for program summary. */
|
/* Look for program summary. */
|
||||||
for (f_ix = 0;;)
|
for (f_ix = 0;;) {
|
||||||
{
|
|
||||||
struct gcov_summary tmp;
|
struct gcov_summary tmp;
|
||||||
|
|
||||||
eof_pos = gcov_position();
|
eof_pos = gcov_position();
|
||||||
@ -506,11 +499,14 @@ gcov_exit(void)
|
|||||||
gcov_read_summary(&tmp);
|
gcov_read_summary(&tmp);
|
||||||
if ((error = gcov_is_error()))
|
if ((error = gcov_is_error()))
|
||||||
goto read_error;
|
goto read_error;
|
||||||
if (summary_pos || tmp.checksum != crc32)
|
if (summary_pos
|
||||||
|
|| tmp.checksum != crc32)
|
||||||
goto next_summary;
|
goto next_summary;
|
||||||
|
|
||||||
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++)
|
for (t_ix = 0; t_ix !=
|
||||||
if (tmp.ctrs[t_ix].num != this_prg.ctrs[t_ix].num)
|
GCOV_COUNTERS_SUMMABLE; t_ix++)
|
||||||
|
if (tmp.ctrs[t_ix].num !=
|
||||||
|
this_prg.ctrs[t_ix].num)
|
||||||
goto next_summary;
|
goto next_summary;
|
||||||
prg = tmp;
|
prg = tmp;
|
||||||
summary_pos = eof_pos;
|
summary_pos = eof_pos;
|
||||||
@ -519,9 +515,9 @@ gcov_exit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Merge execution counts for each function. */
|
/* Merge execution counts for each function. */
|
||||||
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions;
|
for (f_ix = 0; (unsigned int)f_ix !=
|
||||||
f_ix++, tag = gcov_read_unsigned())
|
gi_ptr->n_functions;
|
||||||
{
|
f_ix++, tag = gcov_read_unsigned()) {
|
||||||
gfi_ptr = gi_ptr->functions[f_ix];
|
gfi_ptr = gi_ptr->functions[f_ix];
|
||||||
|
|
||||||
if (tag != GCOV_TAG_FUNCTION)
|
if (tag != GCOV_TAG_FUNCTION)
|
||||||
@ -529,22 +525,29 @@ gcov_exit(void)
|
|||||||
|
|
||||||
length = gcov_read_unsigned();
|
length = gcov_read_unsigned();
|
||||||
if (!length)
|
if (!length)
|
||||||
/* This function did not appear in the other program.
|
/* This function did not appear
|
||||||
We have nothing to merge. */
|
* in the other program. We
|
||||||
|
* have nothing to merge.
|
||||||
|
*/
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (length != GCOV_TAG_FUNCTION_LENGTH)
|
if (length != GCOV_TAG_FUNCTION_LENGTH)
|
||||||
goto read_mismatch;
|
goto read_mismatch;
|
||||||
|
|
||||||
if (!gfi_ptr || gfi_ptr->key != gi_ptr)
|
if (!gfi_ptr || gfi_ptr->key !=
|
||||||
{
|
gi_ptr) {
|
||||||
/* This function appears in the other program. We
|
/* This function appears in the
|
||||||
need to buffer the information in order to write
|
* other program. We need to
|
||||||
it back out -- we'll be inserting data before
|
* buffer the information in
|
||||||
this point, so cannot simply keep the data in the
|
* order to write it back out --
|
||||||
file. */
|
* we'll be inserting data
|
||||||
fn_tail = buffer_fn_data(gi_filename,
|
* before this point, so cannot
|
||||||
gi_ptr, fn_tail, f_ix);
|
* simply keep the data in the
|
||||||
|
* file.
|
||||||
|
*/
|
||||||
|
fn_tail = buffer_fn_data(
|
||||||
|
gi_filename, gi_ptr,
|
||||||
|
fn_tail, f_ix);
|
||||||
if (!fn_tail)
|
if (!fn_tail)
|
||||||
goto read_mismatch;
|
goto read_mismatch;
|
||||||
continue;
|
continue;
|
||||||
@ -563,78 +566,79 @@ gcov_exit(void)
|
|||||||
goto read_mismatch;
|
goto read_mismatch;
|
||||||
|
|
||||||
ci_ptr = gfi_ptr->ctrs;
|
ci_ptr = gfi_ptr->ctrs;
|
||||||
for (t_ix = 0; t_ix < GCOV_COUNTERS; t_ix++)
|
for (t_ix = 0; t_ix < GCOV_COUNTERS;
|
||||||
{
|
t_ix++) {
|
||||||
gcov_merge_fn merge = gi_ptr->merge[t_ix];
|
gcov_merge_fn merge =
|
||||||
|
gi_ptr->merge[t_ix];
|
||||||
|
|
||||||
if (!merge)
|
if (!merge)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tag = gcov_read_unsigned();
|
tag = gcov_read_unsigned();
|
||||||
length = gcov_read_unsigned();
|
length = gcov_read_unsigned();
|
||||||
if (tag != GCOV_TAG_FOR_COUNTER(t_ix)
|
if (tag != GCOV_TAG_FOR_COUNTER(
|
||||||
|| length != GCOV_TAG_COUNTER_LENGTH(ci_ptr->num))
|
t_ix) || length !=
|
||||||
|
GCOV_TAG_COUNTER_LENGTH(
|
||||||
|
ci_ptr->num))
|
||||||
goto read_mismatch;
|
goto read_mismatch;
|
||||||
(*merge)(ci_ptr->values, ci_ptr->num);
|
(*merge)(ci_ptr->values,
|
||||||
|
ci_ptr->num);
|
||||||
ci_ptr++;
|
ci_ptr++;
|
||||||
}
|
}
|
||||||
if ((error = gcov_is_error()))
|
if ((error = gcov_is_error()))
|
||||||
goto read_error;
|
goto read_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag)
|
if (tag) {
|
||||||
{
|
|
||||||
read_mismatch:;
|
read_mismatch:;
|
||||||
fprintf(stderr, "profiling:%s:Merge mismatch for %s %u\n",
|
fprintf(stderr,
|
||||||
gi_filename, f_ix >= 0 ? "function" : "summary",
|
"profiling:%s:Merge mismatch for %s %u\n",
|
||||||
|
gi_filename, f_ix >= 0 ?
|
||||||
|
"function" : "summary",
|
||||||
f_ix < 0 ? -1 - f_ix : f_ix);
|
f_ix < 0 ? -1 - f_ix : f_ix);
|
||||||
goto read_fatal;
|
goto read_fatal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto rewrite;
|
goto rewrite;
|
||||||
|
|
||||||
read_error:;
|
read_error:;
|
||||||
fprintf(stderr, "profiling:%s:%s merging\n", gi_filename,
|
fprintf(stderr, "profiling:%s:%s merging\n", gi_filename,
|
||||||
error < 0 ? "Overflow": "Error");
|
error < 0 ? "Overflow": "Error");
|
||||||
|
|
||||||
goto read_fatal;
|
goto read_fatal;
|
||||||
|
|
||||||
rewrite:;
|
rewrite:;
|
||||||
gcov_rewrite();
|
gcov_rewrite();
|
||||||
if (!summary_pos)
|
if (!summary_pos) {
|
||||||
{
|
|
||||||
memset(&prg, 0, sizeof(prg));
|
memset(&prg, 0, sizeof(prg));
|
||||||
summary_pos = eof_pos;
|
summary_pos = eof_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Merge the summaries. */
|
/* Merge the summaries. */
|
||||||
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++)
|
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++) {
|
||||||
{
|
|
||||||
cs_prg = &prg.ctrs[t_ix];
|
cs_prg = &prg.ctrs[t_ix];
|
||||||
cs_tprg = &this_prg.ctrs[t_ix];
|
cs_tprg = &this_prg.ctrs[t_ix];
|
||||||
cs_all = &all_prg.ctrs[t_ix];
|
cs_all = &all_prg.ctrs[t_ix];
|
||||||
|
|
||||||
if (gi_ptr->merge[t_ix])
|
if (gi_ptr->merge[t_ix]) {
|
||||||
{
|
|
||||||
if (!cs_prg->runs++)
|
if (!cs_prg->runs++)
|
||||||
cs_prg->num = cs_tprg->num;
|
cs_prg->num = cs_tprg->num;
|
||||||
cs_prg->sum_all += cs_tprg->sum_all;
|
cs_prg->sum_all += cs_tprg->sum_all;
|
||||||
if (cs_prg->run_max < cs_tprg->run_max)
|
if (cs_prg->run_max < cs_tprg->run_max)
|
||||||
cs_prg->run_max = cs_tprg->run_max;
|
cs_prg->run_max = cs_tprg->run_max;
|
||||||
cs_prg->sum_max += cs_tprg->run_max;
|
cs_prg->sum_max += cs_tprg->run_max;
|
||||||
}
|
} else if (cs_prg->runs)
|
||||||
else if (cs_prg->runs)
|
|
||||||
goto read_mismatch;
|
goto read_mismatch;
|
||||||
|
|
||||||
if (!cs_all->runs && cs_prg->runs)
|
if (!cs_all->runs && cs_prg->runs)
|
||||||
memcpy(cs_all, cs_prg, sizeof(*cs_all));
|
memcpy(cs_all, cs_prg, sizeof(*cs_all));
|
||||||
else if (!all_prg.checksum
|
else if (!all_prg.checksum
|
||||||
&& (!GCOV_LOCKED || cs_all->runs == cs_prg->runs)
|
&& (!GCOV_LOCKED || cs_all->runs == cs_prg->runs)
|
||||||
&& memcmp(cs_all, cs_prg, sizeof(*cs_all)))
|
&& memcmp(cs_all, cs_prg, sizeof(*cs_all))) {
|
||||||
{
|
fprintf(stderr,
|
||||||
fprintf(stderr, "profiling:%s:Invocation mismatch - some data files may have been removed%s\n",
|
"profiling:%s:Invocation mismatch - some data files may have been removed%s\n",
|
||||||
gi_filename, GCOV_LOCKED
|
gi_filename, GCOV_LOCKED ? "" :
|
||||||
? "" : " or concurrently updated without locking support");
|
" or concurrently updated without locking support");
|
||||||
all_prg.checksum = ~0u;
|
all_prg.checksum = ~0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -642,8 +646,7 @@ gcov_exit(void)
|
|||||||
prg.checksum = crc32;
|
prg.checksum = crc32;
|
||||||
|
|
||||||
/* Write out the data. */
|
/* Write out the data. */
|
||||||
if (!eof_pos)
|
if (!eof_pos) {
|
||||||
{
|
|
||||||
gcov_write_tag_length(GCOV_DATA_MAGIC, GCOV_VERSION);
|
gcov_write_tag_length(GCOV_DATA_MAGIC, GCOV_VERSION);
|
||||||
gcov_write_unsigned(gi_ptr->stamp);
|
gcov_write_unsigned(gi_ptr->stamp);
|
||||||
}
|
}
|
||||||
@ -658,19 +661,15 @@ gcov_exit(void)
|
|||||||
gcov_seek(eof_pos);
|
gcov_seek(eof_pos);
|
||||||
|
|
||||||
/* Write execution counts for each function. */
|
/* Write execution counts for each function. */
|
||||||
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++)
|
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++) {
|
||||||
{
|
|
||||||
unsigned int buffered = 0;
|
unsigned int buffered = 0;
|
||||||
|
|
||||||
if (fn_buffer && fn_buffer->fn_ix == (unsigned int)f_ix)
|
if (fn_buffer && fn_buffer->fn_ix == (unsigned int)f_ix) {
|
||||||
{
|
|
||||||
/* Buffered data from another program. */
|
/* Buffered data from another program. */
|
||||||
buffered = 1;
|
buffered = 1;
|
||||||
gfi_ptr = &fn_buffer->info;
|
gfi_ptr = &fn_buffer->info;
|
||||||
length = GCOV_TAG_FUNCTION_LENGTH;
|
length = GCOV_TAG_FUNCTION_LENGTH;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
gfi_ptr = gi_ptr->functions[f_ix];
|
gfi_ptr = gi_ptr->functions[f_ix];
|
||||||
if (gfi_ptr && gfi_ptr->key == gi_ptr)
|
if (gfi_ptr && gfi_ptr->key == gi_ptr)
|
||||||
length = GCOV_TAG_FUNCTION_LENGTH;
|
length = GCOV_TAG_FUNCTION_LENGTH;
|
||||||
@ -687,8 +686,7 @@ gcov_exit(void)
|
|||||||
gcov_write_unsigned(gfi_ptr->cfg_checksum);
|
gcov_write_unsigned(gfi_ptr->cfg_checksum);
|
||||||
|
|
||||||
ci_ptr = gfi_ptr->ctrs;
|
ci_ptr = gfi_ptr->ctrs;
|
||||||
for (t_ix = 0; t_ix < GCOV_COUNTERS; t_ix++)
|
for (t_ix = 0; t_ix < GCOV_COUNTERS; t_ix++) {
|
||||||
{
|
|
||||||
if (!gi_ptr->merge[t_ix])
|
if (!gi_ptr->merge[t_ix])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -701,12 +699,13 @@ gcov_exit(void)
|
|||||||
ci_ptr++;
|
ci_ptr++;
|
||||||
}
|
}
|
||||||
if (buffered)
|
if (buffered)
|
||||||
fn_buffer = free_fn_data(gi_ptr, fn_buffer, GCOV_COUNTERS);
|
fn_buffer = free_fn_data(gi_ptr, fn_buffer,
|
||||||
|
GCOV_COUNTERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
gcov_write_unsigned(0);
|
gcov_write_unsigned(0);
|
||||||
|
|
||||||
read_fatal:;
|
read_fatal:;
|
||||||
while (fn_buffer)
|
while (fn_buffer)
|
||||||
fn_buffer = free_fn_data(gi_ptr, fn_buffer, GCOV_COUNTERS);
|
fn_buffer = free_fn_data(gi_ptr, fn_buffer, GCOV_COUNTERS);
|
||||||
|
|
||||||
@ -726,8 +725,7 @@ __gcov_init(struct gcov_info *info)
|
|||||||
{
|
{
|
||||||
if (!info->version || !info->n_functions)
|
if (!info->version || !info->n_functions)
|
||||||
return;
|
return;
|
||||||
if (gcov_version(info, info->version, 0))
|
if (gcov_version(info, info->version, 0)) {
|
||||||
{
|
|
||||||
size_t filename_length = strlen(info->filename);
|
size_t filename_length = strlen(info->filename);
|
||||||
|
|
||||||
/* Refresh the longest file name information */
|
/* Refresh the longest file name information */
|
||||||
@ -755,24 +753,23 @@ __gcov_flush(void)
|
|||||||
const struct gcov_info *gi_ptr;
|
const struct gcov_info *gi_ptr;
|
||||||
|
|
||||||
gcov_exit();
|
gcov_exit();
|
||||||
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
|
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) {
|
||||||
{
|
|
||||||
unsigned int f_ix;
|
unsigned int f_ix;
|
||||||
|
|
||||||
for (f_ix = 0; f_ix < gi_ptr->n_functions; f_ix++)
|
for (f_ix = 0; f_ix < gi_ptr->n_functions; f_ix++) {
|
||||||
{
|
|
||||||
unsigned int t_ix;
|
unsigned int t_ix;
|
||||||
const struct gcov_fn_info *gfi_ptr = gi_ptr->functions[f_ix];
|
const struct gcov_fn_info *gfi_ptr =
|
||||||
|
gi_ptr->functions[f_ix];
|
||||||
|
|
||||||
if (!gfi_ptr || gfi_ptr->key != gi_ptr)
|
if (!gfi_ptr || gfi_ptr->key != gi_ptr)
|
||||||
continue;
|
continue;
|
||||||
const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs;
|
const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs;
|
||||||
for (t_ix = 0; t_ix != GCOV_COUNTERS; t_ix++)
|
for (t_ix = 0; t_ix != GCOV_COUNTERS; t_ix++) {
|
||||||
{
|
|
||||||
if (!gi_ptr->merge[t_ix])
|
if (!gi_ptr->merge[t_ix])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memset(ci_ptr->values, 0, sizeof(gcov_type) * ci_ptr->num);
|
memset(ci_ptr->values, 0,
|
||||||
|
sizeof(gcov_type) * ci_ptr->num);
|
||||||
ci_ptr++;
|
ci_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -824,20 +821,17 @@ __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
|||||||
|
|
||||||
gcc_assert(!(n_counters % 3));
|
gcc_assert(!(n_counters % 3));
|
||||||
n_measures = n_counters / 3;
|
n_measures = n_counters / 3;
|
||||||
for (i = 0; i < n_measures; i++, counters += 3)
|
for (i = 0; i < n_measures; i++, counters += 3) {
|
||||||
{
|
|
||||||
value = gcov_read_counter();
|
value = gcov_read_counter();
|
||||||
counter = gcov_read_counter();
|
counter = gcov_read_counter();
|
||||||
all = gcov_read_counter();
|
all = gcov_read_counter();
|
||||||
|
|
||||||
if (counters[0] == value)
|
if (counters[0] == value)
|
||||||
counters[1] += counter;
|
counters[1] += counter;
|
||||||
else if (counter > counters[1])
|
else if (counter > counters[1]) {
|
||||||
{
|
|
||||||
counters[0] = value;
|
counters[0] = value;
|
||||||
counters[1] = counter - counters[1];
|
counters[1] = counter - counters[1];
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
counters[1] -= counter;
|
counters[1] -= counter;
|
||||||
counters[2] += all;
|
counters[2] += all;
|
||||||
}
|
}
|
||||||
@ -864,21 +858,19 @@ __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
|
|||||||
|
|
||||||
gcc_assert(!(n_counters % 4));
|
gcc_assert(!(n_counters % 4));
|
||||||
n_measures = n_counters / 4;
|
n_measures = n_counters / 4;
|
||||||
for (i = 0; i < n_measures; i++, counters += 4)
|
for (i = 0; i < n_measures; i++, counters += 4) {
|
||||||
{
|
/* last = */
|
||||||
/* last = */ gcov_read_counter();
|
gcov_read_counter();
|
||||||
value = gcov_read_counter();
|
value = gcov_read_counter();
|
||||||
counter = gcov_read_counter();
|
counter = gcov_read_counter();
|
||||||
all = gcov_read_counter();
|
all = gcov_read_counter();
|
||||||
|
|
||||||
if (counters[1] == value)
|
if (counters[1] == value)
|
||||||
counters[2] += counter;
|
counters[2] += counter;
|
||||||
else if (counter > counters[2])
|
else if (counter > counters[2]) {
|
||||||
{
|
|
||||||
counters[1] = value;
|
counters[1] = value;
|
||||||
counters[2] = counter - counters[2];
|
counters[2] = counter - counters[2];
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
counters[2] -= counter;
|
counters[2] -= counter;
|
||||||
counters[3] += all;
|
counters[3] += all;
|
||||||
}
|
}
|
||||||
@ -934,12 +926,10 @@ __gcov_one_value_profiler_body(gcov_type *counters, gcov_type value)
|
|||||||
{
|
{
|
||||||
if (value == counters[0])
|
if (value == counters[0])
|
||||||
counters[1]++;
|
counters[1]++;
|
||||||
else if (counters[1] == 0)
|
else if (counters[1] == 0) {
|
||||||
{
|
|
||||||
counters[1] = 1;
|
counters[1] = 1;
|
||||||
counters[0] = value;
|
counters[0] = value;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
counters[1]--;
|
counters[1]--;
|
||||||
counters[2]++;
|
counters[2]++;
|
||||||
}
|
}
|
||||||
@ -977,8 +967,9 @@ __gcov_indirect_call_profiler(gcov_type *counter, gcov_type value,
|
|||||||
void *cur_func, void *callee_func)
|
void *cur_func, void *callee_func)
|
||||||
{
|
{
|
||||||
/* If the C++ virtual tables contain function descriptors then one
|
/* If the C++ virtual tables contain function descriptors then one
|
||||||
function may have multiple descriptors and we need to dereference
|
* function may have multiple descriptors and we need to dereference
|
||||||
the descriptors to see if they point to the same function. */
|
* the descriptors to see if they point to the same function.
|
||||||
|
*/
|
||||||
if (cur_func == callee_func
|
if (cur_func == callee_func
|
||||||
|| (VTABLE_USES_DESCRIPTORS && callee_func
|
|| (VTABLE_USES_DESCRIPTORS && callee_func
|
||||||
&& *(void **) cur_func == *(void **) callee_func))
|
&& *(void **) cur_func == *(void **) callee_func))
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
|
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
|
||||||
|
|
||||||
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
||||||
{ int i; for (i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
|
{ int i; for (i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) \
|
||||||
|
| RC_READ_BYTE; }}
|
||||||
|
|
||||||
|
|
||||||
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
||||||
@ -59,9 +60,16 @@
|
|||||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
||||||
|
|
||||||
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
|
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
|
||||||
{ int i = numLevels; res = 1; \
|
{ \
|
||||||
do { CProb *cp = probs + res; RC_GET_BIT(cp, res) } while (--i != 0); \
|
int i = numLevels; \
|
||||||
res -= (1 << numLevels); }
|
\
|
||||||
|
res = 1; \
|
||||||
|
do { \
|
||||||
|
CProb *cp = probs + res; \
|
||||||
|
RC_GET_BIT(cp, res) \
|
||||||
|
} while (--i != 0); \
|
||||||
|
res -= (1 << numLevels); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define kNumPosBitsMax 4
|
#define kNumPosBitsMax 4
|
||||||
@ -123,16 +131,17 @@ int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsDa
|
|||||||
if (prop0 >= (9 * 5 * 5))
|
if (prop0 >= (9 * 5 * 5))
|
||||||
return LZMA_RESULT_DATA_ERROR;
|
return LZMA_RESULT_DATA_ERROR;
|
||||||
{
|
{
|
||||||
for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5))
|
for (propsRes->pb = 0; prop0 >= (9 * 5);
|
||||||
|
propsRes->pb++, prop0 -= (9 * 5))
|
||||||
;
|
;
|
||||||
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9)
|
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9)
|
||||||
;
|
;
|
||||||
propsRes->lc = prop0;
|
propsRes->lc = prop0;
|
||||||
/*
|
/*
|
||||||
unsigned char remainder = (unsigned char)(prop0 / 9);
|
* unsigned char remainder = (unsigned char)(prop0 / 9);
|
||||||
propsRes->lc = prop0 % 9;
|
* propsRes->lc = prop0 % 9;
|
||||||
propsRes->pb = remainder / 5;
|
* propsRes->pb = remainder / 5;
|
||||||
propsRes->lp = remainder % 5;
|
* propsRes->lp = remainder % 5;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
const Byte *Buffer;
|
const Byte *Buffer;
|
||||||
const Byte *BufferLim;
|
const Byte *BufferLim;
|
||||||
int look_ahead_ptr = 4;
|
int look_ahead_ptr = 4;
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
Byte raw[4];
|
Byte raw[4];
|
||||||
UInt32 dw;
|
UInt32 dw;
|
||||||
} look_ahead;
|
} look_ahead;
|
||||||
@ -172,7 +180,8 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
|
|
||||||
{
|
{
|
||||||
UInt32 i;
|
UInt32 i;
|
||||||
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
|
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc
|
||||||
|
+ vs->Properties.lp));
|
||||||
for (i = 0; i < numProbs; i++)
|
for (i = 0; i < numProbs; i++)
|
||||||
p[i] = kBitModelTotal >> 1;
|
p[i] = kBitModelTotal >> 1;
|
||||||
}
|
}
|
||||||
@ -180,43 +189,36 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
RC_INIT(inStream, inSize);
|
RC_INIT(inStream, inSize);
|
||||||
|
|
||||||
|
|
||||||
while (nowPos < outSize)
|
while (nowPos < outSize) {
|
||||||
{
|
|
||||||
CProb *prob;
|
CProb *prob;
|
||||||
UInt32 bound;
|
UInt32 bound;
|
||||||
int posState = (int)(
|
int posState = (int)((nowPos)& posStateMask);
|
||||||
(nowPos
|
|
||||||
)
|
|
||||||
& posStateMask);
|
|
||||||
|
|
||||||
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
|
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
int symbol = 1;
|
int symbol = 1;
|
||||||
UpdateBit0(prob)
|
UpdateBit0(prob)
|
||||||
prob = p + Literal + (LZMA_LIT_SIZE *
|
prob = p + Literal + (LZMA_LIT_SIZE *
|
||||||
(((
|
((((nowPos) & literalPosMask) << lc)
|
||||||
(nowPos
|
+ (previousByte >> (8 - lc))));
|
||||||
)
|
|
||||||
& literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
|
||||||
|
|
||||||
if (state >= kNumLitStates)
|
if (state >= kNumLitStates) {
|
||||||
{
|
|
||||||
int matchByte;
|
int matchByte;
|
||||||
matchByte = outStream[nowPos - rep0];
|
matchByte = outStream[nowPos - rep0];
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
int bit;
|
int bit;
|
||||||
CProb *probLit;
|
CProb *probLit;
|
||||||
matchByte <<= 1;
|
matchByte <<= 1;
|
||||||
bit = (matchByte & 0x100);
|
bit = (matchByte & 0x100);
|
||||||
probLit = prob + 0x100 + bit + symbol;
|
probLit = prob + 0x100 + bit + symbol;
|
||||||
RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
|
RC_GET_BIT2(probLit, symbol,
|
||||||
|
if (bit != 0)
|
||||||
|
break,
|
||||||
|
if (bit == 0)
|
||||||
|
break)
|
||||||
|
} while (symbol < 0x100);
|
||||||
}
|
}
|
||||||
while (symbol < 0x100);
|
while (symbol < 0x100) {
|
||||||
}
|
|
||||||
while (symbol < 0x100)
|
|
||||||
{
|
|
||||||
CProb *probLit = prob + symbol;
|
CProb *probLit = prob + symbol;
|
||||||
RC_GET_BIT(probLit, symbol)
|
RC_GET_BIT(probLit, symbol)
|
||||||
}
|
}
|
||||||
@ -229,30 +231,23 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
state -= 3;
|
state -= 3;
|
||||||
else
|
else
|
||||||
state -= 6;
|
state -= 6;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
prob = p + IsRep + state;
|
prob = p + IsRep + state;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
UpdateBit0(prob);
|
UpdateBit0(prob);
|
||||||
rep3 = rep2;
|
rep3 = rep2;
|
||||||
rep2 = rep1;
|
rep2 = rep1;
|
||||||
rep1 = rep0;
|
rep1 = rep0;
|
||||||
state = state < kNumLitStates ? 0 : 3;
|
state = state < kNumLitStates ? 0 : 3;
|
||||||
prob = p + LenCoder;
|
prob = p + LenCoder;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
prob = p + IsRepG0 + state;
|
prob = p + IsRepG0 + state;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
UpdateBit0(prob);
|
UpdateBit0(prob);
|
||||||
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
UpdateBit0(prob);
|
UpdateBit0(prob);
|
||||||
|
|
||||||
if (nowPos == 0)
|
if (nowPos == 0)
|
||||||
@ -263,33 +258,22 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
outStream[nowPos++] = previousByte;
|
outStream[nowPos++] = previousByte;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UInt32 distance;
|
UInt32 distance;
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
prob = p + IsRepG1 + state;
|
prob = p + IsRepG1 + state;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
UpdateBit0(prob);
|
UpdateBit0(prob);
|
||||||
distance = rep1;
|
distance = rep1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
prob = p + IsRepG2 + state;
|
prob = p + IsRepG2 + state;
|
||||||
IfBit0(prob)
|
IfBit0(prob) {
|
||||||
{
|
|
||||||
UpdateBit0(prob);
|
UpdateBit0(prob);
|
||||||
distance = rep2;
|
distance = rep2;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(prob);
|
UpdateBit1(prob);
|
||||||
distance = rep3;
|
distance = rep3;
|
||||||
rep3 = rep2;
|
rep3 = rep2;
|
||||||
@ -305,26 +289,20 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
{
|
{
|
||||||
int numBits, offset;
|
int numBits, offset;
|
||||||
CProb *probLen = prob + LenChoice;
|
CProb *probLen = prob + LenChoice;
|
||||||
IfBit0(probLen)
|
IfBit0(probLen) {
|
||||||
{
|
|
||||||
UpdateBit0(probLen);
|
UpdateBit0(probLen);
|
||||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
numBits = kLenNumLowBits;
|
numBits = kLenNumLowBits;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(probLen);
|
UpdateBit1(probLen);
|
||||||
probLen = prob + LenChoice2;
|
probLen = prob + LenChoice2;
|
||||||
IfBit0(probLen)
|
IfBit0(probLen) {
|
||||||
{
|
|
||||||
UpdateBit0(probLen);
|
UpdateBit0(probLen);
|
||||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||||
offset = kLenNumLowSymbols;
|
offset = kLenNumLowSymbols;
|
||||||
numBits = kLenNumMidBits;
|
numBits = kLenNumMidBits;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateBit1(probLen);
|
UpdateBit1(probLen);
|
||||||
probLen = prob + LenHigh;
|
probLen = prob + LenHigh;
|
||||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||||
@ -335,38 +313,30 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
len += offset;
|
len += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state < 4)
|
if (state < 4) {
|
||||||
{
|
|
||||||
int posSlot;
|
int posSlot;
|
||||||
state += kNumLitStates;
|
state += kNumLitStates;
|
||||||
prob = p + PosSlot +
|
prob = p + PosSlot +
|
||||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||||
kNumPosSlotBits);
|
kNumPosSlotBits);
|
||||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
||||||
if (posSlot >= kStartPosModelIndex)
|
if (posSlot >= kStartPosModelIndex) {
|
||||||
{
|
|
||||||
int numDirectBits = ((posSlot >> 1) - 1);
|
int numDirectBits = ((posSlot >> 1) - 1);
|
||||||
rep0 = (2 | ((UInt32)posSlot & 1));
|
rep0 = (2 | ((UInt32)posSlot & 1));
|
||||||
if (posSlot < kEndPosModelIndex)
|
if (posSlot < kEndPosModelIndex) {
|
||||||
{
|
|
||||||
rep0 <<= numDirectBits;
|
rep0 <<= numDirectBits;
|
||||||
prob = p + SpecPos + rep0 - posSlot - 1;
|
prob = p + SpecPos + rep0 - posSlot - 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
numDirectBits -= kNumAlignBits;
|
numDirectBits -= kNumAlignBits;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
RC_NORMALIZE
|
RC_NORMALIZE
|
||||||
Range >>= 1;
|
Range >>= 1;
|
||||||
rep0 <<= 1;
|
rep0 <<= 1;
|
||||||
if (Code >= Range)
|
if (Code >= Range) {
|
||||||
{
|
|
||||||
Code -= Range;
|
Code -= Range;
|
||||||
rep0 |= 1;
|
rep0 |= 1;
|
||||||
}
|
}
|
||||||
}
|
} while (--numDirectBits != 0);
|
||||||
while (--numDirectBits != 0);
|
|
||||||
prob = p + Align;
|
prob = p + Align;
|
||||||
rep0 <<= kNumAlignBits;
|
rep0 <<= kNumAlignBits;
|
||||||
numDirectBits = kNumAlignBits;
|
numDirectBits = kNumAlignBits;
|
||||||
@ -374,19 +344,15 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int mi = 1;
|
int mi = 1;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
CProb *prob3 = prob + mi;
|
CProb *prob3 = prob + mi;
|
||||||
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
|
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
|
||||||
i <<= 1;
|
i <<= 1;
|
||||||
|
} while (--numDirectBits != 0);
|
||||||
}
|
}
|
||||||
while (--numDirectBits != 0);
|
} else
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rep0 = posSlot;
|
rep0 = posSlot;
|
||||||
if (++rep0 == (UInt32)(0))
|
if (++rep0 == (UInt32)(0)) {
|
||||||
{
|
|
||||||
/* it's for stream version */
|
/* it's for stream version */
|
||||||
len = kLzmaStreamWasFinishedId;
|
len = kLzmaStreamWasFinishedId;
|
||||||
break;
|
break;
|
||||||
@ -398,13 +364,11 @@ int LzmaDecode(CLzmaDecoderState *vs,
|
|||||||
return LZMA_RESULT_DATA_ERROR;
|
return LZMA_RESULT_DATA_ERROR;
|
||||||
|
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
previousByte = outStream[nowPos - rep0];
|
previousByte = outStream[nowPos - rep0];
|
||||||
len--;
|
len--;
|
||||||
outStream[nowPos++] = previousByte;
|
outStream[nowPos++] = previousByte;
|
||||||
}
|
} while (len != 0 && nowPos < outSize);
|
||||||
while (len != 0 && nowPos < outSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RC_NORMALIZE;
|
RC_NORMALIZE;
|
||||||
|
@ -38,8 +38,7 @@ typedef UInt32 SizeT;
|
|||||||
|
|
||||||
#define LZMA_PROPERTIES_SIZE 5
|
#define LZMA_PROPERTIES_SIZE 5
|
||||||
|
|
||||||
typedef struct _CLzmaProperties
|
typedef struct _CLzmaProperties {
|
||||||
{
|
|
||||||
int lc;
|
int lc;
|
||||||
int lp;
|
int lp;
|
||||||
int pb;
|
int pb;
|
||||||
@ -51,12 +50,9 @@ int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsDa
|
|||||||
|
|
||||||
#define kLzmaNeedInitId (-2)
|
#define kLzmaNeedInitId (-2)
|
||||||
|
|
||||||
typedef struct _CLzmaDecoderState
|
typedef struct _CLzmaDecoderState {
|
||||||
{
|
|
||||||
CLzmaProperties Properties;
|
CLzmaProperties Properties;
|
||||||
CProb *Probs;
|
CProb *Probs;
|
||||||
|
|
||||||
|
|
||||||
} CLzmaDecoderState;
|
} CLzmaDecoderState;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user