diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-03-16 20:22:55 -0300 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-28 03:45:23 -0200 |
commit | edda127130da731e9d314456d89f083a7eeca276 (patch) | |
tree | 27da841b44b10834013f636b34c6e460700b6c25 | |
parent | bb0968eff74cb55cf2de125f828a76f679c4a017 (diff) |
Compile warning fixes.
Ansify functions with K&R prototypes.
Adjust some definitions to match required prototypes.
Declare as static some functions to avoid warnings about missing prototypes.
-rw-r--r-- | ULabel.c | 92 | ||||
-rw-r--r-- | xfontsel.c | 161 |
2 files changed, 91 insertions, 162 deletions
@@ -109,13 +109,16 @@ static XtResource resources[] = { }; #undef offset -static void Initialize(); -static void Resize(); -static void Redisplay(); -static Boolean SetValues(); -static void ClassInitialize(); -static void Destroy(); -static XtGeometryResult QueryGeometry(); +static void Initialize(Widget request, Widget new, + ArgList args, Cardinal *num_args); +static void Resize(Widget w); +static void Redisplay(Widget gw, XEvent *event, Region region); +static Boolean SetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args); +static void ClassInitialize(void); +static void Destroy(Widget w); +static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *intended, + XtWidgetGeometry *preferred); UCSLabelClassRec ucsLabelClassRec = { { @@ -169,7 +172,7 @@ WidgetClass ucsLabelWidgetClass = (WidgetClass)&ucsLabelClassRec; * ****************************************************************/ -static void ClassInitialize() +static void ClassInitialize(void) { XawInitializeWidgetSet(); XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, @@ -187,10 +190,7 @@ static int buf2blen = 0; #define TXT16 char -static int _XawLabelWidth16(fs, str, n) - XFontStruct *fs; - char *str; - int n; +static int _XawLabelWidth16(XFontStruct *fs, char *str, int n) { int i; XChar2b *ptr; @@ -206,13 +206,8 @@ static int _XawLabelWidth16(fs, str, n) return XTextWidth16(fs, buf2b, n); } -static void _XawLabelDraw16(dpy, d, gc, x, y, str, n) - Display *dpy; - Drawable d; - GC gc; - int x, y; - char *str; - int n; +static void _XawLabelDraw16(Display *dpy, Drawable d, GC gc, + int x, int y, char *str, int n) { int i; XChar2b *ptr; @@ -233,13 +228,8 @@ static void _XawLabelDraw16(dpy, d, gc, x, y, str, n) #endif /* WORD64 */ -static void _XawLabelDrawUCS(dpy, d, gc, x, y, str, n) - Display *dpy; - Drawable d; - GC gc; - int x, y; - char *str; - int n; +static void _XawLabelDrawUCS(Display *dpy, Drawable d, GC gc, + int x, int y, char *str, int n) { char *ep; unsigned short codepoint; @@ -320,8 +310,7 @@ static int _XawLabelWidthUCS( * Calculate width and height of displayed text in pixels */ -static void SetTextWidthAndHeight(lw) - UCSLabelWidget lw; +static void SetTextWidthAndHeight(UCSLabelWidget lw) { XFontStruct *fs = lw->label.font; @@ -431,8 +420,7 @@ static void SetTextWidthAndHeight(lw) } } -static void GetnormalGC(lw) - UCSLabelWidget lw; +static void GetnormalGC(UCSLabelWidget lw) { XGCValues values; @@ -454,8 +442,7 @@ static void GetnormalGC(lw) &values); } -static void GetgrayGC(lw) - UCSLabelWidget lw; +static void GetgrayGC(UCSLabelWidget lw) { XGCValues values; @@ -485,8 +472,7 @@ static void GetgrayGC(lw) &values); } -static void compute_bitmap_offsets (lw) - UCSLabelWidget lw; +static void compute_bitmap_offsets(UCSLabelWidget lw) { /* * bitmap will be eventually be displayed at @@ -502,8 +488,7 @@ static void compute_bitmap_offsets (lw) } -static void set_bitmap_info (lw) - UCSLabelWidget lw; +static void set_bitmap_info(UCSLabelWidget lw) { Window root; int x, y; @@ -521,10 +506,8 @@ static void set_bitmap_info (lw) /* ARGSUSED */ -static void Initialize(request, new, args, num_args) - Widget request, new; - ArgList args; - Cardinal *num_args; +static void +Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { UCSLabelWidget lw = (UCSLabelWidget) new; @@ -560,10 +543,7 @@ static void Initialize(request, new, args, num_args) */ /* ARGSUSED */ -static void Redisplay(gw, event, region) - Widget gw; - XEvent *event; - Region region; +static void Redisplay(Widget gw, XEvent *event, Region region) { UCSLabelWidget w = (UCSLabelWidget) gw; GC gc; @@ -676,10 +656,8 @@ static void Redisplay(gw, event, region) #endif /* notdef */ } -static void _Reposition(lw, width, height, dx, dy) - UCSLabelWidget lw; - Dimension width, height; - Position *dx, *dy; +static void _Reposition(UCSLabelWidget lw, Dimension width, Dimension height, + Position *dx, Position *dy) { Position newPos; Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw); @@ -710,8 +688,7 @@ static void _Reposition(lw, width, height, dx, dy) return; } -static void Resize(w) - Widget w; +static void Resize(Widget w) { UCSLabelWidget lw = (UCSLabelWidget)w; Position dx, dy; @@ -729,10 +706,9 @@ static void Resize(w) #define HEIGHT 2 #define NUM_CHECKS 3 -static Boolean SetValues(current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; +static Boolean +SetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args) { UCSLabelWidget curlw = (UCSLabelWidget) current; UCSLabelWidget reqlw = (UCSLabelWidget) request; @@ -827,8 +803,7 @@ static Boolean SetValues(current, request, new, args, num_args) XtIsSensitive(current) != XtIsSensitive(new); } -static void Destroy(w) - Widget w; +static void Destroy(Widget w) { UCSLabelWidget lw = (UCSLabelWidget)w; @@ -840,9 +815,8 @@ static void Destroy(w) } -static XtGeometryResult QueryGeometry(w, intended, preferred) - Widget w; - XtWidgetGeometry *intended, *preferred; +static XtGeometryResult +QueryGeometry(Widget w, XtWidgetGeometry *intended, XtWidgetGeometry *preferred) { UCSLabelWidget lw = (UCSLabelWidget)w; @@ -66,22 +66,22 @@ Modified: Mark Leisher <mleisher@crl.nmsu.edu> to deal with UCS sample text. #define NZ NULL,ZERO #define BACKGROUND 10 -void GetFontNames(); -Boolean Matches(); -Boolean DoWorkPiece(); -void Quit(); -void OwnSelection(); -void SelectField(); -void ParseFontNames(); -void SortFields(); -void FixScalables(); -void MakeFieldMenu(); -void SelectValue(); -void AnyValue(); -void EnableOtherValues(); -void EnableMenu(); -void SetCurrentFont(); -void QuitAction(); +void GetFontNames(XtPointer closure); +Boolean Matches(String pattern, String fontName, Boolean fields[], int *maxfields); +Boolean DoWorkPiece(XtPointer closure); +void Quit(Widget w, XtPointer closure, XtPointer callData); +void OwnSelection(Widget w, XtPointer closure, XtPointer callData); +void SelectField(Widget w, XtPointer closure, XtPointer callData); +void ParseFontNames(XtPointer closure); +void SortFields(XtPointer closure); +void FixScalables(XtPointer closure); +void MakeFieldMenu(XtPointer closure); +void SelectValue(Widget w, XtPointer closure, XtPointer callData); +void AnyValue(Widget w, XtPointer closure, XtPointer callData); +void EnableOtherValues(Widget w, XtPointer closure, XtPointer callData); +void EnableMenu(XtPointer closure); +void SetCurrentFont(XtPointer closure); +void QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params); XtActionsRec xfontsel_actions[] = { {"Quit", QuitAction} @@ -89,9 +89,9 @@ XtActionsRec xfontsel_actions[] = { Atom wm_delete_window; -Boolean IsXLFDFontName(); +Boolean IsXLFDFontName(String fontName); -typedef void (*XtProc)(); +typedef void (*XtProc)(XtPointer closure); static struct _appRes { int app_defaults_version; @@ -150,8 +150,7 @@ static XrmOptionDescRec options[] = { {"-scaled", "scaledFonts", XrmoptionNoArg, "True"}, }; -static void Syntax(call) - char *call; +static void Syntax(char *call) { fprintf (stderr, "usage: %s [-options ...] -fn font\n\n", call); fprintf (stderr, "where options include:\n"); @@ -260,9 +259,7 @@ int enabledMenuIndex; static Boolean patternFieldSpecified[FIELD_COUNT]; /* = 0 */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { Widget topLevel, pane; @@ -328,7 +325,7 @@ see 'xfontsel' manual page." makeRec->field = f; makeRec->button = field; ScheduleWork(MakeFieldMenu, (XtPointer)makeRec, 2); - ScheduleWork(XtFree, (XtPointer)makeRec, 2); + ScheduleWork((XtProc)XtFree, (XtPointer)makeRec, 2); } } @@ -397,10 +394,7 @@ static WorkPiece workQueue = NULL; * Xt knows we have (background) work to do. */ -static void ScheduleWork( proc, closure, priority ) - XtProc proc; - XtPointer closure; - int priority; +static void ScheduleWork(XtProc proc, XtPointer closure, int priority) { WorkPiece piece = XtNew(WorkPieceRec); @@ -427,8 +421,7 @@ static void ScheduleWork( proc, closure, priority ) } /* ARGSUSED */ -Boolean DoWorkPiece(closure) - XtPointer closure; /* unused */ +Boolean DoWorkPiece(XtPointer closure) { WorkPiece piece = workQueue; @@ -450,7 +443,7 @@ Boolean DoWorkPiece(closure) * Foreground == (priority < BACKGROUND) */ -void FinishWork() +static void FinishWork(void) { while (workQueue && workQueue->priority < BACKGROUND) DoWorkPiece(NULL); @@ -467,8 +460,7 @@ struct ParseRec { }; -void GetFontNames( closure ) - XtPointer closure; +void GetFontNames(XtPointer closure) { Display *dpy = (Display*)closure; ParseRec *parseRec = XtNew(ParseRec); @@ -502,7 +494,7 @@ void GetFontNames( closure ) ParseRec *prevRec = parseRec; parseRec->end = parseRec->start + PARSE_QUANTUM; ScheduleWork(ParseFontNames, (XtPointer)parseRec, work_priority); - ScheduleWork(XtFree, (XtPointer)parseRec, work_priority); + ScheduleWork((XtProc)XtFree, (XtPointer)parseRec, work_priority); parseRec = XtNew(ParseRec); *parseRec = *prevRec; parseRec->start += PARSE_QUANTUM; @@ -514,7 +506,7 @@ void GetFontNames( closure ) parseRec->end = numFonts; ScheduleWork(ParseFontNames,(XtPointer)parseRec,work_priority); ScheduleWork((XtProc)XFreeFontNames,(XtPointer)fontNames,work_priority); - ScheduleWork(XtFree, (XtPointer)parseRec, work_priority); + ScheduleWork((XtProc)XtFree, (XtPointer)parseRec, work_priority); if (AppRes.scaled_fonts) ScheduleWork(FixScalables,(XtPointer)0,work_priority); ScheduleWork(SortFields,(XtPointer)0,work_priority); @@ -543,8 +535,7 @@ void GetFontNames( closure ) } -void ParseFontNames( closure ) - XtPointer closure; +void ParseFontNames(XtPointer closure) { ParseRec *parseRec = (ParseRec*)closure; char **fontNames = parseRec->fontNames; @@ -629,8 +620,7 @@ void ParseFontNames( closure ) * since we need to do this for resolution fields which can be nonzero in * the scalable fonts. */ -void AddScalables(f) - int f; +static void AddScalables(int f) { int i; int max = fieldValues[f]->count; @@ -683,9 +673,7 @@ void AddScalables(f) * for field f. Weed out duplicates. The set of matching fonts is just * the set of scalable fonts. */ -void NewScalables(f, slist) - int f; - char *slist; +static void NewScalables(int f, char *slist) { char endc = 1; char *str; @@ -732,8 +720,7 @@ void NewScalables(f, slist) * in resources. */ /*ARGSUSED*/ -void FixScalables( closure ) - XtPointer closure; +void FixScalables(XtPointer closure) { int i; FieldValue *fval = fieldValues[6]->value; @@ -797,7 +784,7 @@ static int strcmpn(const char *s1, const char *s2) /* Order is *, (nil), rest */ -int AlphabeticSort(_Xconst void *fval1, _Xconst void *fval2) +static int AlphabeticSort(_Xconst void *fval1, _Xconst void *fval2) { # define fval1 ((_Xconst FieldValue *)fval1) # define fval2 ((_Xconst FieldValue *)fval2) @@ -819,7 +806,7 @@ int AlphabeticSort(_Xconst void *fval1, _Xconst void *fval2) /* Order is *, (nil), rest */ -int NumericSort(_Xconst void *fval1, _Xconst void *fval2) +static int NumericSort(_Xconst void *fval1, _Xconst void *fval2) { # define fval1 ((_Xconst FieldValue *)fval1) # define fval2 ((_Xconst FieldValue *)fval2) @@ -846,8 +833,7 @@ int NumericSort(_Xconst void *fval1, _Xconst void *fval2) * sort. */ /*ARGSUSED*/ -void SortFields( closure ) - XtPointer closure; +void SortFields(XtPointer closure) { int i, j, count; FieldValue *vals; @@ -883,8 +869,7 @@ void SortFields( closure ) } -Boolean IsXLFDFontName(fontName) - String fontName; +Boolean IsXLFDFontName(String fontName) { int f; for (f = 0; *fontName;) if (*fontName++ == DELIM) f++; @@ -892,8 +877,7 @@ Boolean IsXLFDFontName(fontName) } -void MakeFieldMenu(closure) - XtPointer closure; +void MakeFieldMenu(XtPointer closure) { FieldMenuRec *makeRec = (FieldMenuRec*)closure; Widget menu; @@ -948,10 +932,8 @@ static void SetNoFonts(void) } -Boolean Matches(pattern, fontName, fields, maxField) - register String pattern, fontName; - Boolean fields[/*FIELD_COUNT*/]; - int *maxField; +Boolean Matches(register String pattern, register String fontName, + Boolean fields[/*FIELD_COUNT*/], int *maxField) { register int field = (*fontName == DELIM) ? -1 : 0; register Boolean marked_this_field = False; @@ -999,9 +981,7 @@ Boolean Matches(pattern, fontName, fields, maxField) /* ARGSUSED */ -void SelectValue(w, closure, callData) - Widget w; - XtPointer closure, callData; +void SelectValue(Widget w, XtPointer closure, XtPointer callData) { FieldValue *val = (FieldValue*)closure; #ifdef LOG_CHOICES @@ -1031,9 +1011,7 @@ void SelectValue(w, closure, callData) /* ARGSUSED */ -void AnyValue(w, closure, callData) - Widget w; - XtPointer closure, callData; +void AnyValue(Widget w, XtPointer closure, XtPointer callData) { int field = (long)closure; currentFont.value_index[field] = -1; @@ -1072,9 +1050,7 @@ static void SetParsingFontCount(int count) } /* ARGSUSED */ -static Boolean IsISO10646(dpy, font) - Display *dpy; - XFontStruct *font; +static Boolean IsISO10646(Display *dpy, XFontStruct *font) { Boolean ok; int i; @@ -1099,8 +1075,7 @@ static Boolean IsISO10646(dpy, font) } /* ARGSUSED */ -void SetCurrentFont(closure) - XtPointer closure; /* unused */ +void SetCurrentFont(XtPointer closure) { int f; Boolean *b; @@ -1200,9 +1175,7 @@ void SetCurrentFont(closure) } -static void MarkInvalidFonts( set, val ) - Boolean *set; - FieldValue *val; +static void MarkInvalidFonts(Boolean *set, FieldValue *val) { int fi = 0, vi; int *fp = val->font; @@ -1220,8 +1193,7 @@ static void MarkInvalidFonts( set, val ) } -static void EnableRemainingItems(current_field_action) - ValidateAction current_field_action; +static void EnableRemainingItems(ValidateAction current_field_action) { if (matchingFontCount == 0 || matchingFontCount == numFonts) { if (anyDisabled) { @@ -1275,9 +1247,7 @@ static void EnableAllItems(int field) /* ARGSUSED */ -void SelectField(w, closure, callData) - Widget w; - XtPointer closure, callData; +void SelectField(Widget w, XtPointer closure, XtPointer callData) { int field = (long)closure; FieldValue *values = fieldValues[field]->value; @@ -1297,8 +1267,7 @@ void SelectField(w, closure, callData) * will almost always produce an illegal font name, and it isn't worth * trying to compute which choices might be legal to the font scaler. */ -void DisableScaled(f, f1, f2) - int f, f1, f2; +static void DisableScaled(int f, int f1, int f2) { int i, j; FieldValue *v; @@ -1321,9 +1290,7 @@ void DisableScaled(f, f1, f2) } /* ARGSUSED */ -void EnableOtherValues(w, closure, callData) - Widget w; - XtPointer closure, callData; +void EnableOtherValues(Widget w, XtPointer closure, XtPointer callData) { int field = (long)closure; Boolean *font_in_set = (Boolean*)XtMalloc(numFonts*sizeof(Boolean)); @@ -1386,8 +1353,7 @@ void EnableOtherValues(w, closure, callData) } -void EnableMenu(closure) - XtPointer closure; +void EnableMenu(XtPointer closure) { int field = (long)closure; FieldValue *val = fieldValues[field]->value; @@ -1434,8 +1400,7 @@ void EnableMenu(closure) } -static void FlushXqueue(dpy) - Display *dpy; +static void FlushXqueue(Display *dpy) { XSync(dpy, False); while (XtAppPending(appCtx)) XtAppProcessEvent(appCtx, XtIMAll); @@ -1443,9 +1408,7 @@ static void FlushXqueue(dpy) /* ARGSUSED */ -void Quit(w, closure, callData) - Widget w; - XtPointer closure, callData; +void Quit(Widget w, XtPointer closure, XtPointer callData) { XtCloseDisplay(XtDisplay(w)); if (AppRes.print_on_quit) printf( "%s", currentFontNameString ); @@ -1453,12 +1416,9 @@ void Quit(w, closure, callData) } -Boolean ConvertSelection(w, selection, target, type, value, length, format) - Widget w; - Atom *selection, *target, *type; - XtPointer *value; - unsigned long *length; - int *format; +static Boolean +ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, + XtPointer *value, unsigned long *length, int *format) { /* XmuConvertStandardSelection will use the second parameter only when * converting to the target TIMESTAMP. However, it will never be @@ -1485,9 +1445,7 @@ static AtomPtr _XA_PRIMARY_FONT = NULL; #define XA_PRIMARY_FONT XmuInternAtom(XtDisplay(w),_XA_PRIMARY_FONT) /* ARGSUSED */ -void LoseSelection(w, selection) - Widget w; - Atom *selection; +static void LoseSelection(Widget w, Atom *selection) { Arg args[1]; XtSetArg( args[0], XtNstate, False ); @@ -1499,18 +1457,14 @@ void LoseSelection(w, selection) /* ARGSUSED */ -void DoneSelection(w, selection, target) - Widget w; - Atom *selection, *target; +static void DoneSelection(Widget w, Atom *selection, Atom *target) { /* do nothing */ } /* ARGSUSED */ -void OwnSelection(w, closure, callData) - Widget w; - XtPointer closure, callData; +void OwnSelection(Widget w, XtPointer closure, XtPointer callData) { Time time = XtLastTimestampProcessed(XtDisplay(w)); Boolean primary = (Boolean) (long) closure; @@ -1537,8 +1491,9 @@ void OwnSelection(w, closure, callData) } } +/*ARGSUSED*/ void -QuitAction () +QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { exit (0); } |