fix: cfree

This commit is contained in:
kuoi 2023-04-11 23:34:31 +08:00
parent b2951105ae
commit a80e729e21
6 changed files with 91 additions and 121 deletions

View File

@ -426,7 +426,7 @@ SetNADData()
Fills in the display data structure for an initial monochrome display.
All settings are simple defaults, and will need to be modified externally
if otherwise. This routine passes back a new NA_DisplayData structure, which
can be destroyed after use with a call to cfree().
can be destroyed after use with a call to free().
Copyright (c) 1989-1990, University of Illinois board of trustees. All
rights reserved. Written by Steven Smith at the Center for Prokaryote Genome

View File

@ -342,7 +342,7 @@ Notify_arg arg;
repeat_cnt = 0;
SetNACursor(ddata,EditCan,win,xwin,dpy,gc);
cfree(buf);
free(buf);
}
/*
* Check mode

View File

@ -410,7 +410,7 @@ DO()
xv_set(pframe,FRAME_BUSY,TRUE,0);
xv_set(frame,FRAME_BUSY,TRUE,0);
system(Action);
cfree(Action);
free(Action);
xv_set(pframe,FRAME_BUSY,FALSE,0);
xv_set(frame,FRAME_BUSY,FALSE,0);
BlockInput = FALSE;
@ -503,7 +503,7 @@ GfileFormat file;
strncat(temp,Action,i);
strncat(temp,method,strlen(method));
strcat( temp,&(Action[i+strlen(symbol)]) );
cfree(Action);
free(Action);
Action = temp;
}
return(Action);
@ -592,7 +592,7 @@ GmenuItemArg arg;
strncat(temp,Action,i-1);
strncat(temp,textvalue,strlen(textvalue));
strcat( temp,&(Action[i+strlen(symbol)]) );
cfree(Action);
free(Action);
Action = temp;
}
else
@ -605,7 +605,7 @@ GmenuItemArg arg;
strncat(temp,Action,i);
strncat(temp,method,strlen(method));
strcat( temp,&(Action[i+strlen(symbol)]) );
cfree(Action);
free(Action);
Action = temp;
}
}

View File

@ -182,10 +182,10 @@ char* block;
FileIO.c: In function `Cfree':
FileIO.c:181: void value not ignored as it ought to be
if(cfree(block) == 0)
if(free(block) == 0)
Warning("Error in Cfree...");
*/
cfree(block);
free(block);
}
else
Warning("Error in Cfree, NULL block");

View File

@ -751,7 +751,7 @@ NA_Alignment *aln;
if (this->description[0])
strcpy(that->description, this->description);
if (this->sequence) {
cfree(that->sequence);
free(that->sequence);
that->sequence = this->sequence;
that->seqlen = this->seqlen;
that->seqmaxlen = this->seqmaxlen;
@ -783,7 +783,7 @@ NA_Alignment *aln;
that->comments_maxlen);
}
if (this->cmask) {
cfree(that->cmask);
free(that->cmask);
that->cmask = this->cmask;
}
if (this->offset != that->offset) that->offset = this->offset;

View File

