Fix formatting

This commit is contained in:
Alexander S. Aganichev 2002-11-04 18:59:51 +00:00
parent ad6294124f
commit a39960cd13
15 changed files with 79 additions and 79 deletions

View File

@ -257,7 +257,7 @@ bool inline samekey(gkey key1, gkey key2) {
return false;
if(key1 == key2)
return true;
if((key1 > 0xFF) || (key2 > 0xFF))
if((key1 > 0xFF) or (key2 > 0xFF))
return false;
return (tolower(key1) == key2) or (tolower(key2) == key1);
}

View File

@ -2086,7 +2086,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
strcpy(msg->charset, chsbuf);
}
}
else if((kludgetype == FSC_CHARSET) || (kludgetype == FSC_CODEPAGE)) {
else if((kludgetype == FSC_CHARSET) or (kludgetype == FSC_CODEPAGE)) {
*chsbuf = NUL;
qpencoded = IsQuotedPrintable(ptr);
if(kludgetype == FSC_CODEPAGE)

View File

@ -60,7 +60,7 @@ static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int c
char *p = strchr(dst+toklen, '}');
if(p) {
uint dstlen = p-dst-toklen-1;
if(use && dstlen) {
if(use and dstlen) {
strxcpy (buf, dst+toklen+1, dstlen+1);
src = buf;
}

View File

@ -80,7 +80,7 @@ gposixdir::~gposixdir()
void gposixdir::cd(const char *name, bool relative)
{
std::string ndirname;
if(!*name)
if(not *name)
name = ".";
if(relative) {
dirname += "/";
@ -97,9 +97,9 @@ void gposixdir::cd(const char *name, bool relative)
while((de=readdir(d)) != NULL) {
ndirname = de->d_name;
#ifdef __HAVE_DRIVES__
if((ndirname != ".") && !((ndirname == "..") && streql(dirname.c_str()+1, ":/")))
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
#else
if((ndirname != ".") && !((ndirname == "..") && (dirname == "/")))
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
#endif
entries.push_back(ndirname);
}
@ -111,7 +111,7 @@ void gposixdir::cd(const char *name, bool relative)
void gposixdir::cd(const char *name, bool relative)
{
std::string ndirname;
if(!*name)
if(not *name)
name = ".";
if(relative) {
dirname += "/";
@ -134,9 +134,9 @@ void gposixdir::cd(const char *name, bool relative)
do {
ndirname = de.name;
#ifdef __HAVE_DRIVES__
if((ndirname != ".") && !((ndirname == "..") && streql(dirname.c_str()+1, ":/")))
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
#else
if((ndirname != ".") && !((ndirname == "..") && (dirname == "/")))
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
#endif
entries.push_back(ndirname);
} while(_findnext(d, &de) == 0);
@ -151,13 +151,13 @@ void gposixdir::cd(const char *name, bool relative)
const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
{
while(last_entry < entries.size()) {
if(mask && !gwildmat(entries[last_entry].c_str(), mask)) {
if(mask and not gwildmat(entries[last_entry].c_str(), mask)) {
++last_entry;
continue;
}
ret.name = entries[last_entry];
ret.dirname = dirname.c_str();
if(!nameonly) {
if(not nameonly) {
std::string pn = ret.dirname;
pn += "/";
pn += ret.name;

View File

@ -113,7 +113,7 @@
#define GOLD_SHELL_ENV "SHELL"
#endif
inline bool isslash(char c) { return (c == '\\') || (c == '/'); }
inline bool isslash(char c) { return (c == '\\') or (c == '/'); }
// ------------------------------------------------------------------

View File

@ -278,7 +278,7 @@ FILE *fsopen(const char *path, const char *type, int shflag) {
default:
break;
}
} while((n < 3) && (c));
} while((n < 3) and (c));
fh = sopen(path, acc, shflag, mode);
if(fh != -1)

View File

@ -164,16 +164,16 @@ bool maketruepath(std::string &dirname) {
}
#else
long inspos = -1;
if((dirname.length() == 2) && (dirname[1] == ':'))
if((dirname.length() == 2) and (dirname[1] == ':'))
inspos = 2;
else if((dirname.length() < 2) || (dirname[1] != ':') || isslash(dirname[0]))
else if((dirname.length() < 2) or (dirname[1] != ':') or isslash(dirname[0]))
inspos = 0;
else if(!isslash(dirname[2]))
else if(not isslash(dirname[2]))
inspos = 2;
if(inspos != -1) {
char chdrive[] = " :";
chdrive[0] = (inspos == 2) ? dirname[0] : cwd[0];
if(!chdir(chdrive)) {
if(not chdir(chdrive)) {
char dwd[GMAXPATH];
getcwd(dwd, GMAXPATH);
if(isslash(dirname[0]))
@ -192,11 +192,11 @@ bool maketruepath(std::string &dirname) {
}
#endif
#else
if(!dirname.empty() && (dirname[0] == '~')) {
if(not dirname.empty() and (dirname[0] == '~')) {
char* lname;
const char *p = dirname.c_str()+1;
if((dirname.length() != 1) && !isslash(*p)) {
while(*p && !isslash(*p))
if((dirname.length() != 1) and not isslash(*p)) {
while(*p and not isslash(*p))
ndirname += *p++; // get user name
} else {
if ((lname = getlogin()) == NULL)
@ -215,7 +215,7 @@ bool maketruepath(std::string &dirname) {
dirname = cwd;
ok = false;
}
} else if(!dirname.empty() && !isslash(dirname[0])) {
} else if(not dirname.empty() and not isslash(dirname[0])) {
ndirname = cwd;
ndirname += "/";
ndirname += dirname;
@ -234,9 +234,9 @@ bool maketruepath(std::string &dirname) {
#endif
size_t len = dirname.length();
#ifdef __HAVE_DRIVES__
while((len > 3) && isslash(dirname[--len]))
while((len > 3) and isslash(dirname[--len]))
#else
while((len > 1) && isslash(dirname[--len]))
while((len > 1) and isslash(dirname[--len]))
#endif
dirname.erase(len, 1);
if(access(dirname.c_str(), R_OK)) {
@ -259,13 +259,13 @@ bool maketruepath(std::string &dirname) {
while((skipfrom=dirname.find("/./")) != dirname.npos)
dirname.erase(skipfrom, 2);
len = dirname.length();
if(len > 2 && !strcmp(&(dirname.c_str()[len-2]), "/."))
if(len > 2 and not strcmp(&(dirname.c_str()[len-2]), "/."))
dirname.erase(len-2, 2);
len = dirname.length();
#ifdef __HAVE_DRIVES__
if((len > 3) && isslash(dirname[--len]))
if((len > 3) and isslash(dirname[--len]))
#else
if((len > 1) && isslash(dirname[--len]))
if((len > 1) and isslash(dirname[--len]))
#endif
dirname.erase(len, 1);
return ok;

View File

@ -885,7 +885,7 @@ int gkbd_nt2bios(INPUT_RECORD& inp) {
else {
// If it is a letter key, use the ASCII value supplied
// by NT to take into account the CapsLock state.
if(isupper(keycode) || (k->normal == -1))
if(isupper(keycode) or (k->normal == -1))
c = ascii;
else
c = k->normal;
@ -1037,7 +1037,7 @@ gkey kbxget_raw(int mode) {
ungetch(key2);
}
// Curses sequence; lookup in nice table above
else if((key >= KEY_MIN) && (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
else if((key >= KEY_MIN) and (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
k = (gkbd_curstable[key - KEY_MIN]);
else if(key == '\015')
k = Key_Ent;

View File

@ -30,7 +30,7 @@
// ------------------------------------------------------------------
inline int isleap(unsigned yr) { return yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0); }
inline int isleap(unsigned yr) { return (yr % 400 == 0) or ((yr % 4 == 0) and (yr % 100 != 0)); }
inline unsigned months_to_days(unsigned month) { return (month * 3057 - 3007) / 100; }
inline long years_to_days(unsigned yr) { return yr * 365L + yr / 4 - yr / 100 + yr / 400; }

View File

@ -108,7 +108,7 @@ int g_init_os(int flags) {
tolower(c) = i + 128;
}
for(i=128; i<256; i++) {
if((toupper(tolower(i)) != i) && (tolower(toupper(i)) != i))
if((toupper(tolower(i)) != i) and (tolower(toupper(i)) != i))
tolower(i) = toupper(i) = i;
if(toupper(tolower(i)) != toupper(i))
toupper(i) = i;

View File

@ -217,7 +217,7 @@ void g_increase_priority(void) {
void g_set_ostitle(char *title) {
if(ge_os2_hsw && ge_os2_hwndframe) {
if(ge_os2_hsw and ge_os2_hwndframe) {
strxcpy(ge_os2_swdata.szSwtitle, title, MAXNAMEL);
pfnWinChangeSwitchEntry(ge_os2_hsw, &ge_os2_swdata);
pfnWinSetWindowText(ge_os2_hwndframe, (PSZ)title);
@ -230,7 +230,7 @@ void g_set_ostitle(char *title) {
void g_set_osicon(void) {
if(ge_os2_hwndframe && ge_os2_hsw) {
if(ge_os2_hwndframe and ge_os2_hsw) {
ULONG ulPicture = (ULONG) pfnWinLoadPointer(HWND_DESKTOP, 0, 1);
if(ulPicture) {
pfnWinSendMsg(ge_os2_hwndframe, WM_SETICON, (MPARAM) ulPicture, (MPARAM) 0);

View File

@ -1786,7 +1786,7 @@ int wborder(int btype) {
return gwin.werrno=W_NOACTIVE;
// check for valid box type
if(btype<0||btype>7)
if((btype<0) or (btype>7))
return gwin.werrno=W_INVBTYPE;
// see if window is to have a border

View File

@ -173,7 +173,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
// see if a left junction or corner is needed
up = isupvert (btype,wgetc(row-1,col));
down = isdownvert(btype,wgetc(row+1,col));
if(up&&down)
if(up and down)
ch=LVJ;
else if(up)
ch=LLC;
@ -195,7 +195,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
// see if a middle junction is needed
up = isupvert (btype,wgetc(row-1,col));
down = isdownvert(btype,wgetc(row+1,col));
if(up&&down)
if(up and down)
ch=MJ;
else if(up)
ch=LHJ;
@ -216,7 +216,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
// see if a right junction or corner is needed
up = isupvert (btype,wgetc(row-1,col));
down = isdownvert(btype,wgetc(row+1,col));
if(up&&down)
if(up and down)
ch=RVJ;
else if(up)
ch=LRC;
@ -254,7 +254,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
// see if a top junction or corner is needed
left = islefthorz (btype,wgetc(row,col-1));
right = isrighthorz(btype,wgetc(row,col+1));
if(left&&right)
if(left and right)
ch=UHJ;
else if(left)
ch=URC;
@ -274,7 +274,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
while(count>1) {
left = islefthorz (btype,wgetc(row,col-1));
right = isrighthorz(btype,wgetc(row,col+1));
if(left&&right)
if(left and right)
ch=MJ;
else if(left)
ch=RVJ;
@ -295,7 +295,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
// see if a bottom junction or corner is needed
left = islefthorz (btype,wgetc(row,col-1));
right = isrighthorz(btype,wgetc(row,col+1));
if(left&&right)
if(left and right)
ch=LHJ;
else if(left)
ch=LRC;

View File

@ -220,7 +220,7 @@ static void disp_item(_item_t *witem,int bar)
// see if currently in bar region. if so, then use
// a space for the character. otherwise use the
// character from the current position in the string
ch = (i<gwin.cmenu->textpos||i>textend)?' ':(*p++);
ch = ((i<gwin.cmenu->textpos) or (i>textend)) ? ' ' : (*p++);
// select attribute of character to be displayed based upon if
// selection bar was specified, if the menu item is non-selectable,
@ -229,7 +229,7 @@ static void disp_item(_item_t *witem,int bar)
chattr = gwin.cmenu->barattr;
else if(witem->fmask&M_NOSEL)
chattr = gwin.cmenu->noselattr;
else if((ch==witem->schar)&&!found) {
else if((ch==witem->schar) and not found) {
found = YES;
chattr = gwin.cmenu->scharattr;
}
@ -248,7 +248,7 @@ static void disp_item(_item_t *witem,int bar)
wprintws(witem->wrow, wcol, (vatch*)buf, width);
// display text description, if one exists
if(witem->desc!=NULL&&dispdesc) {
if((witem->desc!=NULL) and dispdesc) {
whp = wfindrec(witem->dwhdl);
i = (1 + whp->ecol - whp->scol) - (whp->border ? 2 : 0);
sprintf(buf, "%-*.*s", i, i, witem->desc);
@ -286,7 +286,7 @@ static _item_t * down_item(_item_t *curr)
if(trow>crow) {
tdist=abs((ccol-tcol));
bdist=abs((ccol-bcol));
if((trow<brow)||((trow==brow&&tdist<bdist))) {
if((trow<brow) or ((trow==brow) and (tdist<bdist))) {
best=temp;
brow=trow;
bcol=tcol;
@ -328,9 +328,8 @@ static _item_t * first_item(void)
// search backwards through linked list, testing each item
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
if( (temp->wrow<best->wrow) ||
( (temp->wrow==best->wrow) && (temp->wcol<best->wcol) ) )
best=temp;
if((temp->wrow<best->wrow) or ((temp->wrow==best->wrow) and (temp->wcol<best->wcol)))
best=temp;
}
// see if menu selection is non-selectable
@ -376,11 +375,9 @@ static _item_t * last_item(void)
// search backwards through linked list, testing each item
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
if( (temp->wrow>best->wrow) ||
( (temp->wrow==best->wrow) &&
(temp->wcol>bcol) ) ) {
best=temp;
bcol=best->wcol;
if((temp->wrow>best->wrow) or ((temp->wrow==best->wrow) and (temp->wcol>bcol))) {
best=temp;
bcol=best->wcol;
}
}
@ -456,7 +453,7 @@ static _item_t * left_item(_item_t *curr)
tpos=(temp->wrow*wwidth) + temp->wcol;
// compare position of test item with best item, current item
if(tpos>bpos && tpos<cpos) {
if((tpos>bpos) and (tpos<cpos)) {
best=temp;
bpos=tpos;
}
@ -492,7 +489,7 @@ static _item_t *mouse_on_item(_menu_t *menu,int mcrow,int mccol)
if(mcrow==(srow+border+item->wrow)) {
start = scol+border+item->wcol;
end = start+calc_bar_width(menu,item)-1;
if(mccol>=start&&mccol<=end) {
if((mccol>=start) and (mccol<=end)) {
found=item;
break;
}
@ -615,7 +612,7 @@ static _item_t * right_item(_item_t *curr)
tpos=(temp->wrow*wwidth) + temp->wcol;
// compare position of test item with best item, current item
if(tpos<bpos && tpos>cpos) {
if((tpos<bpos) and (tpos>cpos)) {
best=temp;
bpos=tpos;
}
@ -661,7 +658,7 @@ static _item_t * up_item(_item_t *curr)
if(trow<crow) {
tdist=abs(ccol-tcol);
bdist=abs(ccol-bcol);
if((trow>brow)||((trow==brow&&tdist<bdist))) {
if((trow>brow) or ((trow==brow) and (tdist<bdist))) {
best=temp;
brow=trow;
bcol=tcol;
@ -823,7 +820,7 @@ int wmenuend(int taginit, int menutype, int barwidth, int textpos, int textattr,
int w_width, border, found;
// make sure at least 1 menu item has been defined
if(!gwin.mlevel||gwin.mlevel>gwin.ilevel)
if(not gwin.mlevel or (gwin.mlevel>gwin.ilevel))
return(gwin.werrno=W_NOITMDEF);
// make sure that the specified initial tagid matches the
@ -886,7 +883,7 @@ int wmenuget() {
}
// make sure that wmenuend() was called
if(gwin.mlevel||gwin.ilevel) {
if(gwin.mlevel or gwin.ilevel) {
gwin.werrno=W_NOMNUEND;
return(-1);
}
@ -939,14 +936,13 @@ int wmenuget() {
citem=NULL;
if(gwin.cmenu->menutype&M_SAVE) {
for(citem=gwin.cmenu->item;citem!=NULL;citem=citem->prev) {
if((gwin.cmenu->citem==citem)&&
(!(citem->fmask&M_NOSEL)))
if((gwin.cmenu->citem==citem) and not (citem->fmask&M_NOSEL))
break;
}
}
if(citem==NULL) {
citem=wmenuifind(gwin.cmenu->tagcurr);
if((citem==NULL)||(citem->fmask&M_NOSEL)) citem=first_item();
if((citem==NULL) or (citem->fmask&M_NOSEL)) citem=first_item();
}
// call the current menu item's 'before'
@ -975,7 +971,7 @@ int wmenuget() {
// if Esc checking is on, erase selection bar,
// free menu records and return to caller
if(gwin.esc||(gwin.cmenu!=gwin.menu)) {
if(gwin.esc or (gwin.cmenu!=gwin.menu)) {
ESCAPE_KEY:
pre_move(citem);
pre_exit(w,YES);
@ -1008,7 +1004,8 @@ int wmenuget() {
citem=goto_item(citem,ITM_LT);
// if pull-down menu flag is set, select this item
if(pulldown&&citem->child!=NULL) goto ENTER;
if(pulldown and (citem->child!=NULL))
goto ENTER;
break;
case Key_Up:
@ -1037,13 +1034,15 @@ int wmenuget() {
citem=goto_item(citem,ITM_RT);
// if pulldown flag is set, then select this item
if(pulldown&&citem->child!=NULL) goto ENTER;
if(pulldown and (citem->child!=NULL))
goto ENTER;
break;
case Key_Dwn:
// if current item has a pull-down menu, select it
if(citem->fmask&M_HASPD) goto ENTER;
if(citem->fmask&M_HASPD)
goto ENTER;
// if current menu is a vertical menu, then hide
// selection bar and find menu item downwards
@ -1064,7 +1063,8 @@ int wmenuget() {
// if current menu item has a pull-down menu
// attached, then set the pulldown flag
if(citem->fmask&M_HASPD) pulldown=YES;
if(citem->fmask&M_HASPD)
pulldown=YES;
// display menu item with selection bar
disp_item(citem,1);
@ -1090,7 +1090,7 @@ int wmenuget() {
// if an error was returned by
// child menu, free menu records
// and pass error code to caller
if(menuerr==-1&&winerr!=W_ESCPRESS) {
if((menuerr==-1) and (winerr!=W_ESCPRESS)) {
call_after(citem);
menuerr=winerr;
pre_exit(w,YES);
@ -1134,7 +1134,7 @@ int wmenuget() {
// function. if so, then move selection bar to new item
if(gwin.cmenu->tagcurr!=-1) {
item=wmenuifind(gwin.cmenu->tagcurr);
if(item!=NULL&&(!(item->fmask&M_NOSEL))) {
if((item!=NULL) and not (item->fmask&M_NOSEL)) {
pre_move(citem);
post_move(gwin.cmenu->citem=citem=item);
break;
@ -1167,12 +1167,12 @@ int wmenuget() {
// if child menu returned an exit-all-menus flag,
// then free menu records and pass exit-all-menus
// flag onto caller
if((menuerr==M_EXITALL)||(citem->fmask&M_CLALL)) {
if((menuerr==M_EXITALL) or (citem->fmask&M_CLALL)) {
disp_item(citem,1);
call_after(citem);
if(citem->fmask&M_CLALL)
if(_finaltagid == -1)
_finaltagid = citem->tagid;
if(_finaltagid == -1)
_finaltagid = citem->tagid;
pre_exit(w,YES);
gwin.werrno=W_NOERROR;
return M_EXITALL;
@ -1182,8 +1182,8 @@ int wmenuget() {
// child menu, or current item has close-menu
// specified, free menu records, and return tag
// identifier of current menu item
if(citem->child!=NULL||citem->select!=NULL)
if((menuerr!=M_EXIT)&&(!(citem->fmask&M_CLOSE)))
if((citem->child!=NULL) or (citem->select!=NULL))
if((menuerr!=M_EXIT) and (not (citem->fmask&M_CLOSE)))
break;
call_after(citem);
_finaltagid = citem->tagid;
@ -1197,9 +1197,9 @@ int wmenuget() {
// code is zero, then it must be an extended key
ch=(char)xch;
if(!ch and gmnudropthrough) {
if((xch != Key_PgDn) and (xch != Key_PgUp))
kbput(xch);
goto ESCAPE_KEY;
if((xch != Key_PgDn) and (xch != Key_PgUp))
kbput(xch);
goto ESCAPE_KEY;
}
// scan through list of items for one that
@ -1208,16 +1208,15 @@ int wmenuget() {
item=citem->next;
for(;;) {
while(item!=NULL) {
if((toupper(ch)==toupper(item->schar))&&(!(item->fmask
&M_NOSEL))) goto FARBREAK;
if((toupper(ch)==toupper(item->schar)) and not (item->fmask&M_NOSEL))
goto FARBREAK;
if(citem==item) {
valid=NO;
goto FARBREAK;
}
item=item->next;
}
for(item=gwin.cmenu->item;item->prev!=NULL;
item=item->prev);
for(item=gwin.cmenu->item; item->prev!=NULL; item=item->prev) {}
}
FARBREAK:

View File

@ -56,6 +56,7 @@ void gareafile::ReadMaximus3(char* mxpath, char* areafile, char* options) {
fread(prmp, sizeof(m_pointers), 1, fp);
long heapsz = fsize(fp) - prm.heap_offset;
char* offsets = (char*)throw_calloc(1, (uint)heapsz);
fseek(fp, prm.heap_offset, SEEK_SET);
fread(offsets, (uint)heapsz, 1, fp);
fclose(fp);