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-43


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-435-g0f37ac0
Date: Wed, 27 Feb 2013 10:04:58 +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  0f37ac043a59e5d051bf492c607a2bd488dd91e0 (commit)
      from  58f3ba7d04744457659548d9e10eeff43e401a24 (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=0f37ac043a59e5d051bf492c607a2bd488dd91e0


commit 0f37ac043a59e5d051bf492c607a2bd488dd91e0
Author: Daniele Forsi <address@hidden>
Date:   Wed Feb 27 10:47:52 2013 +0100

    Rewrite fake phonebook handling to work also on non C99 compilers
    
    Now it uses the raw format so we can easily test actual phonebook
    entries by first reading them from a real phone or by using the
    phonebook_convert utility from the gnokii-extras repository and
    then pasting them in fake.c.
    Also, since we didn't force gcc in c99 mode, the old code wasn't
    compiled by default.

diff --git a/ChangeLog b/ChangeLog
index 9c2ed97..cba89a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,8 @@
     o make it usable with gnome-phone-manager       (Daniele Forsi)
     o set TP-Validity-Period and update the testsuite to test it
                                                     (Daniele Forsi)
+    o rewrite fake phonebook handling to work also on non C99
+      compilers                                     (Daniele Forsi)
  * documentation updates
     o samples for connect and disconnect scripts for Portech
       devices                                   (Guillermo Benitez)
diff --git a/common/phones/fake.c b/common/phones/fake.c
index 1c22e55..4e1fa05 100644
--- a/common/phones/fake.c
+++ b/common/phones/fake.c
@@ -49,16 +49,6 @@ gn_driver driver_fake = {
        NULL
 };
 
-#if __STDC_VERSION__ >= 199901L
-#define HAVE_FAKE_PHONEBOOK 1
-gn_phonebook_entry fake_phonebook[] = {
-       { .location = 1, .empty = false, .name = "Test 1", .number = "1111", 
.subentries_count = 0 },
-       { .location = 2, .empty = false, .name = "Test 2", .number = "2222", 
.subentries_count = 0 },
-       { .location = 3, .empty = true },
-       { .location = 4, .empty = false, .name = "Test 4", .number = "4444", 
.subentries_count = 0 },
-};
-#endif
-
 /* Initialise is the only function allowed to 'use' state */
 static gn_error fake_initialise(struct gn_statemachine *state)
 {
@@ -442,13 +432,20 @@ size_t fake_encode(at_charset charset, char *dst, size_t 
dst_len, const char *sr
        return ret+1;
 }
 
+char *fake_phonebook[] = {
+       "Test 1;1111;ME;1;0\n",
+       "Test 2;2222;ME;2;0",
+       NULL,
+       "Test 4;4444;ME;4;0",
+       NULL
+};
+
 static gn_error fake_phonebookstatus(gn_data *data, struct gn_statemachine 
*state)
 {
-#if defined (HAVE_FAKE_PHONEBOOK)
        int location, used, free;
 
-       for (location = 0, used = 0, free = 0; location < 
sizeof(fake_phonebook) / sizeof(gn_phonebook_entry); location++) {
-               if (fake_phonebook[location].empty)
+       for (location = 0, used = 0, free = 0; location < 
sizeof(fake_phonebook) / sizeof(*fake_phonebook); location++) {
+               if (!fake_phonebook[location])
                        free++;
                else
                        used++;
@@ -458,9 +455,6 @@ static gn_error fake_phonebookstatus(gn_data *data, struct 
gn_statemachine *stat
        data->memory_status->free = free;
 
        return GN_ERR_NONE;
-#else
-       return GN_ERR_NOTIMPLEMENTED;
-#endif
 }
 
 static gn_error fake_writephonebook(gn_data *data, struct gn_statemachine 
*state)
@@ -494,13 +488,12 @@ static gn_error fake_writephonebook(gn_data *data, struct 
gn_statemachine *state
 
 static gn_error fake_readphonebook(gn_data *data, struct gn_statemachine 
*state)
 {
-#if defined (HAVE_FAKE_PHONEBOOK)
        gn_phonebook_entry *pe = data->phonebook_entry;
 
-       if (pe->location < 1 || pe->location > sizeof(fake_phonebook) / 
sizeof(gn_phonebook_entry))
+       if (pe->location < 1 || pe->location > sizeof(fake_phonebook) / 
sizeof(*fake_phonebook))
                return GN_ERR_INVALIDLOCATION;
 
-       if (fake_phonebook[pe->location - 1].empty)
+       if (!fake_phonebook[pe->location - 1])
 #if 1
                /* This is to emulate those phones that return error for empty 
locations */
                return GN_ERR_INVALIDLOCATION;
@@ -508,12 +501,7 @@ static gn_error fake_readphonebook(gn_data *data, struct 
gn_statemachine *state)
                return GN_ERR_EMPTYLOCATION;
 #endif
 
-       memcpy(pe, &fake_phonebook[pe->location - 1], 
sizeof(gn_phonebook_entry));
-
-       return GN_ERR_NONE;
-#else
-       return GN_ERR_NOTIMPLEMENTED;
-#endif 
+       return gn_file_phonebook_raw_parse(pe, fake_phonebook[pe->location - 
1]);
 }
 
 static gn_error fake_functions(gn_operation op, gn_data *data, struct 
gn_statemachine *state)

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

Summary of changes:
 ChangeLog            |    2 ++
 common/phones/fake.c |   38 +++++++++++++-------------------------
 2 files changed, 15 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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