mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-12 17:32:00 -05:00
* lots of files: handle NULL pointer printf problems,
fix some mem leaks * src/gnc-ui-util.c (gnc_account_get_balance_in_currency): new func git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3983 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
2b120f5e96
commit
78915425e0
42 files changed
+425
-213
No files matched your search
@@ -1,5 +1,12 @@
|
||||
2001-04-17 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* lots of files: handle NULL pointer printf problems,
|
||||
fix some mem leaks
|
||||
|
||||
2001-04-16 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnc-ui-util.c (gnc_account_get_balance_in_currency): new func
|
||||
|
||||
* src/gnome/dialog-price-editor.c: button for online quotes
|
||||
|
||||
* src/scm/price-quotes.scm: handle missing lib errors. i18n
|
||||
|
||||
+4
-2
@@ -65,7 +65,8 @@ static DB *database;
|
||||
static void
|
||||
usage (const char *name)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s database key1 value1 key2 value2 ...\n", name);
|
||||
fprintf (stderr, "Usage: %s database key1 value1 key2 value2 ...\n",
|
||||
name ? name : "");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -87,7 +88,8 @@ main (int argc, char *argv[])
|
||||
if (!database)
|
||||
{
|
||||
fprintf (stderr, "Error opening database %s: %s\n",
|
||||
db_name, strerror (errno));
|
||||
db_name ? db_name : "",
|
||||
strerror (errno) ? strerror (errno) : "");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
+38
-18
@@ -2813,6 +2813,8 @@ xaccSRSaveRegEntry (SplitRegister *reg, gboolean do_commit)
|
||||
Transaction *trans;
|
||||
guint32 changed;
|
||||
Split *split;
|
||||
const char *memo;
|
||||
const char *desc;
|
||||
|
||||
/* get the handle to the current split and transaction */
|
||||
split = xaccSRGetCurrentSplit (reg);
|
||||
@@ -2909,8 +2911,12 @@ xaccSRSaveRegEntry (SplitRegister *reg, gboolean do_commit)
|
||||
|
||||
xaccSRSaveChangedCells (reg, trans, split);
|
||||
|
||||
PINFO ("finished saving split %s of trans %s \n",
|
||||
xaccSplitGetMemo (split), xaccTransGetDescription (trans));
|
||||
memo = xaccSplitGetMemo (split);
|
||||
memo = memo ? memo : "(null)";
|
||||
desc = xaccTransGetDescription (trans);
|
||||
desc = desc ? desc : "(null)";
|
||||
|
||||
PINFO ("finished saving split %s of trans %s \n", memo, desc);
|
||||
|
||||
/* If the modified split is the "blank split", then it is now an
|
||||
* official part of the account. Set the blank split to NULL, so
|
||||
@@ -3180,7 +3186,8 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
/* commit any pending changes */
|
||||
xaccCommitDateCell (reg->dateCell);
|
||||
|
||||
DEBUG ("MOD_DATE: %s", reg->dateCell->cell.value);
|
||||
DEBUG ("MOD_DATE: %s",
|
||||
reg->dateCell->cell.value ? reg->dateCell->cell.value : "(null)");
|
||||
|
||||
xaccDateCellGetDate (reg->dateCell, &ts);
|
||||
|
||||
@@ -3189,7 +3196,8 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
|
||||
if (MOD_NUM & changed)
|
||||
{
|
||||
DEBUG ("MOD_NUM: %s\n", reg->numCell->cell.value);
|
||||
DEBUG ("MOD_NUM: %s\n",
|
||||
reg->numCell->cell.value ? reg->numCell->cell.value : "(null)");
|
||||
xaccTransSetNum (trans, reg->numCell->cell.value);
|
||||
if (xaccSetNumCellLastNum (reg->numCell, reg->numCell->cell.value))
|
||||
{
|
||||
@@ -3204,13 +3212,15 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
|
||||
if (MOD_DESC & changed)
|
||||
{
|
||||
DEBUG ("MOD_DESC: %s", reg->descCell->cell.value);
|
||||
DEBUG ("MOD_DESC: %s",
|
||||
reg->descCell->cell.value ? reg->descCell->cell.value : "(null)");
|
||||
xaccTransSetDescription (trans, reg->descCell->cell.value);
|
||||
}
|
||||
|
||||
if (MOD_NOTES & changed)
|
||||
{
|
||||
DEBUG ("MOD_NOTES: %s", reg->notesCell->cell.value);
|
||||
DEBUG ("MOD_NOTES: %s",
|
||||
reg->notesCell->cell.value ? reg->notesCell->cell.value : "(null)");
|
||||
xaccTransSetNotes (trans, reg->notesCell->cell.value);
|
||||
}
|
||||
|
||||
@@ -3222,13 +3232,16 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
|
||||
if (MOD_ACTN & changed)
|
||||
{
|
||||
DEBUG ("MOD_ACTN: %s", reg->actionCell->cell.value);
|
||||
DEBUG ("MOD_ACTN: %s",
|
||||
reg->actionCell->cell.value ?
|
||||
reg->actionCell->cell.value : "(null)");
|
||||
xaccSplitSetAction (split, reg->actionCell->cell.value);
|
||||
}
|
||||
|
||||
if (MOD_MEMO & changed)
|
||||
{
|
||||
DEBUG ("MOD_MEMO: %s", reg->memoCell->cell.value);
|
||||
DEBUG ("MOD_MEMO: %s",
|
||||
reg->memoCell->cell.value ? reg->memoCell->cell.value : "(null)");
|
||||
xaccSplitSetMemo (split, reg->memoCell->cell.value);
|
||||
}
|
||||
|
||||
@@ -3245,7 +3258,8 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
Account *new_acc;
|
||||
char *new_name;
|
||||
|
||||
DEBUG ("MOD_XFRM: %s", reg->xfrmCell->cell.value);
|
||||
DEBUG ("MOD_XFRM: %s",
|
||||
reg->xfrmCell->cell.value ? reg->xfrmCell->cell.value : "(null)");
|
||||
|
||||
/* do some reparenting. Insertion into new account will automatically
|
||||
* delete this split from the old account */
|
||||
@@ -3280,11 +3294,15 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
"accounts with different currencies\n"
|
||||
"you need an intermediate currency account.\n"
|
||||
"Please see the GnuCash online manual.");
|
||||
const char *name;
|
||||
char *message;
|
||||
|
||||
message = g_strdup_printf(format, xaccAccountGetName(new_acc));
|
||||
name = xaccAccountGetName(new_acc);
|
||||
name = name ? name : _("(no name)");
|
||||
|
||||
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
|
||||
message = g_strdup_printf (format, name);
|
||||
|
||||
gnc_warning_dialog_parented (xaccSRGetParent(reg), message);
|
||||
g_free(message);
|
||||
}
|
||||
}
|
||||
@@ -3295,7 +3313,8 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
|
||||
if (MOD_MXFRM & changed)
|
||||
{
|
||||
DEBUG ("MOD_MXFRM: %s", reg->mxfrmCell->cell.value);
|
||||
DEBUG ("MOD_MXFRM: %s",
|
||||
reg->mxfrmCell->cell.value ? reg->mxfrmCell->cell.value : "(null)");
|
||||
|
||||
other_split = xaccSplitGetOtherSplit (split);
|
||||
|
||||
@@ -3356,12 +3375,16 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
|
||||
"accounts with different currencies\n"
|
||||
"you need an intermediate currency account.\n"
|
||||
"Please see the GnuCash online manual.");
|
||||
const char *name;
|
||||
char *message;
|
||||
|
||||
message = g_strdup_printf(format, xaccAccountGetName(new_acc));
|
||||
name = xaccAccountGetName (new_acc);
|
||||
name = name ? name : _("(no name)");
|
||||
|
||||
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
|
||||
g_free(message);
|
||||
message = g_strdup_printf (format, name);
|
||||
|
||||
gnc_warning_dialog_parented (xaccSRGetParent(reg), message);
|
||||
g_free (message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4929,9 +4952,6 @@ LoadXferCell (ComboCell * cell,
|
||||
curr = xaccAccountGetCurrency (account);
|
||||
secu = xaccAccountGetSecurity (account);
|
||||
|
||||
DEBUG ("curr=%p secu=%p acct=%s\n",
|
||||
curr, secu, xaccAccountGetName (account));
|
||||
|
||||
if (load_everything ||
|
||||
(gnc_commodity_equiv (curr,base_currency)) ||
|
||||
(gnc_commodity_equiv (curr,base_security)) ||
|
||||
|
||||
@@ -288,7 +288,8 @@ xaccAccountCommitEdit (Account *acc)
|
||||
xaccFreeAccountGroup (acc->children);
|
||||
acc->children = NULL;
|
||||
|
||||
PINFO ("freeing splits for account %p (%s)\n", acc, acc->accountName);
|
||||
PINFO ("freeing splits for account %p (%s)\n",
|
||||
acc, acc->accountName ? acc->accountName : "(null)");
|
||||
|
||||
/* any split pointing at this account needs to be unmarked */
|
||||
for(lp = acc->splits; lp; lp = lp->next)
|
||||
@@ -1722,7 +1723,9 @@ xaccAccountStringToType(const char* str, int *type) {
|
||||
GNC_RETURN_ON_MATCH(MONEYMRKT);
|
||||
GNC_RETURN_ON_MATCH(CREDITLINE);
|
||||
|
||||
PERR("asked to translate unknown account type string %s.\n", str);
|
||||
PERR("asked to translate unknown account type string %s.\n",
|
||||
str ? str : "(null)");
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -82,7 +82,7 @@ check_response (XMLBackend *be)
|
||||
|
||||
/* get the content type out of the header */
|
||||
bufp = ghttp_get_header(request, "Content-Type");
|
||||
PINFO ("Content-Type: %s", bufp);
|
||||
PINFO ("Content-Type: %s", bufp ? bufp : "(null)");
|
||||
|
||||
/* in principle, we should reject content that isn't
|
||||
* labelled as text/gnc-xml. But for now, we'll be soft ...
|
||||
@@ -102,7 +102,9 @@ check_response (XMLBackend *be)
|
||||
{
|
||||
const char * errstr = ghttp_get_error (request);
|
||||
const char * reason = ghttp_reason_phrase (request);
|
||||
PERR ("connection failed: %s %s\n", errstr, reason);
|
||||
PERR ("connection failed: %s %s\n",
|
||||
errstr ? errstr : "",
|
||||
reason ? reason : "");
|
||||
|
||||
be->be.last_err = ERR_NETIO_SHORT_READ;
|
||||
return len;
|
||||
@@ -166,7 +168,9 @@ static void
|
||||
xmlbeBookBegin (GNCBook *book, const char *url)
|
||||
{
|
||||
XMLBackend *be;
|
||||
if (!book) return;
|
||||
|
||||
if (!book || !url) return;
|
||||
|
||||
ENTER ("url is %s", url);
|
||||
|
||||
be = (XMLBackend *) xaccGNCBookGetBackend (book);
|
||||
|
||||
+8
-2
@@ -86,11 +86,14 @@ void
|
||||
xaccAccountScrubOrphans (Account *acc)
|
||||
{
|
||||
GList *node;
|
||||
const char *str;
|
||||
|
||||
if (!acc)
|
||||
return;
|
||||
|
||||
PINFO ("Looking for orphans in account %s \n", xaccAccountGetName(acc));
|
||||
str = xaccAccountGetName (acc);
|
||||
str = str ? str : "(null)";
|
||||
PINFO ("Looking for orphans in account %s \n", str);
|
||||
|
||||
for (node = xaccAccountGetSplitList(acc); node; node = node->next)
|
||||
{
|
||||
@@ -265,8 +268,11 @@ void
|
||||
xaccAccountScrubImbalance (Account *acc)
|
||||
{
|
||||
GList *node;
|
||||
const char *str;
|
||||
|
||||
PINFO ("Looking for imbalance in account %s \n", xaccAccountGetName(acc));
|
||||
str = xaccAccountGetName(acc);
|
||||
str = str ? str : "(null)";
|
||||
PINFO ("Looking for imbalance in account %s \n", str);
|
||||
|
||||
for(node = xaccAccountGetSplitList(acc); node; node = node->next)
|
||||
{
|
||||
|
||||
@@ -1253,8 +1253,8 @@ xaccTransFindCommonCurrency (Transaction *trans)
|
||||
else if (!gnc_commodity_equiv (retval,trans->common_currency))
|
||||
{
|
||||
PWARN ("expected common currency %s but found %s\n",
|
||||
gnc_commodity_get_unique_name (trans->common_currency),
|
||||
gnc_commodity_get_unique_name (retval));
|
||||
gnc_commodity_get_unique_name (trans->common_currency),
|
||||
gnc_commodity_get_unique_name (retval));
|
||||
}
|
||||
|
||||
if (NULL == retval)
|
||||
@@ -1299,8 +1299,8 @@ xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr)
|
||||
{
|
||||
PWARN ("asked to change from common currency %s to %s\n"
|
||||
"doing so hasn't been tested and may orrupt the system\n",
|
||||
gnc_commodity_get_unique_name (trans->common_currency),
|
||||
gnc_commodity_get_unique_name (curr));
|
||||
gnc_commodity_get_unique_name (trans->common_currency),
|
||||
gnc_commodity_get_unique_name (curr));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1335,8 +1335,8 @@ xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr)
|
||||
{
|
||||
PWARN ("Transaction currency seems to be inconsistent.\n"
|
||||
"\tdefacto common=%s, asked to set %s",
|
||||
gnc_commodity_get_unique_name (kimono),
|
||||
gnc_commodity_get_unique_name (curr));
|
||||
gnc_commodity_get_unique_name (kimono),
|
||||
gnc_commodity_get_unique_name (curr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1378,6 +1378,7 @@ xaccTransCommitEdit (Transaction *trans)
|
||||
{
|
||||
Split *split;
|
||||
Backend *be;
|
||||
const char *str;
|
||||
|
||||
if (!trans) return;
|
||||
ENTER ("trans addr=%p", trans);
|
||||
@@ -1440,7 +1441,10 @@ xaccTransCommitEdit (Transaction *trans)
|
||||
*/
|
||||
|
||||
/* See if there's a backend. If there is, invoke it. */
|
||||
PINFO ("descr is %s", xaccTransGetDescription(trans));
|
||||
str = xaccTransGetDescription(trans);
|
||||
str = str ? str : "(null)";
|
||||
PINFO ("descr is %s", str);
|
||||
|
||||
be = xaccTransactionGetBackend (trans);
|
||||
if (be && be->trans_commit_edit)
|
||||
{
|
||||
|
||||
+33
-21
@@ -451,7 +451,7 @@ gnc_book_backup_file(GNCBook *book)
|
||||
gnc_book_push_error(
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to make bin file backup: %s",
|
||||
strerror(errno)));
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
g_free(bin_bkup);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -470,7 +470,7 @@ gnc_book_backup_file(GNCBook *book)
|
||||
gnc_book_push_error(
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to link backup file: %s",
|
||||
strerror(errno)));
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
g_free(backup);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -490,6 +490,7 @@ gnc_book_write_to_file(GNCBook *book,
|
||||
tmp_name = g_new(char, strlen(datafile) + 12);
|
||||
strcpy(tmp_name, datafile);
|
||||
strcat(tmp_name, ".tmp-XXXXXX");
|
||||
|
||||
if(!mktemp(tmp_name))
|
||||
{
|
||||
gnc_book_push_error(book, ERR_BACKEND_MISC,
|
||||
@@ -512,7 +513,8 @@ gnc_book_write_to_file(GNCBook *book,
|
||||
gnc_book_push_error(
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to unlink filename %s: %s",
|
||||
datafile, strerror(errno)));
|
||||
datafile ? datafile : "(null)",
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
g_free(tmp_name);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -522,7 +524,9 @@ gnc_book_write_to_file(GNCBook *book,
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to link from temp filename %s to "
|
||||
"real filename %s: %s",
|
||||
tmp_name, datafile, strerror(errno)));
|
||||
tmp_name ? tmp_name : "(null)",
|
||||
datafile ? datafile : "(null)",
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
g_free(tmp_name);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -531,7 +535,8 @@ gnc_book_write_to_file(GNCBook *book,
|
||||
gnc_book_push_error(
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to unlink temp filename %s: %s",
|
||||
tmp_name, strerror(errno)));
|
||||
tmp_name ? tmp_name : "(null)",
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
g_free(tmp_name);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -545,7 +550,8 @@ gnc_book_write_to_file(GNCBook *book,
|
||||
gnc_book_push_error(
|
||||
book, ERR_BACKEND_MISC,
|
||||
g_strdup_printf("unable to unlink temp_filename %s: %s",
|
||||
tmp_name, strerror(errno)));
|
||||
tmp_name ? tmp_name : "(null)",
|
||||
strerror(errno) ? strerror(errno) : ""));
|
||||
/* already in an error just flow on through */
|
||||
}
|
||||
g_free(tmp_name);
|
||||
@@ -560,7 +566,7 @@ static gboolean
|
||||
gnc_book_begin_file (GNCBook *book, const char * filefrag,
|
||||
gboolean ignore_lock)
|
||||
{
|
||||
ENTER (" filefrag=%s", filefrag);
|
||||
ENTER (" filefrag=%s", filefrag ? filefrag : "(null)");
|
||||
|
||||
/* Try to find or build an absolute file path */
|
||||
|
||||
@@ -602,7 +608,8 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
int rc;
|
||||
|
||||
if (!book) return FALSE;
|
||||
ENTER (" ignore_lock=%d, book-id=%s", ignore_lock, book_id);
|
||||
ENTER (" ignore_lock=%d, book-id=%s", ignore_lock,
|
||||
book_id ? book_id : "(null)");
|
||||
|
||||
/* clear the error condition of previous errors */
|
||||
gnc_book_clear_error (book);
|
||||
@@ -659,8 +666,8 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
gnc_book_push_error (book, ERR_FILEIO_FILE_NOT_FOUND, NULL);
|
||||
return FALSE; /* ouch */
|
||||
}
|
||||
PINFO ("filepath=%s\n", book->fullpath);
|
||||
|
||||
PINFO ("filepath=%s\n", book->fullpath ? book->fullpath : "(null)");
|
||||
|
||||
/* load different backend based on URL. We should probably
|
||||
* dynamically load these based on some config file ... */
|
||||
@@ -682,7 +689,7 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
if (! dll_handle)
|
||||
{
|
||||
dll_err = dlerror();
|
||||
PWARN (" can't load library: %s\n", dll_err);
|
||||
PWARN (" can't load library: %s\n", dll_err ? dll_err : "");
|
||||
g_free(book->fullpath);
|
||||
book->fullpath = NULL;
|
||||
g_free(book->book_id);
|
||||
@@ -698,7 +705,7 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
dll_err = dlerror();
|
||||
if (dll_err)
|
||||
{
|
||||
PWARN (" can't find symbol: %s\n", dll_err);
|
||||
PWARN (" can't find symbol: %s\n", dll_err ? dll_err : "");
|
||||
g_free(book->fullpath);
|
||||
book->fullpath = NULL;
|
||||
g_free(book->book_id);
|
||||
@@ -721,7 +728,7 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
if (! dll_handle)
|
||||
{
|
||||
dll_err = dlerror();
|
||||
PWARN (" can't load library: %s\n", dll_err);
|
||||
PWARN (" can't load library: %s\n", dll_err ? dll_err : "");
|
||||
g_free(book->fullpath);
|
||||
book->fullpath = NULL;
|
||||
g_free(book->book_id);
|
||||
@@ -737,7 +744,7 @@ gnc_book_begin (GNCBook *book, const char * book_id,
|
||||
dll_err = dlerror();
|
||||
if (dll_err)
|
||||
{
|
||||
PWARN (" can't find symbol: %s\n", dll_err);
|
||||
PWARN (" can't find symbol: %s\n", dll_err ? dll_err : "");
|
||||
g_free(book->fullpath);
|
||||
book->fullpath = NULL;
|
||||
g_free(book->book_id);
|
||||
@@ -788,7 +795,7 @@ gnc_book_load (GNCBook *book)
|
||||
if (!book) return FALSE;
|
||||
if (!book->book_id) return FALSE;
|
||||
|
||||
ENTER ("book_id=%s", book->book_id);
|
||||
ENTER ("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
|
||||
if (strncmp(book->book_id, "file:", 5) == 0)
|
||||
{
|
||||
@@ -823,7 +830,7 @@ gnc_book_load (GNCBook *book)
|
||||
|
||||
xaccGroupScrubSplits (book->topgroup);
|
||||
|
||||
LEAVE("book_id=%s", book->book_id);
|
||||
LEAVE("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
return TRUE;
|
||||
}
|
||||
else if ((strncmp(book->book_id, "http://", 7) == 0) ||
|
||||
@@ -864,7 +871,7 @@ gnc_book_load (GNCBook *book)
|
||||
xaccLogEnable();
|
||||
}
|
||||
|
||||
LEAVE("book_id=%s", book->book_id);
|
||||
LEAVE("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -909,9 +916,11 @@ void
|
||||
gnc_book_save (GNCBook *book)
|
||||
{
|
||||
Backend *be;
|
||||
|
||||
if (!book) return;
|
||||
|
||||
ENTER ("book_id=%s", book->book_id);
|
||||
ENTER ("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
|
||||
/* if there is a backend, and the backend is reachablele
|
||||
* (i.e. we can communicate with it), then synchronize with
|
||||
* the backend. If we cannot contact the backend (e.g.
|
||||
@@ -964,7 +973,8 @@ gnc_book_end (GNCBook *book)
|
||||
{
|
||||
if (!book) return;
|
||||
|
||||
ENTER ("book_id=%s", book->book_id);
|
||||
ENTER ("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
|
||||
/* close down the backend first */
|
||||
if (book->backend && book->backend->book_end)
|
||||
{
|
||||
@@ -1000,7 +1010,8 @@ void
|
||||
gnc_book_destroy (GNCBook *book)
|
||||
{
|
||||
if (!book) return;
|
||||
ENTER ("book_id=%s", book->book_id);
|
||||
|
||||
ENTER ("book_id=%s", book->book_id ? book->book_id : "(null)");
|
||||
|
||||
xaccLogDisable();
|
||||
gnc_book_end (book);
|
||||
@@ -1106,6 +1117,7 @@ xaccResolveFilePath (const char * filefrag)
|
||||
|
||||
/* seriously invalid */
|
||||
if (!filefrag) return NULL;
|
||||
|
||||
ENTER ("filefrag=%s", filefrag);
|
||||
|
||||
/* ---------------------------------------------------- */
|
||||
@@ -1264,7 +1276,7 @@ gnc_run_rpc_server (void)
|
||||
if (! dll_handle)
|
||||
{
|
||||
dll_err = dlerror();
|
||||
PWARN (" can't load library: %s\n", dll_err);
|
||||
PWARN (" can't load library: %s\n", dll_err ? dll_err : "");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1273,7 +1285,7 @@ gnc_run_rpc_server (void)
|
||||
if (dll_err)
|
||||
{
|
||||
dll_err = dlerror();
|
||||
PWARN (" can't find symbol: %s\n", dll_err);
|
||||
PWARN (" can't find symbol: %s\n", dll_err ? dll_err : "");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,21 +66,21 @@ typedef struct _gnc_commodity_namespace gnc_commodity_namespace;
|
||||
static void
|
||||
reset_printname(gnc_commodity *com)
|
||||
{
|
||||
if(com->printname) { g_free(com->printname); }
|
||||
g_free(com->printname);
|
||||
com->printname = g_strdup_printf("%s (%s)",
|
||||
com->mnemonic,
|
||||
com->fullname);
|
||||
com->mnemonic ? com->mnemonic : "",
|
||||
com->fullname ? com->fullname : "");
|
||||
}
|
||||
|
||||
static void
|
||||
reset_unique_name(gnc_commodity *com)
|
||||
{
|
||||
if(com->unique_name) { g_free(com->unique_name); }
|
||||
g_free(com->unique_name);
|
||||
com->unique_name = g_strdup_printf("%s::%s",
|
||||
com->namespace,
|
||||
com->mnemonic);
|
||||
com->namespace ? com->namespace : "",
|
||||
com->mnemonic ? com->mnemonic : "");
|
||||
}
|
||||
|
||||
|
||||
gnc_commodity *
|
||||
gnc_commodity_new(const char * fullname,
|
||||
const char * namespace, const char * mnemonic,
|
||||
@@ -88,7 +88,7 @@ gnc_commodity_new(const char * fullname,
|
||||
int fraction)
|
||||
{
|
||||
gnc_commodity * retval = g_new0(gnc_commodity, 1);
|
||||
|
||||
|
||||
retval->fullname = g_strdup(fullname);
|
||||
retval->namespace = g_strdup(namespace);
|
||||
retval->mnemonic = g_strdup(mnemonic);
|
||||
@@ -97,7 +97,7 @@ gnc_commodity_new(const char * fullname,
|
||||
|
||||
reset_printname(retval);
|
||||
reset_unique_name(retval);
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ prettify (const char *name)
|
||||
static char bf[128];
|
||||
char *p;
|
||||
|
||||
if (!name)
|
||||
return "";
|
||||
|
||||
strncpy (bf, name, 29); bf[28] = 0;
|
||||
p = strchr (bf, '(');
|
||||
|
||||
@@ -130,7 +133,9 @@ gnc_log (gncModuleType module, gncLogLevel log_level, const char *prefix,
|
||||
if (!gnc_should_log (module, log_level))
|
||||
return;
|
||||
|
||||
fprintf (stderr, "%s: %s: ", prefix, prettify (function_name));
|
||||
fprintf (stderr, "%s: %s: ",
|
||||
prefix ? prefix : "(null)",
|
||||
prettify (function_name));
|
||||
|
||||
va_start (ap, format);
|
||||
|
||||
|
||||
+21
-11
@@ -798,12 +798,14 @@ gnc_price_print(GNCPrice *p, FILE *f, int indent)
|
||||
gnc_commodity *commodity;
|
||||
gnc_commodity *currency;
|
||||
gchar *istr = NULL; /* indent string */
|
||||
const char *str;
|
||||
|
||||
if(!p) return;
|
||||
if(!f) return;
|
||||
|
||||
commodity = gnc_price_get_commodity(p);
|
||||
currency = gnc_price_get_currency(p);
|
||||
|
||||
|
||||
if(!commodity) return;
|
||||
if(!currency) return;
|
||||
|
||||
@@ -811,19 +813,27 @@ gnc_price_print(GNCPrice *p, FILE *f, int indent)
|
||||
|
||||
fprintf(f, "%s<pdb:price>\n", istr);
|
||||
fprintf(f, "%s <pdb:commodity pointer=%p>\n", istr, commodity);
|
||||
fprintf(f, "%s <cmdty:ref-space> %s</gnc:cmdty:ref-space>\n", istr,
|
||||
gnc_commodity_get_namespace(commodity));
|
||||
fprintf(f, "%s <cmdty:ref-id>%s</cmdty:ref-id>\n", istr,
|
||||
gnc_commodity_get_mnemonic(commodity));
|
||||
str = gnc_commodity_get_namespace(commodity);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s <cmdty:ref-space> %s</gnc:cmdty:ref-space>\n", istr, str);
|
||||
str = gnc_commodity_get_mnemonic(commodity);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s <cmdty:ref-id>%s</cmdty:ref-id>\n", istr, str);
|
||||
fprintf(f, "%s </pdb:commodity>\n", istr);
|
||||
fprintf(f, "%s <pdb:currency pointer=%p>\n", istr, currency);
|
||||
fprintf(f, "%s <cmdty:ref-space>%s</gnc:cmdty:ref-space>\n", istr,
|
||||
gnc_commodity_get_namespace(currency));
|
||||
fprintf(f, "%s <cmdty:ref-id>%s</cmdty:ref-id>\n", istr,
|
||||
gnc_commodity_get_mnemonic(currency));
|
||||
str = gnc_commodity_get_namespace(currency);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s <cmdty:ref-space>%s</gnc:cmdty:ref-space>\n", istr, str);
|
||||
str = gnc_commodity_get_mnemonic(currency);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s <cmdty:ref-id>%s</cmdty:ref-id>\n", istr, str);
|
||||
fprintf(f, "%s </pdb:currency>\n", istr);
|
||||
fprintf(f, "%s %s\n", istr, gnc_price_get_source(p));
|
||||
fprintf(f, "%s %s\n", istr, gnc_price_get_type(p));
|
||||
str = gnc_price_get_source(p);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s %s\n", istr, str);
|
||||
str = gnc_price_get_type(p);
|
||||
str = str ? str : "(null)";
|
||||
fprintf(f, "%s %s\n", istr, str);
|
||||
fprintf(f, "%s %g\n", istr, gnc_numeric_to_double(gnc_price_get_value(p)));
|
||||
fprintf(f, "%s</pdb:price>\n", istr);
|
||||
|
||||
|
||||
+3
-3
@@ -472,12 +472,12 @@ badstring:
|
||||
char *
|
||||
guid_to_string(const GUID * guid)
|
||||
{
|
||||
char *string = g_malloc(GUID_ENCODING_LENGTH+1);
|
||||
|
||||
if (!string) return NULL;
|
||||
char *string;
|
||||
|
||||
if(!guid) return(NULL);
|
||||
|
||||
string = g_malloc(GUID_ENCODING_LENGTH+1);
|
||||
|
||||
encode_md5_data(guid->data, string);
|
||||
|
||||
string[GUID_ENCODING_LENGTH] = '\0';
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/********************************************************************\
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -48,9 +67,8 @@ clear_up_account_commodity(
|
||||
gnc_commodity_get_mnemonic(com));
|
||||
if(!gcom)
|
||||
{
|
||||
g_warning("unable to find global commodity for %s:%s adding new",
|
||||
gnc_commodity_get_namespace(com),
|
||||
gnc_commodity_get_mnemonic(com));
|
||||
g_warning("unable to find global commodity for %s adding new",
|
||||
gnc_commodity_get_unique_name(com));
|
||||
gnc_commodity_table_insert(tbl, com);
|
||||
}
|
||||
else
|
||||
@@ -150,7 +168,8 @@ gnc_counter_end_handler(gpointer data_for_children,
|
||||
strval = dom_tree_to_text(tree);
|
||||
if(!string_to_integer(strval, &val))
|
||||
{
|
||||
g_warning("string_to_integer failed with input: %s", strval);
|
||||
g_warning("string_to_integer failed with input: %s",
|
||||
strval ? strval : "(null)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -168,10 +187,11 @@ gnc_counter_end_handler(gpointer data_for_children,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("Unknown type: %s", type);
|
||||
g_warning("Unknown type: %s",
|
||||
type ? type : "(null)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -967,7 +967,7 @@ kvp_value_glist_to_string(const GList *list)
|
||||
gchar *tmp3;
|
||||
|
||||
tmp3 = kvp_value_to_string((kvp_value*)cursor->data);
|
||||
tmp2 = g_strdup_printf("%s %s,", tmp1, tmp3);
|
||||
tmp2 = g_strdup_printf("%s %s,", tmp1, tmp3 ? tmp3 : "");
|
||||
g_free(tmp1);
|
||||
g_free(tmp3);
|
||||
tmp1 = tmp2;
|
||||
@@ -1001,19 +1001,19 @@ kvp_value_to_string(const kvp_value *val)
|
||||
|
||||
case KVP_TYPE_NUMERIC:
|
||||
tmp1 = gnc_numeric_to_string(kvp_value_get_numeric(val));
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_NUMERIC(%s)", tmp1);
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_NUMERIC(%s)", tmp1 ? tmp1 : "");
|
||||
g_free(tmp1);
|
||||
return tmp2;
|
||||
break;
|
||||
|
||||
case KVP_TYPE_STRING:
|
||||
return g_strdup_printf("KVP_VALUE_STRING(%s)",
|
||||
kvp_value_get_string(val));
|
||||
tmp1 = kvp_value_get_string (val);
|
||||
return g_strdup_printf("KVP_VALUE_STRING(%s)", tmp1 ? tmp1 : "");
|
||||
break;
|
||||
|
||||
case KVP_TYPE_GUID:
|
||||
tmp1 = guid_to_string(kvp_value_get_guid(val));
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_GUID(%s)", tmp1);
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_GUID(%s)", tmp1 ? tmp1 : "");
|
||||
g_free(tmp1);
|
||||
return tmp2;
|
||||
break;
|
||||
@@ -1024,20 +1024,20 @@ kvp_value_to_string(const kvp_value *val)
|
||||
void *data;
|
||||
data = kvp_value_get_binary(val, &len);
|
||||
tmp1 = binary_to_string(data, len);
|
||||
return g_strdup_printf("KVP_VALUE_BINARY(%s)", tmp1);
|
||||
return g_strdup_printf("KVP_VALUE_BINARY(%s)", tmp1 ? tmp1 : "");
|
||||
}
|
||||
break;
|
||||
|
||||
case KVP_TYPE_GLIST:
|
||||
tmp1 = kvp_value_glist_to_string(kvp_value_get_glist(val));
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_GLIST(%s)", tmp1);
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_GLIST(%s)", tmp1 ? tmp1 : "");
|
||||
g_free(tmp1);
|
||||
return tmp2;
|
||||
break;
|
||||
|
||||
case KVP_TYPE_FRAME:
|
||||
tmp1 = kvp_frame_to_string(kvp_value_get_frame(val));
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_FRAME(%s)", tmp1);
|
||||
tmp2 = g_strdup_printf("KVP_VALUE_FRAME(%s)", tmp1 ? tmp1 : "");
|
||||
g_free(tmp1);
|
||||
return tmp2;
|
||||
break;
|
||||
@@ -1056,8 +1056,11 @@ kvp_frame_to_string_helper(gpointer key, gpointer value, gpointer data)
|
||||
gchar *old_data = *str;
|
||||
|
||||
tmp_val = kvp_value_to_string((kvp_value*)value);
|
||||
|
||||
*str = g_strdup_printf("%s %s => %s,\n", *str, (gchar*)key, tmp_val);
|
||||
|
||||
*str = g_strdup_printf("%s %s => %s,\n",
|
||||
*str ? *str : "",
|
||||
key ? (char *) key : "",
|
||||
tmp_val ? tmp_val : "");
|
||||
|
||||
g_free(old_data);
|
||||
g_free(tmp_val);
|
||||
@@ -1071,14 +1074,14 @@ kvp_frame_to_string(const kvp_frame *frame)
|
||||
tmp1 = g_strdup_printf("{\n");
|
||||
|
||||
g_hash_table_foreach(frame->hash, kvp_frame_to_string_helper, &tmp1);
|
||||
|
||||
|
||||
{
|
||||
gchar *tmp2;
|
||||
tmp2 = g_strdup_printf("%s}\n", tmp1);
|
||||
g_free(tmp1);
|
||||
tmp1 = tmp2;
|
||||
}
|
||||
|
||||
|
||||
return tmp1;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,9 @@ static void rpcendLogin (RPCBackend *be)
|
||||
CLIENT *client = NULL;
|
||||
int err;
|
||||
|
||||
ENTER ("be=%p, host=\"%s\", port=\"%s\"", be, be->hostname, be->portNum);
|
||||
ENTER ("be=%p, host=\"%s\", port=\"%s\"", be,
|
||||
be->hostname ? be->hostname : "",
|
||||
be->portNum ? be->portNum : "");
|
||||
|
||||
/* Figure out the port number */
|
||||
if (be->portNum)
|
||||
@@ -790,7 +792,8 @@ static void rpcend_book_begin (GNCBook *book, const char *book_id,
|
||||
be = (RPCBackend *) xaccGNCBookGetBackend (book);
|
||||
VERIFY_BEV (be);
|
||||
|
||||
ENTER("be=%p, id=%s, ignore=%s, create=%s", be, book_id,
|
||||
ENTER("be=%p, id=%s, ignore=%s, create=%s", be,
|
||||
book_id ? book_id : "",
|
||||
(ignore_lock == TRUE ? "true" : "false"),
|
||||
(create == TRUE ? "true" : "false"));
|
||||
|
||||
@@ -886,7 +889,7 @@ static void rpcend_book_begin (GNCBook *book, const char *book_id,
|
||||
be->be.events_pending = rpcend_events_pending;
|
||||
be->be.process_events = rpcend_process_events;
|
||||
|
||||
LEAVE("be=%p, id=%s", be, book_id);
|
||||
LEAVE("be=%p, id=%s", be, book_id ? book_id : "");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -444,7 +444,8 @@ void rpcend_build_gncacct (gncAccount *gncacct, Account *acc)
|
||||
#ifdef GNCACCT_COMMODITY
|
||||
c = xaccAccountGetCommodity (acc);
|
||||
if (!c)
|
||||
PWARN ("Account (%s) had NULL commodity", gncacct->name);
|
||||
PWARN ("Account (%s) had NULL commodity",
|
||||
gncacct->name ? gncacct->name : "");
|
||||
gncacct->commodity.namespace = STRDUP (gnc_commodity_get_namespace (c));
|
||||
gncacct->commodity.mnemonic = STRDUP (gnc_commodity_get_mnemonic (c));
|
||||
#else
|
||||
@@ -686,7 +687,7 @@ gnc_vers_list * rpcend_build_gncverslist_txn (GList *txnlist,
|
||||
gnc_vers_list *vlist = NULL;
|
||||
struct _listinfo listinfo;
|
||||
|
||||
ENTER ("list=%p, copy=%s", txnlist, copyguid?"true":"false");
|
||||
ENTER ("list=%p, copy=%s", txnlist, copyguid ? "true" : "false");
|
||||
listinfo.end = &vlist;
|
||||
listinfo.copyguid = copyguid;
|
||||
listinfo.count = 0;
|
||||
@@ -705,7 +706,7 @@ gnc_vers_list * rpcend_build_gnctxn_verslist (AccountGroup *ag,
|
||||
gnc_vers_list *vlist = NULL;
|
||||
struct _listinfo listinfo;
|
||||
|
||||
ENTER ("ag=%p, copy=%s", ag, copyguid?"true":"false");
|
||||
ENTER ("ag=%p, copy=%s", ag, copyguid ? "true" : "false");
|
||||
listinfo.end = &vlist;
|
||||
listinfo.copyguid = copyguid;
|
||||
listinfo.count = 0;
|
||||
@@ -733,7 +734,7 @@ gnc_vers_list * rpcend_build_gncacct_verslist (AccountGroup *ag,
|
||||
gnc_vers_list *vlist = NULL;
|
||||
struct _listinfo listinfo;
|
||||
|
||||
ENTER ("ag=%p, copy=%s", ag, copyguid?"true":"false");
|
||||
ENTER ("ag=%p, copy=%s", ag, copyguid ? "true" : "false");
|
||||
listinfo.end = &vlist;
|
||||
listinfo.copyguid = copyguid;
|
||||
listinfo.count = 0;
|
||||
|
||||
@@ -59,7 +59,7 @@ gncrpc_book_begin_1_svc(gncrpc_book_begin_args *argp, int *result, struct svc_re
|
||||
GncRpcSvc *cl;
|
||||
int res = ERR_RPC_SERVER_STATE;
|
||||
|
||||
ENTER ("id=\"%s\"", argp->book_id);
|
||||
ENTER ("id=\"%s\"", argp->book_id ? argp->book_id : "");
|
||||
|
||||
do {
|
||||
gboolean ret;
|
||||
|
||||
@@ -52,24 +52,21 @@ text_to_dom_tree(const char *tag, const char *str)
|
||||
xmlNodePtr
|
||||
guid_to_dom_tree(const char *tag, const GUID* gid)
|
||||
{
|
||||
char *guid_str;
|
||||
char guid_str[GUID_ENCODING_LENGTH + 1];
|
||||
xmlNodePtr ret;
|
||||
|
||||
|
||||
ret = xmlNewNode(NULL, tag);
|
||||
|
||||
xmlSetProp(ret, "type", "guid");
|
||||
|
||||
guid_str = guid_to_string(gid);
|
||||
if (!guid_str)
|
||||
if (!guid_to_string_buff(gid, guid_str))
|
||||
{
|
||||
printf("FAILURE: guid_to_string failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
xmlNodeAddContent(ret, guid_str);
|
||||
|
||||
g_free(guid_str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,12 @@ dom_tree_to_guid(xmlNodePtr node)
|
||||
|
||||
if(strcmp(node->properties->name, "type") != 0)
|
||||
{
|
||||
g_warning("Unknown attribute for id tag: %s\n",
|
||||
node->properties->name);
|
||||
PERR("Unknown attribute for id tag: %s\n",
|
||||
node->properties->name ?
|
||||
(char *) node->properties->name : "(null)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
char *type = node->properties->xmlAttrPropertyValue->content;
|
||||
/* handle new and guid the same for the moment */
|
||||
@@ -63,8 +64,10 @@ dom_tree_to_guid(xmlNodePtr node)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("Unknown type %s for attribute type for tag %s",
|
||||
type, node->properties->name);
|
||||
PERR("Unknown type %s for attribute type for tag %s",
|
||||
type ? type : "(null)",
|
||||
node->properties->name ?
|
||||
(char *) node->properties->name : "(null)");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +233,7 @@ dom_tree_to_binary_kvp_value(xmlNodePtr node)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("string_to_binary returned false");
|
||||
PERR("string_to_binary returned false");
|
||||
}
|
||||
|
||||
g_free(text);
|
||||
@@ -425,7 +428,9 @@ dom_tree_to_text(xmlNodePtr tree)
|
||||
default:
|
||||
PERR("dom_tree_to_text: hit illegal node while extracting text.");
|
||||
PERR(" (name %s) (type %d) (content %s)",
|
||||
current->name, current->type, current->content);
|
||||
current->name ? (char *) current->name : "(null)",
|
||||
current->type,
|
||||
current->content ? (char *) current->content : "(null)");
|
||||
current = NULL;
|
||||
ok = FALSE;
|
||||
break;
|
||||
@@ -544,7 +549,7 @@ dom_tree_to_timespec(xmlNodePtr node)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PERR("dom_tree_to_timespec: unexpected sub-node.");
|
||||
PERR("unexpected sub-node.");
|
||||
return timespec_failure(ret);
|
||||
break;
|
||||
}
|
||||
@@ -552,7 +557,7 @@ dom_tree_to_timespec(xmlNodePtr node)
|
||||
|
||||
if(!seen_s)
|
||||
{
|
||||
g_warning("dom_tree_to_timespec: no ts:date node found.");
|
||||
PERR("no ts:date node found.");
|
||||
return timespec_failure(ret);
|
||||
}
|
||||
|
||||
@@ -665,7 +670,8 @@ dom_tree_handlers_all_gotten_p(struct dom_tree_handler *handlers)
|
||||
{
|
||||
if(handlers->required && ! handlers->gotten)
|
||||
{
|
||||
g_warning("Not defined and it should be: %s", handlers->tag);
|
||||
PERR("Not defined and it should be: %s",
|
||||
handlers->tag ? handlers->tag : "(null)");
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -675,7 +681,7 @@ dom_tree_handlers_all_gotten_p(struct dom_tree_handler *handlers)
|
||||
|
||||
static gboolean
|
||||
gnc_xml_set_data(const gchar* tag, xmlNodePtr node, gboolean *item,
|
||||
struct dom_tree_handler *handlers)
|
||||
struct dom_tree_handler *handlers)
|
||||
{
|
||||
for(;handlers->tag != NULL; handlers++)
|
||||
{
|
||||
@@ -689,7 +695,8 @@ gnc_xml_set_data(const gchar* tag, xmlNodePtr node, gboolean *item,
|
||||
|
||||
if(!handlers->tag)
|
||||
{
|
||||
g_warning("Unhandled tag: %s\n", tag);
|
||||
PERR("Unhandled tag: %s\n",
|
||||
tag ? tag : "(null)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -709,7 +716,7 @@ dom_tree_generic_parse(xmlNodePtr node, struct dom_tree_handler *handlers,
|
||||
{
|
||||
if(!gnc_xml_set_data(achild->name, achild, data, handlers))
|
||||
{
|
||||
g_warning("gnc_xml_set_data failed");
|
||||
PERR("gnc_xml_set_data failed");
|
||||
successful = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -717,7 +724,7 @@ dom_tree_generic_parse(xmlNodePtr node, struct dom_tree_handler *handlers,
|
||||
|
||||
if(!dom_tree_handlers_all_gotten_p(handlers))
|
||||
{
|
||||
g_warning("missing tag in input");
|
||||
PERR("missing tag in input");
|
||||
successful = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,9 @@ sixtp_stack_frame_print(sixtp_stack_frame *sf, gint indent, FILE *f) {
|
||||
|
||||
fprintf(f, "%s(stack-frame %p\n", is, sf);
|
||||
fprintf(f, "%s (parser %p)\n", is, sf->parser);
|
||||
fprintf(f, "%s (tag %s)\n", is, sf->tag);
|
||||
fprintf(f, "%s (data-for-children %p)\n", is, sf->data_for_children);
|
||||
fprintf(f, "%s (tag %s)\n", is, sf->tag ? sf->tag : "(null)");
|
||||
fprintf(f, "%s (data-for-children %p)\n", is,
|
||||
sf->data_for_children);
|
||||
|
||||
{
|
||||
GSList *lp;
|
||||
@@ -74,6 +75,7 @@ sixtp_stack_frame_print(sixtp_stack_frame *sf, gint indent, FILE *f) {
|
||||
|
||||
fprintf(f, "%s (frame-data %p))\n", is, sf->frame_data);
|
||||
fflush(f);
|
||||
g_free(is);
|
||||
}
|
||||
|
||||
GSList*
|
||||
|
||||
@@ -203,19 +203,13 @@ xml_add_guid(xmlNodePtr p, const char *tag, const GUID *guid) {
|
||||
g_return_val_if_fail(guid, FALSE);
|
||||
|
||||
{
|
||||
const char *guidstr;
|
||||
char guidstr[GUID_ENCODING_LENGTH + 1];
|
||||
xmlNodePtr child;
|
||||
|
||||
if(!guid) {
|
||||
guidstr = NULL;
|
||||
} else {
|
||||
guidstr = guid_to_string(guid);
|
||||
g_return_val_if_fail(guidstr, FALSE);
|
||||
}
|
||||
guid_to_string_buff(guid, guidstr);
|
||||
|
||||
child = xmlNewTextChild(p, NULL, tag, guidstr);
|
||||
g_return_val_if_fail(child, FALSE);
|
||||
if(guidstr) free((void *) guidstr);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -325,7 +319,8 @@ xml_add_binary(xmlNodePtr p,
|
||||
g_string_free(output, TRUE);
|
||||
|
||||
} else {
|
||||
PERR("unknown output format %s.\n", format);
|
||||
PERR("unknown output format %s.\n",
|
||||
format ? format : "(null)");
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
|
||||
+17
-10
@@ -49,7 +49,6 @@ sixtp_child_free_data(sixtp_child_result *result) {
|
||||
if(result->data) g_free(result->data);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sixtp_child_result_destroy(sixtp_child_result *r) {
|
||||
if(r->should_cleanup && r->cleanup_handler) {
|
||||
@@ -61,7 +60,9 @@ sixtp_child_result_destroy(sixtp_child_result *r) {
|
||||
|
||||
void
|
||||
sixtp_child_result_print(sixtp_child_result *cr, FILE *f) {
|
||||
fprintf(f, "((tag %s) (data %p))", cr->tag, cr->data);
|
||||
fprintf(f, "((tag %s) (data %p))",
|
||||
cr->tag ? cr->tag : "(null)",
|
||||
cr->data);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
@@ -238,15 +239,18 @@ sixtp_destroy_child(gpointer key, gpointer value, gpointer user_data) {
|
||||
gpointer lookup_key;
|
||||
gpointer lookup_value;
|
||||
|
||||
PINFO ("Killing sixtp child under key <%s>", (char *) key);
|
||||
PINFO ("Killing sixtp child under key <%s>",
|
||||
key ? (char *) key : "(null)");
|
||||
g_free(key);
|
||||
|
||||
if(!corpses) {
|
||||
PERR("no corpses in sixtp_destroy_child <%s>\n", (char *) key);
|
||||
PERR("no corpses in sixtp_destroy_child <%s>\n",
|
||||
key ? (char *) key : "(null)");
|
||||
return;
|
||||
}
|
||||
if(!child) {
|
||||
PERR("no child in sixtp_destroy_child <%s>\n", (char *) key);
|
||||
PERR("no child in sixtp_destroy_child <%s>\n",
|
||||
key ? (char *) key : "");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -312,8 +316,9 @@ sixtp_add_some_sub_parsers(sixtp *tochange, int cleanup, ...)
|
||||
handler = va_arg(ap, sixtp*);
|
||||
if(!handler)
|
||||
{
|
||||
g_warning("Handler for tag %s is null\n", tag);
|
||||
|
||||
g_warning("Handler for tag %s is null\n",
|
||||
tag ? tag : "(null)");
|
||||
|
||||
if(cleanup)
|
||||
{
|
||||
sixtp_destroy(tochange);
|
||||
@@ -379,7 +384,8 @@ sixtp_sax_start_handler(void *user_data,
|
||||
(gpointer) &next_parser_tag, (gpointer) &next_parser);
|
||||
if(!lookup_success)
|
||||
{
|
||||
PERR("Tag <%s> not allowed in current context.\n", name);
|
||||
PERR("Tag <%s> not allowed in current context.\n",
|
||||
name ? (char *) name : "(null)");
|
||||
pdata->parsing_ok = FALSE;
|
||||
return;
|
||||
}
|
||||
@@ -525,7 +531,8 @@ sixtp_sax_end_handler(void *user_data, const xmlChar *name) {
|
||||
/* grab it before it goes away - we own the reference */
|
||||
end_tag = current_frame->tag;
|
||||
|
||||
PINFO("Finished with end of <%s>", end_tag);
|
||||
PINFO("Finished with end of <%s>",
|
||||
end_tag ? end_tag : "(null)");
|
||||
|
||||
/*sixtp_print_frame_stack(pdata->stack, stderr);*/
|
||||
|
||||
@@ -754,7 +761,7 @@ gnc_is_our_xml_file(const char *filename, const char *first_tag)
|
||||
return FALSE;
|
||||
|
||||
tag_compare = g_strdup_printf("<%s>", first_tag);
|
||||
|
||||
|
||||
num_read = fread(first_chunk, sizeof(char), sizeof(first_chunk) - 1, f);
|
||||
fclose(f);
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ pgendStoreTransactionNoLock (PGBackend *be, Transaction *trans,
|
||||
}
|
||||
if (p != be->buff)
|
||||
{
|
||||
PINFO ("%s", be->buff);
|
||||
PINFO ("%s", be->buff ? be->buff : "(null)");
|
||||
SEND_QUERY (be,be->buff, );
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
@@ -698,7 +698,7 @@ pgendStoreTransactionNoLock (PGBackend *be, Transaction *trans,
|
||||
p = stpcpy (p, "DELETE FROM gncTransaction WHERE transGuid='");
|
||||
p = guid_to_string_buff (xaccTransGetGUID(trans), p);
|
||||
p = stpcpy (p, "';");
|
||||
PINFO ("%s\n", be->buff);
|
||||
PINFO ("%s\n", be->buff ? be->buff : "(null)");
|
||||
SEND_QUERY (be,be->buff, );
|
||||
FINISH_QUERY(be->connection);
|
||||
|
||||
@@ -984,7 +984,8 @@ pgendCopyTransactionToEngine (PGBackend *be, GUID *trans_guid)
|
||||
/* hack alert - not all split fields handled */
|
||||
xaccSplitSetMemo(s, DB_GET_VAL("memo",j));
|
||||
xaccSplitSetAction(s, DB_GET_VAL("action",j));
|
||||
ts = gnc_iso8601_to_timespec_local (DB_GET_VAL("date_reconciled",j));
|
||||
ts = gnc_iso8601_to_timespec_local
|
||||
(DB_GET_VAL("date_reconciled",j));
|
||||
xaccSplitSetDateReconciledTS (s, &ts);
|
||||
|
||||
num = atoll (DB_GET_VAL("amountNum", j));
|
||||
@@ -999,7 +1000,6 @@ pgendCopyTransactionToEngine (PGBackend *be, GUID *trans_guid)
|
||||
|
||||
xaccSplitSetReconcile (s, (DB_GET_VAL("reconciled", j))[0]);
|
||||
|
||||
|
||||
/* --------------------------------------------- */
|
||||
/* next, find the account that this split goes into */
|
||||
guid = nullguid; /* just in case the read fails ... */
|
||||
@@ -1201,7 +1201,7 @@ pgendRunQueryHelper (PGBackend *be, const char *qstring)
|
||||
{
|
||||
GList *node, *xact_list = NULL;
|
||||
|
||||
ENTER ("string=%s\n", qstring);
|
||||
ENTER ("string=%s\n", qstring ? qstring : "(null)");
|
||||
|
||||
SEND_QUERY (be, qstring, );
|
||||
xact_list = pgendGetResults (be, query_cb, xact_list);
|
||||
@@ -1635,7 +1635,12 @@ get_session_cb (PGBackend *be, PGresult *result, int j, gpointer data)
|
||||
|
||||
PWARN ("This database is already opened by \n"
|
||||
"\t%s@%s (%s) in mode %s on %s \n",
|
||||
username, hostname, gecos, mode, datestr);
|
||||
username ? username : "(null)",
|
||||
hostname ? hostname : "(null)",
|
||||
gecos ? gecos : "(null)",
|
||||
mode ? mode : "(null)",
|
||||
datestr ? datestr : "(null)");
|
||||
|
||||
PWARN ("The above messages should be handled by the GUI\n");
|
||||
|
||||
if (lock_holder) return lock_holder;
|
||||
@@ -1665,7 +1670,8 @@ pgendSessionCanStart (PGBackend *be, int break_lock)
|
||||
* but that's what the GUI is set up to do ...
|
||||
*/
|
||||
PINFO ("break_lock=%d nrows=%d lock_holder=%s\n",
|
||||
break_lock, be->nrows, lock_holder);
|
||||
break_lock, be->nrows,
|
||||
lock_holder ? lock_holder : "(null)");
|
||||
if (break_lock && (1==be->nrows) && lock_holder)
|
||||
{
|
||||
p = be->buff; *p=0;
|
||||
@@ -1869,7 +1875,8 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
if (!sess) return;
|
||||
be = (PGBackend *) xaccGNCBookGetBackend (sess);
|
||||
|
||||
ENTER("be=%p, sessionid=%s", be, sessionid);
|
||||
ENTER("be=%p, sessionid=%s", be,
|
||||
sessionid ? sessionid : "(null)");
|
||||
|
||||
/* close any dangling sessions from before; reinitialize */
|
||||
pgend_session_end ((Backend *) be);
|
||||
@@ -1953,7 +1960,7 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
{
|
||||
PWARN ("the following message should be shown in a gui");
|
||||
PWARN ("unknown mode %s, will use single-update mode",
|
||||
start);
|
||||
start ? start : "(null)");
|
||||
be->session_mode = MODE_SINGLE_UPDATE;
|
||||
}
|
||||
|
||||
@@ -1998,11 +2005,13 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
(0 == strncasecmp (start, "authtype=", 9)))
|
||||
{
|
||||
PWARN ("the following message should be shown in a gui");
|
||||
PWARN ("ignoring the postgres keyword %s", start);
|
||||
PWARN ("ignoring the postgres keyword %s",
|
||||
start ? start : "(null)");
|
||||
} else
|
||||
{
|
||||
PWARN ("the following message should be shown in a gui");
|
||||
PWARN ("unknown keyword %s, ignoring", start);
|
||||
PWARN ("unknown keyword %s, ignoring",
|
||||
start ? start : "(null)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2027,8 +2036,10 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
if (CONNECTION_BAD == PQstatus(be->connection))
|
||||
{
|
||||
PWARN("Connection to database '%s' failed:\n"
|
||||
"\t%s",
|
||||
be->dbName, PQerrorMessage(be->connection));
|
||||
"\t%s",
|
||||
be->dbName ? be->dbName : "(null)",
|
||||
PQerrorMessage(be->connection));
|
||||
|
||||
PQfinish (be->connection);
|
||||
be->connection = NULL;
|
||||
|
||||
@@ -2102,7 +2113,7 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
{
|
||||
PERR("Can't connect to the newly created database '%s':\n"
|
||||
"\t%s",
|
||||
be->dbName,
|
||||
be->dbName ? be->dbName : "(null)",
|
||||
PQerrorMessage(be->connection));
|
||||
PQfinish (be->connection);
|
||||
be->connection = NULL;
|
||||
@@ -2186,7 +2197,8 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
||||
}
|
||||
}
|
||||
|
||||
LEAVE("be=%p, sessionid=%s", be, sessionid);
|
||||
LEAVE("be=%p, sessionid=%s", be,
|
||||
sessionid ? sessionid : "(null)");
|
||||
}
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
@@ -14,7 +14,8 @@ main ()
|
||||
|
||||
if (CONNECTION_BAD == PQstatus(conn))
|
||||
{
|
||||
printf("Fatal Error: Connection to database '%s' failed:\n", dbName);
|
||||
printf("Fatal Error: Connection to database '%s' failed:\n",
|
||||
dbName ? dbName : "(null)");
|
||||
printf("\t%s", PQerrorMessage(conn));
|
||||
PQfinish (conn);
|
||||
exit (1);
|
||||
@@ -62,11 +63,10 @@ main ()
|
||||
printf ("accountName === description\n");
|
||||
for (row=0; row<nrows; row++) {
|
||||
printf ("%s ==== %s\n",
|
||||
PQgetvalue(result, row, iacc),
|
||||
PQgetvalue(result, row, idesc));
|
||||
PQgetvalue(result, row, iacc),
|
||||
PQgetvalue(result, row, idesc));
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
} while (result);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ pgendGetPathCache (PGBackend *be, const char *path_str)
|
||||
{
|
||||
int ival;
|
||||
ival = pgendGetCache (be, "gncPathCache", "path", "ipath", path_str);
|
||||
PINFO ("cached %d for %s", ival, path_str);
|
||||
PINFO ("cached %d for %s", ival, path_str ? path_str : "(null)");
|
||||
|
||||
if (0 >= ival) return ival;
|
||||
pgendPokePathCache (be, ival, path_str);
|
||||
@@ -145,7 +145,7 @@ pgendGetGUIDCacheIDStr (PGBackend *be, const char *guid_str)
|
||||
{
|
||||
int ival;
|
||||
ival = pgendGetCache (be, "gncGUIDCache", "guid", "iguid", guid_str);
|
||||
PINFO ("cached %d for %s", ival, guid_str);
|
||||
PINFO ("cached %d for %s", ival, guid_str ? guid_str : "(null)");
|
||||
return ival;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ store_cb (const char *key, kvp_value *val, gpointer p)
|
||||
|
||||
default:
|
||||
PERR("Unknown type %d for path=%s\n",
|
||||
kvp_value_get_type (val), cb_data->path);
|
||||
kvp_value_get_type (val), cb_data->path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ dump_components (void)
|
||||
ComponentInfo *ci = node->data;
|
||||
|
||||
fprintf (stderr, " %s:\t%d\n",
|
||||
ci->component_class, ci->component_id);
|
||||
ci->component_class ? ci->component_class : "(null)",
|
||||
ci->component_id);
|
||||
}
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
@@ -380,7 +381,7 @@ gnc_register_gui_component (const char *component_class,
|
||||
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "Register component %d in class %s\n",
|
||||
component_id, component_class);
|
||||
component_id, component_class ? component_class : "(null)");
|
||||
dump_components ();
|
||||
#endif
|
||||
|
||||
@@ -469,7 +470,8 @@ gnc_unregister_gui_component (gint component_id)
|
||||
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "Unregister component %d in class %s\n",
|
||||
ci->component_id, ci->component_class);
|
||||
ci->component_id,
|
||||
ci->component_class ? ci->component_class : "(null)");
|
||||
#endif
|
||||
|
||||
gnc_gui_component_clear_watches (component_id);
|
||||
|
||||
@@ -151,6 +151,52 @@ gnc_ui_get_account_field_name (AccountFieldCode field)
|
||||
}
|
||||
|
||||
|
||||
static gnc_numeric
|
||||
gnc_account_get_balance_in_currency (Account *account,
|
||||
gnc_commodity *currency)
|
||||
{
|
||||
GNCBook *book;
|
||||
GNCPriceDB *pdb;
|
||||
GNCPrice *price;
|
||||
gboolean has_shares;
|
||||
gnc_numeric balance;
|
||||
GNCAccountType atype;
|
||||
gnc_commodity *balance_currency;
|
||||
|
||||
if (!account || !currency)
|
||||
return gnc_numeric_zero ();
|
||||
|
||||
atype = xaccAccountGetType (account);
|
||||
has_shares = (atype == STOCK || atype == MUTUAL || atype == CURRENCY);
|
||||
|
||||
if (has_shares)
|
||||
{
|
||||
balance = xaccAccountGetShareBalance (account);
|
||||
balance_currency = xaccAccountGetSecurity (account);
|
||||
}
|
||||
else
|
||||
{
|
||||
balance = xaccAccountGetBalance (account);
|
||||
balance_currency = xaccAccountGetCurrency (account);
|
||||
}
|
||||
|
||||
if (gnc_numeric_zero_p (balance) ||
|
||||
gnc_commodity_equiv (currency, balance_currency))
|
||||
return balance;
|
||||
|
||||
book = gncGetCurrentBook ();
|
||||
pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
price = gnc_pricedb_lookup_latest (pdb, balance_currency, currency);
|
||||
if (!price)
|
||||
return gnc_numeric_zero ();
|
||||
|
||||
return gnc_numeric_mul (balance, gnc_price_get_value (price),
|
||||
gnc_commodity_get_fraction (currency),
|
||||
GNC_RND_ROUND);
|
||||
}
|
||||
|
||||
|
||||
gnc_numeric
|
||||
gnc_ui_account_get_balance (Account *account, gboolean include_children)
|
||||
{
|
||||
|
||||
@@ -367,8 +367,6 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
|
||||
gtk_clist_clear(clist);
|
||||
|
||||
root_account = xaccAccountLookup (&tree->root_account);
|
||||
PINFO ("looked up %p for root account guid=%s\n",
|
||||
root_account, guid_to_string(&tree->root_account));
|
||||
|
||||
gnc_account_tree_fill(tree, expanded_accounts,
|
||||
gnc_account_tree_insert_row(tree, NULL, NULL,
|
||||
@@ -1100,6 +1098,7 @@ gnc_account_tree_fill(GNCAccountTree *tree,
|
||||
GList *n;
|
||||
|
||||
ENTER ("grp=%p", accts);
|
||||
|
||||
list = xaccGroupGetAccountList (accts);
|
||||
|
||||
/* Add each account to the tree */
|
||||
@@ -1107,9 +1106,6 @@ gnc_account_tree_fill(GNCAccountTree *tree,
|
||||
{
|
||||
Account *account = n->data;
|
||||
|
||||
PINFO ("acct=%p guid=%s\n",
|
||||
account, guid_to_string(xaccAccountGetGUID(account)));
|
||||
|
||||
if (tree->view_filter != NULL)
|
||||
if (!tree->view_filter(account, tree->view_filter_data))
|
||||
continue;
|
||||
|
||||
@@ -198,7 +198,7 @@ gnc_account_to_ui(AccountWindow *aw)
|
||||
if(pos == 0)
|
||||
{
|
||||
PWARN("Unknown price quote timezone (%s), resetting to default.",
|
||||
quote_tz);
|
||||
quote_tz ? quote_tz : "(null)");
|
||||
xaccAccountSetQuoteTZ (account, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,6 +399,9 @@ gnc_parse_error_dialog (XferDialog *xferData, const char *error_string)
|
||||
char * error_phrase;
|
||||
|
||||
parse_error_string = gnc_exp_parser_error_string ();
|
||||
if (parse_error_string == NULL)
|
||||
parse_error_string = "";
|
||||
|
||||
if (error_string == NULL)
|
||||
error_string = "";
|
||||
|
||||
@@ -706,6 +709,8 @@ gnc_xfer_dialog_ok_cb(GtkWidget * widget, gpointer data)
|
||||
curr = gnc_xfer_dialog_get_selected_curr_acct(xferData);
|
||||
if (curr == NULL)
|
||||
{
|
||||
const char *from_name = gnc_commodity_get_printname(from_currency);
|
||||
const char *to_name = gnc_commodity_get_printname(to_currency);
|
||||
char *message =
|
||||
g_strdup_printf(_("No matching currency account!\n"
|
||||
"Please create a currency account\n"
|
||||
@@ -713,8 +718,8 @@ gnc_xfer_dialog_ok_cb(GtkWidget * widget, gpointer data)
|
||||
"and security %s\n"
|
||||
"(or vice versa) to transfer funds\n"
|
||||
"between the selected accounts."),
|
||||
gnc_commodity_get_printname(from_currency),
|
||||
gnc_commodity_get_printname(to_currency));
|
||||
from_name ? from_name : "(null)",
|
||||
to_name ? to_name : "(null)");
|
||||
|
||||
gnc_error_dialog_parented(GTK_WINDOW(xferData->dialog), message);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ make_commodity_druid_page(gnc_commodity * comm) {
|
||||
/* save the old commodity name */
|
||||
retval->old_name = g_strdup(gnc_commodity_get_mnemonic(comm));
|
||||
title = g_strdup_printf("Enter information about \"%s\"",
|
||||
retval->old_name);
|
||||
retval->old_name ? retval->old_name : "");
|
||||
|
||||
gnome_druid_page_standard_set_bg_color(page, & std_bg_color);
|
||||
gnome_druid_page_standard_set_logo_bg_color(page, & std_logo_bg_color);
|
||||
|
||||
@@ -570,7 +570,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
|
||||
(gh_car(load_return) == SCM_BOOL_T)) {
|
||||
char *warn_str = gh_scm2newstr(gh_cadr(load_return), NULL);
|
||||
error_string = g_strdup_printf(_("QIF file load warning:\n%s"),
|
||||
warn_str);
|
||||
warn_str ? warn_str : "(null)");
|
||||
gnc_warning_dialog_parented(GTK_WIDGET(wind->window), error_string);
|
||||
g_free(error_string);
|
||||
free (warn_str);
|
||||
@@ -588,7 +588,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
|
||||
(gh_car(load_return) != SCM_BOOL_T))) {
|
||||
char *warn_str = gh_scm2newstr(gh_cadr(load_return), NULL);
|
||||
error_string = g_strdup_printf(_("QIF file load failed:\n%s"),
|
||||
warn_str);
|
||||
warn_str ? warn_str : "(null)");
|
||||
gnc_error_dialog_parented(GTK_WINDOW(wind->window), error_string);
|
||||
g_free(error_string);
|
||||
free (warn_str);
|
||||
@@ -643,7 +643,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
|
||||
(gh_car(parse_return) != SCM_BOOL_T))) {
|
||||
char *warn_str = gh_scm2newstr(gh_cadr(parse_return), NULL);
|
||||
error_string = g_strdup_printf(_("QIF file parse failed:\n%s"),
|
||||
warn_str);
|
||||
warn_str ? warn_str : "(null)");
|
||||
gnc_error_dialog_parented(GTK_WINDOW(wind->window), error_string);
|
||||
g_free(error_string);
|
||||
free(warn_str);
|
||||
@@ -1568,6 +1568,7 @@ make_qif_druid_page(gnc_commodity * comm) {
|
||||
GtkWidget * next_label;
|
||||
GtkWidget * temp;
|
||||
char * title = NULL;
|
||||
const char * str;
|
||||
GnomeDruidPageStandard * page;
|
||||
|
||||
/* make the page widget */
|
||||
@@ -1576,12 +1577,13 @@ make_qif_druid_page(gnc_commodity * comm) {
|
||||
gtk_object_set_data(GTK_OBJECT(retval->page),
|
||||
"page_struct", (gpointer)retval);
|
||||
|
||||
page = GNOME_DRUID_PAGE_STANDARD(retval->page);
|
||||
|
||||
page = GNOME_DRUID_PAGE_STANDARD(retval->page);
|
||||
|
||||
/* save the old commodity name */
|
||||
title = g_strdup_printf(_("Enter information about \"%s\""),
|
||||
gnc_commodity_get_mnemonic(comm));
|
||||
|
||||
str = gnc_commodity_get_mnemonic(comm);
|
||||
str = str ? str : "";
|
||||
title = g_strdup_printf(_("Enter information about \"%s\""), str);
|
||||
|
||||
gnome_druid_page_standard_set_bg_color(page, & std_bg_color);
|
||||
gnome_druid_page_standard_set_logo_bg_color(page, & std_logo_bg_color);
|
||||
gnome_druid_page_standard_set_title_color(page, & std_title_color);
|
||||
|
||||
@@ -214,6 +214,9 @@ gnc_parse_error_dialog (StockSplitInfo *info, const char *error_string)
|
||||
char * error_phrase;
|
||||
|
||||
parse_error_string = gnc_exp_parser_error_string ();
|
||||
if (parse_error_string == NULL)
|
||||
parse_error_string = "";
|
||||
|
||||
if (error_string == NULL)
|
||||
error_string = "";
|
||||
|
||||
|
||||
+12
-6
@@ -326,7 +326,7 @@ gnc_gpg_export(const gchar * keyname) {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
argv[6] = g_strdup_printf("(%s)", keyname);
|
||||
argv[6] = g_strdup_printf("(%s)", keyname ? keyname : "");
|
||||
retval = gnc_gpg_transform(NULL, 0, NULL, argv);
|
||||
g_free(argv[6]);
|
||||
return retval;
|
||||
@@ -345,7 +345,7 @@ gnc_gpg_export_async(const gchar * keyname, GncGPGCb cb, gpointer data) {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
argv[6] = g_strdup_printf("(%s)", keyname);
|
||||
argv[6] = g_strdup_printf("(%s)", keyname ? keyname : "");
|
||||
gnc_gpg_transform_async(NULL, 0, NULL, argv, cb, data);
|
||||
g_free(argv[6]);
|
||||
}
|
||||
@@ -371,8 +371,11 @@ gnc_gpg_make_keypair(const gchar * username,
|
||||
"Name-Email: %s\n"
|
||||
"Passphrase: %s\n"
|
||||
"%%commit\n",
|
||||
username, idstring, email, passphrase);
|
||||
char * argv [] =
|
||||
username ? username : "",
|
||||
idstring ? idstring : "",
|
||||
email ? email : "",
|
||||
passphrase ? passphrase : "");
|
||||
char * argv [] =
|
||||
{ "gpg",
|
||||
"--batch",
|
||||
"-q",
|
||||
@@ -405,8 +408,11 @@ gnc_gpg_make_keypair_async(const gchar * username,
|
||||
"Name-Email: %s\n"
|
||||
"Passphrase: %s\n"
|
||||
"%%commit\n",
|
||||
username, idstring, email, passphrase);
|
||||
char * argv [] =
|
||||
username ? username : "",
|
||||
idstring ? idstring : "",
|
||||
email ? email : "",
|
||||
passphrase ? passphrase : "");
|
||||
char * argv [] =
|
||||
{ "gpg",
|
||||
"--batch",
|
||||
"-q",
|
||||
|
||||
+13
-7
@@ -214,7 +214,7 @@ gnc_html_parse_url(gnc_html * html, const gchar * url,
|
||||
retval = URL_TYPE_HELP;
|
||||
}
|
||||
else {
|
||||
PWARN("unhandled URL type for '%s'", url);
|
||||
PWARN("unhandled URL type for '%s'", url ? url : "(null)");
|
||||
retval = URL_TYPE_OTHER;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,8 @@ static gchar *
|
||||
rebuild_url(URLType type, const gchar * location, const gchar * label) {
|
||||
if(label) {
|
||||
return g_strdup_printf("%s%s#%s", url_type_names[type],
|
||||
(location ? location : ""), label);
|
||||
(location ? location : ""),
|
||||
label ? label : "");
|
||||
}
|
||||
else {
|
||||
return g_strdup_printf("%s%s", url_type_names[type],
|
||||
@@ -605,7 +606,9 @@ gnc_html_load_to_stream(gnc_html * html, GtkHTMLStream * handle,
|
||||
case URL_TYPE_FTP:
|
||||
default:
|
||||
PWARN("load_to_stream for inappropriate type\n"
|
||||
"\turl = '%s#%s'\n", location, label);
|
||||
"\turl = '%s#%s'\n",
|
||||
location ? location : "(null)",
|
||||
label ? label : "(null)");
|
||||
gtk_html_write(GTK_HTML(html->html), handle, error_404,
|
||||
strlen(error_404));
|
||||
gtk_html_end(GTK_HTML(html->html), handle, GTK_HTML_STREAM_ERROR);
|
||||
@@ -945,7 +948,8 @@ gnc_html_submit_cb(GtkHTML * html, const gchar * method,
|
||||
cb(gnchtml, method, action_parts[0], form_data);
|
||||
}
|
||||
else {
|
||||
PWARN ("no handler for gnc-network action '%s'\n", action);
|
||||
PWARN ("no handler for gnc-network action '%s'\n",
|
||||
action ? action : "(null)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1149,7 +1153,7 @@ gnc_html_open_help(gnc_html * html, const gchar * location,
|
||||
static void
|
||||
gnc_html_open_scm(gnc_html * html, const gchar * location,
|
||||
const gchar * label, int newwin) {
|
||||
PINFO("location='%s'", location);
|
||||
PINFO("location='%s'", location ? location : "(null)");
|
||||
}
|
||||
|
||||
|
||||
@@ -1453,12 +1457,14 @@ gnc_html_export(gnc_html * html) {
|
||||
if (!filepath)
|
||||
return;
|
||||
|
||||
PINFO (" user selected file=%s\n", filepath);
|
||||
PINFO (" user selected file=%s\n", filepath ? filepath : "(null)");
|
||||
|
||||
fh = fopen (filepath, "w");
|
||||
if (NULL == fh) {
|
||||
const char *fmt = _("Could not open the file\n"
|
||||
" %s\n%s");
|
||||
char *buf = g_strdup_printf (fmt, filepath, strerror (errno));
|
||||
char *buf = g_strdup_printf (fmt, filepath ? filepath : "(null)",
|
||||
strerror (errno) ? strerror (errno) : "");
|
||||
gnc_error_dialog (buf);
|
||||
if (buf) g_free (buf);
|
||||
return;
|
||||
|
||||
@@ -305,6 +305,9 @@ gnc_acct_tree_window_toolbar_delete_account_cb (GtkWidget *widget,
|
||||
char *name;
|
||||
|
||||
name = xaccAccountGetFullName(account, gnc_get_account_separator ());
|
||||
if (!name)
|
||||
name = g_strdup ("");
|
||||
|
||||
message = g_strdup_printf(format, name);
|
||||
|
||||
if (gnc_verify_dialog(message, FALSE)) {
|
||||
@@ -436,6 +439,9 @@ gnc_acct_tree_window_menu_delete_account_cb (GtkWidget *widget,
|
||||
char *name;
|
||||
|
||||
name = xaccAccountGetFullName(account, gnc_get_account_separator ());
|
||||
if (!name)
|
||||
name = g_strdup ("");
|
||||
|
||||
message = g_strdup_printf(format, name);
|
||||
|
||||
if (gnc_verify_dialog(message, FALSE)) {
|
||||
|
||||
@@ -689,7 +689,8 @@ gnc_help_window_new (void) {
|
||||
help->index_db = dbopen(indexfile, O_RDONLY, 0644, DB_HASH, NULL);
|
||||
if (!help->index_db) {
|
||||
PERR("Failed to open help index DB '%s' : %s\n",
|
||||
indexfile, strerror(errno));
|
||||
indexfile ? indexfile : "(null)",
|
||||
strerror(errno) ? strerror(errno) : "");
|
||||
}
|
||||
g_free(indexfile);
|
||||
|
||||
|
||||
@@ -119,7 +119,8 @@ gnc_ui_build_currency_item(gnc_commodity * currency)
|
||||
gtk_widget_show(hbox);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), hbox, FALSE, FALSE, 5);
|
||||
|
||||
label_str = g_strdup_printf ("%s (%s):", _("Net Assets"), mnemonic);
|
||||
label_str = g_strdup_printf ("%s (%s):", _("Net Assets"),
|
||||
mnemonic ? mnemonic : "");
|
||||
label = gtk_label_new(label_str);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
||||
gtk_widget_show(label);
|
||||
@@ -136,7 +137,8 @@ gnc_ui_build_currency_item(gnc_commodity * currency)
|
||||
gtk_widget_show(hbox);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), hbox, FALSE, FALSE, 5);
|
||||
|
||||
label_str = g_strdup_printf ("%s (%s):", _("Profits"), mnemonic);
|
||||
label_str = g_strdup_printf ("%s (%s):", _("Profits"),
|
||||
mnemonic ? mnemonic : "");
|
||||
label = gtk_label_new(label_str);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
||||
gtk_widget_show(label);
|
||||
|
||||
@@ -160,8 +160,13 @@ gnc_childwin_set_title (GNCMainChildInfo *childwin)
|
||||
else if (strncmp ("file:", filename, 5) == 0)
|
||||
filename += 5;
|
||||
|
||||
title = g_strdup_printf("%s - GnuCash (%s)", childwin->title, filename);
|
||||
if (!childwin->title)
|
||||
title = g_strdup_printf("GnuCash (%s)", filename);
|
||||
else
|
||||
title = g_strdup_printf("%s - GnuCash (%s)", childwin->title, filename);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(childwin->app), title);
|
||||
|
||||
g_free(title);
|
||||
}
|
||||
|
||||
|
||||
@@ -2392,6 +2392,8 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
|
||||
gnc_set_label_color (regData->value_label, amount);
|
||||
gtk_label_set_text (GTK_LABEL (regData->value_label), string);
|
||||
|
||||
gnc_price_unref (price);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2903,11 +2905,19 @@ deleteCB(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
const char *format = _("Are you sure you want to delete\n %s\n"
|
||||
"from the transaction\n %s ?");
|
||||
/* ask for user confirmation before performing permanent damage */
|
||||
buf = g_strdup_printf(format, xaccSplitGetMemo(split),
|
||||
xaccTransGetDescription(trans));
|
||||
const char *memo;
|
||||
const char *desc;
|
||||
|
||||
result = gnc_verify_dialog_parented(regData->window, buf, FALSE);
|
||||
memo = xaccSplitGetMemo (split);
|
||||
memo = (memo && *memo) ? memo : _("(no memo)");
|
||||
|
||||
desc = xaccTransGetDescription (trans);
|
||||
desc = (desc && *desc) ? desc : _("(no description)");
|
||||
|
||||
/* ask for user confirmation before performing permanent damage */
|
||||
buf = g_strdup_printf (format, memo, desc);
|
||||
|
||||
result = gnc_verify_dialog_parented (regData->window, buf, FALSE);
|
||||
|
||||
g_free(buf);
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ gnucash_sheet_modify_current_cell(GnucashSheet *sheet, const gchar *new_text)
|
||||
new_text_len = gnc_mbstowcs (&new_text_wc, new_text);
|
||||
if (new_text_len < 0)
|
||||
{
|
||||
PERR ("bad text: %s", new_text);
|
||||
PERR ("bad text: %s", new_text ? new_text : "(null)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,8 +1034,10 @@ gnc_table_modify_update(Table *table,
|
||||
}
|
||||
|
||||
LEAVE ("change %d %d (relrow=%d relcol=%d) val=%s\n",
|
||||
virt_loc.vcell_loc.virt_row, virt_loc.vcell_loc.virt_col,
|
||||
cell_row, cell_col, cell->value);
|
||||
virt_loc.vcell_loc.virt_row,
|
||||
virt_loc.vcell_loc.virt_col,
|
||||
cell_row, cell_col,
|
||||
cell->value ? cell->value : "(null)");
|
||||
|
||||
if (changed)
|
||||
return cell->value;
|
||||
|
||||
Reference in new issue
Block a user