Skip to content

Commit 0d88179

Browse files
committed
Fix error handling in paramGetValue
1 parent 8a9af08 commit 0d88179

2 files changed

Lines changed: 71 additions & 36 deletions

File tree

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"binaryDir": "${sourceDir}/build/${presetName}",
104104
"cacheVariables": {
105105
"BUILD_TESTING": "OFF",
106-
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
106+
"CMAKE_INSTALL_PREFIX": "c:/Projects/Shotcut",
107107
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
108108
"CMAKE_PREFIX_PATH": "C:/Qt/$env{QT_VERSION}/mingw_64;C:/msys64/mingw64;C:/msys64/clangarm64",
109109
"MOD_GLAXNIMATE_QT6": "ON",

src/modules/openfx/mlt_openfx.c

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -843,23 +843,31 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
843843

844844
OfxStatus status
845845
= propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, red);
846-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, green);
847-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, blue);
848-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 3, alpha);
846+
if (status == kOfxStatOK)
847+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, green);
848+
if (status == kOfxStatOK)
849+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, blue);
850+
if (status == kOfxStatOK)
851+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 3, alpha);
849852

850853
if (status != kOfxStatOK) {
851854
status
852855
= propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, red);
853-
status = propGetDouble((OfxPropertySetHandle) param_props,
854-
"OfxParamPropDefault",
855-
1,
856-
green);
857-
status
858-
= propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 2, blue);
859-
status = propGetDouble((OfxPropertySetHandle) param_props,
860-
"OfxParamPropDefault",
861-
3,
862-
alpha);
856+
if (status == kOfxStatOK)
857+
status = propGetDouble((OfxPropertySetHandle) param_props,
858+
"OfxParamPropDefault",
859+
1,
860+
green);
861+
if (status == kOfxStatOK)
862+
status = propGetDouble((OfxPropertySetHandle) param_props,
863+
"OfxParamPropDefault",
864+
2,
865+
blue);
866+
if (status == kOfxStatOK)
867+
status = propGetDouble((OfxPropertySetHandle) param_props,
868+
"OfxParamPropDefault",
869+
3,
870+
alpha);
863871
if (status != kOfxStatOK)
864872
return kOfxStatErrUnknown;
865873
}
@@ -870,18 +878,24 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
870878

871879
OfxStatus status
872880
= propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, red);
873-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, green);
874-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, blue);
881+
if (status == kOfxStatOK)
882+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, green);
883+
if (status == kOfxStatOK)
884+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, blue);
875885

876886
if (status != kOfxStatOK) {
877887
status
878888
= propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, red);
879-
status = propGetDouble((OfxPropertySetHandle) param_props,
880-
"OfxParamPropDefault",
881-
1,
882-
green);
883-
status
884-
= propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 2, blue);
889+
if (status == kOfxStatOK)
890+
status = propGetDouble((OfxPropertySetHandle) param_props,
891+
"OfxParamPropDefault",
892+
1,
893+
green);
894+
if (status == kOfxStatOK)
895+
status = propGetDouble((OfxPropertySetHandle) param_props,
896+
"OfxParamPropDefault",
897+
2,
898+
blue);
885899
if (status != kOfxStatOK)
886900
return kOfxStatErrUnknown;
887901
}
@@ -891,11 +905,16 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
891905

892906
OfxStatus status
893907
= propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, X);
894-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
908+
if (status == kOfxStatOK)
909+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
895910

896911
if (status != kOfxStatOK) {
897912
status = propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, X);
898-
status = propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
913+
if (status == kOfxStatOK)
914+
status = propGetDouble((OfxPropertySetHandle) param_props,
915+
"OfxParamPropDefault",
916+
1,
917+
Y);
899918
if (status != kOfxStatOK)
900919
return kOfxStatErrUnknown;
901920
}
@@ -904,11 +923,13 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
904923
int *Y = va_arg(ap, int *);
905924

906925
OfxStatus status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, X);
907-
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
926+
if (status == kOfxStatOK)
927+
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
908928

909929
if (status != kOfxStatOK) {
910930
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, X);
911-
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
931+
if (status == kOfxStatOK)
932+
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
912933
if (status != kOfxStatOK)
913934
return kOfxStatErrUnknown;
914935
}
@@ -919,13 +940,23 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
919940

920941
OfxStatus status
921942
= propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, X);
922-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
923-
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, Z);
943+
if (status == kOfxStatOK)
944+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
945+
if (status == kOfxStatOK)
946+
status = propGetDouble((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, Z);
924947

925948
if (status != kOfxStatOK) {
926949
status = propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, X);
927-
status = propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
928-
status = propGetDouble((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 2, Z);
950+
if (status == kOfxStatOK)
951+
status = propGetDouble((OfxPropertySetHandle) param_props,
952+
"OfxParamPropDefault",
953+
1,
954+
Y);
955+
if (status == kOfxStatOK)
956+
status = propGetDouble((OfxPropertySetHandle) param_props,
957+
"OfxParamPropDefault",
958+
2,
959+
Z);
929960
if (status != kOfxStatOK)
930961
return kOfxStatErrUnknown;
931962
}
@@ -935,13 +966,17 @@ static OfxStatus paramGetValueImpl(OfxParamHandle paramHandle, va_list ap)
935966
int *Z = va_arg(ap, int *);
936967

937968
OfxStatus status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 0, X);
938-
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
939-
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, Z);
969+
if (status == kOfxStatOK)
970+
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 1, Y);
971+
if (status == kOfxStatOK)
972+
status = propGetInt((OfxPropertySetHandle) param_props, "MltOfxParamValue", 2, Z);
940973

941974
if (status != kOfxStatOK) {
942975
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 0, X);
943-
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
944-
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 2, Z);
976+
if (status == kOfxStatOK)
977+
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 1, Y);
978+
if (status == kOfxStatOK)
979+
status = propGetInt((OfxPropertySetHandle) param_props, "OfxParamPropDefault", 2, Z);
945980
if (status != kOfxStatOK)
946981
return kOfxStatErrUnknown;
947982
}
@@ -2208,8 +2243,8 @@ static void mltofx_get_render_scale(mlt_properties image_effect, double *scale_x
22082243

22092244
int mltofx_allows_frame_threading(mlt_properties image_effect)
22102245
{
2211-
if (!image_effect)
2212-
return 0;
2246+
if (!image_effect)
2247+
return 0;
22132248

22142249
mlt_properties props = mlt_properties_get_properties(image_effect, "props");
22152250
if (!props)

0 commit comments

Comments
 (0)