1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Deal with the fact that modern compilers assume different scoping rules

Patch from Pascal Stumpf <Pascal.Stumpf@cubes.de>:

So here are all the patches that deal with the fact that modern
compilers assume different scoping rules for variables declared in for
loops.  On Linux, -fpermissive has been added as a compiler flag to
compensate for this old C code, but I think it is the wrong approach.

Sorry, couldn't help sneaking in a || defined(CSRG_BASED) and some casts
needed for other reasons ...
This commit is contained in:
Jon Trulson 2012-08-09 12:18:30 -06:00
parent 1bb40f1f0b
commit 491ff2228f
7 changed files with 32 additions and 24 deletions

View file

@ -118,7 +118,8 @@ _SHXbuf::reset(boolean g, boolean comp)
char **
_SHXbuf::vector()
{
for (int i = 0; i < vec.size(); i++)
int i;
for (i = 0; i < vec.size(); i++)
vec[i] = &buf[long(vec[i])];
vec[i] = NULL;

View file

@ -1079,7 +1079,8 @@ _tt_isopen_1(_Tt_isopen_args *args, SVCXPRT * /* transp */)
int l = db_path.len();
int tl = strlen("TT_DB");
for (int j = 0; j<l; j++) {
int j;
for (j = 0; j<l; j++) {
if (0==strncmp((char *)db_path+j,"TT_DB",tl)) {
break;
}

View file

@ -289,8 +289,9 @@ char *
ComposeFamily::valueToAddrString(DtMailValueSeq & value)
{
int max_len = 0;
int count;
for (int count = 0; count < value.length(); count++) {
for (count = 0; count < value.length(); count++) {
max_len += strlen(*(value[count]));
}

View file

@ -210,6 +210,7 @@ DmxPrintOptions::DmxPrintOptions (
char **strings;
void **data;
XmString xms;
int i, j, nhdrftrs;
_iom_array = new DtVirtArray<IndexedOptionMenu *>(10);
_propui_array = new DtVirtArray<PropUiItem *>(10);
@ -240,7 +241,7 @@ DmxPrintOptions::DmxPrintOptions (
nitems = DMX_ARRAY_SIZE(hdrftr_values);;
strings = (char **) XtMalloc( nitems * sizeof(char*) );
data = (void **) XtMalloc( nitems * sizeof(void*) );
for (int i=0; i<nitems; i++)
for (i=0; i<nitems; i++)
{
data[i] = (void*) hdrftr_values[i].prop_string;
strings[i] = GETMSG(
@ -265,7 +266,7 @@ DmxPrintOptions::DmxPrintOptions (
//
menu_buttons = NULL;
_DtPrintHdrFtrFrameMenuWidgets( _hdrftr_frame, NULL, NULL, &menu_buttons);
for (int j=0, nhdrftrs=DMX_ARRAY_SIZE(hdrftr_keys); j<nhdrftrs; j++)
for (j=0, nhdrftrs=DMX_ARRAY_SIZE(hdrftr_keys); j<nhdrftrs; j++)
{
w = _DtPrintHdrFtrFrameEnumToWidget(
_hdrftr_frame,
@ -671,7 +672,7 @@ DmxPrintOptions::isValidMarginSpec(PropUiItem* pui, void* data)
char *marginSpec = NULL;
XtEnum parseError;
Widget text;
#if defined(linux)
#if defined(linux) || defined(CSRG_BASED)
_DtPrintMarginEnum which = *((_DtPrintMarginEnum *) data);
#else
_DtPrintMarginEnum which = (_DtPrintMarginEnum) data;

View file

@ -124,7 +124,7 @@
#include "SortCmd.hh"
extern force( Widget );
extern int force( Widget );
static const char * NormalIcon = "DtMail";
static const char * EmptyIcon = "DtMnone";
@ -725,7 +725,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
printHelpId("form1", form1);
/* add help callback */
// XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);
XtAddCallback(form1, XmNhelpCallback, HelpCB, DTMAILWINDOWID);
XtAddCallback(form1, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWID);
panedW = XtCreateManagedWidget("panedW", xmPanedWindowWidgetClass,
form1, NULL, 0);
@ -757,7 +757,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
/* add help callback */
// XtAddCallback(_rowOfLabels, XmNhelpCallback, HelpCB, helpId);
XtAddCallback(
_rowOfLabels, XmNhelpCallback, HelpCB, DTMAILWINDOWROWOFLABELSID);
_rowOfLabels, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWROWOFLABELSID);
XtVaSetValues(_rowOfLabels,
XmNrightAttachment,XmATTACH_FORM,
@ -792,7 +792,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
XtAddCallback(
_list->get_scrolling_list(), XmNhelpCallback,
HelpCB, DTMAILMSGLISTID);
HelpCB, (void *)DTMAILMSGLISTID);
XtVaSetValues(_list->get_scrolling_list(), XmNuserData, this, NULL);
_rowOfButtons =
@ -2863,7 +2863,7 @@ RoamMenuWindow::addToRowOfButtons()
TRUE, this );
ci = new ButtonInterface (_rowOfButtons, _delete_button);
w = ci->baseWidget();
XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILDELBTNID);
XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILDELBTNID);
XtVaSetValues(w,
XmNleftAttachment, XmATTACH_FORM,
XmNtopAttachment, XmATTACH_FORM,
@ -2880,7 +2880,7 @@ RoamMenuWindow::addToRowOfButtons()
TRUE, this );
ci = new ButtonInterface (_rowOfButtons, _next_button);
w = ci->baseWidget();
XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILNEXTBTNID);
XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILNEXTBTNID);
XtVaSetValues(w,
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, prev_widget,
@ -2899,7 +2899,7 @@ RoamMenuWindow::addToRowOfButtons()
TRUE, this );
ci = new ButtonInterface (_rowOfButtons, _previous_button);
w = ci->baseWidget();
XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILPREVBTNID);
XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPREVBTNID);
XtVaSetValues(w,
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, prev_widget,
@ -2920,7 +2920,7 @@ RoamMenuWindow::addToRowOfButtons()
FALSE );
ci = new ButtonInterface (_rowOfButtons, _replySender_button);
w = ci->baseWidget();
XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILREPLYBTNID);
XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILREPLYBTNID);
XtVaSetValues(w,
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, prev_widget,
@ -2938,7 +2938,7 @@ RoamMenuWindow::addToRowOfButtons()
TRUE, TRUE, this);
ci = new ButtonInterface (_rowOfButtons, _print_button);
w = ci->baseWidget();
XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILPRINTBTNID);
XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPRINTBTNID);
XtVaSetValues(w,
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, prev_widget,
@ -3292,7 +3292,7 @@ RoamMenuWindow::createContainerList()
void
RoamMenuWindow::createOpenContainerList(CmdList * open_container)
{
int ncontainers;
int ncontainers, i;
char *container_name;
ContainerMenuCmd *container_cmd;
@ -3327,7 +3327,7 @@ RoamMenuWindow::createOpenContainerList(CmdList * open_container)
_open_container_containerlist =
new DtVirtArray<ContainerMenuCmd*>(ncontainers);
for (int i=0; i<ncontainers; i++)
for (i=0; i<ncontainers; i++)
{
container_name = (*_user_containerlist)[i]->containerName();
if (NULL != container_name)
@ -3490,7 +3490,7 @@ RoamMenuWindow::construct_file_menu()
void
RoamMenuWindow::createCopyList(CmdList * copy_to)
{
int ncontainers;
int ncontainers, i;
char *container_name;
ContainerMenuCmd *container_cmd;
@ -3550,7 +3550,7 @@ RoamMenuWindow::createCopyList(CmdList * copy_to)
_copyto_containerlist =
new DtVirtArray<ContainerMenuCmd *> (ncontainers);
for (int i=0; i<ncontainers; i++)
for (i=0; i<ncontainers; i++)
{
container_name = (*_user_containerlist)[i]->containerName();
if (NULL != container_name)
@ -3930,7 +3930,7 @@ RoamMenuWindow::construct_compose_menu()
void
RoamMenuWindow::construct_move_menu()
{
int ncontainers;
int ncontainers, i;
char *container_name;
ContainerMenuCmd *container_cmd;
@ -3967,7 +3967,7 @@ RoamMenuWindow::construct_move_menu()
delete _move_containerlist;
_move_containerlist = new DtVirtArray<ContainerMenuCmd *> (ncontainers);
for (int i=0; i<ncontainers; i++)
for (i=0; i<ncontainers; i++)
{
container_name = (*_user_containerlist)[i]->containerName();
if (NULL != container_name)

View file

@ -328,9 +328,11 @@ V3BodyPart::checksum(DtMailEnv & error)
static int
countTypes(char ** types)
{
int count;
if (NULL == types) return 0;
for (int count = 0; *types; types++, count++) {
for (count = 0; *types; types++, count++) {
continue;
}

View file

@ -510,12 +510,14 @@ CTokenizedString::~CTokenizedString()
CString CTokenizedString::next()
{
char * q = 0;
char * p;
int i;
if (cursor) {
if (strlen(delimiter) == 1)
q = strchr(cursor,delimiter[0]);
else {
for (int i = 0; i < strlen(cursor); i++)
for (i = 0; i < strlen(cursor); i++)
if (strchr(delimiter,cursor[i])) {
q = &cursor[i];
break;
@ -533,7 +535,7 @@ char * q = 0;
// eliminate trailing white space
if (skipWhiteSpace) {
for (char *p = q; isspace(*(p-1)); p--);
for (p = q; isspace(*(p-1)); p--);
*p = 0;
}
CString result(cursor);