CANopenNode / CANopenEditor

CANopen Object Dictionary Editor
GNU General Public License v3.0
120 stars 60 forks source link

bugfix: export of array of strings has dimensions switched #19

Closed nimrof closed 1 year ago

nimrof commented 2 years ago

The export of array of strings has a bug that makes the dimensions of the 2d array wrong. The dimensions are in the wrong order.

before fix: arrayOfStrings [length_of_string] [number_of_strings]

after fix: arrayOfStrings [number_of_strings] [length_of_string]

trojanobelix commented 1 year ago

Thanks for the PR Can you describe the problem in detail?. Can you provide a source file that shows the problem and one that fixed it?

nimrof commented 1 year ago

The problem is that if you want a array of 10 string of length 20 and you specify that in your od you get a array of 20 with length of 10 in the .c file. So the array size and length is switched.

Not sure what you mean with the source file, you want a exported .c file before and after?

edit: Thanks for taking the time to maintain the project

trojanobelix commented 1 year ago

Not sure what you mean with the source file, you want a exported .c file before and after?

Yes, that might be helpfull to reproduce.

nimrof commented 1 year ago

Yes, that might be helpfull to reproduce.

Attached a project and exported code from current main. source.zip

at CO_OD.h line 116 is the problem /*2000 */ VISIBLE_STRING stringTest[2][10];

What i expected is [10][2]