Maybe easiest and safest is to make sure sizeof(gphoto_gimme_struct) is big enough to hold some maximum number of args by declaring it a fixed size:

#define MAXARGS 339966
    t_atom argv[MAXARGS];

instead of

    t_atom *argv;

and then copy up to MAXARGS atoms in a loop:

    for (i = 0; (i < argc)&&(i < MAXARGS); ++i)
      threadargs->argv[i] = argv[i];

instead of

    threadArgs->argv = argv;

...or you could leave the struct alone and separately allocate the precise amount of memory for argc atoms, as

    threadArgs->argv = malloc(sizeof(*argv)*argc));

and then copy them over.

Martin


B. Bogart wrote:
Thanks Martin,

I can't get the syntax right, care to give me a hint?

B. Bogart

[email protected] wrote:
So what have I misunderstood?

argv is a pointer, it's size is 4. You're still not copying whatever argv is pointing to.

Martin

_______________________________________________
Pd-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev


_______________________________________________
Pd-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev




_______________________________________________
Pd-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev

Reply via email to