[-]
[+]
|
Changed |
_service:tar_git:ofono.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,7 +1,7 @@
<services>
<service name="tar_git">
<param name="url">https://git.monich.net/git/ofono.git</param>
- <param name="branch">branch-1.28</param>
- <param name="revision">36c281e8</param>
+ <param name="branch">master</param>
+ <param name="revision">15d0364d</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.27+git1+branch.1.28.20220109222857.18.g36c281e8.tar.bz2/upstream/src/idmap.c
^
|
@@ -1,213 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <glib.h>
-
-#include "idmap.h"
-
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
-
-struct idmap {
- unsigned long *bits;
- unsigned int size;
- unsigned int min;
- unsigned int max;
-};
-
-static inline int ffz(unsigned long word)
-{
- return __builtin_ctzl(~word);
-}
-
-/*
- * Stolen from linux kernel lib/find_next_bit.c
- */
-static unsigned int find_next_zero_bit(const unsigned long *addr,
- unsigned int size,
- unsigned int offset)
-{
- const unsigned long *p = addr + offset / BITS_PER_LONG;
- unsigned int result = offset & ~(BITS_PER_LONG-1);
- unsigned long tmp;
-
- if (offset >= size)
- return size;
-
- size -= result;
- offset %= BITS_PER_LONG;
-
- if (offset) {
- tmp = *(p++);
- tmp |= ~0UL >> (BITS_PER_LONG - offset);
-
- if (size < BITS_PER_LONG)
- goto found_first;
-
- if (~tmp)
- goto found_middle;
-
- size -= BITS_PER_LONG;
- result += BITS_PER_LONG;
- }
-
- while (size & ~(BITS_PER_LONG-1)) {
- if (~(tmp = *(p++)))
- goto found_middle;
-
- size -= BITS_PER_LONG;
- result += BITS_PER_LONG;
- }
-
- if (!size)
- return result;
-
- tmp = *p;
-
-found_first:
- tmp |= ~0UL << size;
-
- if (tmp == ~0UL) /* Are any bits zero? */
- return result + size; /* Nope. */
-
-found_middle:
- return result + ffz(tmp);
-}
-
-struct idmap *idmap_new_from_range(unsigned int min, unsigned int max)
-{
- struct idmap *ret = g_new0(struct idmap, 1);
- unsigned int size = max - min + 1;
-
- ret->bits = g_new0(unsigned long,
- (size + BITS_PER_LONG - 1) / BITS_PER_LONG);
- ret->size = size;
- ret->min = min;
- ret->max = max;
-
- return ret;
-}
-
-struct idmap *idmap_new(unsigned int size)
-{
- return idmap_new_from_range(1, size);
-}
-
-void idmap_free(struct idmap *idmap)
-{
- g_free(idmap->bits);
- g_free(idmap);
-}
-
-void idmap_put(struct idmap *idmap, unsigned int id)
-{
- unsigned int offset = (id - idmap->min) / BITS_PER_LONG;
-
- id -= idmap->min;
-
- if (id > idmap->size)
- return;
-
- id %= BITS_PER_LONG;
-
- idmap->bits[offset] &= ~(1UL << id);
-}
-
-unsigned int idmap_alloc(struct idmap *idmap)
-{
- unsigned int bit;
- unsigned int offset;
-
- bit = find_next_zero_bit(idmap->bits, idmap->size, 0);
-
- if (bit >= idmap->size)
- return idmap->max + 1;
-
- offset = bit / BITS_PER_LONG;
- idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
-
- return bit + idmap->min;
-}
-
-void idmap_take(struct idmap *idmap, unsigned int id)
-{
- unsigned int bit = id - idmap->min;
- unsigned int offset;
-
- if (bit >= idmap->size)
- return;
-
- offset = bit / BITS_PER_LONG;
- idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
-}
-
-int idmap_find(struct idmap *idmap, unsigned int id)
-{
- unsigned int bit = id - idmap->min;
- unsigned int offset;
-
- if (bit >= idmap->size)
- return 0;
-
- offset = bit / BITS_PER_LONG;
- return (idmap->bits[offset] & (1UL << (bit % BITS_PER_LONG))) != 0;
-}
-
-/*
- * Allocate the next bit skipping the ids up to and including last. If there
- * is no free ids until the max id is encountered, the counter is wrapped back
- * to min and the search starts again.
- */
-unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
-{
- unsigned int bit;
- unsigned int offset;
-
- if (last < idmap->min || last > idmap->max)
- return idmap->max + 1;
-
- bit = find_next_zero_bit(idmap->bits, idmap->size,
- last - idmap->min + 1);
-
- if (bit >= idmap->size)
- return idmap_alloc(idmap);
-
- offset = bit / BITS_PER_LONG;
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.27+git1+branch.1.28.20220109222857.18.g36c281e8.tar.bz2/upstream/src/idmap.h
^
|
@@ -1,33 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-struct idmap;
-
-struct idmap *idmap_new(unsigned int size);
-void idmap_free(struct idmap *idmap);
-void idmap_put(struct idmap *idmap, unsigned int id);
-void idmap_take(struct idmap *idmap, unsigned int id);
-int idmap_find(struct idmap *idmap, unsigned int id);
-unsigned int idmap_alloc(struct idmap *idmap);
-unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last);
-struct idmap *idmap_new_from_range(unsigned int min, unsigned int max);
-unsigned int idmap_get_min(struct idmap *idmap);
-unsigned int idmap_get_max(struct idmap *idmap);
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.27+git1+branch.1.28.20220109222857.18.g36c281e8.tar.bz2/upstream/unit/test-idmap.c
^
|
@@ -1,121 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include "idmap.h"
-
-static void test_alloc(void)
-{
- struct idmap *idmap;
- unsigned int bit;
-
- idmap = idmap_new(2);
-
- g_assert(idmap);
- g_assert(idmap_get_min(idmap) == 1);
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
- g_assert(idmap_find(idmap, bit));
- g_assert(!idmap_find(idmap, idmap_get_max(idmap) + 1));
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 2);
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 3);
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 0);
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 1);
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
-
- idmap_put(idmap, 1);
- idmap_put(idmap, 2);
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
-
- idmap_put(idmap, 1);
- idmap_take(idmap, 1);
- idmap_take(idmap, 3);
- bit = idmap_alloc(idmap);
- g_assert(bit == 2);
-
- idmap_free(idmap);
-}
-
-static void test_alloc_next(void)
-{
- struct idmap *idmap;
- unsigned int bit;
-
- idmap = idmap_new(256);
-
- g_assert(idmap);
-
- bit = idmap_alloc_next(idmap, 255);
- g_assert(bit == 256);
-
- bit = idmap_alloc_next(idmap, 255);
- g_assert(bit == 1);
-
- while (idmap_alloc(idmap) < (sizeof(unsigned long) * 8) + 1);
- bit = idmap_alloc_next(idmap, 1);
- g_assert(bit == (sizeof(unsigned long) * 8) + 2);
-
- idmap_free(idmap);
-
- idmap = idmap_new(2);
-
- g_assert(idmap);
- g_assert(idmap_alloc_next(idmap, 0) == 3);
- g_assert(idmap_alloc_next(idmap, 3) == 3);
-
- bit = idmap_alloc_next(idmap, 1);
- g_assert(bit == 2);
-
- bit = idmap_alloc_next(idmap, 2);
- g_assert(bit == 1);
-
- idmap_free(idmap);
-}
-
-int main(int argc, char **argv)
-{
- g_test_init(&argc, &argv, NULL);
-
- g_test_add_func("/testidmap/alloc", test_alloc);
- g_test_add_func("/testidmap/alloc_next", test_alloc_next);
-
- return g_test_run();
-}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/ofono/include/voicecall.h
^
|
@@ -190,6 +190,10 @@
void ofono_voicecall_ringback_tone_notify(struct ofono_voicecall *vc,
const ofono_bool_t playTone);
+/* Since mer/1.27+git3 */
+ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
+ const char *number);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/ofono/src/common.c
^
|
@@ -424,7 +424,7 @@
}
const char *ofono_phone_number_to_string(const struct ofono_phone_number *ph,
- char buffer[/* OFONO_MAX_PHONE_NUMBER_BUFFER_SIZE */])
+ char buffer[/* OFONO_PHONE_NUMBER_BUFFER_SIZE */])
{
if (ph->type == 145 && (strlen(ph->number) > 0) &&
ph->number[0] != '+') {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/ofono/src/slot-manager.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2022 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -183,7 +183,8 @@
static void slot_manager_emit_all_queued_signals(OfonoSlotManagerObject *mgr);
static void slot_manager_update_ready(OfonoSlotManagerObject *mgr);
static enum slot_manager_dbus_signal slot_manager_update_modem_paths
- (OfonoSlotManagerObject *mgr) G_GNUC_WARN_UNUSED_RESULT;
+ (OfonoSlotManagerObject *mgr, gboolean imsi_change)
+ G_GNUC_WARN_UNUSED_RESULT;
static inline OfonoSlotBase *slot_base_cast(gpointer p)
{
@@ -375,7 +376,7 @@
(OfonoSlotManagerObject *mgr, enum slot_manager_dbus_signal extra)
{
slot_manager_dbus_signal(mgr->dbus, extra |
- slot_manager_update_modem_paths(mgr));
+ slot_manager_update_modem_paths(mgr, FALSE));
}
static void slot_update_data_role(OfonoSlotObject *slot,
@@ -421,34 +422,9 @@
{
OfonoSlotObject *slot = OFONO_SLOT_OBJECT(data);
OfonoSlotManagerObject *mgr = slot->manager;
- OfonoSlotObject *voice_slot = mgr->voice_slot;
- OfonoSlotObject *data_slot = mgr->data_slot;
- int signal_mask;
-
- /*
- * We want the first slot to be selected by default.
- * However, things may become available in pretty much
- * any order, so reset the slot pointers to NULL and let
- * slot_manager_update_modem_paths() to pick them again.
- */
- mgr->voice_slot = NULL;
- mgr->data_slot = NULL;
- mgr->pub.default_voice_path = NULL;
- mgr->pub.default_data_path = NULL;
- signal_mask = slot_manager_update_modem_paths(mgr);
- if (voice_slot != mgr->voice_slot) {
- if (!mgr->voice_slot) {
- DBG("No default voice SIM");
- }
- signal_mask |= SLOT_MANAGER_DBUS_SIGNAL_VOICE_PATH;
- }
- if (data_slot != mgr->data_slot) {
- if (!mgr->data_slot) {
- DBG("No default data SIM");
- }
- signal_mask |= SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH;
- }
- slot_manager_dbus_signal(mgr->dbus, signal_mask);
+
+ slot_manager_dbus_signal(mgr->dbus,
+ slot_manager_update_modem_paths(mgr, TRUE));
slot_manager_emit_all_queued_signals(mgr);
}
@@ -707,7 +683,7 @@
* queued signals mask but doesn't actually emit any signals.
*/
static enum slot_manager_dbus_signal slot_manager_update_modem_paths
- (OfonoSlotManagerObject *mgr)
+ (OfonoSlotManagerObject *mgr, gboolean imsi_change)
{
enum slot_manager_dbus_signal mask = SLOT_MANAGER_DBUS_SIGNAL_NONE;
OfonoSlotObject *slot = NULL;
@@ -719,7 +695,7 @@
if (mgr->default_voice_imsi) {
slot = slot_manager_find_slot_imsi(mgr,
mgr->default_voice_imsi);
- } else if (mgr->voice_slot) {
+ } else if (mgr->voice_slot && !imsi_change) {
/* Make sure that the slot is enabled and SIM is in */
slot = slot_manager_find_slot_imsi(mgr,
mgr->voice_slot->watch->imsi);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/ofono/src/voicecall.c
^
|
@@ -4663,3 +4663,10 @@
break;
}
}
+
+/* Since mer/1.27+git3 */
+ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
+ const char *number)
+{
+ return vc && number && is_emergency_number(vc, number);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/ofono/unit/test-slot-manager.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2022 Jolla Ltd.
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
@@ -51,6 +51,12 @@
#define TEST_SLOT_ERROR_KEY "SlotError"
#define TEST_CONFIG_DIR_TEMPLATE "test-saifish_manager-config-XXXXXX"
+#define SM_STORE "ril"
+#define SM_STORE_GROUP "Settings"
+#define SM_STORE_ENABLED_SLOTS "EnabledSlots"
+#define SM_STORE_DEFAULT_VOICE_SIM "DefaultVoiceSim"
+#define SM_STORE_DEFAULT_DATA_SIM "DefaultDataSim"
+
static GMainLoop *test_loop = NULL;
static GSList *test_drivers = NULL;
static struct ofono_slot_driver_reg *test_driver_reg = NULL;
@@ -1141,6 +1147,7 @@
/* Set data SIM IMSI */
fake_slot_manager_dbus.cb.set_default_data_imsi(m, TEST_IMSI);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
g_assert(!m->default_data_path); /* Modem is offline */
/* Data IMSI is signaled, path is not */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
@@ -1157,6 +1164,7 @@
fake_watch_emit_queued_signals(w);
/* Now is should point to our slot */
g_assert_cmpstr(m->default_data_path, == ,TEST_PATH);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
/* And D-Bus clients are notified */
g_assert(fake_slot_manager_dbus.signals &
SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
@@ -1166,6 +1174,7 @@
fake_slot_manager_dbus.cb.set_default_data_imsi(m, TEST_IMSI_1);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI_1);
g_assert(!m->default_data_path);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
/* And D-Bus clients are notified again */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1177,8 +1186,10 @@
/* Switch the SIM */
fake_watch_set_ofono_imsi(w, TEST_IMSI_1);
+ fake_watch_set_ofono_iccid(w, TEST_ICCID_1);
fake_watch_emit_queued_signals(w);
g_assert_cmpstr(m->default_data_path, == ,TEST_PATH);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
/* And D-Bus clients are notified of data path change */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1193,6 +1204,7 @@
g_assert_cmpint(m->slots[0]->sim_presence, == ,OFONO_SLOT_SIM_ABSENT);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI_1);
g_assert(!m->default_data_path);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
/* And D-Bus clients are notified of data path change */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1200,6 +1212,20 @@
SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
fake_slot_manager_dbus.signals &= ~SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI;
+ /* Insert the SIM back */
+ fake_watch_set_ofono_sim(w, &sim);
+ ofono_slot_set_sim_presence(s, OFONO_SLOT_SIM_PRESENT);
+ g_assert_cmpint(s->sim_presence, == ,OFONO_SLOT_SIM_PRESENT);
+ fake_watch_set_ofono_iccid(w, TEST_ICCID_1);
+ fake_watch_set_ofono_imsi(w, TEST_IMSI_1);
+ fake_watch_emit_queued_signals(w);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
+ g_assert_cmpuint(fake_slot_manager_dbus.signals &
+ (SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
+ SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH), == ,
+ SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
+ fake_slot_manager_dbus.signals &= ~SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI;
+
ofono_watch_unref(w);
g_main_loop_quit(test_loop);
return G_SOURCE_REMOVE;
@@ -1629,6 +1655,102 @@
test_common_deinit();
}
+/* ==== config_storage ==== */
+
+static gboolean test_config_storage_run(gpointer user_data)
+{
+ TestDriverData *dd = user_data;
+ struct ofono_slot_manager *m = fake_slot_manager_dbus.m;
+ struct ofono_slot *s = ofono_slot_add(dd->manager, TEST_PATH,
+ OFONO_RADIO_ACCESS_MODE_GSM, TEST_IMEI, TEST_IMEISV,
+ OFONO_SLOT_SIM_PRESENT, OFONO_SLOT_NO_FLAGS);
+ struct ofono_slot *s2 = ofono_slot_add(dd->manager, TEST_PATH_1,
+ OFONO_RADIO_ACCESS_MODE_GSM, TEST_IMEI_1, TEST_IMEISV,
+ OFONO_SLOT_SIM_PRESENT, OFONO_SLOT_NO_FLAGS);
+ char *storage_file = g_build_filename(STORAGEDIR, SM_STORE, NULL);
+ GKeyFile *storage;
+ char **slots;
+ char* val;
+
+ DBG("");
+
+ /* Unblocking D-Bus clients will exit the loop */
+ fake_slot_manager_dbus.fn_block_changed =
+ test_quit_loop_when_unblocked;
+
+ /* Finish initialization with 2 slots */
+ g_assert(s);
+ g_assert(s2);
+ g_assert(!m->ready);
+ ofono_slot_driver_started(test_driver_reg);
+ ofono_slot_unref(s);
+ ofono_slot_unref(s2);
+ g_assert(m->ready);
+
+ /* No file yet */
+ storage = g_key_file_new();
+ g_assert(!g_key_file_load_from_file(storage, storage_file, 0, NULL));
+
+ /* Enable one slot */
+ slots = gutil_strv_add(NULL, TEST_PATH);
+ fake_slot_manager_dbus.cb.set_enabled_slots(m, slots);
+ g_assert(m->slots[0]->enabled);
+ g_assert(!m->slots[1]->enabled);
+
+ /* Check the config file */
+ g_assert(g_key_file_load_from_file(storage, storage_file, 0, NULL));
+ val = g_key_file_get_string(storage, SM_STORE_GROUP,
+ SM_STORE_ENABLED_SLOTS, NULL);
+ g_assert_cmpstr(val, == ,TEST_PATH);
+ g_free(val);
+ g_key_file_free(storage);
+
+ /* Enable both slots */
+ slots = gutil_strv_add(slots, TEST_PATH_1);
+ fake_slot_manager_dbus.cb.set_enabled_slots(m, slots);
+ g_assert(m->slots[0]->enabled);
+ g_assert(m->slots[1]->enabled);
+ g_strfreev(slots);
+
+ /* There's no [EnabledSlots] there because it's the default config */
+ storage = g_key_file_new();
+ g_assert(g_key_file_load_from_file(storage, storage_file, 0, NULL));
+ g_assert(!g_key_file_get_string(storage, SM_STORE_GROUP,
+ SM_STORE_ENABLED_SLOTS, NULL));
+ g_key_file_free(storage);
+
+ g_free(storage_file);
+ return G_SOURCE_REMOVE;
+}
+
+static guint test_config_storage_start(TestDriverData *dd)
+{
+ return g_idle_add(test_config_storage_run, dd);
+}
+
+static void test_config_storage(void)
+{
+ static const struct ofono_slot_driver test_config_storage_d = {
+ .name = "config_storage",
+ .api_version = OFONO_SLOT_API_VERSION,
+ .init = test_driver_init,
+ .start = test_config_storage_start,
+ .cleanup = test_driver_cleanup
+ };
+
+ test_common_init();
+
+ test_driver_reg = ofono_slot_driver_register(&test_config_storage_d);
+ g_assert(test_driver_reg);
+ g_main_loop_run(test_loop);
+ g_assert(test_timeout_id);
+
+ ofono_slot_driver_unregister(test_driver_reg);
+ test_driver_reg = NULL;
+ test_common_deinit();
+}
+
+
/* ==== storage ==== */
static void test_storage_init()
@@ -1805,6 +1927,7 @@
g_test_add_data_func(TEST_("auto_data_sim_once"), "once",
test_auto_data_sim);
g_test_add_func(TEST_("multisim"), test_multisim);
+ g_test_add_func(TEST_("config_storage"), test_config_storage);
g_test_add_func(TEST_("storage"), test_storage);
return g_test_run();
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/AUTHORS
^
|
@@ -139,3 +139,5 @@
Julien Tournier <tournier.julien@gmail.com>
Nandini Rebello <nandini.rebello@intel.com>
Giacinto Cifelli <gciofono@gmail.com>
+Khaled Romdhani <khaledromdhani216@gmail.com>
+Pavel Machek <pavel@ucw.cz>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/ChangeLog
^
|
@@ -1,3 +1,6 @@
+ver 1.28:
+ Fix issue with SIM initialization and Gemalto modems.
+
ver 1.27:
Add support for handling SIMCom based SIM800 modems.
Add support for SIM lock state with xmm7xxx modems.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/Makefile.am
^
|
@@ -30,7 +30,9 @@
ell/checksum.h \
ell/random.h \
ell/uuid.h \
- ell/file.h
+ ell/file.h \
+ ell/uintset.h \
+ ell/string.h
ell_sources = ell/private.h \
ell/missing.h \
@@ -48,7 +50,9 @@
ell/checksum.c \
ell/random.c \
ell/uuid.c \
- ell/file.c
+ ell/file.c \
+ ell/uintset.c \
+ ell/string.c
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
endif
@@ -699,8 +703,8 @@
src/phonebook.c src/history.c src/message-waiting.c \
src/simutil.h src/simutil.c src/storage.h \
src/storage.c src/cbs.c src/watch.c src/call-volume.c \
- src/gprs.c src/idmap.h src/idmap.c \
- src/radio-settings.c src/stkutil.h src/stkutil.c \
+ src/gprs.c src/radio-settings.c \
+ src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
@@ -892,7 +896,7 @@
unit_objects =
-unit_tests = unit/test-common unit/test-util unit/test-idmap \
+unit_tests = unit/test-common unit/test-util \
unit/test-simutil unit/test-stkutil \
unit/test-sms unit/test-cdmasms \
unit/test-mbim \
@@ -905,40 +909,36 @@
unit/test-sms-root unit/test-mux unit/test-caif
unit_test_common_SOURCES = unit/test-common.c src/common.c src/util.c
-unit_test_common_LDADD = @GLIB_LIBS@
+unit_test_common_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_common_OBJECTS)
unit_test_util_SOURCES = unit/test-util.c src/util.c
-unit_test_util_LDADD = @GLIB_LIBS@
+unit_test_util_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_utils_OBJECTS)
-unit_test_idmap_SOURCES = unit/test-idmap.c src/idmap.c
-unit_test_idmap_LDADD = @GLIB_LIBS@
-unit_objects += $(unit_test_idmap_OBJECTS)
-
unit_test_simutil_SOURCES = unit/test-simutil.c src/util.c \
src/simutil.c src/smsutil.c src/storage.c
-unit_test_simutil_LDADD = @GLIB_LIBS@
+unit_test_simutil_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_simutil_OBJECTS)
unit_test_stkutil_SOURCES = unit/test-stkutil.c unit/stk-test-data.h \
src/util.c \
src/storage.c src/smsutil.c \
src/simutil.c src/stkutil.c
-unit_test_stkutil_LDADD = @GLIB_LIBS@
+unit_test_stkutil_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_stkutil_OBJECTS)
unit_test_sms_SOURCES = unit/test-sms.c src/util.c src/smsutil.c src/storage.c
-unit_test_sms_LDADD = @GLIB_LIBS@
+unit_test_sms_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_sms_OBJECTS)
unit_test_cdmasms_SOURCES = unit/test-cdmasms.c src/cdma-smsutil.c
-unit_test_cdmasms_LDADD = @GLIB_LIBS@
+unit_test_cdmasms_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_cdmasms_OBJECTS)
unit_test_sms_root_SOURCES = unit/test-sms-root.c \
src/util.c src/smsutil.c src/storage.c
-unit_test_sms_root_LDADD = @GLIB_LIBS@
+unit_test_sms_root_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_sms_root_OBJECTS)
unit_test_mux_SOURCES = unit/test-mux.c $(gatchat_sources)
@@ -964,28 +964,32 @@
unit/test-rilmodem-cs.c \
drivers/rilmodem/call-settings.c
unit_test_rilmodem_cs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_cs_OBJECTS)
unit_test_rilmodem_sms_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-sms.c \
drivers/rilmodem/sms.c
unit_test_rilmodem_sms_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_sms_OBJECTS)
unit_test_rilmodem_cb_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-cb.c \
drivers/rilmodem/call-barring.c
unit_test_rilmodem_cb_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_cb_OBJECTS)
unit_test_rilmodem_gprs_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-gprs.c \
drivers/rilmodem/gprs.c
unit_test_rilmodem_gprs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_gprs_OBJECTS)
unit_test_mbim_SOURCES = unit/test-mbim.c \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/acinclude.m4
^
|
@@ -12,7 +12,8 @@
AC_DEFUN([COMPILER_FLAGS], [
if (test "${CFLAGS}" = ""); then
- CFLAGS="-Wall -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
+ CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions"
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
fi
if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS="$CFLAGS -Werror -Wextra"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(ofono, 1.27)
+AC_INIT(ofono, 1.28)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/atmodem/phonebook.c
^
|
@@ -29,6 +29,7 @@
#include <errno.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -86,16 +87,12 @@
if (g_at_result_iter_next_hexstring(iter, &hex, &len) == FALSE)
return FALSE;
- utf8 = g_convert((const gchar*) hex, len,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
-
- if (utf8) {
- *str = utf8;
- return TRUE;
- }
+ utf8 = l_utf8_from_ucs2be(hex, len);
+ if (!utf8)
+ return FALSE;
- return FALSE;
+ *str = utf8;
+ return TRUE;
}
/*
@@ -103,7 +100,7 @@
* characters, same as in UTF8
*/
if (g_at_result_iter_next_string(iter, &string)) {
- *str = g_strdup(string);
+ *str = l_strdup(string);
return TRUE;
}
@@ -187,12 +184,12 @@
adtype, secondtext, email,
sip_uri, tel_uri);
- g_free(text);
- g_free(group);
- g_free(secondtext);
- g_free(email);
- g_free(sip_uri);
- g_free(tel_uri);
+ l_free(text);
+ l_free(group);
+ l_free(secondtext);
+ l_free(email);
+ l_free(sip_uri);
+ l_free(tel_uri);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/atmodem/sms.c
^
|
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -921,7 +922,7 @@
if (len != tpdu_len)
goto err;
- d->cnma_ack_pdu = encode_hex(pdu, tpdu_len, 0);
+ d->cnma_ack_pdu = l_util_hexstring(pdu, tpdu_len);
if (d->cnma_ack_pdu == NULL)
goto err;
@@ -1318,7 +1319,7 @@
{
struct sms_data *data = ofono_sms_get_data(sms);
- g_free(data->cnma_ack_pdu);
+ l_free(data->cnma_ack_pdu);
if (data->timeout_source > 0)
g_source_remove(data->timeout_source);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/atmodem/ussd.c
^
|
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -87,12 +88,12 @@
return NULL;
if (written > 182) {
- g_free(gsm);
+ l_free(gsm);
return NULL;
}
- packed = pack_7bit_own_buf(gsm, written, 0, TRUE, msg_len, 0, msg);
- g_free(gsm);
+ packed = pack_7bit_own_buf(gsm, written, 0, true, msg_len, 0, msg);
+ l_free(gsm);
return packed;
}
@@ -136,7 +137,7 @@
switch (data->charset) {
case AT_UTIL_CHARSET_GSM:
msg_ptr = pack_7bit_own_buf((const guint8 *) content,
- -1, 0, TRUE, &msg_len,
+ -1, 0, true, &msg_len,
0, msg);
break;
@@ -200,7 +201,7 @@
unsigned char unpacked_buf[182];
long written;
- unpack_7bit_own_buf(pdu, len, 0, TRUE, sizeof(unpacked_buf),
+ unpack_7bit_own_buf(pdu, len, 0, true, sizeof(unpacked_buf),
&written, 0, unpacked_buf);
if (written < 1)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/ifxmodem/gprs-context.c
^
|
@@ -616,9 +616,11 @@
DBG("");
- if (stat(TUN_DEV, &st) < 0) {
- ofono_error("Missing support for TUN/TAP devices");
- return -ENODEV;
+ if (vendor != OFONO_VENDOR_XMM) {
+ if (stat(TUN_DEV, &st) < 0) {
+ ofono_error("Missing support for TUN/TAP devices");
+ return -ENODEV;
+ }
}
if (vendor != OFONO_VENDOR_XMM) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/rilmodem/call-forwarding.c
^
|
@@ -37,7 +37,9 @@
#include <ofono/call-forwarding.h>
#include "common.h"
+#if __GNUC__ > 7
#pragma GCC diagnostic ignored "-Wrestrict"
+#endif
#include "gril.h"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/rilmodem/network-registration.c
^
|
@@ -36,7 +36,9 @@
#include <ofono/modem.h>
#include <ofono/netreg.h>
+#if __GNUC__ > 7
#pragma GCC diagnostic ignored "-Wrestrict"
+#endif
#include <gril/gril.h>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/rilmodem/phonebook.c
^
|
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono.h>
#include <ofono/log.h>
@@ -180,29 +181,22 @@
if (number_length != UNUSED && number_length != 0) {
number_length--;
/* '+' + number + terminator */
- number = g_try_malloc0(2 * number_length + 2);
+ number = g_new(char, 2 * number_length + 2);
+ prefix = 0;
- if (number) {
- prefix = 0;
-
- if ((msg[number_start + 1] & TON_MASK)
- == TON_INTERNATIONAL) {
- number[0] = '+';
- prefix = 1;
- }
-
- for (i = 0; i < number_length; i++) {
-
- number[2 * i + prefix] =
- digit_to_utf8[msg[number_start + 2 + i]
- & 0x0f];
- number[2 * i + 1 + prefix] =
- digit_to_utf8[msg[number_start + 2 + i]
- >> 4];
- }
+ if ((msg[number_start + 1] & TON_MASK) == TON_INTERNATIONAL) {
+ number[0] = '+';
+ prefix = 1;
+ }
- extension_record = msg[len - 1];
+ for (i = 0; i < number_length; i++) {
+ number[2 * i + prefix] =
+ digit_to_utf8[msg[number_start + 2 + i] & 0x0f];
+ number[2 * i + 1 + prefix] =
+ digit_to_utf8[msg[number_start + 2 + i] >> 4];
}
+
+ extension_record = msg[len - 1];
}
DBG("ADN name %s, number %s ", name, number);
@@ -212,12 +206,7 @@
if ((name == NULL || *name == '\0') && number == NULL)
goto end;
- new_entry = g_try_malloc0(sizeof(*new_entry));
- if (new_entry == NULL) {
- ofono_error("%s: out of memory", __func__);
- goto end;
- }
-
+ new_entry = l_new(struct phonebook_entry, 1);
new_entry->name = name;
new_entry->number = number;
@@ -246,8 +235,8 @@
return new_entry;
end:
- g_free(name);
- g_free(number);
+ l_free(name);
+ l_free(number);
return NULL;
}
@@ -314,17 +303,17 @@
if (entry) {
/* If one already exists, delete it */
if (entry->sne)
- g_free(entry->sne);
+ l_free(entry->sne);
DBG("Adding SNE %s to %d", sne, rec_data->adn_idx);
DBG("name %s", entry->name);
entry->sne = sne;
} else {
- g_free(sne);
+ l_free(sne);
}
} else {
- g_free(sne);
+ l_free(sne);
}
}
@@ -358,9 +347,7 @@
number_length--;
/* '+' + number + terminator */
- anr = g_try_malloc0(2 * number_length + 2);
- if (anr == NULL)
- return;
+ anr = l_new(char, 2 * number_length + 2);
prefix = 0;
if ((msg[2] & TON_MASK) == TON_INTERNATIONAL) {
@@ -376,13 +363,13 @@
entry = g_tree_lookup(ref->phonebook,
GINT_TO_POINTER(rec_data->adn_idx));
if (entry == NULL) {
- g_free(anr);
+ l_free(anr);
return;
}
/* If one already exists, delete it */
if (entry->anr)
- g_free(entry->anr);
+ l_free(entry->anr);
DBG("Adding ANR %s to %d", anr, rec_data->adn_idx);
DBG("name %s", entry->name);
@@ -427,20 +414,20 @@
email = sim_string_to_utf8(msg, len);
if (email == NULL || *email == '\0') {
- g_free(email);
+ l_free(email);
return;
}
entry = g_tree_lookup(ref->phonebook,
GINT_TO_POINTER(rec_data->adn_idx));
if (entry == NULL) {
- g_free(email);
+ l_free(email);
return;
}
/* if one already exists, delete it */
if (entry->email)
- g_free(entry->email);
+ l_free(entry->email);
DBG("Adding email to entry %d", rec_data->adn_idx);
DBG("name %s", entry->name);
@@ -582,12 +569,12 @@
entry->email,
NULL, NULL);
- g_free(entry->name);
- g_free(entry->number);
- g_free(entry->email);
- g_free(entry->anr);
- g_free(entry->sne);
- g_free(entry);
+ l_free(entry->name);
+ l_free(entry->number);
+ l_free(entry->email);
+ l_free(entry->anr);
+ l_free(entry->sne);
+ l_free(entry);
return FALSE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/rilmodem/sim.c
^
|
@@ -31,6 +31,7 @@
#include <errno.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -150,7 +151,7 @@
int sw1, sw2;
char *hex_response;
unsigned char *response = NULL;
- long len;
+ size_t len;
gboolean ok = FALSE;
int flen = 0, rlen = 0, str = 0;
guchar access[3] = { 0x00, 0x00, 0x00 };
@@ -173,7 +174,7 @@
goto error;
if (hex_response != NULL) {
- response = decode_hex(hex_response, -1, &len, -1);
+ response = l_util_from_hexstring(hex_response, &len);
g_free(hex_response);
hex_response = NULL;
@@ -217,9 +218,6 @@
return;
}
- if (len < 0)
- goto error;
-
if (response[0] == 0x62) {
ok = sim_parse_3g_get_response(response, len,
&flen, &rlen, &str,
@@ -230,7 +228,7 @@
&flen, &rlen, &str,
access, &file_status);
- g_free(response);
+ l_free(response);
if (!ok)
goto error;
@@ -240,7 +238,7 @@
return;
error:
- g_free(response);
+ l_free(response);
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
EF_STATUS_INVALIDATED, cbd->data);
}
@@ -291,7 +289,7 @@
if (len == 0)
return NULL;
- return encode_hex(comm_path, len, 0);
+ return l_util_hexstring(comm_path, len);
}
static void ril_sim_read_info(struct ofono_sim *sim, int fileid,
@@ -346,7 +344,7 @@
"0,0,15,(null),pin2=(null),aid=%s)",
CMD_GET_RESPONSE, fileid, hex_path,
sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_info_cb, cbd, g_free) > 0)
@@ -366,7 +364,7 @@
int sw1, sw2;
char *hex_response;
unsigned char *response = NULL;
- long len;
+ size_t len;
if (message->error != RIL_E_SUCCESS) {
ofono_error("RILD reply failure: %s",
@@ -380,7 +378,7 @@
if (hex_response == NULL)
goto error;
- response = decode_hex(hex_response, -1, &len, -1);
+ response = l_util_from_hexstring(hex_response, &len);
g_free(hex_response);
hex_response = NULL;
@@ -390,11 +388,11 @@
}
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
- g_free(response);
+ l_free(response);
return;
error:
- g_free(response);
+ l_free(response);
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
}
@@ -477,7 +475,7 @@
CMD_READ_BINARY, fileid, hex_path,
start >> 8, start & 0xff,
length, sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_io_cb, cbd, g_free) > 0)
@@ -527,7 +525,7 @@
"%d,%d,%d,(null),pin2=(null),aid=%s)",
CMD_READ_RECORD, fileid, hex_path,
record, 4, length, sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_io_cb, cbd, g_free) > 0)
@@ -563,7 +561,7 @@
p1 = start >> 8;
p2 = start & 0xff;
- hex_data = encode_hex(value, length, 0);
+ hex_data = l_util_hexstring(value, length);
parcel_init(&rilp);
parcel_w_int32(&rilp, CMD_UPDATE_BINARY);
@@ -584,8 +582,8 @@
"%d,%d,%d,%s,pin2=(null),aid=%s),",
CMD_UPDATE_BINARY, fileid, hex_path,
p1, p2, length, hex_data, sd->aid_str);
- g_free(hex_path);
- g_free(hex_data);
+ l_free(hex_path);
+ l_free(hex_data);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_write_cb, cbd, g_free) > 0)
@@ -619,7 +617,7 @@
goto error;
}
- hex_data = encode_hex(value, length, 0);
+ hex_data = l_util_hexstring(value, length);
parcel_init(&rilp);
parcel_w_int32(&rilp, CMD_UPDATE_RECORD);
@@ -641,8 +639,8 @@
CMD_UPDATE_RECORD, fileid, hex_path,
record, access_mode, length, hex_data,
sd->aid_str);
- g_free(hex_path);
- g_free(hex_data);
+ l_free(hex_path);
+ l_free(hex_data);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_write_cb, cbd, g_free) > 0)
@@ -951,10 +949,10 @@
goto error;
}
- hex_dump = encode_hex((unsigned char *) data, len, '\0');
+ hex_dump = l_util_hexstring((const unsigned char *) data, len);
g_ril_append_print_buf(sd->ril, "{%d,%s}", len, hex_dump);
g_ril_print_response(sd->ril, message);
- g_free(hex_dump);
+ l_free(hex_dump);
expected = sizeof(int32_t) * 5;
if (len < expected) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/rilmodem/stk.c
^
|
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -94,20 +95,21 @@
struct stk_data *sd = cbd->user;
struct parcel rilp;
unsigned char *response = NULL;
- long len = 0;
- char *pdu;
g_ril_print_response(sd->ril, message);
if (message->error == RIL_E_SUCCESS) {
+ char *pdu;
+ size_t len;
+
g_ril_init_parcel(message, &rilp);
pdu = parcel_r_string(&rilp);
if (pdu)
- response = decode_hex(pdu, -1, &len, -1);
+ response = l_util_from_hexstring(pdu, &len);
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
- g_free(response);
+ l_free(response);
} else {
ofono_error("%s RILD reply failure: %s",
g_ril_request_id_to_string(sd->ril, message->req),
@@ -145,32 +147,32 @@
{
struct ofono_stk *stk = user_data;
struct parcel rilp;
- long pdulen;
+ size_t pdulen;
unsigned char *pdu;
DBG("");
g_ril_init_parcel(message, &rilp);
- pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
+ pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
ofono_stk_proactive_command_notify(stk, pdulen, pdu);
- g_free(pdu);
+ l_free(pdu);
}
static void ril_stk_event_notify(struct ril_msg *message, gpointer user_data)
{
struct ofono_stk *stk = user_data;
struct parcel rilp;
- long pdulen;
+ size_t pdulen;
unsigned char *pdu;
DBG("");
g_ril_init_parcel(message, &rilp);
- pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
+ pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
ofono_stk_proactive_command_handled_notify(stk, pdulen, pdu);
- g_free(pdu);
+ l_free(pdu);
}
static void ril_stk_session_end_notify(struct ril_msg *message,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/drivers/speedupmodem/ussd.c
^
|
@@ -98,7 +98,7 @@
cbd->user = ussd;
- unpack_7bit_own_buf(pdu, len, 0, TRUE, sizeof(coded_buf),
+ unpack_7bit_own_buf(pdu, len, 0, true, sizeof(coded_buf),
&written, 0, (unsigned char *)coded_buf);
if (written < 1)
goto error;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/plugins/gemalto.c
^
|
@@ -573,9 +573,6 @@
ofono_devinfo_create(modem, 0, "atmodem", data->app);
ofono_location_reporting_create(modem, 0, "gemaltomodem", data->app);
- ofono_modem_set_integer(modem, "GemaltoVtsQuotes", 1);
- ofono_voicecall_create(modem, 0, "gemaltomodem", data->app);
-
data->sim = ofono_sim_create(modem, OFONO_VENDOR_GEMALTO, "atmodem",
data->app);
@@ -604,11 +601,6 @@
ofono_ussd_create(modem, 0, "atmodem", data->app);
- ofono_call_forwarding_create(modem, 0, "atmodem", data->app);
- ofono_call_settings_create(modem, 0, "atmodem", data->app);
- ofono_call_meter_create(modem, 0, "atmodem", data->app);
- ofono_call_barring_create(modem, 0, "atmodem", data->app);
-
if (!g_strcmp0(model, GEMALTO_MODEL_ALS3_PLS8x))
ofono_lte_create(modem, OFONO_VENDOR_GEMALTO,
"atmodem", data->app);
@@ -621,6 +613,14 @@
DBG("%p", modem);
ofono_netreg_create(modem, OFONO_VENDOR_GEMALTO, "atmodem", data->app);
+
+ ofono_modem_set_integer(modem, "GemaltoVtsQuotes", 1);
+ ofono_voicecall_create(modem, 0, "gemaltomodem", data->app);
+
+ ofono_call_forwarding_create(modem, 0, "atmodem", data->app);
+ ofono_call_settings_create(modem, 0, "atmodem", data->app);
+ ofono_call_meter_create(modem, 0, "atmodem", data->app);
+ ofono_call_barring_create(modem, 0, "atmodem", data->app);
}
static struct ofono_modem_driver gemalto_driver = {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/gprs.c
^
|
@@ -36,6 +36,7 @@
#include <arpa/inet.h>
#include <stdbool.h>
+#include <ell/ell.h>
#include <glib.h>
#include <gdbus.h>
@@ -43,7 +44,6 @@
#include "common.h"
#include "storage.h"
-#include "idmap.h"
#include "simutil.h"
#include "util.h"
@@ -70,9 +70,9 @@
int flags;
int bearer;
guint suspend_timeout;
- struct idmap *pid_map;
+ struct l_uintset *used_pids;
unsigned int last_context_id;
- struct idmap *cid_map;
+ struct l_uintset *used_cids;
int netreg_status;
struct ofono_netreg *netreg;
unsigned int netreg_watch;
@@ -223,43 +223,23 @@
return FALSE;
}
-static unsigned int gprs_cid_alloc(struct ofono_gprs *gprs)
+static gboolean assign_context(struct pri_context *ctx, unsigned int use_cid)
{
- return idmap_alloc(gprs->cid_map);
-}
-
-static void gprs_cid_take(struct ofono_gprs *gprs, unsigned int id)
-{
- idmap_take(gprs->cid_map, id);
-}
-
-static void gprs_cid_release(struct ofono_gprs *gprs, unsigned int id)
-{
- idmap_put(gprs->cid_map, id);
-}
-
-static gboolean gprs_cid_taken(struct ofono_gprs *gprs, unsigned int id)
-{
- return idmap_find(gprs->cid_map, id) != 0;
-}
-
-static gboolean assign_context(struct pri_context *ctx, int use_cid)
-{
- struct idmap *cidmap = ctx->gprs->cid_map;
+ struct l_uintset *used_cids = ctx->gprs->used_cids;
GSList *l;
- if (cidmap == NULL)
+ if (used_cids == NULL)
return FALSE;
- if (use_cid > 0) {
- gprs_cid_take(ctx->gprs, use_cid);
- ctx->context.cid = use_cid;
- } else
- ctx->context.cid = gprs_cid_alloc(ctx->gprs);
+ if (!use_cid)
+ use_cid = l_uintset_find_unused_min(used_cids);
- if (ctx->context.cid > idmap_get_max(cidmap))
+ if (use_cid > l_uintset_get_max(used_cids))
return FALSE;
+ l_uintset_put(used_cids, use_cid);
+ ctx->context.cid = use_cid;
+
for (l = ctx->gprs->context_drivers; l; l = l->next) {
struct ofono_gprs_context *gc = l->data;
@@ -299,7 +279,7 @@
if (ctx == NULL || ctx->gprs == NULL || ctx->context_driver == NULL)
return;
- gprs_cid_release(ctx->gprs, ctx->context.cid);
+ l_uintset_take(ctx->gprs->used_cids, ctx->context.cid);
ctx->context.cid = 0;
ctx->context_driver->inuse = FALSE;
ctx->context_driver = NULL;
@@ -1434,7 +1414,7 @@
context_methods, context_signals,
NULL, ctx, pri_context_destroy)) {
ofono_error("Could not register PrimaryContext %s", path);
- idmap_put(ctx->gprs->pid_map, ctx->id);
+ l_uintset_take(ctx->gprs->used_pids, ctx->id);
pri_context_destroy(ctx);
return FALSE;
@@ -1462,7 +1442,7 @@
}
strcpy(path, ctx->path);
- idmap_put(ctx->gprs->pid_map, ctx->id);
+ l_uintset_take(ctx->gprs->used_pids, ctx->id);
return g_dbus_unregister_interface(conn, path,
OFONO_CONNECTION_CONTEXT_INTERFACE);
@@ -1919,20 +1899,21 @@
struct pri_context *context;
if (gprs->last_context_id)
- id = idmap_alloc_next(gprs->pid_map, gprs->last_context_id);
+ id = l_uintset_find_unused(gprs->used_pids,
+ gprs->last_context_id);
else
- id = idmap_alloc(gprs->pid_map);
+ id = l_uintset_find_unused_min(gprs->used_pids);
- if (id > idmap_get_max(gprs->pid_map))
+ if (id > l_uintset_get_max(gprs->used_pids))
return NULL;
context = pri_context_create(gprs, name, type);
if (context == NULL) {
- idmap_put(gprs->pid_map, id);
ofono_error("Unable to allocate context struct");
return NULL;
}
+ l_uintset_put(gprs->used_pids, id);
context->id = id;
DBG("Registering new context");
@@ -1962,7 +1943,7 @@
DBG("");
- if (gprs_cid_taken(gprs, cid)) {
+ if (l_uintset_contains(gprs->used_cids, cid)) {
DBG("cid %u already activated", cid);
return;
}
@@ -2353,20 +2334,15 @@
strlen(ap->message_center) > MAX_MESSAGE_CENTER_LENGTH)
return;
- if (gprs->last_context_id)
- id = idmap_alloc_next(gprs->pid_map, gprs->last_context_id);
- else
- id = idmap_alloc(gprs->pid_map);
-
- if (id > idmap_get_max(gprs->pid_map))
+ id = l_uintset_find_unused(gprs->used_pids, gprs->last_context_id);
+ if (id > l_uintset_get_max(gprs->used_pids))
return;
context = pri_context_create(gprs, ap->name, ap->type);
- if (context == NULL) {
- idmap_put(gprs->pid_map, id);
+ if (context == NULL)
return;
- }
+ l_uintset_put(gprs->used_pids, id);
context->id = id;
if (ap->username != NULL)
@@ -2600,10 +2576,8 @@
if (gprs == NULL)
return;
- if (gprs->cid_map)
- idmap_free(gprs->cid_map);
-
- gprs->cid_map = idmap_new_from_range(min, max);
+ l_uintset_free(gprs->used_cids);
+ gprs->used_cids = l_uintset_new_from_range(min, max);
}
static void gprs_context_unregister(struct ofono_atom *atom)
@@ -3010,10 +2984,8 @@
free_contexts(gprs);
- if (gprs->cid_map) {
- idmap_free(gprs->cid_map);
- gprs->cid_map = NULL;
- }
+ l_uintset_free(gprs->used_cids);
+ gprs->used_cids = NULL;
if (gprs->netreg_watch) {
if (gprs->status_watch) {
@@ -3053,10 +3025,8 @@
if (gprs->suspend_timeout)
g_source_remove(gprs->suspend_timeout);
- if (gprs->pid_map) {
- idmap_free(gprs->pid_map);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/ofono.h
^
|
@@ -20,6 +20,7 @@
*/
#include <glib.h>
+#include <ell/ell.h>
#define OFONO_API_SUBJECT_TO_CHANGE
@@ -387,9 +388,8 @@
ofono_bool_t __ofono_is_valid_net_pin(const char *pin);
-void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
- ofono_bool_t full_file_change,
- ofono_bool_t naa_init);
+void __ofono_sim_refresh(struct ofono_sim *sim, struct l_queue *file_list,
+ bool full_file_change, bool naa_init);
void __ofono_sim_recheck_pin(struct ofono_sim *sim);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/sim.c
^
|
@@ -36,6 +36,8 @@
#include <errno.h>
#include <unistd.h>
+#include <ell/ell.h>
+
#include "ofono.h"
#include "common.h"
@@ -349,8 +351,8 @@
static void service_number_free(gpointer pointer)
{
struct service_number *num = pointer;
- g_free(num->id);
- g_free(num);
+ l_free(num->id);
+ l_free(num);
}
static void call_state_watches(struct ofono_sim *sim)
@@ -927,7 +929,7 @@
if (cache)
sim_fs_cache_image(sim->simfs, (const char *) xpm, id);
- g_free(xpm);
+ l_free(xpm);
}
static void sim_iidf_read_clut_cb(int ok, int length, int record,
@@ -1285,27 +1287,26 @@
if (sim_adn_parse(data, record_length, &ph, &alpha) == FALSE)
goto out;
-
/* Use phone number if Id is unavailable */
if (alpha && alpha[0] == '\0') {
- g_free(alpha);
+ l_free(alpha);
alpha = NULL;
}
if (alpha == NULL)
- alpha = g_strdup(phone_number_to_string(&ph));
+ alpha = l_strdup(phone_number_to_string(&ph));
if (sim->service_numbers &&
g_slist_find_custom(sim->service_numbers,
alpha, service_number_compare)) {
ofono_error("Duplicate EFsdn entries for `%s'",
alpha);
- g_free(alpha);
+ l_free(alpha);
goto out;
}
- sdn = g_new(struct service_number, 1);
+ sdn = l_new(struct service_number, 1);
sdn->id = alpha;
memcpy(&sdn->ph, &ph, sizeof(struct ofono_phone_number));
@@ -2512,10 +2513,10 @@
sim->reading_spn = false;
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
- g_free(sim->spn_dc);
+ l_free(sim->spn_dc);
sim->spn_dc = NULL;
}
@@ -2829,10 +2830,10 @@
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(sim->atom);
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
- g_free(sim->spn_dc);
+ l_free(sim->spn_dc);
sim->spn_dc = NULL;
if (data == NULL)
@@ -2861,13 +2862,13 @@
}
if (strlen(sim->spn) == 0) {
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
goto notify;
}
if (dc)
- sim->spn_dc = g_memdup(dc, 1);
+ sim->spn_dc = l_memdup(dc, 1);
notify:
if (sim->spn)
@@ -3399,17 +3400,17 @@
sim_fs_cache_flush_file(sim->simfs, id);
}
-void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
- ofono_bool_t full_file_change, ofono_bool_t naa_init)
+void __ofono_sim_refresh(struct ofono_sim *sim, struct l_queue *files,
+ bool full_file_change, bool naa_init)
{
- GSList *l;
- gboolean reinit_naa = naa_init || full_file_change;
+ const struct l_queue_entry *l;
+ bool reinit_naa = naa_init || full_file_change;
/*
* Check if any files used in SIM initialisation procedure
* are affected, except EFiccid, EFpl, EFli.
*/
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
uint32_t mf, df, ef;
@@ -3450,7 +3451,7 @@
if (full_file_change)
sim_fs_cache_flush(sim->simfs);
else {
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
int id = (file->file[file->len - 2] << 8) |
(file->file[file->len - 1] << 0);
@@ -3475,7 +3476,7 @@
if (full_file_change)
sim_fs_notify_file_watches(sim->simfs, -1);
else {
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
int id = (file->file[file->len - 2] << 8) |
(file->file[file->len - 1] << 0);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/simutil.c
^
|
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "simutil.h"
@@ -793,14 +794,14 @@
spare_bits = dcs & 0x07;
num_char = (length * 8 - spare_bits) / 7;
- unpacked_buf = unpack_7bit(buffer, length, 0, FALSE,
+ unpacked_buf = unpack_7bit(buffer, length, 0, false,
num_char, &written, 0);
if (unpacked_buf == NULL)
break;
ret = convert_gsm_to_utf8(unpacked_buf, written, NULL, NULL, 0);
- g_free(unpacked_buf);
+ l_free(unpacked_buf);
break;
case 0x10:
@@ -815,9 +816,7 @@
if (buffer[i] == 0xff && buffer[i + 1] == 0xff)
break;
- ret = g_convert((const char *) buffer, length,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
+ ret = l_utf8_from_ucs2be(buffer, length);
break;
}
@@ -989,9 +988,9 @@
if (oper == NULL)
return;
- g_free(oper->info);
- g_free(oper->shortname);
- g_free(oper->longname);
+ l_free(oper->info);
+ l_free(oper->shortname);
+ l_free(oper->longname);
}
struct sim_eons *sim_eons_new(int pnn_records)
@@ -1551,7 +1550,7 @@
void sim_app_record_free(struct sim_app_record *app)
{
- g_free(app->label);
+ l_free(app->label);
g_free(app);
}
@@ -1606,7 +1605,7 @@
GSList *t = ret;
struct sim_app_record *app = ret->data;
- g_free(app->label);
+ l_free(app->label);
g_free(app);
ret = ret->next;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/smsutil.c
^
|
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
#include "storage.h"
@@ -556,13 +557,13 @@
return FALSE;
if (written > 11) {
- g_free(gsm);
+ l_free(gsm);
return FALSE;
}
- r = pack_7bit_own_buf(gsm, written, 0, FALSE, &packed, 0, p);
+ r = pack_7bit_own_buf(gsm, written, 0, false, &packed, 0, p);
- g_free(gsm);
+ l_free(gsm);
if (r == NULL)
return FALSE;
@@ -667,7 +668,7 @@
return TRUE;
}
- res = unpack_7bit(pdu + *offset, byte_len, 0, FALSE, chars,
+ res = unpack_7bit(pdu + *offset, byte_len, 0, false, chars,
&written, 0);
*offset = *offset + (addr_len + 1) / 2;
@@ -676,10 +677,9 @@
return FALSE;
utf8 = convert_gsm_to_utf8(res, written, NULL, NULL, 0);
+ l_free(res);
- g_free(res);
-
- if (utf8 == NULL)
+ if (!utf8)
return FALSE;
/*
@@ -687,13 +687,12 @@
* 22 bytes+terminator in UTF-8.
*/
if (strlen(utf8) > 22) {
- g_free(utf8);
+ l_free(utf8);
return FALSE;
}
strcpy(out->address, utf8);
-
- g_free(utf8);
+ l_free(utf8);
}
return TRUE;
@@ -1330,7 +1329,7 @@
if ((len - offset) < out->submit.udl)
return FALSE;
- pack_7bit_own_buf(pdu + offset, out->submit.udl, 0, FALSE,
+ pack_7bit_own_buf(pdu + offset, out->submit.udl, 0, false,
NULL, 0, out->submit.ud);
return TRUE;
@@ -2218,7 +2217,8 @@
const struct sms *sms;
int guess_size = g_slist_length(sms_list);
char *utf8;
- GByteArray *utf16 = 0;
+ void *utf16 = NULL;
+ size_t utf16_size = 0;
if (guess_size == 1)
guess_size = 160;
@@ -2265,7 +2265,7 @@
if (unpack_7bit_own_buf(ud + taken,
udl_in_bytes - taken,
- taken, FALSE, max_chars,
+ taken, false, max_chars,
&written, 0, buf) == NULL)
continue;
@@ -2292,7 +2292,7 @@
single_shift);
if (converted) {
g_string_append(str, converted);
- g_free(converted);
+ l_free(converted);
}
} else {
const guint8 *from = ud + taken;
@@ -2302,7 +2302,7 @@
* Header is odd, the maximum length of the whole TP-UD
* field is 139 octets
*/
- gssize num_ucs2_chars = (udl_in_bytes - taken) >> 1;
+ size_t num_ucs2_chars = (udl_in_bytes - taken) >> 1;
num_ucs2_chars = num_ucs2_chars << 1;
/*
@@ -2313,25 +2313,32 @@
* character in the middle. So accumulate the
* entire message before converting to UTF-8.
*/
- if (!utf16)
- utf16 = g_byte_array_new();
-
- g_byte_array_append(utf16, from, num_ucs2_chars);
+ utf16 = l_realloc(utf16, utf16_size + num_ucs2_chars);
+ memcpy(utf16 + utf16_size, from, num_ucs2_chars);
+ utf16_size += num_ucs2_chars;
}
}
if (utf16) {
- char *converted = g_convert_with_fallback((const gchar *)
- utf16->data, utf16->len,
- "UTF-8//TRANSLIT", "UTF-16BE",
- NULL, NULL, NULL, NULL);
+ char *converted;
+
+ /* Strings are in UTF16-BE, so convert if needed */
+ if (L_CPU_TO_BE16(0x8000) != 0x8000) {
+ size_t i;
+ uint16_t *p = utf16;
+
+ for (i = 0; i < utf16_size / 2; i++)
+ p[i] = __builtin_bswap16(p[i]);
+ }
+
+ converted = l_utf8_from_utf16(utf16, utf16_size);
if (converted) {
g_string_append(str, converted);
- g_free(converted);
+ l_free(converted);
}
- g_byte_array_free(utf16, TRUE);
+ l_free(utf16);
}
utf8 = g_string_free(str, FALSE);
@@ -3561,7 +3568,7 @@
struct sms template;
int offset = 0;
unsigned char *gsm_encoded = NULL;
- char *ucs2_encoded = NULL;
+ void *ucs2_encoded = NULL;
long written;
long left;
guint8 seq;
@@ -3586,16 +3593,15 @@
gsm_encoded = convert_utf8_to_gsm_best_lang(utf8, -1, NULL, &written, 0,
alphabet, &used_locking,
&used_single);
- if (gsm_encoded == NULL) {
- gsize converted;
+ if (!gsm_encoded) {
+ size_t converted;
- ucs2_encoded = g_convert(utf8, -1, "UCS-2BE//TRANSLIT", "UTF-8",
- NULL, &converted, NULL);
- written = converted;
- }
+ ucs2_encoded = l_utf8_to_ucs2be(utf8, &converted);
+ if (!ucs2_encoded)
+ return NULL;
- if (gsm_encoded == NULL && ucs2_encoded == NULL)
- return NULL;
+ written = converted - 2;
+ }
if (gsm_encoded != NULL)
template.submit.dcs = 0x00; /* Class Unspecified, 7 Bit */
@@ -3629,10 +3635,10 @@
if (gsm_encoded && (written <= sms_text_capacity_gsm(160, offset))) {
template.submit.udl = written + (offset * 8 + 6) / 7;
- pack_7bit_own_buf(gsm_encoded, written, offset, FALSE, NULL,
+ pack_7bit_own_buf(gsm_encoded, written, offset, false, NULL,
0, template.submit.ud + offset);
- g_free(gsm_encoded);
+ l_free(gsm_encoded);
return sms_list_append(NULL, &template);
}
@@ -3640,7 +3646,7 @@
template.submit.udl = written + offset;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/stk.c
^
|
@@ -34,6 +34,8 @@
#include <time.h>
#include <sys/time.h>
+#include <ell/ell.h>
+
#include "ofono.h"
#include "common.h"
@@ -343,15 +345,15 @@
}
static struct stk_menu *stk_menu_create(const char *title,
- const struct stk_text_attribute *title_attr,
- const struct stk_icon_id *icon, GSList *items,
- const struct stk_item_text_attribute_list *item_attrs,
- const struct stk_item_icon_id_list *item_icon_ids,
- int default_id, gboolean soft_key, gboolean has_help)
+ const struct stk_text_attribute *title_attr,
+ const struct stk_icon_id *icon, struct l_queue *items,
+ const struct stk_item_text_attribute_list *item_attrs,
+ const struct stk_item_icon_id_list *item_icon_ids,
+ int default_id, bool soft_key, bool has_help)
{
- unsigned int len = g_slist_length(items);
+ unsigned int len = l_queue_length(items);
struct stk_menu *ret;
- GSList *l;
+ const struct l_queue_entry *entry;
int i;
struct stk_text_attribute attr;
@@ -363,23 +365,22 @@
if (item_icon_ids && item_icon_ids->len && item_icon_ids->len != len)
return NULL;
- ret = g_try_new(struct stk_menu, 1);
- if (ret == NULL)
- return NULL;
+ ret = l_new(struct stk_menu, 1);
ret->title = dbus_apply_text_attributes(title ? title : "",
title_attr);
if (ret->title == NULL)
- ret->title = g_strdup(title ? title : "");
+ ret->title = l_strdup(title ? title : "");
memcpy(&ret->icon, icon, sizeof(ret->icon));
- ret->items = g_new0(struct stk_menu_item, len + 1);
+ ret->items = l_new(struct stk_menu_item, len + 1);
ret->default_item = -1;
ret->soft_key = soft_key;
ret->has_help = has_help;
- for (l = items, i = 0; l; l = l->next, i++) {
- struct stk_item *item = l->data;
+ for (entry = l_queue_get_entries(items), i = 0;
+ entry; entry = entry->next, i++) {
+ struct stk_item *item = entry->data;
char *text;
ret->items[i].item_id = item->id;
@@ -394,7 +395,7 @@
}
if (text == NULL)
- text = strdup(item->text);
+ text = l_strdup(item->text);
ret->items[i].text = text;
@@ -416,8 +417,8 @@
static struct stk_menu *stk_menu_create_from_set_up_menu(
const struct stk_command *cmd)
{
- gboolean soft_key = (cmd->qualifier & (1 << 0)) != 0;
- gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+ bool soft_key = (cmd->qualifier & (1 << 0)) != 0;
+ bool has_help = (cmd->qualifier & (1 << 7)) != 0;
return stk_menu_create(cmd->setup_menu.alpha_id,
&cmd->setup_menu.text_attr,
@@ -431,8 +432,8 @@
static struct stk_menu *stk_menu_create_from_select_item(
const struct stk_command *cmd)
{
- gboolean soft_key = (cmd->qualifier & (1 << 2)) != 0;
- gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+ bool soft_key = (cmd->qualifier & (1 << 2)) != 0;
+ bool has_help = (cmd->qualifier & (1 << 7)) != 0;
return stk_menu_create(cmd->select_item.alpha_id,
&cmd->select_item.text_attr,
@@ -448,11 +449,11 @@
struct stk_menu_item *i;
for (i = menu->items; i->text; i++)
- g_free(i->text);
+ l_free(i->text);
- g_free(menu->items);
- g_free(menu->title);
- g_free(menu);
+ l_free(menu->items);
+ l_free(menu->title);
+ l_free(menu);
}
static void emit_menu_changed(struct ofono_stk *stk)
@@ -461,7 +462,7 @@
static struct stk_menu no_menu = {
.title = "",
.items = &end_item,
- .has_help = FALSE,
+ .has_help = false,
.default_item = -1,
};
static char *name = "MainMenu";
@@ -561,7 +562,7 @@
else
stk_agent_display_action_info(stk->current_agent, alpha, icon);
- g_free(alpha);
+ l_free(alpha);
return TRUE;
}
@@ -986,7 +987,7 @@
}
if (stk->idle_mode_text)
- g_free(stk->idle_mode_text);
+ l_free(stk->idle_mode_text);
if (sim->icon_id.id != 0 && sim->icon_id.qualifier ==
STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY)
@@ -1040,7 +1041,7 @@
static void timer_value_from_seconds(struct stk_timer_value *val, int seconds)
{
- val->has_value = TRUE;
+ val->has_value = true;
val->hour = seconds / 3600;
seconds -= val->hour * 3600;
val->minute = seconds / 60;
@@ -1403,7 +1404,7 @@
err = stk_agent_display_text(stk->current_agent, text, &dt->icon_id,
priority, display_text_cb, stk,
display_text_destroy, timeout);
- g_free(text);
+ l_free(text);
/* We most likely got an out of memory error, tell SIM to retry */
if (err < 0) {
@@ -1454,8 +1455,7 @@
}
static void request_confirmation_cb(enum stk_agent_result result,
- gboolean confirm,
- void *user_data)
+ bool confirm, void *user_data)
{
struct ofono_stk *stk = user_data;
static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
@@ -1468,7 +1468,7 @@
rsp.result.type = STK_RESULT_TYPE_SUCCESS;
rsp.get_inkey.text.text = confirm ? "" : NULL;
- rsp.get_inkey.text.yesno = TRUE;
+ rsp.get_inkey.text.yesno = true;
if (cmd->duration.interval) {
rsp.get_inkey.duration.unit = cmd->duration.unit;
@@ -1610,7 +1610,7 @@
&gi->icon_id, request_key_cb,
stk, NULL, timeout);
- g_free(text);
+ l_free(text);
if (err < 0) {
unsigned char no_cause_result[] = { 0x00 };
@@ -1704,7 +1704,7 @@
request_string_cb,
stk, NULL, timeout);
- g_free(text);
+ l_free(text);
if (err < 0) {
unsigned char no_cause_result[] = { 0x00 };
@@ -1761,7 +1761,7 @@
__ofono_voicecall_dial_cancel(vc);
}
-static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
+static void confirm_call_cb(enum stk_agent_result result, bool confirm,
void *user_data)
{
struct ofono_stk *stk = user_data;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/stkagent.c
^
|
@@ -29,6 +29,7 @@
#include <glib.h>
#include <gdbus.h>
+#include <ell/ell.h>
#include "ofono.h"
@@ -51,7 +52,7 @@
char *path; /* Agent Path */
char *bus; /* Agent bus */
guint disconnect_watch; /* DBus disconnect watch */
- ofono_bool_t remove_on_terminate;
+ bool remove_on_terminate;
ofono_destroy_func removed_cb;
void *removed_data;
DBusMessage *msg;
@@ -60,7 +61,7 @@
void *user_data;
int min_length;
int max_length;
- ofono_bool_t hidden_entry;
+ bool hidden_entry;
ofono_destroy_func user_destroy;
const struct stk_menu *request_selection_menu;
@@ -117,7 +118,7 @@
agent->user_cb = NULL;
}
-ofono_bool_t stk_agent_matches(struct stk_agent *agent,
+bool stk_agent_matches(struct stk_agent *agent,
const char *path, const char *sender)
{
return !strcmp(agent->path, path) && !strcmp(agent->bus, sender);
@@ -227,7 +228,7 @@
}
struct stk_agent *stk_agent_new(const char *path, const char *sender,
- ofono_bool_t remove_on_terminate)
+ bool remove_on_terminate)
{
struct stk_agent *agent = g_try_new0(struct stk_agent, 1);
DBusConnection *conn = ofono_dbus_get_connection();
@@ -287,9 +288,9 @@
done: \
if (result == STK_AGENT_RESULT_TERMINATE && \
agent->remove_on_terminate) \
- remove_agent = TRUE; \
+ remove_agent = true; \
else \
- remove_agent = FALSE; \
+ remove_agent = false; \
\
error: \
stk_agent_request_end(agent); \
@@ -306,12 +307,12 @@
DBusMessage *reply = dbus_pending_call_steal_reply(call);
unsigned char selection, i;
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -324,7 +325,7 @@
DBUS_TYPE_BYTE, &selection,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to RequestSelection()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -332,7 +333,7 @@
if (i != selection) {
ofono_error("Invalid item selected");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -387,12 +388,12 @@
stk_agent_display_text_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE |
ALLOWED_ERROR_BUSY, &result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -403,7 +404,7 @@
if (dbus_message_get_args(reply, NULL, DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to DisplayText()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -414,7 +415,7 @@
int stk_agent_display_text(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t urgent,
+ bool urgent,
stk_agent_display_text_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout)
@@ -455,18 +456,18 @@
stk_agent_confirmation_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
dbus_bool_t confirm;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (result != STK_AGENT_RESULT_OK) {
- cb(result, FALSE, agent->user_data);
+ cb(result, false, agent->user_data);
goto done;
}
@@ -474,7 +475,7 @@
DBUS_TYPE_BOOLEAN, &confirm,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to GetConfirmation()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -524,13 +525,13 @@
stk_agent_string_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
char *digit;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -543,19 +544,19 @@
DBUS_TYPE_STRING, &digit,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to GetDigit()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (strlen(digit) != 1 || !strspn(digit, "0123456789*#+")) {
ofono_error("Invalid character");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (agent->hidden_entry && digit[0] == '+') {
ofono_error("The character + is not allowed in this mode");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -590,7 +591,7 @@
agent->user_cb = cb;
agent->user_data = user_data;
agent->user_destroy = destroy;
- agent->hidden_entry = FALSE;
+ agent->hidden_entry = false;
dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/stkagent.h
^
|
@@ -40,8 +40,8 @@
struct stk_icon_id icon;
struct stk_menu_item *items;
int default_item;
- gboolean soft_key;
- gboolean has_help;
+ bool soft_key;
+ bool has_help;
};
typedef void (*stk_agent_display_text_cb)(enum stk_agent_result result,
@@ -51,7 +51,7 @@
uint8_t id, void *user_data);
typedef void (*stk_agent_confirmation_cb)(enum stk_agent_result result,
- ofono_bool_t confirm,
+ bool confirm,
void *user_data);
typedef void (*stk_agent_string_cb)(enum stk_agent_result result,
@@ -64,7 +64,7 @@
void *user_data);
struct stk_agent *stk_agent_new(const char *path, const char *sender,
- ofono_bool_t remove_on_terminate);
+ bool remove_on_terminate);
void stk_agent_free(struct stk_agent *agent);
@@ -72,7 +72,7 @@
ofono_destroy_func removed_cb,
void *user_data);
-ofono_bool_t stk_agent_matches(struct stk_agent *agent,
+bool stk_agent_matches(struct stk_agent *agent,
const char *path, const char *sender);
void stk_agent_request_cancel(struct stk_agent *agent);
@@ -85,7 +85,7 @@
int stk_agent_display_text(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t urgent,
+ bool urgent,
stk_agent_display_text_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
@@ -110,22 +110,22 @@
int stk_agent_request_key(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t unicode_charset,
+ bool unicode_charset,
stk_agent_string_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
int stk_agent_request_digits(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
const char *default_text, int min, int max,
- ofono_bool_t hidden, stk_agent_string_cb cb,
+ bool hidden, stk_agent_string_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
int stk_agent_request_input(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
const char *default_text,
- ofono_bool_t unicode_charset, int min, int max,
- ofono_bool_t hidden, stk_agent_string_cb cb,
+ bool unicode_charset, int min, int max,
+ bool hidden, stk_agent_string_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
@@ -135,12 +135,12 @@
ofono_destroy_func destroy, int timeout);
int stk_agent_play_tone(struct stk_agent *agent, const char *text,
- const struct stk_icon_id *icon, ofono_bool_t vibrate,
+ const struct stk_icon_id *icon, bool vibrate,
const char *tone, stk_agent_tone_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
- const struct stk_icon_id *icon, ofono_bool_t vibrate,
+ const struct stk_icon_id *icon, bool vibrate,
const char *tone, stk_agent_tone_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/stkutil.c
^
|
@@ -28,6 +28,7 @@
#include <stdint.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "smsutil.h"
@@ -43,23 +44,22 @@
};
struct stk_file_iter {
- const unsigned char *start;
+ const uint8_t *start;
unsigned int pos;
unsigned int max;
- unsigned char len;
- const unsigned char *file;
+ uint8_t len;
+ const uint8_t *file;
};
struct stk_tlv_builder {
struct comprehension_tlv_builder ctlv;
- unsigned char *value;
+ uint8_t *value;
unsigned int len;
unsigned int max_len;
};
-typedef gboolean (*dataobj_handler)(struct comprehension_tlv_iter *, void *);
-typedef gboolean (*dataobj_writer)(struct stk_tlv_builder *,
- const void *, gboolean);
+typedef bool (*dataobj_handler)(struct comprehension_tlv_iter *, void *);
+typedef bool (*dataobj_writer)(struct stk_tlv_builder *, const void *, bool);
/*
* Defined in TS 102.223 Section 8.13
@@ -71,7 +71,7 @@
*/
struct gsm_sms_tpdu {
unsigned int len;
- unsigned char tpdu[184];
+ uint8_t tpdu[184];
};
#define CHECK_TEXT_AND_ICON(text, icon_id) \
@@ -81,7 +81,7 @@
if ((text == NULL || text[0] == '\0') && icon_id != 0) \
status = STK_PARSE_RESULT_DATA_NOT_UNDERSTOOD; \
-static char *decode_text(unsigned char dcs, int len, const unsigned char *data)
+static char *decode_text(uint8_t dcs, int len, const unsigned char *data)
{
char *utf8;
enum sms_charset charset;
@@ -94,7 +94,7 @@
{
long written;
unsigned long max_to_unpack = len * 8 / 7;
- unsigned char *unpacked = unpack_7bit(data, len, 0, FALSE,
+ uint8_t *unpacked = unpack_7bit(data, len, 0, false,
max_to_unpack,
&written, 0);
if (unpacked == NULL)
@@ -102,16 +102,14 @@
utf8 = convert_gsm_to_utf8(unpacked, written,
NULL, NULL, 0);
- g_free(unpacked);
+ l_free(unpacked);
break;
}
case SMS_CHARSET_8BIT:
utf8 = convert_gsm_to_utf8(data, len, NULL, NULL, 0);
break;
case SMS_CHARSET_UCS2:
- utf8 = g_convert((const gchar *) data, len,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
+ utf8 = l_utf8_from_ucs2be(data, len);
break;
default:
utf8 = NULL;
@@ -121,99 +119,92 @@
}
/* For data object only to indicate its existence */
-static gboolean parse_dataobj_common_bool(struct comprehension_tlv_iter *iter,
- gboolean *out)
+static bool parse_dataobj_common_bool(struct comprehension_tlv_iter *iter,
+ bool *out)
{
if (comprehension_tlv_iter_get_length(iter) != 0)
- return FALSE;
+ return false;
- *out = TRUE;
+ *out = true;
- return TRUE;
+ return true;
}
/* For data object that only has one byte */
-static gboolean parse_dataobj_common_byte(struct comprehension_tlv_iter *iter,
- unsigned char *out)
+static bool parse_dataobj_common_byte(struct comprehension_tlv_iter *iter,
+ uint8_t *out)
{
- const unsigned char *data;
+ const uint8_t *data;
if (comprehension_tlv_iter_get_length(iter) != 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
*out = data[0];
- return TRUE;
+ return true;
}
/* For data object that only has text terminated by '\0' */
-static gboolean parse_dataobj_common_text(struct comprehension_tlv_iter *iter,
+static bool parse_dataobj_common_text(struct comprehension_tlv_iter *iter,
char **text)
{
- const unsigned char *data;
+ const uint8_t *data;
unsigned int len = comprehension_tlv_iter_get_length(iter);
if (len < 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
- *text = g_try_malloc(len + 1);
- if (*text == NULL)
- return FALSE;
-
+ *text = l_malloc(len + 1);
memcpy(*text, data, len);
(*text)[len] = '\0';
- return TRUE;
+ return true;
}
/* For data object that only has a byte array with undetermined length */
-static gboolean parse_dataobj_common_byte_array(
- struct comprehension_tlv_iter *iter,
- struct stk_common_byte_array *array)
+static bool parse_dataobj_common_byte_array(struct comprehension_tlv_iter *iter,
+ struct stk_common_byte_array *array)
{
- const unsigned char *data;
+ const uint8_t *data;
unsigned int len = comprehension_tlv_iter_get_length(iter);
if (len < 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
array->len = len;
- array->array = g_try_malloc(len);
- if (array->array == NULL)
- return FALSE;
-
+ array->array = l_malloc(len);
memcpy(array->array, data, len);
- return TRUE;
+ return true;
}
static void stk_file_iter_init(struct stk_file_iter *iter,
- const unsigned char *start, unsigned int len)
+ const uint8_t *start, unsigned int len)
{
iter->start = start;
iter->max = len;
iter->pos = 0;
}
-static gboolean stk_file_iter_next(struct stk_file_iter *iter)
+static bool stk_file_iter_next(struct stk_file_iter *iter)
{
unsigned int pos = iter->pos;
const unsigned int max = iter->max;
- const unsigned char *start = iter->start;
+ const uint8_t *start = iter->start;
unsigned int i;
- unsigned char last_type;
+ uint8_t last_type;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/stkutil.h
^
|
@@ -19,6 +19,8 @@
*
*/
+struct l_queue;
+
/*
* TS 101.220, Section 7.2, Card Application Toolkit assigned templates,
* These are the same as 3GPP 11.14 Sections 13.1 and 13.2
@@ -644,13 +646,13 @@
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
- unsigned char *array;
+ uint8_t *array;
unsigned int len;
};
/* Defined in TS 102.223 Section 8.1 */
struct stk_address {
- unsigned char ton_npi;
+ uint8_t ton_npi;
char *number;
};
@@ -669,9 +671,9 @@
* bytes."
*/
struct stk_subaddress {
- ofono_bool_t has_subaddr;
- unsigned char len;
- unsigned char subaddr[23];
+ bool has_subaddr;
+ uint8_t len;
+ uint8_t subaddr[23];
};
/*
@@ -686,14 +688,14 @@
* The CCP structure is not decoded, but stored as is from the CTLV
*/
struct stk_ccp {
- unsigned char len;
- unsigned char ccp[16];
+ uint8_t len;
+ uint8_t ccp[16];
};
/* Defined in TS 31.111 Section 8.5 */
struct stk_cbs_page {
- unsigned char len;
- unsigned char page[88];
+ uint8_t len;
+ uint8_t page[88];
};
/*
@@ -702,12 +704,12 @@
*/
struct stk_duration {
enum stk_duration_type unit;
- unsigned char interval;
+ uint8_t interval;
};
/* Defined in TS 102.223 Section 8.9 */
struct stk_item {
- unsigned char id;
+ uint8_t id;
char *text;
};
@@ -716,27 +718,27 @@
* to 0.
*/
struct stk_response_length {
- unsigned char min;
- unsigned char max;
+ uint8_t min;
+ uint8_t max;
};
/* Defined in TS 102.223 Section 8.12 */
struct stk_result {
enum stk_result_type type;
unsigned int additional_len;
- unsigned char *additional;
+ uint8_t *additional;
};
/* Defined in TS 102.223 Section 8.14 */
struct stk_ss {
- unsigned char ton_npi;
+ uint8_t ton_npi;
char *ss;
};
/* Defined in TS 131.111 Section 8.17. Length limit of 160 chars in 23.028 */
struct stk_ussd_string {
- unsigned char dcs;
- unsigned char string[160];
+ uint8_t dcs;
+ uint8_t string[160];
int len;
};
@@ -748,7 +750,7 @@
* 2 bytes of 2nd level Dedicated File and 2 bytes of Elementary File.
*/
struct stk_file {
- unsigned char file[8];
+ uint8_t file[8];
unsigned int len;
};
@@ -756,13 +758,13 @@
struct stk_location_info {
char mnc[OFONO_MAX_MNC_LENGTH + 1];
char mcc[OFONO_MAX_MCC_LENGTH + 1];
- unsigned short lac_tac;
- ofono_bool_t has_ci;
- unsigned short ci;
- ofono_bool_t has_ext_ci;
- unsigned short ext_ci;
- ofono_bool_t has_eutran_ci;
- guint32 eutran_ci;
+ uint16_t lac_tac;
+ bool has_ci;
+ uint16_t ci;
+ bool has_ext_ci;
+ uint16_t ext_ci;
+ bool has_eutran_ci;
+ uint32_t eutran_ci;
};
/*
@@ -770,7 +772,7 @@
* that the maximum size is 127 according to the rules of CTLVs.
*/
struct stk_items_next_action_indicator {
- unsigned char list[127];
+ uint8_t list[127];
unsigned int len;
};
@@ -779,7 +781,7 @@
* one should appear more than once.
*/
struct stk_event_list {
- unsigned char list[21];
+ uint8_t list[21];
unsigned int len;
};
@@ -787,9 +789,9 @@
* According to 102.223 Section 8.26, the maximum length of cause is 30.
*/
struct stk_cause {
- unsigned char cause[30];
+ uint8_t cause[30];
unsigned int len;
- ofono_bool_t has_cause;
+ bool has_cause;
};
/*
@@ -797,7 +799,7 @@
* that the maximum size is 127 according to the rules of CTLVs.
*/
struct stk_transaction_id {
- unsigned char list[127];
+ uint8_t list[127];
unsigned int len;
};
@@ -807,9 +809,9 @@
* is represented as 10 bits, so the maximum number of channel is 127*8/10=101.
*/
struct stk_bcch_channel_list {
- unsigned short channels[101];
+ uint16_t channels[101];
unsigned int num;
- ofono_bool_t has_list;
+ bool has_list;
};
/*
@@ -818,8 +820,8 @@
* ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
*/
struct stk_icon_id {
- unsigned char qualifier;
- unsigned char id;
+ uint8_t qualifier;
+ uint8_t id;
};
/*
@@ -829,19 +831,19 @@
* identifier list is 126.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/ussd.c
^
|
@@ -34,7 +34,6 @@
#include "common.h"
#include "smsutil.h"
-#include "util.h"
#define MAX_USSD_LENGTH 160
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/util.c
^
|
@@ -29,7 +29,7 @@
#include <ctype.h>
#include <stdlib.h>
-#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
@@ -65,9 +65,6 @@
#define UTF8_LENGTH(c) \
((c) < 0x80 ? 1 : ((c) < 0x800 ? 2 : 3))
-#define TABLE_SIZE(t) \
- (sizeof((t)) / sizeof(struct codepoint))
-
struct codepoint {
unsigned short from;
unsigned short to;
@@ -2690,7 +2687,7 @@
return codepoint_lookup(&key, t->single_u, t->single_len_u);
}
-static gboolean populate_locking_shift(struct conversion_table *t,
+static bool populate_locking_shift(struct conversion_table *t,
enum gsm_dialect lang)
{
switch (lang) {
@@ -2698,192 +2695,192 @@
case GSM_DIALECT_SPANISH:
t->locking_g = def_gsm;
t->locking_u = def_unicode;
- t->locking_len_u = TABLE_SIZE(def_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(def_unicode);
+ return true;
case GSM_DIALECT_TURKISH:
t->locking_g = tur_gsm;
t->locking_u = tur_unicode;
- t->locking_len_u = TABLE_SIZE(tur_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tur_unicode);
+ return true;
case GSM_DIALECT_PORTUGUESE:
t->locking_g = por_gsm;
t->locking_u = por_unicode;
- t->locking_len_u = TABLE_SIZE(por_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(por_unicode);
+ return true;
case GSM_DIALECT_BENGALI:
t->locking_g = ben_gsm;
t->locking_u = ben_unicode;
- t->locking_len_u = TABLE_SIZE(ben_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(ben_unicode);
+ return true;
case GSM_DIALECT_GUJARATI:
t->locking_g = guj_gsm;
t->locking_u = guj_unicode;
- t->locking_len_u = TABLE_SIZE(guj_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(guj_unicode);
+ return true;
case GSM_DIALECT_HINDI:
t->locking_g = hin_gsm;
t->locking_u = hin_unicode;
- t->locking_len_u = TABLE_SIZE(hin_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(hin_unicode);
+ return true;
case GSM_DIALECT_KANNADA:
t->locking_g = kan_gsm;
t->locking_u = kan_unicode;
- t->locking_len_u = TABLE_SIZE(kan_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(kan_unicode);
+ return true;
case GSM_DIALECT_MALAYALAM:
t->locking_g = mal_gsm;
t->locking_u = mal_unicode;
- t->locking_len_u = TABLE_SIZE(mal_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(mal_unicode);
+ return true;
case GSM_DIALECT_ORIYA:
t->locking_g = ori_gsm;
t->locking_u = ori_unicode;
- t->locking_len_u = TABLE_SIZE(ori_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(ori_unicode);
+ return true;
case GSM_DIALECT_PUNJABI:
t->locking_g = pun_gsm;
t->locking_u = pun_unicode;
- t->locking_len_u = TABLE_SIZE(pun_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(pun_unicode);
+ return true;
case GSM_DIALECT_TAMIL:
t->locking_g = tam_gsm;
t->locking_u = tam_unicode;
- t->locking_len_u = TABLE_SIZE(tam_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tam_unicode);
+ return true;
case GSM_DIALECT_TELUGU:
t->locking_g = tel_gsm;
t->locking_u = tel_unicode;
- t->locking_len_u = TABLE_SIZE(tel_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tel_unicode);
+ return true;
case GSM_DIALECT_URDU:
t->locking_g = urd_gsm;
t->locking_u = urd_unicode;
- t->locking_len_u = TABLE_SIZE(urd_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(urd_unicode);
+ return true;
}
- return FALSE;
+ return false;
}
-static gboolean populate_single_shift(struct conversion_table *t,
+static bool populate_single_shift(struct conversion_table *t,
enum gsm_dialect lang)
{
switch (lang) {
case GSM_DIALECT_DEFAULT:
t->single_g = def_ext_gsm;
- t->single_len_g = TABLE_SIZE(def_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(def_ext_gsm);
t->single_u = def_ext_unicode;
- t->single_len_u = TABLE_SIZE(def_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(def_ext_unicode);
+ return true;
case GSM_DIALECT_TURKISH:
t->single_g = tur_ext_gsm;
- t->single_len_g = TABLE_SIZE(tur_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(tur_ext_gsm);
t->single_u = tur_ext_unicode;
- t->single_len_u = TABLE_SIZE(tur_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(tur_ext_unicode);
+ return true;
case GSM_DIALECT_SPANISH:
t->single_g = spa_ext_gsm;
- t->single_len_g = TABLE_SIZE(spa_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(spa_ext_gsm);
t->single_u = spa_ext_unicode;
- t->single_len_u = TABLE_SIZE(spa_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(spa_ext_unicode);
+ return true;
case GSM_DIALECT_PORTUGUESE:
t->single_g = por_ext_gsm;
- t->single_len_g = TABLE_SIZE(por_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(por_ext_gsm);
t->single_u = por_ext_unicode;
- t->single_len_u = TABLE_SIZE(por_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(por_ext_unicode);
+ return true;
case GSM_DIALECT_BENGALI:
t->single_g = ben_ext_gsm;
- t->single_len_g = TABLE_SIZE(ben_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(ben_ext_gsm);
t->single_u = ben_ext_unicode;
- t->single_len_u = TABLE_SIZE(ben_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(ben_ext_unicode);
+ return true;
case GSM_DIALECT_GUJARATI:
t->single_g = guj_ext_gsm;
- t->single_len_g = TABLE_SIZE(guj_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(guj_ext_gsm);
t->single_u = guj_ext_unicode;
- t->single_len_u = TABLE_SIZE(guj_ext_unicode);
- return TRUE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/src/util.h
^
|
@@ -19,6 +19,8 @@
*
*/
+#include <stdbool.h>
+
enum gsm_dialect {
GSM_DIALECT_DEFAULT = 0,
GSM_DIALECT_TURKISH,
@@ -65,33 +67,27 @@
unsigned char terminator,
unsigned char *buf);
-unsigned char *decode_hex(const char *in, long len, long *items_written,
- unsigned char terminator);
-
char *encode_hex_own_buf(const unsigned char *in, long len,
unsigned char terminator, char *buf);
-char *encode_hex(const unsigned char *in, long len,
- unsigned char terminator);
-
unsigned char *unpack_7bit_own_buf(const unsigned char *in, long len,
- int byte_offset, gboolean ussd,
+ int byte_offset, bool ussd,
long max_to_unpack, long *items_written,
unsigned char terminator,
unsigned char *buf);
unsigned char *unpack_7bit(const unsigned char *in, long len, int byte_offset,
- gboolean ussd, long max_to_unpack,
+ bool ussd, long max_to_unpack,
long *items_written, unsigned char terminator);
unsigned char *pack_7bit_own_buf(const unsigned char *in, long len,
- int byte_offset, gboolean ussd,
+ int byte_offset, bool ussd,
long *items_written,
unsigned char terminator,
unsigned char *buf);
unsigned char *pack_7bit(const unsigned char *in, long len, int byte_offset,
- gboolean ussd,
+ bool ussd,
long *items_written, unsigned char terminator);
char *sim_string_to_utf8(const unsigned char *buffer, int length);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/tools/stktest.c
^
|
@@ -1189,30 +1189,6 @@
g_idle_add(end_session_and_not_canceled_after_3, NULL);
}
-static gboolean poweroff_and_canceled_after_21(gpointer user_data)
-{
- __stktest_test_finish(pending == NULL);
- return FALSE;
-}
-
-static gboolean end_session_and_canceled_after_21(gpointer user_data)
-{
- g_at_server_send_unsolicited(emulator, "+CUSATEND");
- g_timeout_add_seconds(21, poweroff_and_canceled_after_21, NULL);
-
- return FALSE;
-}
-
-static void expect_response_and_canceled_after_21(const unsigned char *pdu,
- unsigned int len)
-{
- struct test *test = cur_test->data;
-
- STKTEST_RESPONSE_ASSERT(test->rsp_pdu, test->rsp_len, pdu, len);
-
- g_idle_add(end_session_and_canceled_after_21, NULL);
-}
-
static DBusMessage *test_display_text_11(DBusMessage *msg,
const char *text,
unsigned char icon_id,
@@ -1405,7 +1381,7 @@
unsigned char icon_id,
gboolean urgent)
{
- STKTEST_AGENT_ASSERT(g_str_equal(text, "Basic Icon"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
STKTEST_AGENT_ASSERT(urgent == FALSE);
@@ -1417,7 +1393,7 @@
unsigned char icon_id,
gboolean urgent)
{
- STKTEST_AGENT_ASSERT(g_str_equal(text, "Colour Icon"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
STKTEST_AGENT_ASSERT(urgent == FALSE);
@@ -1854,7 +1830,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
reply = dbus_message_new_method_return(msg);
@@ -1888,7 +1864,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
reply = dbus_message_new_method_return(msg);
@@ -2662,7 +2638,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
STKTEST_AGENT_ASSERT(g_str_equal(def_input, ""));
STKTEST_AGENT_ASSERT(min == 0);
@@ -2710,7 +2686,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
STKTEST_AGENT_ASSERT(g_str_equal(def_input, ""));
STKTEST_AGENT_ASSERT(min == 0);
@@ -3168,7 +3144,7 @@
unsigned char icon_id)
{
STKTEST_AGENT_ASSERT(g_str_equal(tone, "positive-acknowledgement"));
- STKTEST_AGENT_ASSERT(g_str_equal(text, "<BASIC-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
return dbus_message_new_method_return(msg);
@@ -3192,7 +3168,7 @@
unsigned char icon_id)
{
STKTEST_AGENT_ASSERT(g_str_equal(tone, "positive-acknowledgement"));
- STKTEST_AGENT_ASSERT(g_str_equal(text, "<COLOUR-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
return dbus_message_new_method_return(msg);
@@ -3510,7 +3486,7 @@
display_text_response_421,
sizeof(display_text_response_421),
test_display_text_42,
- expect_response_and_canceled_after_21);
+ expect_response_and_not_canceled_after_3);
stktest_add_test("Display Text 4.3", "DisplayText",
display_text_431, sizeof(display_text_431),
display_text_response_431,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-common.c
^
|
@@ -29,10 +29,14 @@
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
+
#include <ofono/types.h>
#include "common.h"
+static const bool VERBOSE = false;
+
static const char *invalid_strings[] = {
"33",
"*",
@@ -71,8 +75,8 @@
gboolean ret;
for (i = 0; invalid_strings[i]; i++) {
- if (g_test_verbose())
- g_print("%s...\n", invalid_strings[i]);
+ if (VERBOSE)
+ printf("%s...\n", invalid_strings[i]);
str = strdup(invalid_strings[i]);
@@ -122,8 +126,8 @@
int i;
for (i = 0; valid_strings[i]; i++) {
- if (g_test_verbose())
- g_print("%s...", valid_strings[i]);
+ if (VERBOSE)
+ printf("%s...", valid_strings[i]);
str = strdup(valid_strings[i]);
@@ -134,8 +138,8 @@
g_assert(ret == TRUE);
- if (g_test_verbose())
- g_print("parsed as: %d, %s, %s, %s, %s, %s\n",
+ if (VERBOSE)
+ printf("parsed as: %d, %s, %s, %s, %s, %s\n",
type, sc, sia, sib, sic, dn);
free(str);
@@ -164,8 +168,8 @@
gboolean res;
for (i = 0; valid_apns[i]; i++) {
- if (g_test_verbose())
- g_print("Test Valid:%s\n", valid_apns[i]);
+ if (VERBOSE)
+ printf("Test Valid:%s\n", valid_apns[i]);
res = is_valid_apn(valid_apns[i]);
@@ -173,8 +177,8 @@
}
for (i = 0; invalid_apns[i]; i++) {
- if (g_test_verbose())
- g_print("Test Invalid:%s\n", invalid_apns[i]);
+ if (VERBOSE)
+ printf("Test Invalid:%s\n", invalid_apns[i]);
res = is_valid_apn(invalid_apns[i]);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-simutil.c
^
|
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
@@ -407,12 +408,12 @@
static void test_3g_status_data(void)
{
unsigned char *response;
- long len;
+ size_t len;
int flen, rlen, str;
unsigned char access[3];
unsigned short efid;
- response = decode_hex(binary_ef, -1, &len, 0);
+ response = l_util_from_hexstring(binary_ef, &len);
sim_parse_3g_get_response(response, len, &flen, &rlen, &str,
access, &efid);
@@ -427,7 +428,7 @@
g_free(response);
- response = decode_hex(record_ef, -1, &len, 0);
+ response = l_util_from_hexstring(record_ef, &len);
sim_parse_3g_get_response(response, len, &flen, &rlen, &str,
access, &efid);
@@ -450,11 +451,11 @@
static void test_application_entry_decode(void)
{
unsigned char *ef_dir;
- long len;
+ size_t len;
GSList *entries;
struct sim_app_record *app[2];
- ef_dir = decode_hex(at_cuad_response, -1, &len, 0);
+ ef_dir = l_util_from_hexstring(at_cuad_response, &len);
entries = sim_parse_app_template_entries(ef_dir, len);
g_assert(g_slist_length(entries) == 2);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-sms-root.c
^
|
@@ -29,11 +29,12 @@
#include <string.h>
#include <glib.h>
-#include <glib/gprintf.h>
#include "util.h"
#include "smsutil.h"
+static const bool VERBOSE = false;
+
static const char *assembly_pdu1 = "038121F340048155550119906041001222048C0500"
"031E0301041804420430043A002C002004100"
"43B0435043A04410430043D04340440002000"
@@ -81,10 +82,10 @@
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
&sms.deliver.oaddr, ref, max, seq);
- if (g_test_verbose()) {
- g_print("Ref: %u\n", ref);
- g_print("Max: %u\n", max);
- g_print("From: %s\n",
+ if (VERBOSE) {
+ printf("Ref: %u\n", ref);
+ printf("Max: %u\n", max);
+ printf("From: %s\n",
sms_address_to_string(&sms.deliver.oaddr));
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-sms.c
^
|
@@ -27,13 +27,16 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
+#include <ell/ell.h>
#include <glib.h>
-#include <glib/gprintf.h>
#include "util.h"
#include "smsutil.h"
+static const bool VERBOSE = false;
+
static const char *simple_deliver = "07911326040000F0"
"040B911346610089F60000208062917314480CC8F71D14969741F977FD07";
static const char *alnum_sender = "0791447758100650"
@@ -56,13 +59,13 @@
struct tm remote;
char buf[128];
- g_print("%s: (YY-MM-DD) %02d-%02d-%02d\n", prefix,
+ printf("%s: (YY-MM-DD) %02d-%02d-%02d\n", prefix,
(int)scts->year, (int)scts->month, (int)scts->day);
- g_print("%s: (HH-MM-SS) %02d:%02d:%02d\n", prefix,
+ printf("%s: (HH-MM-SS) %02d:%02d:%02d\n", prefix,
(int)scts->hour, (int)scts->minute, (int)scts->second);
- g_print("%s: Timezone %d hours %d minutes\n", prefix,
+ printf("%s: Timezone %d hours %d minutes\n", prefix,
(int)scts->timezone / 4,
(int)((abs(scts->timezone) % 4) * 15));
@@ -71,32 +74,32 @@
strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&ts));
buf[127] = '\0';
- g_print("local time: %s\n", buf);
+ printf("local time: %s\n", buf);
strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", &remote);
buf[127] = '\0';
- g_print("remote time: %s\n", buf);
+ printf("remote time: %s\n", buf);
}
static void print_vpf(enum sms_validity_period_format vpf,
struct sms_validity_period *vp)
{
- g_print("Validity Period Format: %d\n", (int)vpf);
+ printf("Validity Period Format: %d\n", (int)vpf);
switch (vpf) {
case SMS_VALIDITY_PERIOD_FORMAT_ABSENT:
- g_print("Validity-Period: Absent\n");
+ printf("Validity-Period: Absent\n");
break;
case SMS_VALIDITY_PERIOD_FORMAT_RELATIVE:
- g_print("Validity-Period: %d\n",
+ printf("Validity-Period: %d\n",
(int)vp->relative);
break;
case SMS_VALIDITY_PERIOD_FORMAT_ABSOLUTE:
print_scts(&vp->absolute, "Validity-Period:");
break;
case SMS_VALIDITY_PERIOD_FORMAT_ENHANCED:
- g_print("Validity-Period: Enhanced");
+ printf("Validity-Period: Enhanced");
break;
}
}
@@ -104,39 +107,39 @@
static void dump_details(struct sms *sms)
{
if (sms->sc_addr.address[0] == '\0')
- g_print("SMSC Address absent, default will be used\n");
+ printf("SMSC Address absent, default will be used\n");
else
- g_print("SMSC Address number_type: %d, number_plan: %d, %s\n",
+ printf("SMSC Address number_type: %d, number_plan: %d, %s\n",
(int)sms->sc_addr.number_type,
(int)sms->sc_addr.numbering_plan, sms->sc_addr.address);
switch (sms->type) {
case SMS_TYPE_DELIVER:
- g_print("Type: Deliver\n");
+ printf("Type: Deliver\n");
- g_print("Originator-Address: %d, %d, %s\n",
+ printf("Originator-Address: %d, %d, %s\n",
(int)sms->deliver.oaddr.number_type,
(int)sms->deliver.oaddr.numbering_plan,
sms->deliver.oaddr.address);
- g_print("PID: %d\n", (int)sms->deliver.pid);
- g_print("DCS: %d\n", (int)sms->deliver.dcs);
+ printf("PID: %d\n", (int)sms->deliver.pid);
+ printf("DCS: %d\n", (int)sms->deliver.dcs);
print_scts(&sms->deliver.scts, "Timestamp");
break;
case SMS_TYPE_SUBMIT:
- g_print("Type: Submit\n");
+ printf("Type: Submit\n");
- g_print("Message Reference: %u\n", (int)sms->submit.mr);
+ printf("Message Reference: %u\n", (int)sms->submit.mr);
- g_print("Destination-Address: %d, %d, %s\n",
+ printf("Destination-Address: %d, %d, %s\n",
(int)sms->submit.daddr.number_type,
(int)sms->submit.daddr.numbering_plan,
sms->submit.daddr.address);
- g_print("PID: %d\n", (int)sms->submit.pid);
- g_print("DCS: %d\n", (int)sms->submit.dcs);
+ printf("PID: %d\n", (int)sms->submit.pid);
+ printf("DCS: %d\n", (int)sms->submit.dcs);
print_vpf(sms->submit.vpf, &sms->submit.vp);
@@ -156,25 +159,22 @@
{
struct sms sms;
unsigned char *decoded_pdu;
- long pdu_len;
+ size_t pdu_len;
gboolean ret;
int data_len;
unsigned char *unpacked;
char *utf8;
- decoded_pdu = decode_hex(simple_deliver, -1, &pdu_len, 0);
-
+ decoded_pdu = l_util_from_hexstring(simple_deliver, &pdu_len);
g_assert(decoded_pdu);
- g_assert(pdu_len == (long)strlen(simple_deliver) / 2);
+ g_assert(pdu_len == strlen(simple_deliver) / 2);
ret = sms_decode(decoded_pdu, pdu_len, FALSE, 30, &sms);
-
- g_free(decoded_pdu);
-
+ l_free(decoded_pdu);
g_assert(ret);
g_assert(sms.type == SMS_TYPE_DELIVER);
- if (g_test_verbose())
+ if (VERBOSE)
dump_details(&sms);
g_assert(sms.sc_addr.number_type == SMS_NUMBER_TYPE_INTERNATIONAL);
@@ -204,48 +204,43 @@
g_assert(data_len == 11);
- unpacked = unpack_7bit(sms.deliver.ud, data_len, 0, FALSE,
+ unpacked = unpack_7bit(sms.deliver.ud, data_len, 0, false,
sms.deliver.udl, NULL, 0xff);
g_assert(unpacked);
utf8 = convert_gsm_to_utf8(unpacked, -1, NULL, NULL, 0xff);
-
- g_free(unpacked);
+ l_free(unpacked);
g_assert(utf8);
- if (g_test_verbose())
- g_print("Decoded user data is: %s\n", utf8);
+ if (VERBOSE)
+ printf("Decoded user data is: %s\n", utf8);
g_assert(strcmp(utf8, "How are you?") == 0);
-
- g_free(utf8);
+ l_free(utf8);
}
static void test_alnum_sender(void)
{
struct sms sms;
unsigned char *decoded_pdu;
- long pdu_len;
+ size_t pdu_len;
gboolean ret;
int data_len;
unsigned char *unpacked;
char *utf8;
- decoded_pdu = decode_hex(alnum_sender, -1, &pdu_len, 0);
-
+ decoded_pdu = l_util_from_hexstring(alnum_sender, &pdu_len);
g_assert(decoded_pdu);
- g_assert(pdu_len == (long)strlen(alnum_sender) / 2);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-stkutil.c
^
|
@@ -30,7 +30,7 @@
#include <stdint.h>
#include <glib.h>
-#include <glib/gprintf.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "smsutil.h"
@@ -186,14 +186,14 @@
check_common_byte(command, test);
}
-static void check_items(GSList *command, const struct stk_item *test)
+static void check_items(struct l_queue *command, const struct stk_item *test)
{
struct stk_item *si;
- GSList *l;
+ const struct l_queue_entry *entry;
unsigned int i = 0;
- for (l = command; l; l = l->next) {
- si = l->data;
+ for (entry = l_queue_get_entries(command); entry; entry = entry->next) {
+ si = entry->data;
check_item(si, &test[i++]);
}
@@ -278,6 +278,7 @@
message = sms_decode_text(sms_list);
g_assert(g_str_equal(message, ts->ud));
g_free(message);
+ g_slist_free(sms_list);
}
break;
@@ -318,16 +319,17 @@
}
/* Defined in TS 102.223 Section 8.18 */
-static void check_file_list(GSList *command, const struct stk_file *test)
+static void check_file_list(struct l_queue *command,
+ const struct stk_file *test)
{
struct stk_file *sf;
- GSList *l;
+ const struct l_queue_entry *entry = l_queue_get_entries(command);
unsigned int i = 0;
- for (l = command; l; l = l->next) {
- sf = l->data;
+ for (; entry; entry = entry->next) {
+ sf = entry->data;
g_assert(sf->len == test[i].len);
- g_assert(g_mem_equal(sf->file, test[i++].file, sf->len));
+ g_assert(!memcmp(sf->file, test[i++].file, sf->len));
}
g_assert(test[i].len == 0);
@@ -457,14 +459,14 @@
g_assert(g_mem_equal(command->file, test->file, test->len));
}
-static void check_provisioning_file_references(GSList *command,
+static void check_provisioning_file_references(struct l_queue *command,
const struct stk_file *test)
{
struct stk_file *sf;
- GSList *l;
+ const struct l_queue_entry *l;
unsigned int i = 0;
- for (l = command; l; l = l->next) {
+ for (l = l_queue_get_entries(command); l; l = l->next) {
sf = l->data;
check_provisioning_file_reference(sf, &test[i++]);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.28+git1.tar.bz2/upstream/unit/test-util.c
^
|
@@ -24,12 +24,16 @@
#endif
#include <string.h>
+#include <strings.h>
#include <stdio.h>
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
+static const bool VERBOSE = false;
+
const unsigned char invalid_gsm_extended[] = {
0x1b, 0x15
};
@@ -356,7 +360,7 @@
g_assert(nread == 0);
g_assert(nwritten == 0);
g_assert(res[0] == '\0');
- g_free(res);
+ l_free(res);
/*
* In case of invalid GSM extended code, we should display
@@ -369,13 +373,13 @@
exp_code = gsm_to_unicode_map[invalid_gsm_extended[1]*2 + 1];
exp_res_length = UTF8_LENGTH(exp_code);
- exp_res = g_new0(char, exp_res_length + 1);
- g_unichar_to_utf8(exp_code, exp_res);
+ exp_res = l_new(char, exp_res_length + 1);
+ l_utf8_from_wchar(exp_code, exp_res);
- g_assert(g_strcmp0(res, exp_res) == 0);
+ g_assert(!strcmp(res, exp_res));
g_assert(nread == exp_res_length);
- g_free(exp_res);
- g_free(res);
+ l_free(exp_res);
+ l_free(res);
res = convert_gsm_to_utf8(invalid_gsm_extended_len,
sizeof(invalid_gsm_extended_len),
@@ -404,7 +408,7 @@
char *res;
int i;
long size;
- gunichar *verify;
+ wchar_t verify;
unsigned char *back;
unsigned char buf[2];
@@ -427,23 +431,18 @@
res = convert_gsm_to_utf8(buf, size, &nread, &nwritten, 0);
g_assert(res);
- if (g_test_verbose())
- g_print("size: %ld, nread:%ld, nwritten:%ld, %s\n",
+ if (VERBOSE)
+ printf("size: %ld, nread:%ld, nwritten:%ld, %s\n",
size, nread, nwritten, res);
g_assert(nread == size);
- verify = g_utf8_to_ucs4(res, -1, NULL, NULL, NULL);
-
- g_assert(verify[0] == gsm_to_unicode_map[i*2+1]);
- g_assert(verify[1] == 0);
-
- g_assert(nwritten == UTF8_LENGTH(verify[0]));
+ g_assert(l_utf8_get_codepoint(res, nwritten, &verify) > 0);
+ g_assert(verify == gsm_to_unicode_map[i*2+1]);
+ g_assert(nwritten == UTF8_LENGTH(verify));
back = convert_utf8_to_gsm(res, -1, &nread, &nwritten, 0);
-
g_assert(back);
-
g_assert(nwritten == size);
if (c & 0x1b00) {
@@ -453,9 +452,8 @@
g_assert(back[0] == (c & 0x7f));
}
- g_free(back);
- g_free(verify);
- g_free(res);
+ l_free(back);
+ l_free(res);
}
}
@@ -466,7 +464,7 @@
char *res;
int i;
long size;
- gunichar *verify;
+ wchar_t verify;
unsigned char *back;
unsigned char buf[2];
@@ -490,24 +488,19 @@
&nwritten, 0, 1, 1);
g_assert(res);
- if (g_test_verbose())
- g_print("size: %ld, nread:%ld, nwritten:%ld, %s\n",
+ if (VERBOSE)
+ printf("size: %ld, nread:%ld, nwritten:%ld, %s\n",
size, nread, nwritten, res);
g_assert(nread == size);
- verify = g_utf8_to_ucs4(res, -1, NULL, NULL, NULL);
-
- g_assert(verify[0] == gsm_turkish_to_unicode_map[i*2+1]);
- g_assert(verify[1] == 0);
-
- g_assert(nwritten == UTF8_LENGTH(verify[0]));
+ g_assert(l_utf8_get_codepoint(res, nwritten, &verify) > 0);
+ g_assert(verify == gsm_turkish_to_unicode_map[i*2+1]);
+ g_assert(nwritten == UTF8_LENGTH(verify));
back = convert_utf8_to_gsm_with_lang(res, -1, &nread,
&nwritten, 0, 1, 1);
-
g_assert(back);
-
g_assert(nwritten == size);
if (c & 0x1b00) {
@@ -517,9 +510,8 @@
g_assert(back[0] == (c & 0x7f));
}
- g_free(back);
- g_free(verify);
- g_free(res);
+ l_free(back);
+ l_free(res);
}
}
@@ -536,44 +528,43 @@
unsigned char *decoded, *packed;
char *utf8, *hex_packed;
unsigned char *gsm, *gsm_encoded;
- long hex_decoded_size;
+ size_t hex_decoded_size;
long unpacked_size, packed_size;
long gsm_encoded_size;
- long i;
- if (g_test_verbose())
- g_print("Size of the orig string: %u\n",
+ if (VERBOSE)
+ printf("Size of the orig string: %u\n",
(unsigned int)strlen(sms));
- decoded = decode_hex(sms, -1, &hex_decoded_size, 0);
-
+ decoded = l_util_from_hexstring(sms, &hex_decoded_size);
g_assert(decoded != NULL);
- if (g_test_verbose())
- g_print("Decode to %ld bytes\n", hex_decoded_size);
+ if (VERBOSE)
+ printf("Decode to %zu bytes\n", hex_decoded_size);
+
+ if (VERBOSE) {
+ size_t i;
- if (g_test_verbose()) {
- g_print("%s\n", sms);
+ printf("%s\n", sms);
for (i = 0; i < hex_decoded_size; i++)
- g_print("%02X", decoded[i]);
- g_print("\n");
+ printf("%02X", decoded[i]);
+ printf("\n");
}
- gsm = unpack_7bit(decoded, hex_decoded_size, 0, FALSE,
+ gsm = unpack_7bit(decoded, hex_decoded_size, 0, false,
reported_text_size, &unpacked_size, 0xff);
g_assert(gsm != NULL);
- if (g_test_verbose())
- g_print("String unpacked to %ld bytes\n", unpacked_size);
+ if (VERBOSE)
+ printf("String unpacked to %ld bytes\n", unpacked_size);
utf8 = convert_gsm_to_utf8(gsm, -1, NULL, NULL, 0xff);
+ g_assert(utf8);
|