From 7c9d7438d6a489a7d3a8480a68166fb7b6d562b1 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:11:26 +0100 Subject: [PATCH 1/8] mark function unused parameters --- corec/corec/helpers/charconvert/charconvert_osx.c | 8 ++++---- corec/corec/helpers/file/file_libc.c | 4 ++-- corec/tests/file_test.c | 2 +- corec/tests/node_test.c | 2 +- corec/tests/string_test.c | 2 +- libebml2/ebmlbinary.c | 6 +++--- libebml2/ebmlcrc.c | 6 +++--- libebml2/ebmldate.c | 2 +- libebml2/ebmlelement.c | 6 +++--- libebml2/ebmlmaster.c | 6 +++--- libebml2/ebmlnumber.c | 12 ++++++------ libebml2/ebmlstring.c | 4 ++-- libebml2/ebmlvoid.c | 6 +++--- libmatroska2/matroskamain.c | 4 ++-- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/corec/corec/helpers/charconvert/charconvert_osx.c b/corec/corec/helpers/charconvert/charconvert_osx.c index c63814ea..59e4b590 100644 --- a/corec/corec/helpers/charconvert/charconvert_osx.c +++ b/corec/corec/helpers/charconvert/charconvert_osx.c @@ -131,22 +131,22 @@ void CharConvSU(charconv* Conv, char* Out, size_t OutLen, const utf16_t* In) } } -void CharConvSW(charconv* Conv, char* Out, size_t OutLen, const wchar_t* In) +void CharConvSW(charconv* UNUSED_PARAM(Conv), char* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const wchar_t* UNUSED_PARAM(In)) { fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__); } -void CharConvWS(charconv* Conv, wchar_t* Out, size_t OutLen, const char* In) +void CharConvWS(charconv* UNUSED_PARAM(Conv), wchar_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const char* UNUSED_PARAM(In)) { fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__); } -void CharConvUW(charconv* Conv, utf16_t* Out, size_t OutLen, const wchar_t* In) +void CharConvUW(charconv* UNUSED_PARAM(Conv), utf16_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const wchar_t* UNUSED_PARAM(In)) { fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__); } -void CharConvWU(charconv* Conv, wchar_t* Out, size_t OutLen, const utf16_t* In) +void CharConvWU(charconv* UNUSED_PARAM(Conv), wchar_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const utf16_t* UNUSED_PARAM(In)) { fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__); } diff --git a/corec/corec/helpers/file/file_libc.c b/corec/corec/helpers/file/file_libc.c index ca49f062..54c72cb3 100644 --- a/corec/corec/helpers/file/file_libc.c +++ b/corec/corec/helpers/file/file_libc.c @@ -144,7 +144,7 @@ static filepos_t Seek(filestream* p,filepos_t Pos,int SeekMode) return NewPos; } -static err_t SetLength(filestream* p,dataid Id,const filepos_t* Data,size_t Size) +static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t Size) { if (Size != sizeof(filepos_t)) return ERR_INVALID_DATA; @@ -260,7 +260,7 @@ META_DATA(TYPE_FILEPOS,STREAM_LENGTH,filestream,Length) META_PARAM(STRING,NODE_PROTOCOL,T("file")) META_END(STREAM_CLASS) -bool_t FileErase(nodecontext *p,const tchar_t* Path, bool_t Force, bool_t Safe) +bool_t FileErase(const tchar_t* Path, bool_t Force, bool_t UNUSED_PARAM(Safe)) { if (Force) { diff --git a/corec/tests/file_test.c b/corec/tests/file_test.c index b7616445..5ccd906c 100644 --- a/corec/tests/file_test.c +++ b/corec/tests/file_test.c @@ -19,7 +19,7 @@ void DebugMessage(const tchar_t* Msg,...) #endif } -int main(int argc,char** argv) +int main(int UNUSED_PARAM(argc),char** UNUSED_PARAM(argv)) { nodecontext Context; NodeContext_Init(&Context,NULL,NULL,NULL); diff --git a/corec/tests/node_test.c b/corec/tests/node_test.c index 61a27d7d..1ee3a942 100644 --- a/corec/tests/node_test.c +++ b/corec/tests/node_test.c @@ -19,7 +19,7 @@ void DebugMessage(const tchar_t* Msg,...) #endif } -int main(int argc,char** argv) +int main(int UNUSED_PARAM(argc),char** UNUSED_PARAM(argv)) { node* p[10000]; int i; diff --git a/corec/tests/string_test.c b/corec/tests/string_test.c index 461a4e3e..9b8773f0 100644 --- a/corec/tests/string_test.c +++ b/corec/tests/string_test.c @@ -114,7 +114,7 @@ void test_ptr(const char *Format, intptr_t Value) printf("passed '%s'\n",String); } -int main(int argc,char** argv) +int main(int UNUSED_PARAM(argc),char** argv) { #if defined(UNICODE) ToStr = CharConvOpen(NULL,CHARSET_DEFAULT); diff --git a/libebml2/ebmlbinary.c b/libebml2/ebmlbinary.c index 22e2fdc5..edc641a2 100644 --- a/libebml2/ebmlbinary.c +++ b/libebml2/ebmlbinary.c @@ -6,7 +6,7 @@ #include "internal.h" #include -static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; @@ -40,7 +40,7 @@ static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_par } #if defined(CONFIG_EBML_WRITING) -static err_t RenderData(ebml_binary *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderData(ebml_binary *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { size_t Written; err_t Err = Stream_Write(Output,ARRAYBEGIN(Element->Data,uint8_t),ARRAYCOUNT(Element->Data,uint8_t),&Written); @@ -55,7 +55,7 @@ static void Delete(ebml_binary *Element) ArrayClear(&Element->Data); } -static bool_t IsDefaultValue(const ebml_binary *Element) +static bool_t IsDefaultValue(const ebml_binary *UNUSED_PARAM(Element)) { return 0; // TODO: a default binary value needs a size too (use a structure to set the value in the structure) } diff --git a/libebml2/ebmlcrc.c b/libebml2/ebmlcrc.c index 1325a2c4..8da2bd40 100644 --- a/libebml2/ebmlcrc.c +++ b/libebml2/ebmlcrc.c @@ -138,7 +138,7 @@ static bool_t ValidateSize(const ebml_element *p) return EBML_ElementIsFiniteSize(p) && (p->DataSize == 4); } -static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int UNUSED_PARAM(Scope), size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; uint32_t CRCbuffer; @@ -152,7 +152,7 @@ static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser } #if defined(CONFIG_EBML_WRITING) -static err_t RenderData(ebml_crc *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderData(ebml_crc *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { err_t Result; size_t Written = 0; @@ -182,7 +182,7 @@ static ebml_crc *Copy(const ebml_crc *Element) return Result; } -static bool_t IsDefaultValue(const ebml_element *Element) +static bool_t IsDefaultValue(const ebml_element *UNUSED_PARAM(Element)) { return 0; // CRC has no default value } diff --git a/libebml2/ebmldate.c b/libebml2/ebmldate.c index 0a09bdf1..f24cd3d8 100644 --- a/libebml2/ebmldate.c +++ b/libebml2/ebmldate.c @@ -27,7 +27,7 @@ static bool_t ValidateSize(const ebml_element *p) return EBML_ElementIsFiniteSize(p) && (p->DataSize == 8 || p->DataSize == 0); } -static err_t ReadData(ebml_date *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadData(ebml_date *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; int DataSize; diff --git a/libebml2/ebmlelement.c b/libebml2/ebmlelement.c index 29d6bed6..d41cd9f3 100644 --- a/libebml2/ebmlelement.c +++ b/libebml2/ebmlelement.c @@ -13,7 +13,7 @@ static bool_t ValidateSize(const ebml_element *p) return EBML_ElementIsFiniteSize(p); /* not allowed outside of master elements */ } -static void PostCreate(ebml_element *Element, bool_t SetDefault, int ForProfile) +static void PostCreate(ebml_element *Element, bool_t UNUSED_PARAM(SetDefault), int UNUSED_PARAM(ForProfile)) { Element->DefaultSize = -1; Element->ElementPosition = INVALID_FILEPOS_T; @@ -30,7 +30,7 @@ static bool_t NeedsDataSizeUpdate(ebml_element *Element, bool_t bWithDefault) return 1; } -static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory, int ForProfile) +static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t UNUSED_PARAM(bForceWithoutMandatory), int UNUSED_PARAM(ForProfile)) { if (!bWithDefault && EBML_ElementIsDefaultValue(Element)) return 0; @@ -124,7 +124,7 @@ filepos_t EBML_ElementFullSize(const ebml_element *Element, bool_t bWithDefault) return Element->DataSize + GetIdLength(Element->Context->Id) + EBML_CodedSizeLength(Element->DataSize, Element->SizeLength, EBML_ElementIsFiniteSize(Element)); } -filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t bWithDefault) +filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t UNUSED_PARAM(bWithDefault)) { return Element->DataSize; } diff --git a/libebml2/ebmlmaster.c b/libebml2/ebmlmaster.c index 9f2e35d4..f1f80b1f 100644 --- a/libebml2/ebmlmaster.c +++ b/libebml2/ebmlmaster.c @@ -94,7 +94,7 @@ err_t EBML_MasterAppend(ebml_master *Element, ebml_element *Append) return Result; } -err_t EBML_MasterRemove(ebml_master *Element, ebml_element *Append) +err_t EBML_MasterRemove(ebml_master *UNUSED_PARAM(Element), ebml_element *Append) { err_t Result = NodeTree_SetParent(Append,NULL,NULL); return Result; @@ -157,7 +157,7 @@ void EBML_MasterErase(ebml_master *Element) NodeTree_DetachAndRelease(Element->Base.Base.Children); } -static bool_t IsDefaultValue(const ebml_element *Element) +static bool_t IsDefaultValue(const ebml_element *UNUSED_PARAM(Element)) { return 0; // TODO: a master element has the default value if all the sub elements are unique and have the default value @@ -599,7 +599,7 @@ static void AddChild(ebml_master* p,ebml_element* Child,ebml_element* Before) INHERITED(p,nodetree_vmt,EBML_MASTER_CLASS)->AddChild(p,Child,Before); } -static bool_t ValidateSize(const ebml_element *p) +static bool_t ValidateSize(const ebml_element *UNUSED_PARAM(p)) { return 1; } diff --git a/libebml2/ebmlnumber.c b/libebml2/ebmlnumber.c index 0b71c2ee..ef8d01c9 100644 --- a/libebml2/ebmlnumber.c +++ b/libebml2/ebmlnumber.c @@ -6,7 +6,7 @@ #include "internal.h" #include -static err_t ReadDataInt(ebml_integer *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadDataInt(ebml_integer *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; char Buffer[8]; @@ -45,7 +45,7 @@ static err_t ReadDataInt(ebml_integer *Element, struct stream *Input, const ebml return Result; } -static err_t ReadDataSignedInt(ebml_integer *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadDataSignedInt(ebml_integer *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; char Buffer[8]; @@ -88,7 +88,7 @@ static err_t ReadDataSignedInt(ebml_integer *Element, struct stream *Input, cons } #if defined(CONFIG_EBML_WRITING) -static err_t RenderDataSignedInt(ebml_integer *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderDataSignedInt(ebml_integer *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { uint8_t FinalData[8]; // we don't handle more than 64 bits integers size_t i; @@ -124,7 +124,7 @@ static err_t RenderDataSignedInt(ebml_integer *Element, struct stream *Output, b return Err; } -static err_t RenderDataInt(ebml_integer *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderDataInt(ebml_integer *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { uint8_t FinalData[8]; // we don't handle more than 64 bits integers size_t i; @@ -160,7 +160,7 @@ static err_t RenderDataInt(ebml_integer *Element, struct stream *Output, bool_t return Err; } -static err_t RenderDataFloat(ebml_float *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderDataFloat(ebml_float *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { err_t Err; size_t i = 0; @@ -202,7 +202,7 @@ static bool_t ValidateSizeFloat(const ebml_element *p) return EBML_ElementIsFiniteSize(p) && (p->DataSize == 8 || p->DataSize == 4); } -static err_t ReadDataFloat(ebml_float *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadDataFloat(ebml_float *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { uint8_t Value[8]; err_t Result; diff --git a/libebml2/ebmlstring.c b/libebml2/ebmlstring.c index 74f10c6d..85791ed9 100644 --- a/libebml2/ebmlstring.c +++ b/libebml2/ebmlstring.c @@ -49,7 +49,7 @@ void EBML_StringGet(ebml_string *Element,tchar_t *Out, size_t OutLen) } } -static err_t ReadData(ebml_string *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadData(ebml_string *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC)) { err_t Result; char *Buffer = NULL; @@ -94,7 +94,7 @@ static err_t ReadData(ebml_string *Element, struct stream *Input, const ebml_par } #if defined(CONFIG_EBML_WRITING) -static err_t RenderData(ebml_string *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderData(ebml_string *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { size_t Written; err_t Err = Stream_Write(Output,Element->Buffer,(size_t)Element->Base.DataSize,&Written); diff --git a/libebml2/ebmlvoid.c b/libebml2/ebmlvoid.c index 86cf7f94..a8d66d9c 100644 --- a/libebml2/ebmlvoid.c +++ b/libebml2/ebmlvoid.c @@ -6,19 +6,19 @@ #include "internal.h" #include -static bool_t IsDefaultValue(const ebml_element *Element) +static bool_t IsDefaultValue(const ebml_element *UNUSED_PARAM(Element)) { return 0; } -static err_t ReadData(ebml_element *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC) +static err_t ReadData(ebml_element *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int UNUSED_PARAM(Scope), size_t UNUSED_PARAM(DepthCheckCRC)) { EBML_ElementSkipData(Element,Input,ParserContext,NULL,AllowDummyElt); return ERR_NONE; } #if defined(CONFIG_EBML_WRITING) -static err_t RenderData(ebml_element *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderData(ebml_element *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered) { size_t Written, Left = (size_t)Element->DataSize; err_t Err = ERR_NONE; diff --git a/libmatroska2/matroskamain.c b/libmatroska2/matroskamain.c index 172071cf..41d7c675 100644 --- a/libmatroska2/matroskamain.c +++ b/libmatroska2/matroskamain.c @@ -1374,7 +1374,7 @@ static err_t ReadBigBinaryData(ebml_binary *Element, struct stream *Input, const return INHERITED(Element,ebml_element_vmt,MATROSKA_BIGBINARY_CLASS)->ReadData(Element, Input, ParserContext, AllowDummyElt, Scope, DepthCheckCRC); } -static err_t ReadBlockData(matroska_block *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope) +static err_t ReadBlockData(matroska_block *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t UNUSED_PARAM(AllowDummyElt), int Scope) { err_t Result; uint8_t _TempHead[5]; @@ -1692,7 +1692,7 @@ static char GetBestLacingType(const matroska_block *Element, int ForProfile) return LACING_EBML; } -static err_t RenderBlockData(matroska_block *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered) +static err_t RenderBlockData(matroska_block *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int ForProfile, filepos_t *Rendered) { err_t Err = ERR_NONE; uint8_t BlockHead[5], *Cursor; From 856b08fa718249882d872d755248df9043addb4e Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:12:29 +0100 Subject: [PATCH 2/8] corec: remove unused parameters in all variants --- corec/corec/helpers/file/file.h | 8 ++++---- corec/corec/helpers/file/file_libc.c | 2 +- corec/corec/helpers/file/file_win32.c | 4 ++-- corec/corec/helpers/file/tools.c | 6 +++--- corec/corec/helpers/parser/parser.h | 2 +- corec/corec/helpers/parser/parser2.c | 10 +++++----- corec/corec/node/node.c | 15 +++++---------- mkclean/mkclean.c | 2 +- 8 files changed, 22 insertions(+), 27 deletions(-) diff --git a/corec/corec/helpers/file/file.h b/corec/corec/helpers/file/file.h index 563da0ac..30921e3f 100644 --- a/corec/corec/helpers/file/file.h +++ b/corec/corec/helpers/file/file.h @@ -27,18 +27,18 @@ extern "C" { FILE_DLL void CoreC_FileInit(nodemodule* Module); -FILE_DLL bool_t PathIsFolder(nodecontext*, const tchar_t*); +FILE_DLL bool_t PathIsFolder(const tchar_t*); // \param Force erase even if the file is read-only // \param Safe put in the OS trash rather than a permanent erase -FILE_DLL bool_t FileErase(nodecontext*, const tchar_t*, bool_t Force, bool_t Safe); +FILE_DLL bool_t FileErase(const tchar_t*, bool_t Force, bool_t Safe); FILE_DLL void RemovePathDelimiter(tchar_t* Path); FILE_DLL void AddPathDelimiter(tchar_t* Path,size_t PathLen); FILE_DLL const tchar_t* GetProtocol(const tchar_t* URL, tchar_t *_Protocol, int ProtoLen, bool_t* HasHost); FILE_DLL void SplitPath(const tchar_t* Path, tchar_t* Dir, int DirLen, tchar_t* Name, int NameLen, tchar_t* Ext, int ExtLen); FILE_DLL void AbsPath(tchar_t* Abs, int AbsLen, const tchar_t* Path, const tchar_t* Base); -FILE_DLL void AbsPathNormalize(tchar_t* Abs, size_t AbsLen); -FILE_DLL void ReduceLocalPath(tchar_t* Abs, size_t AbsLen); +FILE_DLL void AbsPathNormalize(tchar_t* Abs); +FILE_DLL void ReduceLocalPath(tchar_t* Abs); FILE_DLL void RelPath(tchar_t* Rel, int RelLen, const tchar_t* Path, const tchar_t* Base); FILE_DLL bool_t UpperPath(tchar_t* Path, tchar_t* Last, size_t LastLen); diff --git a/corec/corec/helpers/file/file_libc.c b/corec/corec/helpers/file/file_libc.c index 54c72cb3..84af1c41 100644 --- a/corec/corec/helpers/file/file_libc.c +++ b/corec/corec/helpers/file/file_libc.c @@ -277,7 +277,7 @@ bool_t FileErase(const tchar_t* Path, bool_t Force, bool_t UNUSED_PARAM(Safe)) return unlink(Path) == 0; } -bool_t PathIsFolder(nodecontext *p,const tchar_t* Path) +bool_t PathIsFolder(const tchar_t* Path) { struct stat file_stats; if (stat(Path, &file_stats) == 0) diff --git a/corec/corec/helpers/file/file_win32.c b/corec/corec/helpers/file/file_win32.c index 01133812..634298f4 100644 --- a/corec/corec/helpers/file/file_win32.c +++ b/corec/corec/helpers/file/file_win32.c @@ -404,7 +404,7 @@ static bool_t FileRecycle(const tchar_t* Path) return Ret == 0; } -bool_t FileErase(nodecontext* UNUSED_PARAM(p),const tchar_t* Path, bool_t Force, bool_t Safe) +bool_t FileErase(const tchar_t* Path, bool_t Force, bool_t Safe) { if (Force) { @@ -422,7 +422,7 @@ bool_t FileErase(nodecontext* UNUSED_PARAM(p),const tchar_t* Path, bool_t Force, return FileRecycle(Path); } -bool_t PathIsFolder(nodecontext* UNUSED_PARAM(p),const tchar_t* Path) +bool_t PathIsFolder(const tchar_t* Path) { DWORD attr = GetFileAttributes(Path); return (attr != (DWORD)-1) && (attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY; diff --git a/corec/corec/helpers/file/tools.c b/corec/corec/helpers/file/tools.c index fea0d444..35bfa961 100644 --- a/corec/corec/helpers/file/tools.c +++ b/corec/corec/helpers/file/tools.c @@ -276,10 +276,10 @@ void AbsPath(tchar_t* Abs, int AbsLen, const tchar_t* Path, const tchar_t* Base) Abs[0] = 0; tcscat_s(Abs,AbsLen,Path); - AbsPathNormalize(Abs,AbsLen); + AbsPathNormalize(Abs); } -void AbsPathNormalize(tchar_t* Abs,size_t AbsLen) +void AbsPathNormalize(tchar_t* Abs) { if (GetProtocol(Abs,NULL,0,NULL)!=Abs) { @@ -299,7 +299,7 @@ void AbsPathNormalize(tchar_t* Abs,size_t AbsLen) } } -void ReduceLocalPath(tchar_t* Abs,size_t UNUSED_PARAM(AbsLen)) +void ReduceLocalPath(tchar_t* Abs) { tchar_t *Folder,*Back; Folder = tcsstr(Abs,T("://")); // skip the protocol diff --git a/corec/corec/helpers/parser/parser.h b/corec/corec/helpers/parser/parser.h index 2e94bb48..dbc9d026 100644 --- a/corec/corec/helpers/parser/parser.h +++ b/corec/corec/helpers/parser/parser.h @@ -86,7 +86,7 @@ NODE_DLL void TextAttribEx(textwriter*,const tchar_t* Name, const void* Data, si NODE_DLL void TextSerializeNode(textwriter* Text, node* p, uint_fast32_t Mask, uint_fast32_t Filter); NODE_DLL bool_t DataToString(tchar_t* Value, size_t ValueLen, const void* Data, size_t Size, dataflags Type); -NODE_DLL bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node, node* Base); +NODE_DLL bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node); void ExprSkipSpace(const tchar_t** p); NODE_DLL void ExprTrimSpace(tchar_t** p); diff --git a/corec/corec/helpers/parser/parser2.c b/corec/corec/helpers/parser/parser2.c index 5025ac85..bb1afc2f 100644 --- a/corec/corec/helpers/parser/parser2.c +++ b/corec/corec/helpers/parser/parser2.c @@ -210,9 +210,9 @@ static NOINLINE bool_t FindParam(node* Base, findpin* Find, nodecontext* Context return 0; } -static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data, node* Base) +static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data) { - if (NodeToString(Value,ValueLen,Data->Node,Base) && Data->Node) + if (NodeToString(Value,ValueLen,Data->Node) && Data->Node) { size_t n; if (Value[0]) @@ -224,7 +224,7 @@ static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data, node return 1; } -bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node, node* UNUSED_PARAM(Base)) +bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node) { Value[0]=0; @@ -425,11 +425,11 @@ NOINLINE bool_t DataToString(tchar_t* Value, size_t ValueLen, const void* Data, break; case TYPE_PIN: - PinToString(Value,ValueLen,(pin*)Data,NULL); + PinToString(Value,ValueLen,(pin*)Data); break; case TYPE_NODE: - NodeToString(Value,ValueLen,*(node**)Data,NULL); + NodeToString(Value,ValueLen,*(node**)Data); break; case TYPE_STRING: diff --git a/corec/corec/node/node.c b/corec/corec/node/node.c index 5725ee97..3cea6486 100644 --- a/corec/corec/node/node.c +++ b/corec/corec/node/node.c @@ -432,11 +432,6 @@ static NOINLINE void UnlockModules(const nodeclass* Class) } } -static void UnlockModulesWithLock(nodecontext* p,const nodeclass* Class) -{ - UnlockModules(Class); -} - static NOINLINE bool_t DataFree(nodecontext* p, node* Node, nodedata** i, bool_t DeletingNode) { datatype Type; @@ -852,7 +847,7 @@ void Node_Destructor(node* Node) Node->Magic = 0; #endif - UnlockModulesWithLock(p,Class); + UnlockModules(Class); } } @@ -898,7 +893,7 @@ err_t Node_Constructor(anynode* AnyNode, node* Node, size_t Size, fourcc_t Class else { Node->VMT = NULL; - UnlockModulesWithLock(p,Class); + UnlockModules(Class); } } else @@ -1260,7 +1255,7 @@ static node* NodeCreateFromClass(nodecontext* p, const nodeclass* Class, bool_t Size = NodeSize(Class); if (!Size) { - UnlockModulesWithLock(p,Class); + UnlockModules(Class); return NULL; } @@ -1277,7 +1272,7 @@ static node* NodeCreateFromClass(nodecontext* p, const nodeclass* Class, bool_t if (Singleton && !AddSingleton(p,Node)) { - UnlockModulesWithLock(p,Class); + UnlockModules(Class); return NULL; } @@ -1407,7 +1402,7 @@ static void EraseNode(nodecontext* p,node* Node,const nodeclass* Class) Node->Magic = 0; #endif - UnlockModulesWithLock(p,Class); + UnlockModules(Class); if (!(Class->Flags & CFLAG_OWN_MEMORY)) MemHeap_Free(p->NodeHeap,Node,Size); diff --git a/mkclean/mkclean.c b/mkclean/mkclean.c index b36aba93..25839958 100644 --- a/mkclean/mkclean.c +++ b/mkclean/mkclean.c @@ -3202,7 +3202,7 @@ int main(int argc, const char *argv[]) StreamClose(Output); if (Result<0 && Path[0]) - FileErase((nodecontext*)&p,Path,1,0); + FileErase(Path,1,0); // Core-C ending if (!Regression) // until all the memory leaks are fixed From 2a593051373c292b7d11907dfb476fc72a697d54 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:45:26 +0100 Subject: [PATCH 3/8] tremor: fix unused variables. --- libmatroska2/tremor/floor0.c | 2 ++ libmatroska2/tremor/floor1.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libmatroska2/tremor/floor0.c b/libmatroska2/tremor/floor0.c index bdb83b85..be6787cb 100644 --- a/libmatroska2/tremor/floor0.c +++ b/libmatroska2/tremor/floor0.c @@ -138,6 +138,7 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, ogg_int32_t amp, ogg_int32_t ampoffset, ogg_int32_t *icos){ +(void)ln; /* 0 <= m < 256 */ @@ -410,6 +411,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, void *memo,ogg_int32_t *out){ +(void)vb; vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; diff --git a/libmatroska2/tremor/floor1.c b/libmatroska2/tremor/floor1.c index 276ed8d8..be389ff7 100644 --- a/libmatroska2/tremor/floor1.c +++ b/libmatroska2/tremor/floor1.c @@ -124,7 +124,7 @@ static int icomp(const void *a,const void *b){ static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi, vorbis_info_floor *in){ - +(void)vd; (void)mi; int *sortpointer[VIF_POSIT+2]; vorbis_info_floor1 *info=(vorbis_info_floor1 *)in; vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look)); From b4f39f80fa0322dbe4629dd510ac271178e7d850 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:15:51 +0100 Subject: [PATCH 4/8] CMake: warn about unused parameters --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9874a7d..6ee0cfff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ if(DEV_MODE) add_c_flag_if_supported(-Wno-error=unused-command-line-argument -Wall -Wextra -Wpedantic -Wfatal-errors -fstack-protector-strong -Wno-self-assign - -Wno-unused-parameter -Werror=missing-field-initializers -Werror=excess-initializers -Werror=strict-aliasing From 3ad590a93d0b88784f34394d50237e316f5569cd Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:16:47 +0100 Subject: [PATCH 5/8] CMake: warn about self-assign --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ee0cfff..8eb97ce2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,6 @@ if(DEV_MODE) set(CMAKE_C_EXTENSIONS OFF) add_c_flag_if_supported(-Wno-error=unused-command-line-argument -Wall -Wextra -Wpedantic -Wfatal-errors -fstack-protector-strong - -Wno-self-assign -Werror=missing-field-initializers -Werror=excess-initializers -Werror=strict-aliasing From 30e52f8b6a0d8390bc80a21e35046e2e12a4b157 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:33:37 +0100 Subject: [PATCH 6/8] corec: remove bogus UNUSED_PARAM usage --- corec/corec/helpers/file/file_win32.c | 2 +- corec/corec/node/node.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/corec/corec/helpers/file/file_win32.c b/corec/corec/helpers/file/file_win32.c index 634298f4..1995b590 100644 --- a/corec/corec/helpers/file/file_win32.c +++ b/corec/corec/helpers/file/file_win32.c @@ -218,7 +218,7 @@ static err_t Write(filestream* p,const void* Data,size_t Size,size_t* Written) return Err; } -static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t UNUSED_PARAM(Size)) +static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t Size) { err_t Result = ERR_NONE; filepos_t Pos; diff --git a/corec/corec/node/node.c b/corec/corec/node/node.c index 3cea6486..d13ee623 100644 --- a/corec/corec/node/node.c +++ b/corec/corec/node/node.c @@ -1014,7 +1014,7 @@ static const nodemeta* BitLookup(const nodeclass* Class,dataid Id) return NULL; } -static NOINLINE int CmpLookup(const void* UNUSED_PARAM(p), const void* va, const void* vb) +static NOINLINE int CmpLookup(const void* p, const void* va, const void* vb) { const nodemetalookup* a = va; const nodemetalookup* b = vb; From 9ea59732c0c893b9ecf535ca48e48e07831d3242 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 17:47:18 +0100 Subject: [PATCH 7/8] libebml2: remove EBML_MasterRemove() Deleting a node does remove it from its parent element. --- libebml2/ebml2/ebml.h | 1 - libebml2/ebmlmaster.c | 8 -------- mkclean/mkclean.c | 1 - 3 files changed, 10 deletions(-) diff --git a/libebml2/ebml2/ebml.h b/libebml2/ebml2/ebml.h index 4f4fbb1f..7897520c 100644 --- a/libebml2/ebml2/ebml.h +++ b/libebml2/ebml2/ebml.h @@ -168,7 +168,6 @@ EBML_DLL void EBML_ElementForceDataSize(ebml_element *Element, filepos_t Size); // type specific routines EBML_DLL ebml_element *EBML_MasterFindFirstElt(ebml_master *Element, const ebml_context *Context, bool_t bCreateIfNull, bool_t SetDefault, int ForProfile); EBML_DLL err_t EBML_MasterAppend(ebml_master *Element, ebml_element *Append); -EBML_DLL err_t EBML_MasterRemove(ebml_master *Element, ebml_element *Remove); EBML_DLL ebml_element *EBML_MasterFindNextElt(ebml_master *Element, const ebml_element *Current, bool_t bCreateIfNull, bool_t SetDefault, int ForProfile); EBML_DLL ebml_element *EBML_MasterAddElt(ebml_master *Element, const ebml_context *Context, bool_t SetDefault, int ForProfile); EBML_DLL size_t EBML_MasterCount(const ebml_master *Element); diff --git a/libebml2/ebmlmaster.c b/libebml2/ebmlmaster.c index f1f80b1f..45899e86 100644 --- a/libebml2/ebmlmaster.c +++ b/libebml2/ebmlmaster.c @@ -94,12 +94,6 @@ err_t EBML_MasterAppend(ebml_master *Element, ebml_element *Append) return Result; } -err_t EBML_MasterRemove(ebml_master *UNUSED_PARAM(Element), ebml_element *Append) -{ - err_t Result = NodeTree_SetParent(Append,NULL,NULL); - return Result; -} - size_t EBML_MasterCount(const ebml_master *Element) { size_t Result = 0; @@ -638,7 +632,6 @@ void EBML_MasterCheckContext(ebml_master *Element, int ProfileMask, bool_t (*Err Node_FromStr(Element,ClassString,TSIZEOF(ClassString),s->eClass->ElementName); if (ErrCallback && ErrCallback(cookie,MASTER_CHECK_PROFILE_INVALID,ClassString,i)) { - EBML_MasterRemove(Element,i); // make sure it doesn't remain in the list NodeDelete((node*)i); i=EBML_MasterChildren(Element); break; @@ -649,7 +642,6 @@ void EBML_MasterCheckContext(ebml_master *Element, int ProfileMask, bool_t (*Err Node_FromStr(Element,ClassString,TSIZEOF(ClassString),s->eClass->ElementName); if (ErrCallback && ErrCallback(cookie,MASTER_CHECK_MULTIPLE_UNIQUE,ClassString,SubElt)) { - EBML_MasterRemove(Element,i); // make sure it doesn't remain in the list NodeDelete((node*)i); i=EBML_MasterChildren(Element); break; diff --git a/mkclean/mkclean.c b/mkclean/mkclean.c index 25839958..aaff8e63 100644 --- a/mkclean/mkclean.c +++ b/mkclean/mkclean.c @@ -344,7 +344,6 @@ static void UpdateCues(ebml_master *Cues, ebml_master *Segment) NextCue =(ebml_master*)EBML_MasterNext(Cue); if (MATROSKA_CuePointUpdate((matroska_cuepoint*)Cue, (ebml_element*)Segment, DstProfile)!=ERR_NONE) { - EBML_MasterRemove(Cues,(ebml_element*)Cue); // make sure it doesn't remain in the list NodeDelete((node*)Cue); } } From a034609a40615d4294f9c286b942e49f711e98a0 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 2 Jan 2025 18:03:17 +0100 Subject: [PATCH 8/8] CMake: disable MSVC unreferenced formal parameter warnings There's no way to explicitly say the code is OK. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb97ce2..3c8e208e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ if(DEV_MODE) -W4 -we4013 # undefined; assuming extern returning int -we4005 # macro redefinition + -wd4100 # unreferenced formal parameter ) endif()