comparison tools/packed.c @ 2321:9360a693d8af

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Sep 2019 10:40:14 +0300
parents e3f0eaf23f4f
children 36edd316184a
comparison
equal deleted inserted replaced
2320:0115b3dd9064 2321:9360a693d8af
222 if (pack->file == NULL) 222 if (pack->file == NULL)
223 return DMERR_FOPEN; 223 return DMERR_FOPEN;
224 224
225 // Compute directory offset and number of entries 225 // Compute directory offset and number of entries
226 memcpy(&hdr.ident, DPACK_IDENT, sizeof(hdr.ident)); 226 memcpy(&hdr.ident, DPACK_IDENT, sizeof(hdr.ident));
227 hdr.version = DPACK_VERSION; 227 hdr.version = DPACK_VERSION;
228 hdr.dirEntries = 0; 228 hdr.dirEntries = 0;
229 hdr.dirOffset = 229 hdr.dirOffset =
230 sizeof(hdr.ident) + sizeof(hdr.version) + 230 sizeof(hdr.ident) + sizeof(hdr.version) +
231 sizeof(hdr.dirEntries) + sizeof(hdr.dirOffset); 231 sizeof(hdr.dirEntries) + sizeof(hdr.dirOffset);
232 232
233 for (node = pack->entries; node != NULL; node = node->next) 233 for (node = pack->entries; node != NULL; node = node->next)
234 { 234 {
241 241
242 // Write PACK header 242 // Write PACK header
243 if (fseeko(pack->file, 0, SEEK_SET) != 0) 243 if (fseeko(pack->file, 0, SEEK_SET) != 0)
244 return DMERR_FSEEK; 244 return DMERR_FSEEK;
245 245
246 if (!dm_fwrite_str(pack->file, (Uint8 *) & hdr.ident, sizeof(hdr.ident)) || 246 if (!dm_fwrite_str(pack->file, (Uint8 *) &hdr.ident, sizeof(hdr.ident)) ||
247 !dm_fwrite_le16(pack->file, hdr.version) || 247 !dm_fwrite_le16(pack->file, hdr.version) ||
248 !dm_fwrite_le32(pack->file, hdr.dirEntries) || 248 !dm_fwrite_le32(pack->file, hdr.dirEntries) ||
249 !dm_fwrite_le64(pack->file, hdr.dirOffset)) 249 !dm_fwrite_le64(pack->file, hdr.dirOffset))
250 return DMERR_FWRITE; 250 return DMERR_FWRITE;
251 251