From 8abcacc22e050a2fd83c58bf8d7a98bee9a9afb9 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 20 Mar 2019 22:34:21 +0000 Subject: [PATCH] Change unsigned char to uint8_t. --- include/dic.h | 58 ++++++++++++++++++------------------- include/dicformat/context.h | 36 +++++++++++------------ include/dicformat/decls.h | 4 ++- include/dicformat/structs.h | 36 +++++++++++------------ src/open.c | 2 +- src/read.c | 2 +- 6 files changed, 70 insertions(+), 68 deletions(-) diff --git a/include/dic.h b/include/dic.h index 5de9d92..05a8273 100644 --- a/include/dic.h +++ b/include/dic.h @@ -1016,68 +1016,68 @@ typedef enum typedef struct ImageInfo { /** Image contains partitions (or tracks for optical media) */ - uint8_t HasPartitions; + uint8_t HasPartitions; /** Image contains sessions (optical media only) */ - uint8_t HasSessions; + uint8_t HasSessions; /** Size of the image without headers */ - uint64_t ImageSize; + uint64_t ImageSize; /** Sectors contained in the image */ - uint64_t Sectors; + uint64_t Sectors; /** Size of sectors contained in the image */ - uint32_t SectorSize; + uint32_t SectorSize; /** Media tags contained by the image */ //List ReadableMediaTags; /** Sector tags contained by the image */ //List ReadableSectorTags; /** Image version */ - unsigned char *Version; + uint8_t *Version; /** Application that created the image */ - unsigned char *Application; + uint8_t *Application; /** Version of the application that created the image */ - unsigned char *ApplicationVersion; + uint8_t *ApplicationVersion; /** Who (person) created the image? */ - unsigned char *Creator; + uint8_t *Creator; /** Image creation time */ - int64_t CreationTime; + int64_t CreationTime; /** Image last modification time */ - int64_t LastModificationTime; + int64_t LastModificationTime; /** Title of the media represented by the image */ - unsigned char *MediaTitle; + uint8_t *MediaTitle; /** Image comments */ - unsigned char *Comments; + uint8_t *Comments; /** Manufacturer of the media represented by the image */ - unsigned char *MediaManufacturer; + uint8_t *MediaManufacturer; /** Model of the media represented by the image */ - unsigned char *MediaModel; + uint8_t *MediaModel; /** Serial number of the media represented by the image */ - unsigned char *MediaSerialNumber; + uint8_t *MediaSerialNumber; /** Barcode of the media represented by the image */ - unsigned char *MediaBarcode; + uint8_t *MediaBarcode; /** Part number of the media represented by the image */ - unsigned char *MediaPartNumber; + uint8_t *MediaPartNumber; /** Media type represented by the image */ - uint32_t MediaType; + uint32_t MediaType; /** Number in sequence for the media represented by the image */ - int32_t MediaSequence; + int32_t MediaSequence; /** Last media of the sequence the media represented by the image corresponds to */ - int32_t LastMediaSequence; + int32_t LastMediaSequence; /** Manufacturer of the drive used to read the media represented by the image */ - unsigned char *DriveManufacturer; + uint8_t *DriveManufacturer; /** Model of the drive used to read the media represented by the image */ - unsigned char *DriveModel; + uint8_t *DriveModel; /** Serial number of the drive used to read the media represented by the image */ - unsigned char *DriveSerialNumber; + uint8_t *DriveSerialNumber; /** Firmware revision of the drive used to read the media represented by the image */ - unsigned char *DriveFirmwareRevision; + uint8_t *DriveFirmwareRevision; /** Type of the media represented by the image to use in XML sidecars */ - int32_t XmlMediaType; + int32_t XmlMediaType; // CHS geometry... /** Cylinders of the media represented by the image */ - uint32_t Cylinders; + uint32_t Cylinders; /** Heads of the media represented by the image */ - uint32_t Heads; + uint32_t Heads; /** Sectors per track of the media represented by the image (for variable image, the smallest) */ - uint32_t SectorsPerTrack; + uint32_t SectorsPerTrack; } ImageInfo; diff --git a/include/dicformat/context.h b/include/dicformat/context.h index e29b1ab..083ea3a 100644 --- a/include/dicformat/context.h +++ b/include/dicformat/context.h @@ -45,13 +45,13 @@ typedef struct dicformatContext DicHeader header; struct dataLinkedList *mediaTagsHead; struct dataLinkedList *mediaTagsTail; - unsigned char *sectorPrefix; - unsigned char *sectorPrefixCorrected; - unsigned char *sectorSuffix; - unsigned char *sectorSuffixCorrected; - unsigned char *sectorSubchannel; - unsigned char *mode2Subheaders; - unsigned char shift; + uint8_t *sectorPrefix; + uint8_t *sectorPrefixCorrected; + uint8_t *sectorSuffix; + uint8_t *sectorSuffixCorrected; + uint8_t *sectorSubchannel; + uint8_t *mode2Subheaders; + uint8_t shift; bool inMemoryDdt; uint64_t *userDataDdt; size_t mappedMemoryDdtSize; @@ -59,11 +59,11 @@ typedef struct dicformatContext uint32_t *sectorSuffixDdt; GeometryBlockHeader geometryBlock; MetadataBlockHeader metadataBlockHeader; - unsigned char *metadataBlock; + uint8_t *metadataBlock; TracksHeader tracksHeader; TrackEntry *trackEntries; CicmMetadataBlock cicmBlockHeader; - unsigned char *cicmBlock; + uint8_t *cicmBlock; DumpHardwareHeader dumpHardwareHeader; struct DumpHardwareEntriesWithData *dumpHardwareEntriesWithData; struct ImageInfo imageInfo; @@ -73,7 +73,7 @@ typedef struct dataLinkedList { struct dataLinkedList *previous; struct dataLinkedList *next; - unsigned char *data; + uint8_t *data; int type; } dataLinkedList; @@ -81,14 +81,14 @@ typedef struct DumpHardwareEntriesWithData { DumpHardwareEntry entry; struct DumpExtent *extents; - unsigned char *manufacturer; - unsigned char *model; - unsigned char *revision; - unsigned char *firmware; - unsigned char *serial; - unsigned char *softwareName; - unsigned char *softwareVersion; - unsigned char *softwareOperatingSystem; + uint8_t *manufacturer; + uint8_t *model; + uint8_t *revision; + uint8_t *firmware; + uint8_t *serial; + uint8_t *softwareName; + uint8_t *softwareVersion; + uint8_t *softwareOperatingSystem; } DumpHardwareEntriesWithData; #pragma pack(push, 1) diff --git a/include/dicformat/decls.h b/include/dicformat/decls.h index 77f172b..ab5938f 100644 --- a/include/dicformat/decls.h +++ b/include/dicformat/decls.h @@ -33,6 +33,8 @@ #ifndef LIBDICFORMAT_DECLS_H #define LIBDICFORMAT_DECLS_H +#include + int identify(const char *filename); int identifyStream(FILE *imageStream); @@ -41,7 +43,7 @@ void *open(const char *filepath); int close(void *context); -unsigned char *read_media_tag(void *context, int tag); +uint8_t *read_media_tag(void *context, int tag); #endif //LIBDICFORMAT_DECLS_H diff --git a/include/dicformat/structs.h b/include/dicformat/structs.h index 2a76a14..d7087bd 100644 --- a/include/dicformat/structs.h +++ b/include/dicformat/structs.h @@ -45,25 +45,25 @@ typedef struct DicHeader { /**Header identifier, */ - uint64_t identifier; + uint64_t identifier; /**UTF-16LE name of the application that created the image */ - unsigned char application[64]; + uint8_t application[64]; /**Image format major version. A new major version means a possibly incompatible change of format */ - uint8_t imageMajorVersion; + uint8_t imageMajorVersion; /**Image format minor version. A new minor version indicates a compatible change of format */ - uint8_t imageMinorVersion; + uint8_t imageMinorVersion; /**Major version of the application that created the image */ - uint8_t applicationMajorVersion; + uint8_t applicationMajorVersion; /**Minor version of the application that created the image */ - uint8_t applicationMinorVersion; + uint8_t applicationMinorVersion; /**Type of media contained on image */ - uint32_t mediaType; + uint32_t mediaType; /**Offset to index */ - uint64_t indexOffset; + uint64_t indexOffset; /**Windows filetime (100 nanoseconds since 1601/01/01 00:00:00 UTC) of image creation time */ - int64_t creationTime; + int64_t creationTime; /**Windows filetime (100 nanoseconds since 1601/01/01 00:00:00 UTC) of image last written time */ - int64_t lastWrittenTime; + int64_t lastWrittenTime; } DicHeader; /**Header for a deduplication table. Table follows it */ @@ -218,21 +218,21 @@ typedef struct TracksHeader typedef struct TrackEntry { /**Track sequence */ - uint8_t sequence; + uint8_t sequence; /**Track type */ - uint8_t type; + uint8_t type; /**Track starting LBA */ - int64_t start; + int64_t start; /**Track last LBA */ - int64_t end; + int64_t end; /**Track pregap in sectors */ - int64_t pregap; + int64_t pregap; /**Track session */ - uint8_t session; + uint8_t session; /**Track's ISRC in ASCII */ - unsigned char isrc[13]; + uint8_t isrc[13]; /**Track flags */ - uint8_t flags; + uint8_t flags; } TrackEntry; /**Geometry block, contains physical geometry information */ diff --git a/src/open.c b/src/open.c index 1847464..1840cd8 100644 --- a/src/open.c +++ b/src/open.c @@ -47,7 +47,7 @@ void *open(const char *filepath) long pos; IndexHeader idxHeader; IndexEntry *idxEntries; - unsigned char *data; + uint8_t *data; memset(ctx, 0, sizeof(dicformatContext)); diff --git a/src/read.c b/src/read.c index 37c923e..302f3ed 100644 --- a/src/read.c +++ b/src/read.c @@ -33,7 +33,7 @@ #include #include -unsigned char *read_media_tag(void *context, int tag) +uint8_t *read_media_tag(void *context, int tag) { if(context == NULL) {