gnokii-commit
[Top][All Lists]
Advanced

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

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-23


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-239-gdb0279c
Date: Sun, 12 Jun 2011 09:57:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  db0279cce95adf6ea1cd689c6f57f4cdd5ef67ed (commit)
       via  1da7c31773d3080ee3eb546136a524be5c145fda (commit)
      from  d10718c5867aa5ada5d3a721bb4e057831bf81ae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=db0279cce95adf6ea1cd689c6f57f4cdd5ef67ed


commit db0279cce95adf6ea1cd689c6f57f4cdd5ef67ed
Author: Pawel Kot <address@hidden>
Date:   Sun Jun 12 11:54:15 2011 +0200

    Do not overwrite data->sms->user_data when sending SMS. Doing that it makes
    impossible to resend the same gn_sms structure for sequent send attempts.
    
    Currently it makes the full copy of gn_sms. In the future it should be
    changed to copy just gn_sms.user_data.

diff --git a/ChangeLog b/ChangeLog
index 289ad84..9167680 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
                                                         (Paweł Kot)
     o add id for Nokia 3109c to misc.c only; use model=series40
                                                (Alexandre A. Alves)
+    o fix gn_sms_send() so the message could be resent  (Paweł Kot)
  * nk6510 driver updates
     o fix calendar handling issues (few off-by-ones)    (Paweł Kot)
     o implement deletecalendarnote for series40 3rd+ Ed (Paweł Kot)
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index 7c6aa02..717da62 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -1593,6 +1593,9 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 {
        int i, total;
        int enc_chars, ext_chars;
+       gn_error retval;
+       gn_sms sms;
+       gn_sms *orig_sms;
 
        dprintf("=====> ENTER gn_sms_send()\n");
        /*
@@ -1600,6 +1603,15 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
         * total -- total number of octets to be sent
         */
 
+       /*
+        * We need to work on data->sms->user_data; let's have a copy of the
+        * original request so message could be resubmitted.
+        * FIXME: use for that only additional user_data structure
+        */
+       orig_sms = data->sms;
+       memcpy(&sms, data->sms, sizeof(gn_sms));
+       data->sms = &sms;
+
        /* Convert all the input strings to UTF-8 */
        if (data->sms->dcs.u.general.alphabet != GN_SMS_DCS_8bit) {
                i = 0;
@@ -1659,11 +1671,27 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 
        /* It will eventually get overwritten in sms_send_long() */
        data->sms->parts = 1;
+       
+       /*
+        * Make sure that we will not get any corruption if it was not
+        * initialized properly by the app.  Issue a warning that
+        * application may leak the memory
+        */
+       if (data->sms->reference) {
+               dprintf("data->sms->reference was not set to NULL. The app may 
not initialize it\nproperly or leak memory.\n");
+               data->sms->reference = NULL;
+       }
 
        if (total > MAX_SMS_PART)
-               return sms_send_long(data, state, total);
+               retval =  sms_send_long(data, state, total);
        else
-               return sms_send_single(data, state);
+               retval = sms_send_single(data, state);
+
+       data->sms = orig_sms;
+       data->sms->reference = sms.reference;
+       data->sms->parts = sms.parts;
+
+       return retval;
 }
 
 static gn_error sms_send_single(gn_data *data, struct gn_statemachine *state)

http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=1da7c31773d3080ee3eb546136a524be5c145fda


commit db0279cce95adf6ea1cd689c6f57f4cdd5ef67ed
Author: Pawel Kot <address@hidden>
Date:   Sun Jun 12 11:54:15 2011 +0200

    Do not overwrite data->sms->user_data when sending SMS. Doing that it makes
    impossible to resend the same gn_sms structure for sequent send attempts.
    
    Currently it makes the full copy of gn_sms. In the future it should be
    changed to copy just gn_sms.user_data.

diff --git a/ChangeLog b/ChangeLog
index 289ad84..9167680 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
                                                         (Paweł Kot)
     o add id for Nokia 3109c to misc.c only; use model=series40
                                                (Alexandre A. Alves)
+    o fix gn_sms_send() so the message could be resent  (Paweł Kot)
  * nk6510 driver updates
     o fix calendar handling issues (few off-by-ones)    (Paweł Kot)
     o implement deletecalendarnote for series40 3rd+ Ed (Paweł Kot)
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index 7c6aa02..717da62 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -1593,6 +1593,9 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 {
        int i, total;
        int enc_chars, ext_chars;
+       gn_error retval;
+       gn_sms sms;
+       gn_sms *orig_sms;
 
        dprintf("=====> ENTER gn_sms_send()\n");
        /*
@@ -1600,6 +1603,15 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
         * total -- total number of octets to be sent
         */
 
+       /*
+        * We need to work on data->sms->user_data; let's have a copy of the
+        * original request so message could be resubmitted.
+        * FIXME: use for that only additional user_data structure
+        */
+       orig_sms = data->sms;
+       memcpy(&sms, data->sms, sizeof(gn_sms));
+       data->sms = &sms;
+
        /* Convert all the input strings to UTF-8 */
        if (data->sms->dcs.u.general.alphabet != GN_SMS_DCS_8bit) {
                i = 0;
@@ -1659,11 +1671,27 @@ GNOKII_API gn_error gn_sms_send(gn_data *data, struct 
gn_statemachine *state)
 
        /* It will eventually get overwritten in sms_send_long() */
        data->sms->parts = 1;
+       
+       /*
+        * Make sure that we will not get any corruption if it was not
+        * initialized properly by the app.  Issue a warning that
+        * application may leak the memory
+        */
+       if (data->sms->reference) {
+               dprintf("data->sms->reference was not set to NULL. The app may 
not initialize it\nproperly or leak memory.\n");
+               data->sms->reference = NULL;
+       }
 
        if (total > MAX_SMS_PART)
-               return sms_send_long(data, state, total);
+               retval =  sms_send_long(data, state, total);
        else
-               return sms_send_single(data, state);
+               retval = sms_send_single(data, state);
+
+       data->sms = orig_sms;
+       data->sms->reference = sms.reference;
+       data->sms->parts = sms.parts;
+
+       return retval;
 }
 
 static gn_error sms_send_single(gn_data *data, struct gn_statemachine *state)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    1 +
 common/gsm-sms.c |   32 ++++++++++++++++++++++++++++++--
 po/de.po         |    2 +-
 3 files changed, 32 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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