diff --git a/CMakeLists.txt b/CMakeLists.txt index 807fc2f..623b09c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.2) project(maconv) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") # Compile vendor libraries. add_subdirectory("vendors/libhfs") diff --git a/src/conv/binhex.cc b/src/conv/binhex.cc index c9f7c56..c46a647 100644 --- a/src/conv/binhex.cc +++ b/src/conv/binhex.cc @@ -27,7 +27,7 @@ namespace conv { // Return true if a file is in BinHex format. -bool IsFileBinHex(fs::FileReader &reader) +bool IsFileBinHex(fs::FileReader &/* reader */) { // TODO. @@ -37,7 +37,7 @@ bool IsFileBinHex(fs::FileReader &reader) // Read and decode a BinHex file. -void ReadBinHex(fs::FileReader &reader, fs::File &file) +void ReadBinHex(fs::FileReader &/* reader */, fs::File &/* file */) { // TODO. } @@ -45,7 +45,7 @@ void ReadBinHex(fs::FileReader &reader, fs::File &file) // Write a BinHex file. -void WriteBinHex(fs::File &file, fs::FileWriter &writer) +void WriteBinHex(fs::File &/* file */, fs::FileWriter &/* writer */) { // TODO. } diff --git a/src/disk/extract.cc b/src/disk/extract.cc index 1bf0e27..6372cd7 100644 --- a/src/disk/extract.cc +++ b/src/disk/extract.cc @@ -38,7 +38,7 @@ static void ExtractFork(hfsfile *hfile, const hfsdirent &ent, fs::File &file, bool is_res) { // Allocate buffer. - int size = is_res ? ent.u.file.rsize : ent.u.file.dsize; + long unsigned int size = is_res ? ent.u.file.rsize : ent.u.file.dsize; auto buffer = std::make_unique(size); // Read the data. diff --git a/src/formats/file_signature.cc b/src/formats/file_signature.cc index a888864..28bd5ce 100644 --- a/src/formats/file_signature.cc +++ b/src/formats/file_signature.cc @@ -59,10 +59,11 @@ SignToMac signs_to_mac[] = { // File signature array. +/* SignToUnix signs_to_unix[] = { }; - +*/ // Call Unix "file" command on a path. diff --git a/src/formats/file_signature.h b/src/formats/file_signature.h index 60b3d6f..dc024c2 100644 --- a/src/formats/file_signature.h +++ b/src/formats/file_signature.h @@ -33,14 +33,14 @@ struct SignToMac { // Maching type: extension or file command. enum Type { Extension, FileCmd } type; - // Help strings (and count) - int help_len; - const char **helps; - // MAC creator and type. const char *creator; const char *mac; + // Help strings (and count) + int help_len; + const char **helps; + constexpr SignToMac(Type t, const char *c, const char *m, const char **hs, int hl) : type{t}, creator{c}, mac{m}, help_len{hl}, helps{hs} {} }; @@ -57,8 +57,9 @@ struct SignToUnix { extern SignToMac signs_to_mac[]; // File signature array. +/* extern SignToUnix signs_to_unix[]; - +*/ // Get the MAC type (and creator) for a specific file. diff --git a/src/formats/formats.cc b/src/formats/formats.cc index c17c04b..6eb6197 100644 --- a/src/formats/formats.cc +++ b/src/formats/formats.cc @@ -34,7 +34,7 @@ namespace maconv { // Prefered conversion format. -ConvData prefered_conv = { ConvData::NotFound }; +ConvData prefered_conv = { ConvData::NotFound, NULL }; // All available converters. @@ -69,7 +69,7 @@ ConvData GetConverter(const std::string &name) return ConvData { ConvData::Double, &format }; } - return ConvData { ConvData::NotFound }; + return ConvData { ConvData::NotFound, NULL }; } diff --git a/src/fs/file.cc b/src/fs/file.cc index cb714bd..4c296bc 100644 --- a/src/fs/file.cc +++ b/src/fs/file.cc @@ -71,13 +71,12 @@ int ReadLocalFile(const std::string &filename, fs::DataPtr &ptr) // Get file infotmation from a local file. -void GetLocalInfo(const std::string &filename, fs::File &file, bool is_res) +void GetLocalInfo(const std::string & /*filename */, fs::File &/* file */, bool /* is_res */) { // TODO. } - // Set file infotmation to a local file. void SetLocalInfo(fs::File &file, const std::string &filename, bool is_res) { diff --git a/src/fs/file_reader.h b/src/fs/file_reader.h index c469509..df3c7bb 100644 --- a/src/fs/file_reader.h +++ b/src/fs/file_reader.h @@ -71,10 +71,10 @@ struct FileReader { uint8_t *data; // Input data. uint32_t file_size; // Total size of the file. + std::string filename; // Name of the file to read. utils::RawDataStreamBuf stream_buf; // Stream buffer from raw data buffer. std::istream stream; // Stream for reading data. - std::string filename; // Name of the file to read. }; diff --git a/src/stuffit/methods.cc b/src/stuffit/methods.cc index 452f121..5517000 100644 --- a/src/stuffit/methods.cc +++ b/src/stuffit/methods.cc @@ -68,7 +68,7 @@ void CompressionMethod::Extract(const StuffitCompInfo &info, uint8_t *data, total_size = 0; // Uncompress the data chunk by chunks. - for (uint32_t len = 0; true;) { + for (int32_t len = 0; true;) { len = ReadBytes(buffer.get() + total_size, capacity - total_size); if (len == -1) break; @@ -89,7 +89,7 @@ void CompressionMethod::Extract(const StuffitCompInfo &info, uint8_t *data, // Extract data from the compressed fork. void NoneMethod::Extract(const StuffitCompInfo &info, uint8_t *data, - std::vector &mem_pool) + std::vector &/* mem_pool */) { total_size = info.size ? info.size : info.comp_size; uncompressed = data + info.offset; diff --git a/src/stuffit/methods.h b/src/stuffit/methods.h index 155fb37..2562f27 100644 --- a/src/stuffit/methods.h +++ b/src/stuffit/methods.h @@ -47,7 +47,7 @@ struct CompressionMethod { // Read the next bytes. - virtual int32_t ReadBytes(uint8_t *data, uint32_t length) { return -1; } + virtual int32_t ReadBytes(uint8_t * /* data */, uint32_t /* length */) { return -1; } // Initialize the algorithm. virtual void Initialize() {} diff --git a/vendors/libhfs/btree.c b/vendors/libhfs/btree.c index d7d1916..eb4da22 100644 --- a/vendors/libhfs/btree.c +++ b/vendors/libhfs/btree.c @@ -409,7 +409,7 @@ fail: * DESCRIPTION: recursively locate a node and insert a record */ static -int insertx(node *np, byte *record, int *reclen) +int insertx(node *np, byte *record, unsigned int *reclen) { node child; byte *rec; diff --git a/vendors/libhfs/volume.c b/vendors/libhfs/volume.c index 13ee121..ca80810 100644 --- a/vendors/libhfs/volume.c +++ b/vendors/libhfs/volume.c @@ -758,7 +758,7 @@ fail: * DESCRIPTION: translate a pathname; return catalog information */ int v_resolve(hfsvol **vol, const char *path, - CatDataRec *data, long *parid, char *fname, node *np) + CatDataRec *data, unsigned long *parid, char *fname, node *np) { unsigned long dirid; char name[HFS_MAX_FLEN + 1], *nptr; diff --git a/vendors/libhfs/volume.h b/vendors/libhfs/volume.h index ae8a093..6fde218 100644 --- a/vendors/libhfs/volume.h +++ b/vendors/libhfs/volume.h @@ -54,7 +54,7 @@ int v_putextrec(const ExtDataRec *, node *); int v_allocblocks(hfsvol *, ExtDescriptor *); int v_freeblocks(hfsvol *, const ExtDescriptor *); -int v_resolve(hfsvol **, const char *, CatDataRec *, long *, char *, node *); +int v_resolve(hfsvol **, const char *, CatDataRec *, unsigned long *, char *, node *); int v_adjvalence(hfsvol *, unsigned long, int, int); int v_mkdir(hfsvol *, unsigned long, const char *);