1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dsdm: convert k&r function declarations to ansi, and correct the warnings this then uncovered.

This commit is contained in:
Peter Howkins 2014-12-30 15:57:12 +00:00
parent 4fc0bcef0f
commit 59bcb8d08f
2 changed files with 56 additions and 158 deletions

View file

@ -157,10 +157,7 @@ typedef struct {
* Flash the visible region. Useful for debugging. * Flash the visible region. Useful for debugging.
*/ */
void void
FlashRegion(dpy, s, gc) FlashRegion(Display *dpy, int s, GC gc)
Display *dpy;
int s;
GC gc;
{ {
XEvent e; XEvent e;
Bool done = False; Bool done = False;
@ -193,8 +190,7 @@ FlashRegion(dpy, s, gc)
void void
FlashDropSites(dpy) FlashDropSites(Display *dpy)
Display *dpy;
{ {
drop_site_t *site = MasterSiteList; drop_site_t *site = MasterSiteList;
XGCValues gcv; XGCValues gcv;
@ -234,16 +230,10 @@ FlashDropSites(dpy)
*/ */
#ifdef oldcode #ifdef oldcode
void * void *
GetInterestProperty(Display *dpy, Window win, int *nitems)
#else #else
unsigned char * unsigned char *
#endif GetInterestProperty(Display *dpy, Window win, unsigned long *nitems)
GetInterestProperty(dpy, win, nitems)
Display *dpy;
Window win;
#ifdef oldcode
int *nitems;
#else
unsigned long *nitems;
#endif #endif
{ {
Status s; Status s;
@ -306,12 +296,7 @@ GetInterestProperty(dpy, win, nitems)
* children of this window are searched. * children of this window are searched.
*/ */
Bool Bool
FindRecursively(dpy, root, win, pwin, psite, plen, px, py) FindRecursively(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py)
Display *dpy;
Window root, win, *pwin;
void **psite;
unsigned long *plen;
int *px, *py;
{ {
XWindowAttributes attr; XWindowAttributes attr;
Window junk; Window junk;
@ -437,20 +422,9 @@ FindRecursively(dpy, root, win, pwin, psite, plen, px, py)
*/ */
Bool Bool
#ifdef oldcode #ifdef oldcode
SearchChildren(dpy, root, win, pwin, psite, plen, px, py) SearchChildren(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py)
Display *dpy;
Window root, win, *pwin;
void **psite;
unsigned long *plen;
int *px, *py;
#else #else
SearchChildren(dpy, root, win, pwin, psite, plen, px, py, from_FindRec) SearchChildren(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py, Bool from_FindRec)
Display *dpy;
Window root, win, *pwin;
void **psite;
unsigned long *plen;
int *px, *py;
Bool from_FindRec;
#endif #endif
{ {
Window junk; Window junk;
@ -488,9 +462,7 @@ SearchChildren(dpy, root, win, pwin, psite, plen, px, py, from_FindRec)
* Create and return a region that contains a given rectangle. * Create and return a region that contains a given rectangle.
*/ */
Region Region
MakeRegionFromRect(x, y, w, h) MakeRegionFromRect(int x, int y, unsigned int w, unsigned int h)
int x, y;
unsigned int w, h;
{ {
XRectangle r; XRectangle r;
Region reg; Region reg;
@ -513,10 +485,7 @@ MakeRegionFromRect(x, y, w, h)
* corner is at (0,0). * corner is at (0,0).
*/ */
Region Region
GetWindowRegion(dpy, win, offset) GetWindowRegion(Display *dpy, Window win, Bool offset)
Display *dpy;
Window win;
Bool offset;
{ {
Window wjunk; Window wjunk;
int x, y; int x, y;
@ -543,10 +512,7 @@ GetWindowRegion(dpy, win, offset)
* Subtract the area of a window from the current visible region. * Subtract the area of a window from the current visible region.
*/ */
void void
SubtractWindowFromVisibleRegion(dpy, win, visrgn) SubtractWindowFromVisibleRegion(Display *dpy, Window win, Region visrgn)
Display *dpy;
Window win;
Region visrgn;
{ {
Region winrgn = GetWindowRegion(dpy, win, True); Region winrgn = GetWindowRegion(dpy, win, True);
XSubtractRegion(visrgn, winrgn, visrgn); XSubtractRegion(visrgn, winrgn, visrgn);
@ -698,8 +664,7 @@ ProcessInterestProperty(dpy, win, screen, data, datalen, visrgn, xoff, yoff)
* forwarding information to the site database. * forwarding information to the site database.
*/ */
void void
FindDropSites(dpy) FindDropSites(Display *dpy)
Display *dpy;
{ {
#ifdef oldcode #ifdef oldcode
int s, i, nchildren; int s, i, nchildren;
@ -808,7 +773,7 @@ FindDropSites(dpy)
void void
FreeDropSites() FreeDropSites(void)
{ {
drop_site_t *next, *temp; drop_site_t *next, *temp;
@ -843,10 +808,7 @@ FreeDropSites()
* 8k+7 flags * 8k+7 flags
*/ */
void void
WriteSiteRectList(dpy, win, prop) WriteSiteRectList(Display *dpy, Window win, Atom prop)
Display *dpy;
Window win;
Atom prop;
{ {
unsigned long *cur; unsigned long *cur;
unsigned long *array; unsigned long *array;
@ -911,9 +873,7 @@ WriteSiteRectList(dpy, win, prop)
* site database. REMIND: more robust error handling is called for. * site database. REMIND: more robust error handling is called for.
*/ */
int int
ErrorHandler(dpy, error) ErrorHandler(Display *dpy, XErrorEvent *error)
Display *dpy;
XErrorEvent *error;
{ {
if ( (error->error_code == BadWindow || if ( (error->error_code == BadWindow ||
error->error_code == BadDrawable) && error->error_code == BadDrawable) &&
@ -936,9 +896,8 @@ ErrorHandler(dpy, error)
} /* end of ErrorHandler */ } /* end of ErrorHandler */
main(argc, argv) int
int argc; main(int argc, char **argv)
char **argv;
{ {
enum { XA_SUN_DRAGDROP_DSDM, XA_SUN_DRAGDROP_INTEREST, enum { XA_SUN_DRAGDROP_DSDM, XA_SUN_DRAGDROP_INTEREST,
XA_SUN_DRAGDROP_SITE_RECTS, XAWM_STATE, NUM_ATOMS }; XA_SUN_DRAGDROP_SITE_RECTS, XAWM_STATE, NUM_ATOMS };
@ -1082,3 +1041,4 @@ main(argc, argv)
#endif #endif
} }
} /* end of main */ } /* end of main */

View file

@ -207,7 +207,7 @@ Window motif_drag_win;
char motif_byte_order; char motif_byte_order;
void void
InitializeByteOrder() InitializeByteOrder(void)
{ {
unsigned int endian = 1; unsigned int endian = 1;
@ -219,9 +219,8 @@ InitializeByteOrder()
} }
/* swap 2 bytes of data if the byte order is different */ /* swap 2 bytes of data if the byte order is different */
Swap2Bytes(byte_order, data) int
char byte_order; Swap2Bytes(char byte_order, CARD16 data)
CARD16 data;
{ {
static CARD16 ret_data; static CARD16 ret_data;
char *old_p = (char *) &data; char *old_p = (char *) &data;
@ -236,9 +235,8 @@ Swap2Bytes(byte_order, data)
} }
/* swap 4 bytes of data if the byte order is different */ /* swap 4 bytes of data if the byte order is different */
Swap4Bytes(byte_order, data) int
char byte_order; Swap4Bytes(char byte_order, CARD32 data)
CARD32 data;
{ {
static CARD32 ret_data; static CARD32 ret_data;
char *old_p = (char *) &data; char *old_p = (char *) &data;
@ -258,7 +256,7 @@ Swap4Bytes(byte_order, data)
/* Get a new drop record */ /* Get a new drop record */
/* use source_handle to indicate whether record is free or in use */ /* use source_handle to indicate whether record is free or in use */
static drop_info_t * static drop_info_t *
NewDropInfo() NewDropInfo(void)
{ {
int i, oldest_index=0; int i, oldest_index=0;
@ -278,8 +276,7 @@ NewDropInfo()
/* Search for a drop record */ /* Search for a drop record */
/* use source_handle as the key to the drop_info record */ /* use source_handle as the key to the drop_info record */
static drop_info_t * static drop_info_t *
GetDropInfo(proxy_sel_req_win) GetDropInfo(Window proxy_sel_req_win)
Window proxy_sel_req_win;
{ {
int i; int i;
@ -292,8 +289,7 @@ GetDropInfo(proxy_sel_req_win)
/* Search for a drop record using the proxy_handle as the key */ /* Search for a drop record using the proxy_handle as the key */
static drop_info_t * static drop_info_t *
GetDropInfoUsingProxyHandle(proxy_handle) GetDropInfoUsingProxyHandle(Atom proxy_handle)
Atom proxy_handle;
{ {
int i; int i;
@ -306,8 +302,7 @@ GetDropInfoUsingProxyHandle(proxy_handle)
/* Delete a drop record */ /* Delete a drop record */
static void static void
ClearDropInfo(proxy_handle) ClearDropInfo(Atom proxy_handle)
Atom proxy_handle;
{ {
int i; int i;
for(i=0; i<DROP_TABLE_MAX; i++) for(i=0; i<DROP_TABLE_MAX; i++)
@ -319,10 +314,7 @@ ClearDropInfo(proxy_handle)
/* get the window that has the atom associated with it */ /* get the window that has the atom associated with it */
Window Window
GetAtomWindow(dpy, win, atom) GetAtomWindow(Display *dpy, Window win, Atom atom)
Display *dpy;
Window win;
Atom atom;
{ {
Window root, parent; Window root, parent;
Window *children; Window *children;
@ -352,10 +344,7 @@ GetAtomWindow(dpy, win, atom)
/* get the window that is a property of the inputed window */ /* get the window that is a property of the inputed window */
Window Window
GetPropertyWindow(dpy, in_win, atom) GetPropertyWindow(Display *dpy, Window in_win, Atom atom)
Display *dpy;
Window in_win;
Atom atom;
{ {
Atom type; Atom type;
int format; int format;
@ -389,9 +378,7 @@ GetPropertyWindow(dpy, in_win, atom)
/* startup initialization */ /* startup initialization */
void void
ProxyInit(dpy, dsdm_win) ProxyInit(Display *dpy, Window dsdm_win)
Display *dpy;
Window dsdm_win;
{ {
enum { XA_MOTIF_DRAG_WINDOW, XA_MOTIF_DRAG_PROXY_WINDOW, enum { XA_MOTIF_DRAG_WINDOW, XA_MOTIF_DRAG_PROXY_WINDOW,
XA_MOTIF_DRAG_AND_DROP_MESSAGE, XA_MOTIF_DRAG_AND_DROP_MESSAGE,
@ -499,9 +486,7 @@ ProxyInit(dpy, dsdm_win)
/* Place the motif receiver property on the Openlook receiver's top /* Place the motif receiver property on the Openlook receiver's top
level window */ level window */
int int
AdvertiseMotifDropSite(dpy, win) AdvertiseMotifDropSite(Display *dpy, Window win)
Display *dpy;
Window win;
{ {
motif_receiver_t receiver_info; motif_receiver_t receiver_info;
unsigned long nitems; unsigned long nitems;
@ -546,9 +531,7 @@ AdvertiseMotifDropSite(dpy, win)
/* Determine if the drop coordinate is within a rectangle */ /* Determine if the drop coordinate is within a rectangle */
static char static char
InRect(drop_x, drop_y, x, y, width, height) InRect(int drop_x, int drop_y, int x, int y, unsigned int width, unsigned int height)
int drop_x, drop_y, x, y;
unsigned int width, height;
{ {
if ((drop_x >= x) && (drop_x <= (x+width)) && if ((drop_x >= x) && (drop_x <= (x+width)) &&
(drop_y >= y) && (drop_y <= (y+height))) (drop_y >= y) && (drop_y <= (y+height)))
@ -568,12 +551,8 @@ InRect(drop_x, drop_y, x, y, width, height)
/* get the drop site given the window and coordinate */ /* get the drop site given the window and coordinate */
static void static void
GetOlitDropSite(dpy, top_level_win, drop_x, drop_y, ret_site_id, ret_event_win) GetOlitDropSite(Display *dpy, Window top_level_win, INT16 drop_x, INT16 drop_y,
Display *dpy; unsigned long *ret_site_id, Window *ret_event_win)
Window top_level_win;
INT16 drop_x, drop_y;
unsigned long *ret_site_id;
Window *ret_event_win;
{ {
unsigned long *data, nitems, version, nsites, event_win, site_id, flags; unsigned long *data, nitems, version, nsites, event_win, site_id, flags;
unsigned long areatype, nrects, areawin; unsigned long areatype, nrects, areawin;
@ -659,8 +638,7 @@ GetOlitDropSite(dpy, top_level_win, drop_x, drop_y, ret_site_id, ret_event_win)
/* translate an OLIT operation to a Motif operation */ /* translate an OLIT operation to a Motif operation */
static CARD16 static CARD16
ConvertOlitAction(olit_action) ConvertOlitAction(CARD32 olit_action)
CARD32 olit_action;
{ {
CARD16 motif_action; CARD16 motif_action;
@ -676,8 +654,7 @@ ConvertOlitAction(olit_action)
/* translate a Motif operation to an OLIT operation */ /* translate a Motif operation to an OLIT operation */
static CARD32 static CARD32
ConvertMotifAction(motif_action) ConvertMotifAction(CARD16 motif_action)
CARD16 motif_action;
{ {
CARD32 olit_action; CARD32 olit_action;
@ -695,9 +672,7 @@ ConvertMotifAction(motif_action)
/* Process Motif ClientMessage */ /* Process Motif ClientMessage */
void void
HandleMotifMessage(dpy, event) HandleMotifMessage(Display *dpy, XClientMessageEvent *event)
Display *dpy;
XClientMessageEvent *event;
{ {
motif_drop_start_t info; motif_drop_start_t info;
drop_info_t *drop_info; drop_info_t *drop_info;
@ -791,9 +766,7 @@ HandleMotifMessage(dpy, event)
/* Process OLIT ClientMessage */ /* Process OLIT ClientMessage */
static void static void
HandleOlitTrigger(dpy, event) HandleOlitTrigger(Display *dpy, XClientMessageEvent *event)
Display *dpy;
XClientMessageEvent *event;
{ {
drop_site_t *site; drop_site_t *site;
char success = False; char success = False;
@ -852,11 +825,7 @@ HandleOlitTrigger(dpy, event)
/* Place the Motif initiator property on the initiator's top level window */ /* Place the Motif initiator property on the initiator's top level window */
static void static void
UpdateInitiatorAtom(dpy, win, channel, targets_index) UpdateInitiatorAtom(Display *dpy, Window win, Atom channel, CARD16 targets_index)
Display *dpy;
Window win;
Atom channel;
CARD16 targets_index;
{ {
motif_initiator_t initiator_info; motif_initiator_t initiator_info;
@ -877,10 +846,7 @@ UpdateInitiatorAtom(dpy, win, channel, targets_index)
/* Send Motif DROP_START ClientMessage to receiver */ /* Send Motif DROP_START ClientMessage to receiver */
void void
SendStartDrop(dpy, src_win, drop_info) SendStartDrop(Display *dpy, Window src_win, drop_info_t *drop_info)
Display *dpy;
Window src_win;
drop_info_t *drop_info;
{ {
motif_drop_start_t info; motif_drop_start_t info;
XClientMessageEvent event; XClientMessageEvent event;
@ -906,17 +872,17 @@ SendStartDrop(dpy, src_win, drop_info)
/* Compare data of type Atom */ /* Compare data of type Atom */
static int static int
AtomCompare(atom1, atom2) AtomCompare(const void *a1, const void *a2)
Atom *atom1, *atom2;
{ {
const Atom *atom1 = a1;
const Atom *atom2 = a2;
return(*atom1 - *atom2); return(*atom1 - *atom2);
} }
/* Get the Motif TARGETS */ /* Get the Motif TARGETS */
static void static void
GetTargetsList(dpy, targets_list_p) GetTargetsList(Display *dpy, motif_targets_t **targets_list_p)
Display *dpy;
motif_targets_t **targets_list_p;
{ {
motif_targets_t *targets_list; motif_targets_t *targets_list;
Atom type; Atom type;
@ -946,11 +912,7 @@ GetTargetsList(dpy, targets_list_p)
} }
static void static void
MatchTargets(targets_list, atoms, atom_cnt, targets_index_p) MatchTargets(motif_targets_t *targets_list, Atom *atoms, unsigned long atom_cnt, CARD16 *targets_index_p)
motif_targets_t *targets_list;
Atom *atoms;
unsigned long atom_cnt;
CARD16 *targets_index_p;
{ {
int target_index; int target_index;
CARD32 *data; CARD32 *data;
@ -989,11 +951,7 @@ MatchTargets(targets_list, atoms, atom_cnt, targets_index_p)
/* Put OLIT targets on the Motif TARGETS targets list */ /* Put OLIT targets on the Motif TARGETS targets list */
static void static void
GetTargetsIndex(dpy, in_data, atom_cnt, targets_index_p) GetTargetsIndex(Display *dpy, unsigned char *in_data, unsigned long atom_cnt, CARD16 *targets_index_p)
Display *dpy;
unsigned char *in_data;
unsigned long atom_cnt;
CARD16 *targets_index_p; /* RETURN */
{ {
Atom *atoms = (Atom *) in_data; Atom *atoms = (Atom *) in_data;
motif_targets_t *new_list, *targets_list; motif_targets_t *new_list, *targets_list;
@ -1056,11 +1014,7 @@ GetTargetsIndex(dpy, in_data, atom_cnt, targets_index_p)
* send DROP_START message to motif receiver * send DROP_START message to motif receiver
*/ */
static void static void
ContinueHandleOlitTrigger(dpy, data, length, drop_info) ContinueHandleOlitTrigger(Display *dpy, unsigned char *data, unsigned long length, drop_info_t *drop_info)
Display *dpy;
unsigned char *data;
unsigned long length;
drop_info_t *drop_info;
{ {
CARD16 targets_index; CARD16 targets_index;
Window psuedo_motif_initiator_win; Window psuedo_motif_initiator_win;
@ -1074,9 +1028,7 @@ ContinueHandleOlitTrigger(dpy, data, length, drop_info)
/* Get OLIT initiator's TARGETS */ /* Get OLIT initiator's TARGETS */
void void
ProcessOlitInitiatorConversion(event, drop_info) ProcessOlitInitiatorConversion(XSelectionEvent *event, drop_info_t *drop_info)
XSelectionEvent *event;
drop_info_t *drop_info;
{ {
Atom type; Atom type;
int format; int format;
@ -1114,10 +1066,7 @@ ProcessOlitInitiatorConversion(event, drop_info)
/* copy a property and the associated data from one window to another. /* copy a property and the associated data from one window to another.
Returns True if successful else returns False */ Returns True if successful else returns False */
static int static int
CopyProperty(dpy, property, old_win, new_win) CopyProperty(Display *dpy, Atom property, Window old_win, Window new_win)
Display *dpy;
Atom property;
Window old_win, new_win;
{ {
Atom type; Atom type;
int format; int format;
@ -1147,10 +1096,7 @@ CopyProperty(dpy, property, old_win, new_win)
from one window to another. from one window to another.
Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */ Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */
static int static int
CopyTargets(dpy, prop, old_win, new_win) CopyTargets(Display *dpy, Atom prop, Window old_win, Window new_win)
Display *dpy;
Atom prop;
Window old_win, new_win;
{ {
Atom type; Atom type;
int format; int format;
@ -1186,9 +1132,7 @@ CopyTargets(dpy, prop, old_win, new_win)
/* Forward the SelectionNotify to the receiver. /* Forward the SelectionNotify to the receiver.
Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */ Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */
static static
ForwardConversion(event, drop_info) ForwardConversion(XSelectionEvent *event, drop_info_t *drop_info)
XSelectionEvent *event;
drop_info_t *drop_info;
{ {
int ol_done = False; int ol_done = False;
@ -1254,9 +1198,7 @@ ForwardConversion(event, drop_info)
the target data and places this info in a property on window A. the target data and places this info in a property on window A.
*/ */
void void
ForwardMultpleSelectionRequest(event, drop_info) ForwardMultpleSelectionRequest(XSelectionRequestEvent *event, drop_info_t *drop_info)
XSelectionRequestEvent *event;
drop_info_t *drop_info;
{ {
int format, status; int format, status;
unsigned long length, bytes_after; unsigned long length, bytes_after;
@ -1285,10 +1227,7 @@ ForwardMultpleSelectionRequest(event, drop_info)
/* tell the initiator to clean up and do internal cleanup */ /* tell the initiator to clean up and do internal cleanup */
void void
DndDone(dpy, status, drop_info) DndDone(Display *dpy, Atom status, drop_info_t *drop_info)
Display *dpy;
Atom status;
drop_info_t *drop_info;
{ {
XConvertSelection(dpy, XConvertSelection(dpy,
drop_info->source_handle, drop_info->source_handle,
@ -1308,9 +1247,7 @@ DndDone(dpy, status, drop_info)
} }
void void
ProxyMain(dpy, event) ProxyMain(Display *dpy, XEvent *event)
Display *dpy;
XEvent *event;
{ {
switch(event->type) { switch(event->type) {
case ClientMessage: case ClientMessage:
@ -1478,7 +1415,7 @@ ProxyMain(dpy, event)
(event->xselection.property == ATOM_SUN_DND_ACK)) { (event->xselection.property == ATOM_SUN_DND_ACK)) {
ProcessOlitInitiatorConversion(&event->xselection, drop_info); ProcessOlitInitiatorConversion(&event->xselection, drop_info);
} else { } else {
if (ForwardConversion(event, drop_info)) { if (ForwardConversion(&event->xselection, drop_info)) {
/* We are here ONLY if the target is ATOM_MULTIPLE and /* We are here ONLY if the target is ATOM_MULTIPLE and
* the target list contains either _SUN_DRAGDROP_DONE or * the target list contains either _SUN_DRAGDROP_DONE or
@ -1490,3 +1427,4 @@ ProxyMain(dpy, event)
} /* end of case SelectionNotify */ } /* end of case SelectionNotify */
} /* end of switch */ } /* end of switch */
} }