Files
MINGW-packages/mingw-w64-itk/libminc-pr-129.patch
2025-07-08 08:45:19 +05:30

61 lines
2.2 KiB
Diff

From https://github.com/BIC-MNI/libminc/pull/129
--- a/Modules/ThirdParty/MINC/src/libminc/libcommon/ParseArgv.c
+++ b/Modules/ThirdParty/MINC/src/libminc/libcommon/ParseArgv.c
@@ -111,6 +111,16 @@
* Process an argv array according to a table of expected
* command-line options. See the manual page for more details.
*
+ * argcPtr: Number of arguments in argv. Modified to hold # args left in argv
+ * at end.
+ *
+ * argv: Array of arguments. Modified to hold those that couldn't be processed
+ * here.
+ *
+ * argTable: Array of option descriptions
+ *
+ * flags: Or'ed combination of various flag bits, such as ARGV_NO_DEFAULTS.
+ *
* Results:
* The return value is a Boolean value with non-zero indicating an
* error.
@@ -126,14 +136,7 @@
*/
int
-ParseArgv(argcPtr, argv, argTable, flags)
- int *argcPtr; /* Number of arguments in argv. Modified
- * to hold # args left in argv at end. */
- char **argv; /* Array of arguments. Modified to hold
- * those that couldn't be processed here. */
- ArgvInfo *argTable; /* Array of option descriptions */
- int flags; /* Or'ed combination of various flag bits,
- * such as ARGV_NO_DEFAULTS. */
+ParseArgv(int *argcPtr, char **argv, ArgvInfo *argTable, int flags)
{
ArgvInfo *infoPtr;
/* Pointer to the current entry in the
--- a/Modules/ThirdParty/MINC/src/libminc/libcommon/ParseArgv.c
+++ a/Modules/ThirdParty/MINC/src/libminc/libcommon/ParseArgv.c
@@ -318,7 +318,8 @@
}
break;
case ARGV_FUNC: {
- int (*handlerProc)() = (int (*)())(uintptr_t)infoPtr->src;
+ typedef int (*handlerProcType)(void*, const char*, char*);
+ handlerProcType handlerProc = (handlerProcType)(uintptr_t)infoPtr->src;
if ((*handlerProc)(infoPtr->dst, infoPtr->key,
argv[srcIndex])) {
@@ -328,7 +329,8 @@
break;
}
case ARGV_GENFUNC: {
- int (*handlerProc)() = (int (*)())(uintptr_t)infoPtr->src;
+ typedef int (*handlerProcType)(void*, const char*, int, char**);
+ handlerProcType handlerProc = (handlerProcType)(uintptr_t)infoPtr->src;
argc = (*handlerProc)(infoPtr->dst, infoPtr->key,
argc, argv+srcIndex);