comparison src/demac/ape.c @ 2193:80d7ab8f2ec5

removed some duplicated code
author Eugene Zagidullin <e.asphyx@gmail.com>
date Wed, 28 Nov 2007 16:19:57 +0300
parents cc5e9ec110a4
children 8b3c2fe608c9
comparison
equal deleted inserted replaced
2192:e5401b6c4665 2193:80d7ab8f2ec5
56 #define APE_TAG_FLAG_IS_HEADER (1 << 29) 56 #define APE_TAG_FLAG_IS_HEADER (1 << 29)
57 57
58 #define TAG(name, field) {name, offsetof(AVFormatContext, field), sizeof(((AVFormatContext *)0)->field)} 58 #define TAG(name, field) {name, offsetof(AVFormatContext, field), sizeof(((AVFormatContext *)0)->field)}
59 59
60 60
61 static uint16_t get_le16(VFSFile *vfd) 61 uint16_t get_le16(VFSFile *vfd)
62 { 62 {
63 unsigned char tmp[2]; 63 unsigned char tmp[2];
64 64
65 if(aud_vfs_fread(tmp, 1, 2, vfd) != 2) return -1; 65 if(aud_vfs_fread(tmp, 1, 2, vfd) != 2) return -1;
66 return tmp[0] | (tmp[1] << 8); 66 return tmp[0] | (tmp[1] << 8);
67 } 67 }
68 68
69 static uint32_t get_le32(VFSFile *vfd) 69 uint32_t get_le32(VFSFile *vfd)
70 { 70 {
71 unsigned char tmp[4]; 71 unsigned char tmp[4];
72 72
73 if(aud_vfs_fread(tmp, 1, 4, vfd) != 4) return -1; 73 if(aud_vfs_fread(tmp, 1, 4, vfd) != 4) return -1;
74 return tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24); 74 return tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);
75 }
76
77 uint64_t get_le64(VFSFile *vfd)
78 {
79 unsigned char tmp[8];
80
81 if(aud_vfs_fread(tmp, 1, 8, vfd) != 8) return -1;
82 return (uint64_t)tmp[0] | ((uint64_t)tmp[1] << 8) | ((uint64_t)tmp[2] << 16) | ((uint64_t)tmp[3] << 24) |
83 ((uint64_t)tmp[4] << 32) | ((uint64_t)tmp[5] << 40) | ((uint64_t)tmp[6] << 48) | ((uint64_t)tmp[7] << 56);
75 } 84 }
76 85
77 #ifdef DEBUG 86 #ifdef DEBUG
78 static void ape_dumpinfo(APEContext * ape_ctx) 87 static void ape_dumpinfo(APEContext * ape_ctx)
79 { 88 {