Incorrect calls to DNA_find_struct_nr #38290

Closed
opened 2014-01-20 02:08:07 +01:00 by Lawrence D'Oliveiro · 5 comments

In the process of adding SCons support to #37228, I came across a couple of incorrect checks for the result from ##DNA_find_struct_nr##, in ##source/blender/makesrna/intern/rna_define.c##. The code was treating a result of 0 as failure and nonzero as success, when in fact a successful return is any non-negative integer, with -1 representing failure. This may have worked fine before, but it was triggering build failures for me.

Fixing the code to check the right result still resulted in build failures. This suggests to me that the calls are not even necessary. Commenting one of them out allowed my build to succeed.

The enclosed patch rna_define.patch changes the two problem calls, and comments out the one that still remains troublesome afterwards.

In the process of adding SCons support to #37228, I came across a couple of incorrect checks for the result from ##DNA_find_struct_nr##, in ##source/blender/makesrna/intern/rna_define.c##. The code was treating a result of 0 as failure and nonzero as success, when in fact a successful return is any non-negative integer, with -1 representing failure. This may have worked fine before, but it was triggering build failures for me. Fixing the code to check the right result still resulted in build failures. This suggests to me that the calls are not even necessary. Commenting one of them out allowed my build to succeed. The enclosed patch [rna_define.patch](https://archive.blender.org/developer/F70775/rna_define.patch) changes the two problem calls, and comments out the one that still remains troublesome afterwards.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @ldo

Added subscriber: @ldo
Campbell Barton self-assigned this 2014-01-20 03:19:34 +01:00

Checking on this, I think the check in RNA_def_struct_sdna can be used, it just needs to check DefRNA.verify first. will try modify the patch so the check can be kept.

Checking on this, I think the check in RNA_def_struct_sdna can be used, it just needs to check DefRNA.verify first. will try modify the patch so the check can be kept.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Good find, committed ece504aff8

Note, I looked into optionally enabling this check but turns out to be a bit of a mess and would mean adding new arguments or begin/end verification calls all over.

Good find, committed ece504aff8 Note, I looked into optionally enabling this check but turns out to be a bit of a mess and would mean adding new arguments or begin/end verification calls all over.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blender/blender#38290
No description provided.