mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Rename library.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(libdicformat C)
|
||||
project(libaaruformat C)
|
||||
|
||||
set(CMAKE_C_STANDARD 90)
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS=1)
|
||||
|
||||
add_library(dicformat SHARED include/aaruformat/consts.h include/aaruformat/enums.h include/dic.h include/dicformat.h
|
||||
add_library(aaruformat SHARED include/aaruformat/consts.h include/aaruformat/enums.h include/dic.h include/aaruformat.h
|
||||
include/aaruformat/decls.h include/aaruformat/structs.h src/identify.c src/open.c include/aaruformat/context.h
|
||||
src/close.c include/aaruformat/errors.h src/read.c src/crc64.c src/cst.c src/ecc_cd.c src/helpers.c)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : consts.h
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
// Filename : context.h
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Describes context to be passed between libdicformat functions.
|
||||
// Describes context to be passed between libaaruformat functions.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct dicformatContext
|
||||
typedef struct aaruformatContext
|
||||
{
|
||||
uint64_t magic;
|
||||
uint8_t libraryMajorVersion;
|
||||
@@ -73,7 +73,7 @@ typedef struct dicformatContext
|
||||
uint8_t numberOfDataTracks;
|
||||
TrackEntry* dataTracks;
|
||||
bool* readableSectorTags;
|
||||
} dicformatContext;
|
||||
} aaruformatContext;
|
||||
|
||||
typedef struct dataLinkedList
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : decls.h
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : dic.h
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : aaruformat.h
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
@@ -36,11 +36,11 @@
|
||||
#define LIBDICFORMAT_MAJOR_VERSION 1
|
||||
#define LIBDICFORMAT_MINOR_VERSION 0
|
||||
|
||||
#include "dicformat/consts.h"
|
||||
#include "dicformat/context.h"
|
||||
#include "dicformat/decls.h"
|
||||
#include "dicformat/enums.h"
|
||||
#include "dicformat/errors.h"
|
||||
#include "dicformat/structs.h"
|
||||
#include "aaruformat/consts.h"
|
||||
#include "aaruformat/context.h"
|
||||
#include "aaruformat/decls.h"
|
||||
#include "aaruformat/enums.h"
|
||||
#include "aaruformat/errors.h"
|
||||
#include "aaruformat/structs.h"
|
||||
|
||||
#endif // LIBDICFORMAT_DICFORMAT_H
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : close.c
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
@@ -30,7 +30,7 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
@@ -46,9 +46,9 @@ int close(void* context)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dicformatContext* ctx = context;
|
||||
aaruformatContext* ctx = context;
|
||||
|
||||
// Not a libdicformat context
|
||||
// Not a libaaruformat context
|
||||
if(ctx->magic != DIC_MAGIC)
|
||||
{
|
||||
errno = EINVAL;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
// ECC algorithm from ECM(c) 2002-2011 Neill Corlett
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <malloc.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <aaruformat.h>
|
||||
#include <dic.h>
|
||||
#include <dicformat.h>
|
||||
|
||||
// Converts between image data type and dic media tag type
|
||||
int32_t GetMediaTagTypeForDataType(int32_t type)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
120
src/open.c
120
src/open.c
@@ -5,7 +5,7 @@
|
||||
// Filename : open.c
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
@@ -30,7 +30,7 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <malloc.h>
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
void* open(const char* filepath)
|
||||
{
|
||||
dicformatContext* ctx;
|
||||
aaruformatContext* ctx;
|
||||
int errorNo;
|
||||
size_t readBytes;
|
||||
long pos;
|
||||
@@ -53,8 +53,8 @@ void* open(const char* filepath)
|
||||
int i;
|
||||
uint16_t e;
|
||||
|
||||
ctx = (dicformatContext*)malloc(sizeof(dicformatContext));
|
||||
memset(ctx, 0, sizeof(dicformatContext));
|
||||
ctx = (aaruformatContext*)malloc(sizeof(aaruformatContext));
|
||||
memset(ctx, 0, sizeof(aaruformatContext));
|
||||
|
||||
if(ctx == NULL) return NULL;
|
||||
|
||||
@@ -97,7 +97,7 @@ void* open(const char* filepath)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libdicformat: Opening image version %d.%d",
|
||||
"libaaruformat: Opening image version %d.%d",
|
||||
ctx->header.imageMajorVersion,
|
||||
ctx->header.imageMinorVersion);
|
||||
|
||||
@@ -161,7 +161,7 @@ void* open(const char* filepath)
|
||||
}
|
||||
|
||||
fprintf(
|
||||
stderr, "libdicformat: Index at %" PRIu64 " contains %d entries", ctx->header.indexOffset, idxHeader.entries);
|
||||
stderr, "libaaruformat: Index at %" PRIu64 " contains %d entries", ctx->header.indexOffset, idxHeader.entries);
|
||||
|
||||
idxEntries = (IndexEntry*)malloc(sizeof(IndexEntry) * idxHeader.entries);
|
||||
|
||||
@@ -189,7 +189,7 @@ void* open(const char* filepath)
|
||||
for(i = 0; i < idxHeader.entries; i++)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Block type %4.4s with data type %4.4s is indexed to be at %" PRIu64 "",
|
||||
"libaaruformat: Block type %4.4s with data type %4.4s is indexed to be at %" PRIu64 "",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
(char*)&idxEntries[i].dataType,
|
||||
idxEntries[i].offset);
|
||||
@@ -204,7 +204,7 @@ void* open(const char* filepath)
|
||||
if(pos < 0 || ftell(ctx->imageStream) != idxEntries[i].offset)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not seek to %" PRIu64 " as indicated by index entry %d, continuing...",
|
||||
"libaaruformat: Could not seek to %" PRIu64 " as indicated by index entry %d, continuing...",
|
||||
idxEntries[i].offset,
|
||||
i);
|
||||
|
||||
@@ -224,7 +224,7 @@ void* open(const char* filepath)
|
||||
|
||||
if(readBytes != sizeof(BlockHeader))
|
||||
{
|
||||
fprintf(stderr, "libdicformat: Could not read block header at %" PRIu64 "", idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Could not read block header at %" PRIu64 "", idxEntries[i].offset);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ void* open(const char* filepath)
|
||||
if(blockHeader.identifier != idxEntries[i].blockType)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
idxEntries[i].offset);
|
||||
break;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ void* open(const char* filepath)
|
||||
if(blockHeader.type != idxEntries[i].dataType)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Expected block with data type %4.4s at position %" PRIu64
|
||||
"libaaruformat: Expected block with data type %4.4s at position %" PRIu64
|
||||
" but found data type %4.4s",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].offset,
|
||||
@@ -260,7 +260,7 @@ void* open(const char* filepath)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libdicformat: Found data block with type %4.4s at position %" PRIu64 "",
|
||||
"libaaruformat: Found data block with type %4.4s at position %" PRIu64 "",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].offset);
|
||||
|
||||
@@ -285,7 +285,7 @@ void* open(const char* filepath)
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Found unknown compression type %d, continuing...",
|
||||
"libaaruformat: Found unknown compression type %d, continuing...",
|
||||
blockHeader.compression);
|
||||
break;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ void* open(const char* filepath)
|
||||
if(crc64 != blockHeader.crc64)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...",
|
||||
crc64,
|
||||
blockHeader.crc64);
|
||||
@@ -349,7 +349,7 @@ void* open(const char* filepath)
|
||||
if(mediaTag->type == blockHeader.type)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Media tag type %d duplicated, removing previous entry...",
|
||||
"libaaruformat: Media tag type %d duplicated, removing previous entry...",
|
||||
blockHeader.type);
|
||||
free(mediaTag->data);
|
||||
mediaTag->data = data;
|
||||
@@ -368,7 +368,7 @@ void* open(const char* filepath)
|
||||
|
||||
if(mediaTag == NULL)
|
||||
{
|
||||
fprintf(stderr, "libdicformat: Cannot allocate memory for media tag list entry.");
|
||||
fprintf(stderr, "libaaruformat: Cannot allocate memory for media tag list entry.");
|
||||
break;
|
||||
}
|
||||
memset(mediaTag, 0, sizeof(dataLinkedList));
|
||||
@@ -395,7 +395,7 @@ void* open(const char* filepath)
|
||||
|
||||
if(readBytes != sizeof(DdtHeader))
|
||||
{
|
||||
fprintf(stderr, "libdicformat: Could not read block header at %" PRIu64 "", idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Could not read block header at %" PRIu64 "", idxEntries[i].offset);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -424,7 +424,7 @@ void* open(const char* filepath)
|
||||
if(ctx->userDataDdt == MAP_FAILED)
|
||||
{
|
||||
foundUserDataDdt = false;
|
||||
fprintf(stderr, "libdicformat: Could not read map deduplication table.");
|
||||
fprintf(stderr, "libaaruformat: Could not read map deduplication table.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ void* open(const char* filepath)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libdicformat: Found unknown compression type %d, continuing...",
|
||||
"libaaruformat: Found unknown compression type %d, continuing...",
|
||||
blockHeader.compression);
|
||||
foundUserDataDdt = false;
|
||||
break;
|
||||
@@ -448,7 +448,7 @@ void* open(const char* filepath)
|
||||
|
||||
if(mediaTag == NULL)
|
||||
{
|
||||
fprintf(stderr, "libdicformat: Cannot allocate memory for deduplication table.");
|
||||
fprintf(stderr, "libaaruformat: Cannot allocate memory for deduplication table.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != ddtHeader.entries * sizeof(uint32_t))
|
||||
{
|
||||
free(data);
|
||||
fprintf(stderr, "libdicformat: Could not read deduplication table, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read deduplication table, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ void* open(const char* filepath)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libdicformat: Found unknown compression type %d, continuing...",
|
||||
"libaaruformat: Found unknown compression type %d, continuing...",
|
||||
blockHeader.compression);
|
||||
break;
|
||||
}
|
||||
@@ -484,14 +484,14 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(GeometryBlockHeader))
|
||||
{
|
||||
memset(&ctx->geometryBlock, 0, sizeof(GeometryBlockHeader));
|
||||
fprintf(stderr, "libdicformat: Could not read geometry block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read geometry block, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
if(ctx->geometryBlock.identifier == GeometryBlock)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Geometry set to %d cylinders %d heads %d sectors per track",
|
||||
"libaaruformat: Geometry set to %d cylinders %d heads %d sectors per track",
|
||||
ctx->geometryBlock.cylinders,
|
||||
ctx->geometryBlock.heads,
|
||||
ctx->geometryBlock.sectorsPerTrack);
|
||||
@@ -511,7 +511,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(MetadataBlockHeader))
|
||||
{
|
||||
memset(&ctx->metadataBlockHeader, 0, sizeof(MetadataBlockHeader));
|
||||
fprintf(stderr, "libdicformat: Could not read metadata block header, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read metadata block header, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->metadataBlockHeader, 0, sizeof(MetadataBlockHeader));
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
idxEntries[i].offset);
|
||||
break;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ void* open(const char* filepath)
|
||||
if(ctx->metadataBlock == NULL)
|
||||
{
|
||||
memset(&ctx->metadataBlockHeader, 0, sizeof(MetadataBlockHeader));
|
||||
fprintf(stderr, "libdicformat: Could not allocate memory for metadata block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not allocate memory for metadata block, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->metadataBlockHeader, 0, sizeof(MetadataBlockHeader));
|
||||
free(ctx->metadataBlock);
|
||||
fprintf(stderr, "libdicformat: Could not read metadata block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read metadata block, continuing...");
|
||||
}
|
||||
|
||||
if(ctx->metadataBlockHeader.mediaSequence > 0 && ctx->metadataBlockHeader.lastMediaSequence > 0)
|
||||
@@ -549,7 +549,7 @@ void* open(const char* filepath)
|
||||
ctx->imageInfo.MediaSequence = ctx->metadataBlockHeader.mediaSequence;
|
||||
ctx->imageInfo.LastMediaSequence = ctx->metadataBlockHeader.lastMediaSequence;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Setting media sequence as %d of %d",
|
||||
"libaaruformat: Setting media sequence as %d of %d",
|
||||
ctx->imageInfo.MediaSequence,
|
||||
ctx->imageInfo.LastMediaSequence);
|
||||
}
|
||||
@@ -727,7 +727,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(TracksHeader))
|
||||
{
|
||||
memset(&ctx->tracksHeader, 0, sizeof(TracksHeader));
|
||||
fprintf(stderr, "libdicformat: Could not read tracks header, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read tracks header, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->tracksHeader, 0, sizeof(TracksHeader));
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ void* open(const char* filepath)
|
||||
if(ctx->trackEntries == NULL)
|
||||
{
|
||||
memset(&ctx->tracksHeader, 0, sizeof(TracksHeader));
|
||||
fprintf(stderr, "libdicformat: Could not allocate memory for metadata block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not allocate memory for metadata block, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->tracksHeader, 0, sizeof(TracksHeader));
|
||||
free(ctx->trackEntries);
|
||||
fprintf(stderr, "libdicformat: Could not read metadata block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read metadata block, continuing...");
|
||||
}
|
||||
|
||||
crc64 =
|
||||
@@ -764,7 +764,7 @@ void* open(const char* filepath)
|
||||
if(crc64 != ctx->tracksHeader.crc64)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...",
|
||||
crc64,
|
||||
ctx->tracksHeader.crc64);
|
||||
@@ -772,7 +772,7 @@ void* open(const char* filepath)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libdicformat: Found %d tracks at position %" PRIu64 ".",
|
||||
"libaaruformat: Found %d tracks at position %" PRIu64 ".",
|
||||
ctx->tracksHeader.entries,
|
||||
idxEntries[i].offset);
|
||||
|
||||
@@ -813,7 +813,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(CicmMetadataBlock))
|
||||
{
|
||||
memset(&ctx->cicmBlockHeader, 0, sizeof(CicmMetadataBlock));
|
||||
fprintf(stderr, "libdicformat: Could not read CICM XML metadata header, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read CICM XML metadata header, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->cicmBlockHeader, 0, sizeof(CicmMetadataBlock));
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -833,7 +833,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->cicmBlockHeader, 0, sizeof(CicmMetadataBlock));
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not allocate memory for CICM XML metadata block, continuing...");
|
||||
"libaaruformat: Could not allocate memory for CICM XML metadata block, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -843,10 +843,10 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->cicmBlockHeader, 0, sizeof(CicmMetadataBlock));
|
||||
free(ctx->cicmBlock);
|
||||
fprintf(stderr, "libdicformat: Could not read CICM XML metadata block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read CICM XML metadata block, continuing...");
|
||||
}
|
||||
|
||||
fprintf(stderr, "libdicformat: Found CICM XML metadata block %" PRIu64 ".", idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Found CICM XML metadata block %" PRIu64 ".", idxEntries[i].offset);
|
||||
break;
|
||||
// Dump hardware block
|
||||
case DumpHardwareBlock:
|
||||
@@ -855,7 +855,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(DumpHardwareHeader))
|
||||
{
|
||||
memset(&ctx->dumpHardwareHeader, 0, sizeof(DumpHardwareHeader));
|
||||
fprintf(stderr, "libdicformat: Could not read dump hardware block header, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block header, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
memset(&ctx->dumpHardwareHeader, 0, sizeof(DumpHardwareHeader));
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
free(data);
|
||||
fprintf(stderr,
|
||||
"libdicformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...",
|
||||
crc64,
|
||||
ctx->dumpHardwareHeader.crc64);
|
||||
@@ -897,7 +897,7 @@ void* open(const char* filepath)
|
||||
if(ctx->dumpHardwareEntriesWithData == NULL)
|
||||
{
|
||||
memset(&ctx->dumpHardwareHeader, 0, sizeof(DumpHardwareHeader));
|
||||
fprintf(stderr, "libdicformat: Could not allocate memory for dump hardware block, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not allocate memory for dump hardware block, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -913,7 +913,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(DumpHardwareEntry))
|
||||
{
|
||||
ctx->dumpHardwareHeader.entries = e + (uint16_t)1;
|
||||
fprintf(stderr, "libdicformat: Could not read dump hardware block entry, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block entry, continuing...");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ void* open(const char* filepath)
|
||||
free(ctx->dumpHardwareEntriesWithData[e].manufacturer);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry manufacturer, "
|
||||
"libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
"continuing...");
|
||||
}
|
||||
}
|
||||
@@ -957,7 +957,7 @@ void* open(const char* filepath)
|
||||
free(ctx->dumpHardwareEntriesWithData[e].model);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.modelLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry model, continuing...");
|
||||
"libaaruformat: Could not read dump hardware block entry model, continuing...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -980,7 +980,7 @@ void* open(const char* filepath)
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.revisionLength = 0;
|
||||
fprintf(
|
||||
stderr,
|
||||
"libdicformat: Could not read dump hardware block entry revision, continuing...");
|
||||
"libaaruformat: Could not read dump hardware block entry revision, continuing...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ void* open(const char* filepath)
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength = 0;
|
||||
fprintf(
|
||||
stderr,
|
||||
"libdicformat: Could not read dump hardware block entry firmware, continuing...");
|
||||
"libaaruformat: Could not read dump hardware block entry firmware, continuing...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1024,8 +1024,9 @@ void* open(const char* filepath)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].serial);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.serialLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry serial, continuing...");
|
||||
fprintf(
|
||||
stderr,
|
||||
"libaaruformat: Could not read dump hardware block entry serial, continuing...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1048,7 @@ void* open(const char* filepath)
|
||||
free(ctx->dumpHardwareEntriesWithData[e].softwareName);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareNameLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry software name, "
|
||||
"libaaruformat: Could not read dump hardware block entry software name, "
|
||||
"continuing...");
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1071,7 @@ void* open(const char* filepath)
|
||||
free(ctx->dumpHardwareEntriesWithData[e].softwareVersion);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareVersionLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry software version, "
|
||||
"libaaruformat: Could not read dump hardware block entry software version, "
|
||||
"continuing...");
|
||||
}
|
||||
}
|
||||
@@ -1093,7 +1094,7 @@ void* open(const char* filepath)
|
||||
free(ctx->dumpHardwareEntriesWithData[e].softwareOperatingSystem);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareOperatingSystemLength = 0;
|
||||
fprintf(stderr,
|
||||
"libdicformat: Could not read dump hardware block entry manufacturer, "
|
||||
"libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
"continuing...");
|
||||
}
|
||||
}
|
||||
@@ -1106,7 +1107,7 @@ void* open(const char* filepath)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"libdicformat: Could not allocate memory for dump hardware block extents, continuing...");
|
||||
"libaaruformat: Could not allocate memory for dump hardware block extents, continuing...");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1118,7 +1119,7 @@ void* open(const char* filepath)
|
||||
if(readBytes != sizeof(DumpExtent) * ctx->dumpHardwareEntriesWithData->entry.extents)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].extents);
|
||||
fprintf(stderr, "libdicformat: Could not read dump hardware block extents, continuing...");
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block extents, continuing...");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1128,7 +1129,8 @@ void* open(const char* filepath)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libdicformat: Unhandled block type %4.4s with data type %4.4s is indexed to be at %" PRIu64 "",
|
||||
"libaaruformat: Unhandled block type %4.4s with data type %4.4s is indexed to be at %" PRIu64
|
||||
"",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
(char*)&idxEntries[i].dataType,
|
||||
idxEntries[i].offset);
|
||||
@@ -1140,7 +1142,7 @@ void* open(const char* filepath)
|
||||
|
||||
if(!foundUserDataDdt)
|
||||
{
|
||||
fprintf(stderr, "libdicformat: Could not find user data deduplication table, aborting...");
|
||||
fprintf(stderr, "libaaruformat: Could not find user data deduplication table, aborting...");
|
||||
close(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
20
src/read.c
20
src/read.c
@@ -5,7 +5,7 @@
|
||||
// Filename : open.c
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : libdicformat.
|
||||
// Component : libaaruformat.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
@@ -30,20 +30,20 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
#include <dicformat.h>
|
||||
#include <aaruformat.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
int32_t read_media_tag(void* context, uint8_t* data, int32_t tag, uint32_t* length)
|
||||
{
|
||||
dicformatContext* ctx;
|
||||
aaruformatContext* ctx;
|
||||
dataLinkedList* item;
|
||||
|
||||
if(context == NULL) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
ctx = context;
|
||||
|
||||
// Not a libdicformat context
|
||||
// Not a libaaruformat context
|
||||
if(ctx->magic != DIC_MAGIC) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
item = ctx->mediaTagsHead;
|
||||
@@ -71,7 +71,7 @@ int32_t read_media_tag(void* context, uint8_t* data, int32_t tag, uint32_t* leng
|
||||
|
||||
int32_t read_sector(void* context, uint64_t sectorAddress, uint8_t* data, uint32_t* length)
|
||||
{
|
||||
dicformatContext* ctx;
|
||||
aaruformatContext* ctx;
|
||||
uint64_t ddtEntry;
|
||||
uint32_t offsetMask;
|
||||
uint64_t offset;
|
||||
@@ -84,7 +84,7 @@ int32_t read_sector(void* context, uint64_t sectorAddress, uint8_t* data, uint32
|
||||
|
||||
ctx = context;
|
||||
|
||||
// Not a libdicformat context
|
||||
// Not a libaaruformat context
|
||||
if(ctx->magic != DIC_MAGIC) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
if(sectorAddress > ctx->imageInfo.Sectors - 1) return DICF_ERROR_SECTOR_OUT_OF_BOUNDS;
|
||||
@@ -150,14 +150,14 @@ int32_t read_sector(void* context, uint64_t sectorAddress, uint8_t* data, uint32
|
||||
|
||||
int32_t read_track_sector(void* context, uint8_t* data, uint64_t sectorAddress, uint32_t* length, uint8_t track)
|
||||
{
|
||||
dicformatContext* ctx;
|
||||
aaruformatContext* ctx;
|
||||
int i;
|
||||
|
||||
if(context == NULL) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
ctx = context;
|
||||
|
||||
// Not a libdicformat context
|
||||
// Not a libaaruformat context
|
||||
if(ctx->magic != DIC_MAGIC) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
if(ctx->imageInfo.XmlMediaType != OpticalDisc) return DICF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
@@ -173,7 +173,7 @@ int32_t read_track_sector(void* context, uint8_t* data, uint64_t sectorAddress,
|
||||
|
||||
int32_t read_sector_long(void* context, uint8_t* data, uint64_t sectorAddress, uint32_t* length)
|
||||
{
|
||||
dicformatContext* ctx;
|
||||
aaruformatContext* ctx;
|
||||
uint32_t bareLength;
|
||||
uint32_t tagLength;
|
||||
uint8_t* bareData;
|
||||
@@ -186,7 +186,7 @@ int32_t read_sector_long(void* context, uint8_t* data, uint64_t sectorAddress, u
|
||||
|
||||
ctx = context;
|
||||
|
||||
// Not a libdicformat context
|
||||
// Not a libaaruformat context
|
||||
if(ctx->magic != DIC_MAGIC) return DICF_ERROR_NOT_DICFORMAT;
|
||||
|
||||
switch(ctx->imageInfo.XmlMediaType)
|
||||
|
||||
Reference in New Issue
Block a user