[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdepim/kaddressbook/xxport
From: Helge Deller <deller () kde ! org>
Date: 2006-04-17 18:48:28
Message-ID: 1145299708.350443.29346.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 530829 by deller:
make gnokii export filter more robust against internal changes of
libgnokii
M +27 -27 gnokii_xxport.cpp
--- branches/KDE/3.5/kdepim/kaddressbook/xxport/gnokii_xxport.cpp #530828:530829
@@ -94,12 +94,12 @@
revision[GN_REVISION_MAX_LENGTH+1], imei[GN_IMEI_MAX_LENGTH+1];
static QString PhoneProductId;
-static struct gn_statemachine state;
-static gn_data data;
+static gn_statemachine states[4]; // reserve ram if sizeof(gn_statemachine) differs \
between libgnokii versions +static gn_data gnokii_data[4]; // reserve ram if \
sizeof(gn_data) differs between libgnokii versions
static void busterminate(void)
{
- gn_sm_functions(GN_OP_Terminate, NULL, &state);
+ gn_sm_functions(GN_OP_Terminate, NULL, &states[0]);
if (lockfile) gn_device_unlock(lockfile);
}
@@ -116,18 +116,18 @@
#endif
return i18n("Failed to initialize the gnokii library.");
- if (!gn_cfg_phone_load("", &state))
+ if (!gn_cfg_phone_load("", &states[0]))
return i18n("Gnokii is not yet configured.");
// uncomment to debug all gnokii communication on stderr.
// gn_log_debug_mask = GN_LOG_T_STDERR;
- gn_data_clear(&data);
+ gn_data_clear(&gnokii_data[0]);
aux = gn_cfg_get(gn_cfg_info, "global", "use_locking");
// Defaults to 'no'
if (aux && !strcmp(aux, "yes")) {
- lockfile = gn_device_lock(state.config.port_device);
+ lockfile = gn_device_lock(states[0].config.port_device);
if (lockfile == NULL) {
return i18n("Gnokii reports a 'Lock File Error'.\n "
"Please exit all other running instances of gnokii, check if you have "
@@ -136,11 +136,11 @@
}
// Initialise the code for the GSM interface.
- int old_dcd = state.config.require_dcd; // work-around for older gnokii versions
- state.config.require_dcd = false;
- error = gn_gsm_initialise(&state);
+ int old_dcd = states[0].config.require_dcd; // work-around for older gnokii \
versions + states[0].config.require_dcd = false;
+ error = gn_gsm_initialise(&states[0]);
GNOKII_CHECK_ERROR(error);
- state.config.require_dcd = old_dcd;
+ states[0].config.require_dcd = old_dcd;
if (error != GN_ERR_NONE) {
busterminate();
return i18n("<qt><center>Mobile Phone interface initialization failed.<br><br>"
@@ -152,11 +152,11 @@
}
// identify phone
- gn_data_clear(&data);
- data.manufacturer = manufacturer;
- data.model = model;
- data.revision = revision;
- data.imei = imei;
+ gn_data_clear(&gnokii_data[0]);
+ gnokii_data[0].manufacturer = manufacturer;
+ gnokii_data[0].model = model;
+ gnokii_data[0].revision = revision;
+ gnokii_data[0].imei = imei;
QCString unknown(GN_TO(i18n("Unknown")));
qstrncpy(manufacturer, unknown, sizeof(manufacturer)-1);
@@ -167,7 +167,7 @@
if (m_progressDlg->wasCancelled())
return QString::null;
else
- error = gn_sm_functions(GN_OP_Identify, &data, &state);
+ error = gn_sm_functions(GN_OP_Identify, &gnokii_data[0], &states[0]);
GNOKII_CHECK_ERROR(error);
GNOKII_DEBUG( QString("Found mobile phone: %1 %2, Revision: %3, IMEI: %4\n")
@@ -184,11 +184,11 @@
{
gn_error error;
- gn_data_clear(&data);
+ gn_data_clear(&gnokii_data[0]);
memset(memstat, 0, sizeof(*memstat));
memstat->memory_type = memtype;
- data.memory_status = memstat;
- error = gn_sm_functions(GN_OP_GetMemoryStatus, &data, &state);
+ gnokii_data[0].memory_status = memstat;
+ error = gn_sm_functions(GN_OP_GetMemoryStatus, &gnokii_data[0], &states[0]);
GNOKII_CHECK_ERROR(error);
if (error != GN_ERR_NONE) {
switch (memtype) {
@@ -216,8 +216,8 @@
gn_error error;
entry->memory_type = memtype;
entry->location = index;
- data.phonebook_entry = entry;
- error = gn_sm_functions(GN_OP_ReadPhonebook, &data, &state);
+ gnokii_data[0].phonebook_entry = entry;
+ error = gn_sm_functions(GN_OP_ReadPhonebook, &gnokii_data[0], &states[0]);
GNOKII_CHECK_ERROR(error);
return error;
}
@@ -228,8 +228,8 @@
gn_phonebook_entry entry;
entry.memory_type = memtype;
entry.location = index;
- data.phonebook_entry = &entry;
- error = gn_sm_functions(GN_OP_ReadPhonebook, &data, &state);
+ gnokii_data[0].phonebook_entry = &entry;
+ error = gn_sm_functions(GN_OP_ReadPhonebook, &gnokii_data[0], &states[0]);
if (error == GN_ERR_EMPTYLOCATION)
return true;
GNOKII_CHECK_ERROR(error);
@@ -666,8 +666,8 @@
.arg(subentry->number_type).arg(GN_FROM(subentry->data.number)));
}
- data.phonebook_entry = &entry;
- gn_error error = gn_sm_functions(GN_OP_WritePhonebook, &data, &state);
+ gnokii_data[0].phonebook_entry = &entry;
+ gn_error error = gn_sm_functions(GN_OP_WritePhonebook, &gnokii_data[0], \
&states[0]); GNOKII_CHECK_ERROR(error);
return error;
@@ -681,9 +681,9 @@
entry.empty = 1;
entry.memory_type = memtype;
entry.location = phone_location;
- data.phonebook_entry = &entry;
+ gnokii_data[0].phonebook_entry = &entry;
GNOKII_DEBUG(QString("Deleting entry %1\n").arg(phone_location));
- gn_error error = gn_sm_functions(GN_OP_WritePhonebook, &data, &state);
+ gn_error error = gn_sm_functions(GN_OP_WritePhonebook, &gnokii_data[0], \
&states[0]); GNOKII_CHECK_ERROR(error);
return error;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic