]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Kill afhi->header_offset.
authorAndre Noll <maan@systemlinux.org>
Wed, 6 Oct 2010 20:21:07 +0000 (22:21 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 29 Jan 2011 10:43:33 +0000 (11:43 +0100)
It is always zero, and stored _twice_ in the osl table. Since we must
not change the layout of the on-disk afhi structure, rename these
fields to AFHI_UNUSED1_OFFSET and AFHI_UNUSED2_OFFSET, and set them
to zero in save_afhi().

afh.h
afh_common.c
aft.c
wma_afh.c

diff --git a/afh.h b/afh.h
index f6286b24ba6243f561f264aa404601c1d4d4a29d..494a4e15adaf41bb10619b62c36a6a8a33a78fb4 100644 (file)
--- a/afh.h
+++ b/afh.h
@@ -42,11 +42,6 @@ struct afh_info {
        uint32_t *chunk_table;
        /** Period of time between sending data chunks. */
        struct timeval chunk_tv;
-       /**
-        * The position of the header within the audio file. Ignored if \a
-        * header_len equals zero.
-        */
-       uint32_t header_offset;
        /**
         * The header is needed by senders in case a new client connects in the
         * middle of the stream. The length of the header defaults to zero
index dd2ae6507e7510da3d1e57c95e03cda51fbf74ca..10376ba68feb8567291ef0c7325bb3af9c293713 100644 (file)
@@ -160,7 +160,6 @@ int compute_afhi(const char *path, char *data, size_t size, int fd,
 {
        int ret, i, format;
 
-       afhi->header_offset = 0;
        afhi->header_len = 0;
        afhi->techinfo = NULL;
        afhi->tags.artist = NULL;
@@ -265,5 +264,5 @@ void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *
                return;
        }
        *len = afhi->header_len;
-       *buf = map + afhi->header_offset;
+       *buf = map;
 }
diff --git a/aft.c b/aft.c
index 412318b27eb656acabbb5c66faa352c8f56494c3..9f39d705620ee5b3b0e5e784b099730b078350e9 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -344,16 +344,16 @@ enum afhi_offsets {
        AFHI_BITRATE_OFFSET = 4,
        /** Position of the frequency. */
        AFHI_FREQUENCY_OFFSET = 8,
-       /** Location of the audio file header. */
-       AFHI_HEADER_OFFSET_OFFSET = 12,
+       /** Was: Location of the audio file header. */
+       AFHI_UNUSED1_OFFSET = 12,
        /* Length of the audio file header. Zero means: No header. */
        AFHI_HEADER_LEN_OFFSET = 16,
        /** The total number of chunks (4 bytes). */
        CHUNKS_TOTAL_OFFSET = 20,
        /** The length of the audio file header (4 bytes). */
        HEADER_LEN_OFFSET = 24,
-       /** The start of the audio file header (4 bytes). */
-       HEADER_OFFSET_OFFSET = 28,
+       /** Was: The start of the audio file header (4 bytes). */
+       AFHI_UNUSED2_OFFSET = 28,
        /** The seconds part of the chunk time (4 bytes). */
        CHUNK_TV_TV_SEC_OFFSET = 32,
        /** The microseconds part of the chunk time (4 bytes). */
@@ -388,12 +388,12 @@ static void save_afhi(struct afh_info *afhi, char *buf)
        write_u32(buf + AFHI_SECONDS_TOTAL_OFFSET, afhi->seconds_total);
        write_u32(buf + AFHI_BITRATE_OFFSET, afhi->bitrate);
        write_u32(buf + AFHI_FREQUENCY_OFFSET, afhi->frequency);
-       write_u32(buf + AFHI_HEADER_OFFSET_OFFSET, afhi->header_offset);
+       write_u32(buf + AFHI_UNUSED1_OFFSET, 0);
        write_u32(buf + AFHI_HEADER_LEN_OFFSET, afhi->header_len);
        write_u8(buf + AFHI_CHANNELS_OFFSET, afhi->channels);
        write_u32(buf + CHUNKS_TOTAL_OFFSET, afhi->chunks_total);
        write_u32(buf + HEADER_LEN_OFFSET, afhi->header_len);
-       write_u32(buf + HEADER_OFFSET_OFFSET, afhi->header_offset);
+       write_u32(buf + AFHI_UNUSED2_OFFSET, 0);
        write_u32(buf + CHUNK_TV_TV_SEC_OFFSET, afhi->chunk_tv.tv_sec);
        write_u32(buf + CHUNK_TV_TV_USEC_OFFSET, afhi->chunk_tv.tv_usec);
        p = buf + AFHI_INFO_STRING_OFFSET;
@@ -411,12 +411,10 @@ static void load_afhi(const char *buf, struct afh_info *afhi)
        afhi->seconds_total = read_u32(buf + AFHI_SECONDS_TOTAL_OFFSET);
        afhi->bitrate = read_u32(buf + AFHI_BITRATE_OFFSET);
        afhi->frequency = read_u32(buf + AFHI_FREQUENCY_OFFSET);
-       afhi->header_offset = read_u32(buf + AFHI_HEADER_OFFSET_OFFSET);
        afhi->header_len = read_u32(buf + AFHI_HEADER_LEN_OFFSET);
        afhi->channels = read_u8(buf + AFHI_CHANNELS_OFFSET);
        afhi->chunks_total = read_u32(buf + CHUNKS_TOTAL_OFFSET);
        afhi->header_len = read_u32(buf + HEADER_LEN_OFFSET);
-       afhi->header_offset = read_u32(buf + HEADER_OFFSET_OFFSET);
        afhi->chunk_tv.tv_sec = read_u32(buf + CHUNK_TV_TV_SEC_OFFSET);
        afhi->chunk_tv.tv_usec = read_u32(buf + CHUNK_TV_TV_USEC_OFFSET);
        afhi->techinfo = (char *)buf + AFHI_INFO_STRING_OFFSET;
index 9b7d85b3fd7d059c34476419841af8e9d3da42a1..255342dca56d4f8b8ff5a7bea199b78c76c5e55d 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -257,7 +257,6 @@ static int wma_get_file_info(char *map, size_t numbytes, __a_unused int fd,
        afhi->frequency = ahi.sample_rate;
        afhi->channels = ahi.channels;
        afhi->header_len = ahi.header_len;
-       afhi->header_offset = 0;
        wma_make_chunk_table(map + ahi.header_len, numbytes - ahi.header_len,
                ahi.block_align, afhi);
        read_asf_tags(map, ahi.header_len, &afhi->tags);