Mercurial > hg > sidinfo
comparison sidlib.c @ 388:c96448875797
Change "new SLDB" boolean to a flags int.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Feb 2022 20:09:55 +0200 |
parents | 94ff750679a6 |
children | db64a58314a9 |
comparison
equal
deleted
inserted
replaced
387:51d6e86aa196 | 388:c96448875797 |
---|---|
108 return ret; | 108 return ret; |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, | 112 int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, |
113 const BOOL newSLDB, SIDLibChConvCtx *chconv) | 113 const int flags, SIDLibChConvCtx *chconv) |
114 { | 114 { |
115 int ret = THERR_OK; | 115 int ret = THERR_OK; |
116 th_md5state_t state; | 116 th_md5state_t state; |
117 off_t hdrStart, hdrEnd; | 117 off_t hdrStart, hdrEnd; |
118 | 118 |
201 } | 201 } |
202 | 202 |
203 // Initialize MD5-hash calculation | 203 // Initialize MD5-hash calculation |
204 th_md5_init(&state); | 204 th_md5_init(&state); |
205 | 205 |
206 if (newSLDB) | 206 if (flags & SIDLIB_FLG_NEW_SLDB) |
207 { | 207 { |
208 // New Songlengths.md5 style hash calculation: | 208 // New Songlengths.md5 style hash calculation: |
209 // We just hash the whole file, so seek back to beginning .. | 209 // We just hash the whole file, so seek back to beginning .. |
210 if (thfseek(ctx, hdrStart, SEEK_SET) < 0) | 210 if (thfseek(ctx, hdrStart, SEEK_SET) < 0) |
211 { | 211 { |
264 return ret; | 264 return ret; |
265 } | 265 } |
266 | 266 |
267 | 267 |
268 int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, | 268 int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, |
269 const BOOL newSLDB, SIDLibChConvCtx *chconv) | 269 const int flags, SIDLibChConvCtx *chconv) |
270 { | 270 { |
271 if ((*ppsid = th_malloc0(sizeof(SIDLibPSIDHeader))) == NULL) | 271 if ((*ppsid = th_malloc0(sizeof(SIDLibPSIDHeader))) == NULL) |
272 return THERR_MALLOC; | 272 return THERR_MALLOC; |
273 | 273 |
274 (*ppsid)->allocated = TRUE; | 274 (*ppsid)->allocated = TRUE; |
275 | 275 |
276 return sidlib_read_sid_file(ctx, *ppsid, newSLDB, chconv); | 276 return sidlib_read_sid_file(ctx, *ppsid, flags, chconv); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void sidlib_free_sid_file(SIDLibPSIDHeader *psid) | 280 void sidlib_free_sid_file(SIDLibPSIDHeader *psid) |
281 { | 281 { |