[UDFS] Convert C++ to C for MinGW compatibility and apply chunked bitmap refactor#105
[UDFS] Convert C++ to C for MinGW compatibility and apply chunked bitmap refactor#105Copilot wants to merge 13 commits into
Conversation
- Rename all .cpp files to .c in the driver, udf_info, and Include directories - Update CMakeLists.txt to reference .c files and remove C++ specific flags - Convert C++ `using` type aliases to `typedef` in struct.h - Replace `static_assert` with `C_ASSERT` in struct.h - Add typedef forward declarations for struct types in struct.h - Remove `extern "C"` from protos.h and Include/string_lib.c - Update #include directives for renamed .c files - Update file header comments to reference .c filenames Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot |
- Add typedef struct FCB FCB in udf_rel.h to allow FCB* usage without struct prefix - Add typedef aliases in ecma_167.h for all struct types used without struct prefix - Add typedef aliases in osta_misc.h for all struct types used without struct prefix - Fix empty structs FCB_DATA and FCB_INDEX in struct.h (C requires at least one member) - Add typedef FCB_DATA, FCB_INDEX, UDFFSD_MEDIA_TYPE, VCB_CONDITION in struct.h Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
... Fixed in e8ae549. The errors cascaded from a single root cause: Additional fixes:
|
|
@copilot |
- Remove C++ default parameter values from UDFFlushFESpace, UDFFlushFile__, UDFFlushAFile, UDFFlushADirectory, UDFFlushVolume, UDFFlushIsBreaking, UDFGetRegParameter (protos.h/udf_info.h), UDFTRead/UDFTWrite (phys_lib.h) - Update all callers that relied on default values to pass explicit args: cleanup.c, create.c, close.c, mount.c, udf_info.c, fscntrl.c, shutdown.c, flush.c, write.c, phys_eject.c, phys_lib.c - Add typedef enum TYPE_OF_ACQUIRE in protos.h - Fix udf_dbg.h DbgPrint: PCH -> PCSTR to match system header signature Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
... Fixed in bedb7bd. These errors came from two C++ features not supported in C:
|
|
@copilot |
…ization `relPrevExt, prevExt = NULL;` caused C4047 (pointer/integer mismatch) in C mode since NULL expands to (void*)0. Changed to `relPrevExt = prevExt = 0;`. Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot |
… and UDFExtAllocDescToMapping Both declarations used PLONG_AD but definitions use PSHORT_AD and PEXT_AD respectively, causing C4028 (formal parameter different from declaration) treated as error in C mode. Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot |
In C mode NULL expands to (void*)0, causing C4047 when passed for ULONG InputBufferLength (param 4). Swap to NULL (PVOID) and 0 (ULONG) to match the function signature. Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
…OBJECT 'auto RealDevice = Vpb->RealDevice' used C++11 type deduction. In C, 'auto' is the old storage class specifier making the variable default to 'int', causing cascading C2223/C4047/C2198 errors on all uses of RealDevice (->Flags, ->DeviceType, UDFPhSendIOCTL calls, IoCreateStreamFileObject). Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
... Fixed in 4cc3b1b. All errors cascaded from |
|
@copilot |
In C, 'false' is not a keyword (it's defined in <stdbool.h>). Replace with the WDK 'FALSE' macro already available in the codebase. Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot |
- Line 910: FILE_ID FileId{} → FILE_ID FileId = {0}
- Line 1099: LocalPath = RTL_CONSTANT_STRING(...) → RtlInitUnicodeString()
Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot |
Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
|
@copilot Please make a version of https://patch-diff.githubusercontent.com/raw/Zero3K20/reactos/pull/79.diff that can apply to this PR with no errors. |
Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
Applied in 2480da1. The original |
Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
usingtype aliases instruct.htotypedefdeclarationsstatic_assertwithC_ASSERTinstruct.hstructkeyword instruct.hextern "C"fromprotos.hextern "C"fromInclude/string_lib.c.cppfiles to.cfiles (41 files total)CMakeLists.txtto reference.cfiles and remove C++ specific flags#includedirectives to reference.cfilestypedef struct FCB FCBinudf_info/udf_rel.hudf_info/ecma_167.hudf_info/osta_misc.hFCB_DATAandFCB_INDEXinstruct.hFCB_DATA,FCB_INDEX,UDFFSD_MEDIA_TYPE,VCB_CONDITIONinstruct.hudf_dbg.h: ChangePCH FormattoPCSTR FormatinDbgPrintdeclaration; replace{NOTHING;}macros with((void)0)udf_info/udf_info.h: Remove C++ default param= FLUSH_FE_KEEPfromUDFFlushFESpaceudf_info/udf_info.h: Remove C++ default param= 0fromUDFFlushFile__protos.h: Remove C++ default params fromUDFFlushAFile,UDFFlushADirectory,UDFFlushVolume,UDFFlushIsBreaking,UDFGetRegParameter; add declarations for new chunked bitmap functionsprotos.h: Addtypedef enum TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE;Include/phys_lib.h: Remove C++ default param= 0fromUDFTRead,UDFTWriteudf_info/mount.c(2738): ReplacerelPrevExt, prevExt = NULL;withrelPrevExt = prevExt = 0;udf_info/udf_info.h: CorrectPLONG_AD→PSHORT_ADinUDFShortAllocDescToMappingandPLONG_AD→PEXT_ADinUDFExtAllocDescToMappingInclude/phys_lib.c: Replace0,NULLwithNULL,0inUDFPhSendIOCTLcalls (param 3=PVOID, param 4=ULONG)udf_info/udf_info.c(4390): Replacereturn NULLwithreturn STATUS_UNSUCCESSFULinUDFReadTaggedfscntrl.c(299): Replaceauto RealDevice = Vpb->RealDevicewithPDEVICE_OBJECT RealDevice = Vpb->RealDevicemisc.c(714): Replace C++falsewith WDKFALSE; replaceKeAreAllApcsDisabled()withKeGetCurrentIrql() >= APC_LEVELstrucsup.c(910): Replace C++ value-initializationFILE_ID FileId{}withFILE_ID FileId = {0}strucsup.c(1099): Replace C++ struct assignment withRtlInitUnicodeStringwrite.c(256): Add missingFlags=0argument toUDFTWritecallUDF_BITMAP_CHUNKandUDF_CHUNKED_BITMAPtype definitions tostruct.h; replace flatFSBM_Bitmap/BSBM_Bitmap/FSBM_OldBitmappointers inVCBwithUDF_CHUNKED_BITMAPstructs and addFSBM_LockDepthudf_info/alloc.c(UDFInitChunkedBitmap,UDFFreeChunkedBitmap,UDFChunkedGetBit/SetBit/ClrBit/SetBits/ClrBits/GetBitmapLen/CountFreeBits, compress/decompress functions); update all bitmap access sitesudf_info/mount.c,udf_info/extent.c,udf_info/dirtree.c,fscntrl.cto use chunked bitmap API; addUDFDecompressBitmaps/UDFCompressBitmapscalls around exclusive bitmap locksread.c/write.c: AddFcbPagingIoResourceacquisition for paging I/O to prevent deadlocks; fixWait = true→Wait = TRUEcreate.c: Remove redundantUDFIsADirectorycheck for embedded-data flagInclude/mem_tools.c: Replace{NOTHING;}macros with((void)0)udf_info/udf_info.handudffs.hwith declarations for new chunked bitmap functionsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.