gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with gnokii 0.6.31git, smsd segmentation fault


From: Jan Derfinak
Subject: Re: Problem with gnokii 0.6.31git, smsd segmentation fault
Date: Tue, 7 Jun 2011 09:50:59 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

On Mon, 6 Jun 2011, Daniele Forsi wrote:

> 2011/6/6 Jan Derfinak:
> 
> > I think that it is not good that gnokii lib modifies gn_sms structure.
> 
> the problem is how to return a reference number for each part that has
> been sent because the code that calls gn_sms_send() doesn't know how
> many parts will be needed

So it is only for returning reference number?

What you think about such change:
GNOKII_API gn_error gn_sms_send(gn_data *data, struct gn_statemachine
*state, unsigned int **reference)
...

static gn_error sms_send_single(gn_data *data, struct gn_statemachine
*state, unsigned int **reference)
{
  ...
        /* We send SMS parts from the first part to last. */
        /* If reference argument is NULL, caller doesn't want to use
           reference */
        if (reference)
        {
                if (!*reference)
                        *reference =  calloc(data->sms->parts, sizeof(unsigned 
int));

                i = 0;
                while (i < data->sms->parts-1 && *reference[i] != 0)
                        i++;
                *reference[i] = data->raw_sms->reference;
        }
  ...


And the calling as follow:
In the case the reference is unneeded:

gn_sms_send (dt, sm, NULL);


In the case the reference is needed:

unsigned int *ref = NULL;
gn_sms_send (dt, sm, &ref);


Jan


-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]