projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fecdec_filter: Avoid potentially expensive pointer subtraction.
[paraslash.git]
/
afh_common.c
diff --git
a/afh_common.c
b/afh_common.c
index bec99bf4d29b6fb8b75d66e29a627eb4f5a002a3..8c0eed2731837da4e8d3847d1d3d6caeddfe5102 100644
(file)
--- a/
afh_common.c
+++ b/
afh_common.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1997-200
8
Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-200
9
Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
@@
-233,6
+233,15
@@
void afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
*len = afhi->chunk_table[chunk_num + 1] - pos;
}
*len = afhi->chunk_table[chunk_num + 1] - pos;
}
+uint32_t afh_get_largest_chunk_size(struct afh_info *afhi)
+{
+ uint32_t n, largest = 0, *ct = afhi->chunk_table;
+
+ for (n = 1; n <= afhi->chunks_total; n++)
+ largest = PARA_MAX(largest, ct[n] - ct[n - 1]);
+ return largest;
+}
+
/**
* Get the header of an audio file.
*
/**
* Get the header of an audio file.
*
@@
-247,9
+256,10
@@
void afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
*/
void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len)
{
*/
void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len)
{
- if (!map || !afhi || !
afhi->header_len) {
+ if (!map || !afhi || !afhi->header_len) {
*buf = NULL;
*len = 0;
*buf = NULL;
*len = 0;
+ return;
}
*len = afhi->header_len;
*buf = map + afhi->header_offset;
}
*len = afhi->header_len;
*buf = map + afhi->header_offset;