mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-21 16:38:06 -06:00
bug fixes of assorted core dumps;
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6d46486cd4
commit
d6eab4ea84
@ -110,11 +110,12 @@ Widget BuildMenu( Widget parent, int menu_type, char *menu_title,
|
||||
{
|
||||
XtWarning("You can't have submenus from option menu items.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
printf ("creating submen label %s \n", items[i].label);
|
||||
widget = BuildMenu( menu, XmMENU_PULLDOWN, items[i].label,
|
||||
items[i].mnemonic, tear_off, 0,
|
||||
items[i].subitems);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ fileBox( Widget parent, int type )
|
||||
|
||||
ENTER("fileBox");
|
||||
|
||||
// setBusyCursor( parent );
|
||||
/* setBusyCursor( parent ); */
|
||||
|
||||
if( type == OPEN )
|
||||
{
|
||||
@ -105,7 +105,7 @@ fileBox( Widget parent, int type )
|
||||
|
||||
XtManageChild( dialog );
|
||||
|
||||
// unsetBusyCursor( parent );
|
||||
/* unsetBusyCursor( parent ); */
|
||||
/* while the user hasn't pushed "Ok", simulate XtMainLoop.*/
|
||||
while( !done || XtAppPending(app) )
|
||||
XtAppProcessEvent( app, XtIMAll );
|
||||
|
22
src/FileIO.c
22
src/FileIO.c
@ -114,11 +114,29 @@ short xaccFlipShort (short val)
|
||||
return (short) flip;
|
||||
}
|
||||
|
||||
double xaccFlipDouble (double val)
|
||||
{
|
||||
union {
|
||||
unsigned int i[2];
|
||||
double d;
|
||||
} u;
|
||||
unsigned int w0, w1;
|
||||
u.d = val;
|
||||
w0 = xaccFlipInt (u.i[0]);
|
||||
w1 = xaccFlipInt (u.i[1]);
|
||||
|
||||
u.i[0] = w1;
|
||||
u.i[1] = w0;
|
||||
return u.d;
|
||||
}
|
||||
|
||||
#define XACC_FLIP_ENDIAN
|
||||
#ifdef XACC_FLIP_ENDIAN
|
||||
#define XACC_FLIP_DOUBLE(x) { (x) = xaccFlipDouble (x); }
|
||||
#define XACC_FLIP_INT(x) { (x) = xaccFlipInt (x); }
|
||||
#define XACC_FLIP_SHORT(x) { (x) = xaccFlipShort (x); }
|
||||
#else
|
||||
#define XACC_FLIP_DOUBLE(x)
|
||||
#define XACC_FLIP_INT(x)
|
||||
#define XACC_FLIP_SHORT(x)
|
||||
#endif /* XACC_FLIP_ENDIAN */
|
||||
@ -440,6 +458,7 @@ readTransaction( int fd, Account *acc, int token )
|
||||
_free(trans);
|
||||
return NULL;
|
||||
}
|
||||
XACC_FLIP_DOUBLE (damount);
|
||||
trans->damount = damount;
|
||||
|
||||
/* ... next read the share price ... */
|
||||
@ -453,6 +472,7 @@ readTransaction( int fd, Account *acc, int token )
|
||||
_free(trans);
|
||||
return NULL;
|
||||
}
|
||||
XACC_FLIP_DOUBLE (damount);
|
||||
trans->share_price = damount;
|
||||
}
|
||||
DEBUGCMD(printf ("Info: readTransaction(): amount %f \n", trans->damount));
|
||||
@ -773,11 +793,13 @@ writeTransaction( int fd, Account * acc, Transaction *trans )
|
||||
|
||||
damount = trans->damount;
|
||||
DEBUGCMD (printf ("Info: writeTransaction: amount=%f \n", damount));
|
||||
XACC_FLIP_DOUBLE (damount);
|
||||
err = write( fd, &damount, sizeof(double) );
|
||||
if( err != sizeof(double) )
|
||||
return -1;
|
||||
|
||||
damount = trans->share_price;
|
||||
XACC_FLIP_DOUBLE (damount);
|
||||
err = write( fd, &damount, sizeof(double) );
|
||||
if( err != sizeof(double) )
|
||||
return -1;
|
||||
|
@ -607,22 +607,49 @@ accountMenubarCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
DEBUG("AMB_OPEN");
|
||||
{
|
||||
Account *acc = getAccount(data,row);
|
||||
if( NULL == acc->regData ) /* avoid having two registers updating one account */
|
||||
acc->regData = regWindow( toplevel, acc );
|
||||
if( NULL == acc ) {
|
||||
int make_new = verifyBox (toplevel,
|
||||
"Do you want to create a new account?\n\
|
||||
If not, then please select an account\n\
|
||||
account to open in the main window.\n");
|
||||
if (make_new) {
|
||||
accWindow(toplevel);
|
||||
}
|
||||
} else {
|
||||
if( NULL == acc->regData ) {
|
||||
/* avoid having two registers updating one account */
|
||||
acc->regData = regWindow( toplevel, acc );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMB_EDIT:
|
||||
DEBUG("AMB_EDIT");
|
||||
editAccWindow( toplevel, getAccount(data,row) );
|
||||
{
|
||||
Account *acc = getAccount(data,row);
|
||||
if( NULL == acc ) {
|
||||
errorBox (toplevel,
|
||||
"To edit an account, you must first \n\
|
||||
choose an account to delete.\n");
|
||||
} else {
|
||||
editAccWindow( toplevel, getAccount(data,row) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMB_DEL:
|
||||
DEBUG("AMB_DEL");
|
||||
{
|
||||
char *msg = "Are you sure you want to delete this account?";
|
||||
if( verifyBox(toplevel,msg) )
|
||||
{
|
||||
freeAccount( removeAccount(data,row) );
|
||||
refreshMainWindow();
|
||||
Account *acc = getAccount(data,row);
|
||||
if( NULL == acc ) {
|
||||
errorBox (toplevel,
|
||||
"To delete an account, you must first \n\
|
||||
choose an account to delete.\n");
|
||||
} else {
|
||||
char *msg = "Are you sure you want to delete this account?";
|
||||
if( verifyBox(toplevel,msg) ) {
|
||||
freeAccount( removeAccount(data,row) );
|
||||
refreshMainWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -37,9 +37,10 @@ TARGET = ../xacc
|
||||
|
||||
default: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) ../libhtmlw/libhtmlw.a
|
||||
$(TARGET): $(OBJS) ../libhtmlw/libhtmlw.a ../Xbae-4.6.2-linas/src/libXbae.a
|
||||
@echo "++++++"
|
||||
$(CC) $(OBJS) $(LFLAGS) $(LIBS) ../libhtmlw/libhtmlw.a -o $@
|
||||
$(CC) $(OBJS) $(LFLAGS) ../libhtmlw/libhtmlw.a \
|
||||
../Xbae-4.6.2-linas/src/libXbae.a $(LIBS) -o $@
|
||||
|
||||
.c.o: Makefile
|
||||
@echo "+++"
|
||||
|
@ -159,7 +159,7 @@ char * xaccReadQIFAccount (int fd, Account * acc)
|
||||
} else {
|
||||
DEBUG ("Unsupported account type\n");
|
||||
DEBUG (&qifline[1]);
|
||||
acc -> type = 0x0; // hack alert --
|
||||
acc -> type = 0x0; /* hack alert -- */
|
||||
}
|
||||
} else
|
||||
|
||||
|
@ -42,7 +42,7 @@ void qfInsertTransactionRec( QuickFill *qf, Transaction *trans, int depth );
|
||||
* of the internals of QuickFill into one file. *
|
||||
\********************************************************************/
|
||||
|
||||
inline int
|
||||
int
|
||||
CHAR_TO_INDEX( char c )
|
||||
{
|
||||
c = toupper(c)-0x40;
|
||||
|
@ -804,6 +804,7 @@ regWindow( Widget parent, Account *acc )
|
||||
NULL, (XtPointer)0, (MenuItem *)NULL },
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
MenuItem activityMenu[] = {
|
||||
{ "Transfer...", &xmPushButtonWidgetClass, 'T', NULL, NULL,
|
||||
@ -811,21 +812,22 @@ regWindow( Widget parent, Account *acc )
|
||||
{ "", &xmSeparatorWidgetClass, 0, NULL, NULL,
|
||||
NULL, NULL, (MenuItem *)NULL },
|
||||
{ "Reconcile...", &xmPushButtonWidgetClass, 'C', NULL, NULL,
|
||||
startRecnCB, (XtPointer)regData, (MenuItem *)NULL },
|
||||
startRecnCB, NULL, (MenuItem *)NULL },
|
||||
{ "Adjust Balance...", &xmPushButtonWidgetClass, 'A', NULL, NULL,
|
||||
startAdjBCB, (XtPointer)regData, (MenuItem *)NULL },
|
||||
startAdjBCB, NULL, (MenuItem *)NULL },
|
||||
{ "Report", &xmPushButtonWidgetClass, 'D', NULL, NULL,
|
||||
NULL, (XtPointer)0, (MenuItem *)&reportMenu },
|
||||
{ "", &xmSeparatorWidgetClass, 0, NULL, NULL,
|
||||
NULL, NULL, (MenuItem *)NULL },
|
||||
{ "Delete Transaction", &xmPushButtonWidgetClass, 'D', NULL, NULL,
|
||||
deleteCB, (XtPointer)regData, (MenuItem *)NULL },
|
||||
deleteCB, NULL, (MenuItem *)NULL },
|
||||
{ "", &xmSeparatorWidgetClass, 0, NULL, NULL,
|
||||
NULL, NULL, (MenuItem *)NULL },
|
||||
{ "Close Window", &xmPushButtonWidgetClass, 'Q', NULL, NULL,
|
||||
destroyShellCB,(XtPointer)(regData->dialog),(MenuItem *)NULL },
|
||||
destroyShellCB, NULL, (MenuItem *)NULL },
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
MenuItem helpMenu[] = {
|
||||
{ "About...", &xmPushButtonWidgetClass, 'A', NULL, NULL,
|
||||
@ -839,6 +841,13 @@ regWindow( Widget parent, Account *acc )
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* some compilers don't like dynamic data in initializers;
|
||||
* so rather than inlining these, we initialize here ... :-( */
|
||||
activityMenu[2].callback_data=(XtPointer)regData;
|
||||
activityMenu[3].callback_data=(XtPointer)regData;
|
||||
activityMenu[6].callback_data=(XtPointer)regData;
|
||||
activityMenu[8].callback_data=(XtPointer)(regData->dialog);
|
||||
|
||||
menubar = XmCreateMenuBar( pane, "menubar", NULL, 0 );
|
||||
|
||||
BuildMenu( menubar, XmMENU_PULLDOWN, "Activities", 'A',
|
||||
@ -1467,7 +1476,7 @@ regCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
|
||||
if( (regData->qf != NULL) && (regData->qf->trans != NULL) )
|
||||
{
|
||||
//char *str = regData->qf->trans->description;
|
||||
/* char *str = regData->qf->trans->description; */
|
||||
char str[BUFSIZE];
|
||||
strcpy( str, regData->qf->trans->description );
|
||||
DEBUG(str);
|
||||
|
@ -86,6 +86,13 @@ xferWindow( Widget parent )
|
||||
int position,i;
|
||||
int initial = 0;
|
||||
|
||||
if (1 >= (data->numAcc)) {
|
||||
errorBox (toplevel,
|
||||
"There must be at least two accounts\n\
|
||||
created before you can transfer funds.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
setBusyCursor( parent );
|
||||
|
||||
xferData = (XferWindow *)_malloc(sizeof(XferWindow));
|
||||
|
@ -137,8 +137,6 @@ todaysDate( Date *date )
|
||||
date->month = theTime->tm_mon + 1;
|
||||
date->year = theTime->tm_year + 1900;
|
||||
|
||||
// _free(theTime);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user