@ -1,14 +1,15 @@
#include <malloc.h>
#include <pixrect/pixrect.h>
#include <stdio.h>
#include <xview/defaults.h>
#include <xview/icon.h>
#include <xview/panel.h>
#include <xview/window.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/window.h>
#include <xview/icon.h>
#include <pixrect/pixrect.h>
#include <malloc.h>
#include "menudefs.h"
#include "defines.h"
#include "globals.h"
#include "menudefs.h"
/*
Main()
@ -25,152 +26,121 @@ All rights reserved.
*/
Gmenu menu[100];
int num_menus = 0,repeat_cnt = 0;
Frame frame,pframe,infoframe;
Panel popup,infopanel;
Panel_item left_foot,right_foot;
Canvas EditCan,EditNameCan;
// int num_menus = 0;
int repeat_cnt = 0;
Frame frame, pframe, infoframe;
Panel popup, infopanel;
Panel_item left_foot, right_foot;
Canvas EditCan, EditNameCan;
int DisplayType;
GmenuItem *current_item;
NA_Alignment *DataSet = NULL;
NA_Alignment *Clipboard = NULL;
char **TextClip;
int TextClipSize = 0,TextClipLength = 0;
int TextClipSize = 0, TextClipLength = 0;
/*
* Icon structure (pixmap dependent)
*/
* Icon structure (pixmap dependent)
*/
static short GDEicon[258]={
static short GDEicon[258] = {
#include "icon_gde"
};
mpr_static(iconpr,64,64,1,GDEicon);
mpr_static(iconpr, 64, 64, 1, GDEicon);
main(argc,argv)
int argc;
main(argc, argv) int argc;
char **argv;
{
Icon tool_icon; /* obvious */
extern char FileName[], current_dir[];
Icon tool_icon; /* obvious */
extern char FileName[],current_dir[];
int type = GENBANK; /* default file type */
int type = GENBANK; /* default file type */
DataSet = NULL;
Clipboard = (NA_Alignment*)Calloc(1,sizeof(NA_Alignment));
DisplayType = NASEQ_ALIGN; /* default data type */
Clipboard = (NA_Alignment *)Calloc(1, sizeof(NA_Alignment));
DisplayType = NASEQ_ALIGN; /* default data type */
Clipboard->maxnumelements = 5;
Clipboard->element =(NA_Sequence*)Calloc(Clipboard->maxnumelements,
sizeof(NA_Sequence));
/*
* Connect to server, and set up initial XView data types
* that are common to ALL display types
*/
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc,argv,0);
Clipboard->element = (NA_Sequence *)Calloc(Clipboard->maxnumelements,
sizeof(NA_Sequence));
/*
* Main frame (primary window);
*/
frame = xv_create((int) NULL,FRAME,
FRAME_NO_CONFIRM,FALSE,
FRAME_LABEL, "Genetic Data Environment 2.2",
FRAME_INHERIT_COLORS,TRUE,
XV_WIDTH,700,
XV_HEIGHT,500,
FRAME_SHOW_FOOTER,TRUE,
0);
* Connect to server, and set up initial XView data types
* that are common to ALL display types
*/
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
/*
* Popup frame (dialog box window), and default settings in
* the dialog box. These are changed to fit each individual
* command's needs in EventHandler().
*/
infoframe = xv_create(frame,FRAME_CMD,
FRAME_LABEL,"Messages",
WIN_DESIRED_HEIGHT,100,
WIN_DESIRED_WIDTH,300,
FRAME_SHOW_RESIZE_CORNER,TRUE,
FRAME_INHERIT_COLORS,TRUE,
FRAME_CLOSED,FALSE,
WIN_SHOW,FALSE,
0);
* Main frame (primary window);
*/
pframe = xv_create(frame,FRAME_CMD,
FRAME_CMD_PUSHPIN_IN,TRUE,
FRAME_DONE_PROC,FrameDone,
XV_HEIGHT,100,
XV_WIDTH,300,
FRAME_SHOW_RESIZE_CORNER,FALSE,
FRAME_CLOSED,FALSE,
XV_X,300,
XV_Y,150,
WIN_SHOW,FALSE,
0);
frame = xv_create((int)NULL, FRAME, FRAME_NO_CONFIRM, FALSE,
FRAME_LABEL, "Genetic Data Environment 2.2",
FRAME_INHERIT_COLORS, TRUE, XV_WIDTH, 700, XV_HEIGHT,
500, FRAME_SHOW_FOOTER, TRUE, 0);
infopanel = xv_get(infoframe,FRAME_CMD_PANEL);
xv_set(infopanel, PANEL_LAYOUT,PANEL_VERTICAL,
XV_WIDTH,300,
XV_HEIGHT,50,
0);
/*
* Popup frame (dialog box window), and default settings in
* the dialog box. These are changed to fit each individual
* command's needs in EventHandler().
*/
infoframe =
xv_create(frame, FRAME_CMD, FRAME_LABEL, "Messages",
WIN_DESIRED_HEIGHT, 100, WIN_DESIRED_WIDTH, 300,
FRAME_SHOW_RESIZE_CORNER, TRUE, FRAME_INHERIT_COLORS,
TRUE, FRAME_CLOSED, FALSE, WIN_SHOW, FALSE, 0);
left_foot = xv_create(infopanel,PANEL_MESSAGE,0);
right_foot = xv_create(infopanel,PANEL_MESSAGE,0);
pframe = xv_create(frame, FRAME_CMD, FRAME_CMD_PUSHPIN_IN, TRUE,
FRAME_DONE_PROC, FrameDone, XV_HEIGHT, 100, XV_WIDTH,
300, FRAME_SHOW_RESIZE_CORNER, FALSE, FRAME_CLOSED,
FALSE, XV_X, 300, XV_Y, 150, WIN_SHOW, FALSE, 0);
infopanel = xv_get(infoframe, FRAME_CMD_PANEL);
xv_set(infopanel, PANEL_LAYOUT, PANEL_VERTICAL, XV_WIDTH, 300,
XV_HEIGHT, 50, 0);
left_foot = xv_create(infopanel, PANEL_MESSAGE, 0);
right_foot = xv_create(infopanel, PANEL_MESSAGE, 0);
window_fit(infoframe);
/*
popup = xv_create(pframe,PANEL,
PANEL_LAYOUT,PANEL_HORIZONTAL,
0);
*/
popup = xv_get(pframe,FRAME_CMD_PANEL);
/*
popup = xv_create(pframe,PANEL,
PANEL_LAYOUT,PANEL_HORIZONTAL,
0);
*/
popup = xv_get(pframe, FRAME_CMD_PANEL);
xv_create(popup,PANEL_BUTTON,
PANEL_LABEL_STRING,"HELP",
PANEL_NOTIFY_PROC,HELP,
0);
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "HELP",
PANEL_NOTIFY_PROC, HELP, 0);
xv_create(popup,PANEL_BUTTON,
PANEL_LABEL_STRING,"OK",
PANEL_NOTIFY_PROC,DO,
0);
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "OK",
PANEL_NOTIFY_PROC, DO, 0);
xv_create(popup,PANEL_BUTTON,
PANEL_LABEL_STRING,"Cancel",
PANEL_NOTIFY_PROC,DONT,
0);
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "Cancel",
PANEL_NOTIFY_PROC, DONT, 0);
/*
* Keep original directory where program was started
*/
/*
* Keep original directory where program was started
*/
(void)getwd(current_dir);
ParseMenu();
GenMenu(type);
if(argc>1)
LoadData(argv[1]);
if (argc > 1) LoadData(argv[1]);
/*
* Set up the basics of the displays, and off to the main loop.
*/
* Set up the basics of the displays, and off to the main loop.
*/
BasicDisplay(DataSet);
if(DataSet != NULL)
((NA_Alignment*)DataSet)->na_ddata = (char*)SetNADData
((NA_Alignment*)DataSet,EditCan,EditNameCan);
if (DataSet != NULL)
((NA_Alignment *)DataSet)->na_ddata = (char *)SetNADData(
(NA_Alignment *)DataSet, EditCan, EditNameCan);
tool_icon = xv_create((int) NULL,ICON,
ICON_IMAGE,&iconpr,
ICON_LABEL,strlen(FileName)>0?FileName:"GDE",
0);
tool_icon = xv_create((int)NULL, ICON, ICON_IMAGE, &iconpr, ICON_LABEL,
strlen(FileName) > 0 ? FileName : "GDE", 0);
xv_set(frame,
FRAME_ICON,tool_icon,
0);
xv_set(frame, FRAME_ICON, tool_icon, 0);
window_main_loop(frame);
exit(0);