diff --git a/.indent.pro b/.indent.pro index 39ed16d..6161a53 100644 --- a/.indent.pro +++ b/.indent.pro @@ -1 +1 @@ --i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80 +-i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -brs -l80 diff --git a/api/epplet.c b/api/epplet.c index 7b1fa98..91fdead 100644 --- a/api/epplet.c +++ b/api/epplet.c @@ -20,8 +20,7 @@ #define CRSR_WDTH 2 -typedef struct epplet_window -{ +typedef struct { Window win; int w; int h; @@ -29,8 +28,7 @@ typedef struct epplet_window Pixmap bg_pmap; Pixmap bg_mask; Pixmap bg_bg; -} -EppWindow; +} EppWindow; typedef EppWindow *Epplet_window; EAPI Display *disp = NULL; @@ -80,27 +78,27 @@ static void *event_data = NULL; static void *comms_data = NULL; static void *child_data = NULL; -static void (*expose_func) (void *data, Window win, int x, int y, int w, - int h) = NULL; -static void (*moveresize_func) (void *data, Window win, int x, int y, - int w, int h) = NULL; -static void (*buttonpress_func) (void *data, Window win, int x, int y, - int b) = NULL; -static void (*buttonrelease_func) (void *data, Window win, int x, int y, - int b) = NULL; -static void (*mousemotion_func) (void *data, Window win, int x, int y) = +static void (*expose_func)(void *data, Window win, int x, int y, int w, + int h) = NULL; +static void (*moveresize_func)(void *data, Window win, int x, int y, + int w, int h) = NULL; +static void (*buttonpress_func)(void *data, Window win, int x, int y, + int b) = NULL; +static void (*buttonrelease_func)(void *data, Window win, int x, int y, + int b) = NULL; +static void (*mousemotion_func)(void *data, Window win, int x, int y) = NULL; -static void (*keypress_func) (void *data, Window win, char *key) = NULL; -static void (*keyrelease_func) (void *data, Window win, char *key) = +static void (*keypress_func)(void *data, Window win, char *key) = NULL; +static void (*keyrelease_func)(void *data, Window win, char *key) = NULL; -static void (*enter_func) (void *data, Window win) = NULL; -static void (*leave_func) (void *data, Window win) = NULL; -static void (*focusin_func) (void *data, Window win) = NULL; -static void (*focusout_func) (void *data, Window win) = NULL; -static int (*delete_func) (void *data, Window win) = NULL; -static void (*event_func) (void *data, XEvent * ev) = NULL; -static void (*comms_func) (void *data, const char *s) = NULL; -static void (*child_func) (void *data, int pid, int exit_code) = NULL; +static void (*enter_func)(void *data, Window win) = NULL; +static void (*leave_func)(void *data, Window win) = NULL; +static void (*focusin_func)(void *data, Window win) = NULL; +static void (*focusout_func)(void *data, Window win) = NULL; +static int (*delete_func)(void *data, Window win) = NULL; +static void (*event_func)(void *data, XEvent * ev) = NULL; +static void (*comms_func)(void *data, const char *s) = NULL; +static void (*child_func)(void *data, int pid, int exit_code) = NULL; /* For Keeping a list of windows owned by the epplet, to loop through and * do stuff with. */ @@ -114,19 +112,17 @@ static Window Epplet_internal_create_window(int w, int h, static void remember_stuff(void *data); #define MWM_HINTS_DECORATIONS (1L << 1) -typedef struct _mwmhints -{ +typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long inputMode; unsigned long status; -} -MWMHints; -struct _etimer -{ +} MWMHints; + +struct _etimer { char *name; - void (*func) (void *data); + void (*func)(void *data); void *data; double in; char just_added; @@ -136,12 +132,10 @@ struct _etimer #define ESYNC ECommsSend("nop");free(ECommsWaitForMessage()); /* The structures for the config file management ... */ -typedef struct _configdict -{ +typedef struct { ConfigItem *entries; int num_entries; -} -ConfigDict; +} ConfigDict; static ConfigDict *config_dict = NULL; @@ -187,13 +181,11 @@ static void Epplet_textbox_textsize(Epplet_gadget gadget, int *w, int Epplet_textbox_spacesize(Epplet_gadget gadget); static void Epplet_find_instance(const char *name); -typedef struct gad_general -{ +typedef struct { GadType type; char visible; Epplet_window parent; -} -GadGeneral; +} GadGeneral; #define GADGET_GET_TYPE(gad) (((GadGeneral *) (gad))->type) #ifdef __GNUC__ @@ -222,8 +214,7 @@ GadGeneral; if (GADGET_GET_TYPE(gad) != (type)) return (rval);} while (0) #endif -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -234,14 +225,12 @@ typedef struct char pop; Epplet_gadget pop_parent; char *std; - void (*func) (void *data); + void (*func)(void *data); void *data; Pixmap pmap, mask; -} -GadButton; +} GadButton; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -251,14 +240,12 @@ typedef struct char *contents; char hilited; char size; - void (*func) (void *data); + void (*func)(void *data); void *data; Pixmap pmap, mask; -} -GadTextBox; +} GadTextBox; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -267,23 +254,19 @@ typedef struct char hilited; char clicked; int *val; - void (*func) (void *data); + void (*func)(void *data); void *data; Pixmap pmap, mask; -} -GadToggleButton; +} GadToggleButton; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; Window win_in; -} -GadDrawingArea; +} GadDrawingArea; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -292,14 +275,12 @@ typedef struct char hilited; char clicked; int *val; - void (*func) (void *data); + void (*func)(void *data); void *data; Window win_knob; -} -GadHSlider; +} GadHSlider; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -308,68 +289,55 @@ typedef struct char hilited; char clicked; int *val; - void (*func) (void *data); + void (*func)(void *data); void *data; Window win_knob; -} -GadVSlider; +} GadVSlider; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; int *val; char dir; Window win_in; -} -GadHBar; +} GadHBar; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; int *val; char dir; Window win_in; -} -GadVBar; +} GadVBar; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; int pw, ph; char *image; -} -GadImage; +} GadImage; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; char size; char *label; -} -GadLabel; +} GadLabel; -typedef struct -{ +typedef struct { char *label; char *image; int w, h; - void (*func) (void *data); + void (*func)(void *data); void *data; Epplet_gadget gadget; -} -GadPopEntry; +} GadPopEntry; -typedef struct _gadpopupbutton GadPopupButton; -typedef struct -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -377,11 +345,9 @@ typedef struct int entry_num; GadPopEntry *entry; char changed; -} -GadPopup; +} GadPopup; -struct _gadpopupbutton -{ +typedef struct { GadGeneral general; int x, y, w, h; Window win; @@ -393,7 +359,7 @@ struct _gadpopupbutton char popped; char *std; Pixmap pmap, mask; -}; +} GadPopupButton; #if DEBUG_EVENTS static int @@ -705,10 +671,10 @@ Epplet_create_window_borderless(int w, int h, const char *title, char vertical) Window Epplet_create_window_config(int w, int h, const char *title, - void (*ok_func) (void *data), - void *ok_data, void (*apply_func) (void *data), + void (*ok_func)(void *data), + void *ok_data, void(*apply_func)(void *data), void *apply_data, - void (*cancel_func) (void *data), void *cancel_data) + void(*cancel_func)(void *data), void *cancel_data) { Window ret; Epplet_gadget ok_btn, apply_btn, cancel_btn; @@ -1242,15 +1208,14 @@ Epplet_register_delete_event_handler(int (*func) } void -Epplet_register_event_handler(void (*func) - (void *data, XEvent * ev), void *data) +Epplet_register_event_handler(void (*func)(void *data, XEvent * ev), void *data) { event_data = data; event_func = func; } void -Epplet_register_comms_handler(void (*func) (void *data, const char *s), +Epplet_register_comms_handler(void (*func)(void *data, const char *s), void *data) { comms_data = data; @@ -1434,7 +1399,7 @@ Epplet_handle_event(XEvent * ev) } void -Epplet_timer(void (*func) (void *data), void *data, double in, +Epplet_timer(void (*func)(void *data), void *data, double in, const char *name) { ETimer *et, *ptr, *pptr; @@ -2017,7 +1982,6 @@ Epplet_del_gad(Epplet_gadget gadget) } } } - } int @@ -2064,7 +2028,7 @@ Epplet_gadget_get_type(Epplet_gadget gad) Epplet_gadget Epplet_create_textbox(const char *image, const char *contents, int x, int y, - int w, int h, char size, void (*func) (void *data), + int w, int h, char size, void (*func)(void *data), void *data) { GadTextBox *g; @@ -2650,7 +2614,7 @@ Epplet_gadget Epplet_create_button(const char *label, const char *image, int x, int y, int w, int h, const char *std, Window parent, Epplet_gadget pop_parent, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { GadButton *g; XSetWindowAttributes attr; @@ -2713,7 +2677,7 @@ Epplet_create_button(const char *label, const char *image, int x, int y, /* A cut down version for text-only buttons */ Epplet_gadget Epplet_create_text_button(const char *label, int x, int y, - int w, int h, void (*func) (void *data), void *data) + int w, int h, void (*func)(void *data), void *data) { return Epplet_create_button(label, NULL, x, y, w, h, NULL, 0, NULL, func, data); @@ -2722,7 +2686,7 @@ Epplet_create_text_button(const char *label, int x, int y, /* A cut down version for stdimage-only buttons */ Epplet_gadget Epplet_create_std_button(const char *std, int x, int y, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { return Epplet_create_button(NULL, NULL, x, y, 12, 12, std, 0, NULL, func, data); @@ -2731,7 +2695,7 @@ Epplet_create_std_button(const char *std, int x, int y, /* A cut down version for image-only buttons */ Epplet_gadget Epplet_create_image_button(const char *image, int x, int y, - int w, int h, void (*func) (void *data), void *data) + int w, int h, void (*func)(void *data), void *data) { return Epplet_create_button(NULL, image, x, y, w, h, NULL, 0, NULL, func, data); @@ -2883,7 +2847,7 @@ Epplet_draw_button(Epplet_gadget eg) Epplet_gadget Epplet_create_togglebutton(const char *label, const char *image, int x, int y, int w, int h, int *val, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { GadToggleButton *g; XSetWindowAttributes attr; @@ -3074,7 +3038,7 @@ Epplet_draw_drawingarea(Epplet_gadget eg) Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min, int max, int step, int jump, int *val, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { GadHSlider *g; XSetWindowAttributes attr; @@ -3153,7 +3117,7 @@ Epplet_draw_hslider(Epplet_gadget eg) Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min, int max, int step, int jump, int *val, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { GadVSlider *g; XSetWindowAttributes attr; @@ -3572,8 +3536,7 @@ Epplet_create_popup(void) void Epplet_add_popup_entry(Epplet_gadget gadget, const char *label, - const char *pixmap, void (*func) (void *data), - void *data) + const char *pixmap, void (*func)(void *data), void *data) { Epplet_add_sized_popup_entry(gadget, label, pixmap, -1, -1, func, data); } @@ -3581,7 +3544,7 @@ Epplet_add_popup_entry(Epplet_gadget gadget, const char *label, void Epplet_add_sized_popup_entry(Epplet_gadget gadget, const char *label, const char *pixmap, int w, int h, - void (*func) (void *data), void *data) + void (*func)(void *data), void *data) { GadPopup *g; @@ -5647,7 +5610,6 @@ Epplet_load_config_file(const char *file) Epplet_add_config(s2, s3); } fclose(f); - return; } void @@ -5664,7 +5626,6 @@ Epplet_load_config(void) epplet_cfg_file = strdup(s); Epplet_load_config_file(epplet_cfg_file); - return; } void diff --git a/api/epplet.h.in b/api/epplet.h.in index 6d2141d..a55e6d2 100644 --- a/api/epplet.h.in +++ b/api/epplet.h.in @@ -43,20 +43,17 @@ /****************************************************************************/ typedef struct _etimer ETimer; typedef void *Epplet_gadget; -typedef struct _rgb_buf -{ - Imlib_Image *im; -} - *RGB_buf; -typedef struct _configitem -{ +typedef struct { + Imlib_Image *im; +} *RGB_buf; + +typedef struct { char *key; char *value; -} -ConfigItem; -typedef enum gad_type -{ +} ConfigItem; + +typedef enum { E_BUTTON, E_DRAWINGAREA, E_TEXTBOX, @@ -258,7 +255,7 @@ EAPI void Epplet_register_delete_event_handler(int (*func) /* run function func and pass data data to it in in seconds (in is double */ /* so you can for exmaple use 0.5 to have that function called in 0.5 */ /* seconds from now ). You also attach the name to the timeout of name */ -EAPI void Epplet_timer(void (*func) (void *data), void *data, +EAPI void Epplet_timer(void (*func)(void *data), void *data, double in, const char *name); /* delete any timeout of name name in the queue. you should use unique */ @@ -289,23 +286,23 @@ EAPI Epplet_gadget Epplet_create_button(const char *label, const char *image, int x, int y, int w, int h, const char *std, Window parent, Epplet_gadget pop_parent, - void (*func) (void *data), void *data); + void (*func)(void *data), void *data); /* A cut down version for text-only buttons */ EAPI Epplet_gadget Epplet_create_text_button(const char *label, int x, int y, int w, int h, - void (*func) (void *data), + void (*func)(void *data), void *data); /* A cut down version for std-image-only buttons */ EAPI Epplet_gadget Epplet_create_std_button(const char *std, int x, int y, - void (*func) (void *data), + void (*func)(void *data), void *data); /* A cut down version for image-only buttons */ EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y, int w, int h, - void (*func) (void *data), + void (*func)(void *data), void *data); /* create a textbox at coordinates (x, y), with 'image' as bg, 'contents' as @@ -315,8 +312,7 @@ EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y, EAPI Epplet_gadget Epplet_create_textbox(const char *image, const char *contents, int x, int y, int w, int h, char size, - void (*func) (void *data), - void *data); + void (*func)(void *data), void *data); /* Retrieve the current contents of the textbox */ EAPI const char *Epplet_textbox_contents(Epplet_gadget g); @@ -340,14 +336,12 @@ EAPI Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h); /* either side of the slider. whenever the slider changed func is called */ EAPI Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min, int max, int step, int jump, int *val, - void (*func) (void *data), - void *data); + void (*func)(void *data), void *data); /* same as horizontal slider except vertical */ EAPI Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min, int max, int step, int jump, int *val, - void (*func) (void *data), - void *data); + void (*func)(void *data), void *data); /* create a button (like normal buttons) except it toggles the value */ /* pointed to by val between 1 and 0. func is called whenever it changes */ @@ -355,7 +349,7 @@ EAPI Epplet_gadget Epplet_create_togglebutton(const char *label, const char *image, int x, int y, int w, int h, int *val, - void (*func) (void *data), + void (*func)(void *data), void *data); /* creates a button just like normal button except it pops up the popup */ @@ -374,14 +368,14 @@ EAPI Epplet_gadget Epplet_create_popup(void); EAPI void Epplet_add_popup_entry(Epplet_gadget gadget, const char *label, const char *pixmap, - void (*func) (void *data), + void (*func)(void *data), void *data); /* same as above, but specify a size */ EAPI void Epplet_add_sized_popup_entry(Epplet_gadget gadget, const char *label, const char *pixmap, int w, int h, - void (*func) (void *data), + void (*func)(void *data), void *data); /* remove an entry from a popup gadget */ @@ -501,12 +495,11 @@ EAPI Window Epplet_create_window_borderless(int w, int h, * functions as null, the button won't be displayed. This means you can get * just Ok and Cancel by supplying NULL for apply_cb. */ EAPI Window Epplet_create_window_config(int w, int h, const char *title, - void (*ok_func) (void *data), + void (*ok_func)(void *data), void *ok_data, - void (*apply_func) (void *data), + void (*apply_func)(void *data), void *apply_data, - void (*cancel_func) (void - *data), + void (*cancel_func)(void *data), void *cancel_data); /* This is how you add gadgets to specific windows. When you create a diff --git a/epplets/CalcEphem.c b/epplets/CalcEphem.c index 1cad6f2..cc13d87 100644 --- a/epplets/CalcEphem.c +++ b/epplets/CalcEphem.c @@ -222,7 +222,6 @@ CalcEphem(date, UT, c) * Compute Earth-Moon distance */ c->EarthMoonDistance = R; - } static double @@ -286,7 +285,6 @@ jd(ny, nm, nd, UT) JD = B + C + D + day + 1720994.5; return (JD); - } static double @@ -364,7 +362,6 @@ Radec_to_Cart(ra, dec, r) double ra, dec; /* RA and DEC */ Vector *r; /* returns corresponding cartesian unit vector */ { - /* * Convert ra/dec from degrees to radians */ @@ -377,7 +374,6 @@ Radec_to_Cart(ra, dec, r) r->x = cos(dec) * cos(ra); r->y = cos(dec) * sin(ra); r->z = sin(dec); - } int diff --git a/epplets/CalcEphem.h b/epplets/CalcEphem.h index c84f4f0..07c94ce 100644 --- a/epplets/CalcEphem.h +++ b/epplets/CalcEphem.h @@ -7,22 +7,19 @@ #define FALSE 0 #define TRUE 1 -typedef struct Vector -{ +typedef struct { double x; double y; double z; } Vector; -typedef struct Position -{ +typedef struct { double x; double y; double z; } Position; -typedef struct CTrans -{ +typedef struct { double UT; /* Universal Time (in decimal hours) */ int year; /* 2 digit year */ int month; /* 2 digit month of year */ diff --git a/epplets/E-Areas.c b/epplets/E-Areas.c index 1d234a7..a800b59 100644 --- a/epplets/E-Areas.c +++ b/epplets/E-Areas.c @@ -54,7 +54,7 @@ out_cb(void *data __UNUSED__, Window w) static Epplet_gadget epp_create_std_button(int x, int y, const char *std, - void (*func) (void *data), const void *data) + void (*func)(void *data), const void *data) { return Epplet_create_button(NULL, NULL, x, y, 0, 0, std, 0, NULL, func, (void *)data); diff --git a/epplets/E-Biff.c b/epplets/E-Biff.c index 3dca708..b309721 100644 --- a/epplets/E-Biff.c +++ b/epplets/E-Biff.c @@ -276,7 +276,6 @@ apply_config(void) Epplet_modify_config("show_total", buff); display_count(); } - } static void diff --git a/epplets/E-Exec.c b/epplets/E-Exec.c index 838fc9c..2966290 100644 --- a/epplets/E-Exec.c +++ b/epplets/E-Exec.c @@ -156,7 +156,6 @@ empty_popup(void) Epplet_modify_multi_config("Command", command_history, num_commands); Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL); - return; } static void @@ -180,7 +179,6 @@ fill_popup(void) Epplet_add_popup_entry(history_popup, "-Empty-", NULL, NULL, NULL); free(results); - return; } static void diff --git a/epplets/E-Mountbox.c b/epplets/E-Mountbox.c index 9272869..c03d00c 100644 --- a/epplets/E-Mountbox.c +++ b/epplets/E-Mountbox.c @@ -29,21 +29,14 @@ #define __BG_IMAGE "E-Mountbox-bg.png" #define __DEFAULT "E-Mountbox-blockdev.png" -static struct -{ +static struct { const char *key, *value; -} defaults[] = -{ - { - "BG_IMAGE", "E-Mountbox-bg.png"}, - { - "DEFAULT", "E-Mountbox-blockdev.png"}, - { - "EJECT_MODE", "2"}, - { - "DO_POLL", "1"}, - { - "POLLINTVAL", "5"} +} defaults[] = { + {"BG_IMAGE", "E-Mountbox-bg.png"}, + {"DEFAULT", "E-Mountbox-blockdev.png"}, + {"EJECT_MODE", "2"}, + {"DO_POLL", "1"}, + {"POLLINTVAL", "5"} }; static const char *default_types[] = { @@ -53,29 +46,24 @@ static const char *default_types[] = { "jazz E-Mountbox-jazz.png" }; -typedef enum eject_mode -{ +typedef enum { NO_EJECT, MANUAL_EJECT, AUTO_EJECT -} -EjectMode; +} EjectMode; typedef struct _tile Tile; typedef struct _mountpointtype MountPointType; -typedef struct _mode Mode; -struct _mode -{ +typedef struct { EjectMode eject_mode; int do_polling; int polling_interval; int anim_mount; int show_buttons; -}; +} Mode; -struct _mountpointtype -{ +struct _mountpointtype { char *key; char *imagefile; Imlib_Image *image; @@ -83,16 +71,13 @@ struct _mountpointtype MountPointType *prev; }; -typedef struct _mountpoint -{ +typedef struct { char *device; char *path; char mounted; -} -MountPoint; +} MountPoint; -struct _tile -{ +struct _tile { Imlib_Image *image; MountPoint *mountpoint; Tile *prev; @@ -770,7 +755,6 @@ IsTransparent(Imlib_Image * im, int x, int y) static void SetupMounts(void) { - /* first, parse /etc/fstab to see what user-mountable mountpoints we have */ if (!(ParseFstab())) { @@ -969,7 +953,6 @@ static void ModifyMountPointType(MountPointType * mpt, const char *key, const char *imagefile) { - if (mpt) { if (key) diff --git a/epplets/E-PlayCD.c b/epplets/E-PlayCD.c index 0ee0ab9..d0128f0 100644 --- a/epplets/E-PlayCD.c +++ b/epplets/E-PlayCD.c @@ -87,7 +87,7 @@ scroll_cddb_label(void *data) Epplet_change_label(cddb_label, temp); temp[MAX_LBL_LEN] = saved_char; saved_char = temp[0]; - memcpy(data, temp + 1, (size_t) length); + memcpy(data, temp + 1, (size_t)length); temp[length - 1] = saved_char; } @@ -409,7 +409,7 @@ update_cddb_tracks(void) free(tracks); - tracks = (int *)calloc((size_t) DiscInfo.disc_total_tracks, sizeof(int)); + tracks = (int *)calloc((size_t)DiscInfo.disc_total_tracks, sizeof(int)); /* Causes segfault... * if(tracks_popup != NULL) @@ -439,7 +439,7 @@ fake_cddb_tracks(void) free(tracks); - tracks = (int *)calloc((size_t) DiscInfo.disc_total_tracks, sizeof(int)); + tracks = (int *)calloc((size_t)DiscInfo.disc_total_tracks, sizeof(int)); tracks_popup = Epplet_create_popup(); @@ -524,7 +524,7 @@ main(int argc, char **argv) "EJECT" }; int i; - typedef void (*callback_func) (void *data); + typedef void (*callback_func)(void *data); callback_func button_funcs[] = { cb_close, play_cd, stop_cd, prev_track, next_track, diff --git a/epplets/E-Power.c b/epplets/E-Power.c index c6467a1..0652fa2 100644 --- a/epplets/E-Power.c +++ b/epplets/E-Power.c @@ -7,8 +7,7 @@ Added ACPI power management support. */ -typedef struct -{ +typedef struct { char design_cap_unknown; char last_full_unknown; char rate_unknown; diff --git a/epplets/E-SD.c b/epplets/E-SD.c index c62bf37..27134e9 100644 --- a/epplets/E-SD.c +++ b/epplets/E-SD.c @@ -44,8 +44,7 @@ static const int cloak_delays[] = { 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120 }; -struct -{ +struct { int fd; int vol_l; int vol_r; @@ -55,15 +54,13 @@ struct static Epplet_gadget lbar, rbar, standby; -struct -{ +struct { int cloak_anim; int do_cloak; double cloak_delay; double draw_interval; char *dir; -} -opt; +} opt; /* RATE is sample rate (samples/sec) */ #define BUFS 8 /* number of audio buffers (lag compensation) */ @@ -441,7 +438,6 @@ standby_cb(void *data __UNUSED__) static void create_epplet_layout(void) { - Epplet_gadget_show(btn_close = Epplet_create_button(NULL, NULL, 2, 2, 0, 0, "CLOSE", 0, NULL, cb_close, diff --git a/epplets/E-ScreenSave.c b/epplets/E-ScreenSave.c index db293c2..0bdd0ef 100644 --- a/epplets/E-ScreenSave.c +++ b/epplets/E-ScreenSave.c @@ -43,8 +43,7 @@ static int save_delays[] = { 0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120, 300, 600 }; -struct -{ +struct { int quality; int win; int beep; @@ -63,8 +62,7 @@ struct char *file_type; char *script; char *lock_cmd; -} -opt; +} opt; static Window confwin = 0; static Epplet_gadget txt; diff --git a/epplets/E-ScreenShoot.c b/epplets/E-ScreenShoot.c index 1679839..17be89c 100644 --- a/epplets/E-ScreenShoot.c +++ b/epplets/E-ScreenShoot.c @@ -48,8 +48,7 @@ static const int shot_delays[] = { 0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120 }; -struct -{ +struct { int quality; int win; int beep; @@ -78,8 +77,7 @@ struct char *ftp_temp; char *ftp_dir; char *grabber; -} -opt; +} opt; static Window confwin = 0; static Epplet_gadget txt_file_prefix; @@ -506,8 +504,6 @@ apply_config(void) if (opt.ftp_temp) free(opt.ftp_temp); opt.ftp_temp = _Strdup(Epplet_textbox_contents(txt_ftp_temp)); - - return; } static void diff --git a/epplets/E-ScreenShoot_ftp.c b/epplets/E-ScreenShoot_ftp.c index 15f76d6..377e7ee 100644 --- a/epplets/E-ScreenShoot_ftp.c +++ b/epplets/E-ScreenShoot_ftp.c @@ -99,7 +99,6 @@ ftp_init(int passive) ftp_send(1, "pass"); ftp_recv(); } - return; } void diff --git a/epplets/E-Toolbox.c b/epplets/E-Toolbox.c index 4185be9..c518181 100644 --- a/epplets/E-Toolbox.c +++ b/epplets/E-Toolbox.c @@ -37,8 +37,7 @@ #define BEGMATCH(a, b) (!strncasecmp((a), (b), (sizeof(b) - 1))) #define NONULL(x) ((x) ? (x) : ("")) -typedef struct toolbutton_struct -{ +typedef struct { Epplet_gadget gad; char *label, *image; unsigned short x, y, w, h; @@ -46,8 +45,7 @@ typedef struct toolbutton_struct char *prog; } toolbutton_t; -typedef struct tool_config_struct -{ +typedef struct { Epplet_gadget cfg_tb_prog, cfg_tb_label, cfg_tb_image, cfg_tb_x, cfg_tb_y, cfg_tb_w, cfg_tb_h, cfg_tb_popup; } tool_config_t; @@ -395,7 +393,6 @@ config_cb(void *data __UNUSED__) for (i = 0, y = 20, x = 4; i < button_cnt; i++, y += 30, x = 4) { - cfg_gads[i].cfg_tb_prog = Epplet_create_textbox(NULL, buttons[i].prog, x, y, 90, 20, 2, NULL, NULL); diff --git a/epplets/E-UrlWatch.c b/epplets/E-UrlWatch.c index 06a44ef..11843bf 100644 --- a/epplets/E-UrlWatch.c +++ b/epplets/E-UrlWatch.c @@ -36,15 +36,13 @@ static char *urllist[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; static int num_urls = 0; -struct -{ +struct { char *str; unsigned int len; unsigned int pos; } dtext; -struct -{ +struct { int win; int save_urls; int check_url_file; @@ -56,8 +54,7 @@ struct char *www_command; char *ftp_command; char *get_command; -} -opt; +} opt; static Window confwin = 0; static Epplet_gadget txt_new_url_command; @@ -184,8 +181,6 @@ apply_config(void) opt.get_command = _Strdup(Epplet_textbox_contents(txt_get_command)); if (opt.check_url_file) Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER"); - - return; } static void diff --git a/epplets/E-Wireless.c b/epplets/E-Wireless.c index 794f8da..34d7d2f 100644 --- a/epplets/E-Wireless.c +++ b/epplets/E-Wireless.c @@ -141,7 +141,6 @@ cb_timer(void *data __UNUSED__) fpStat = fopen("/proc/net/wireless", "r"); if (fpStat) { - fgets(s, sizeof(s), fpStat); fgets(s, sizeof(s), fpStat); fgets(s, sizeof(s), fpStat); diff --git a/epplets/Emix.c b/epplets/Emix.c index dfe0b37..5fc8937 100644 --- a/epplets/Emix.c +++ b/epplets/Emix.c @@ -21,8 +21,7 @@ static Epplet_gadget vs_master, vs_pcm, vs_lin, vs_cda, b_close, b_help; #define debug #endif -typedef struct _MIX_CHANNEL -{ +typedef struct { int id; int value; } MIX_CHANNEL; diff --git a/epplets/Moon.c b/epplets/Moon.c index 0ce420e..c247c89 100644 --- a/epplets/Moon.c +++ b/epplets/Moon.c @@ -317,7 +317,6 @@ printf("Diff = %f\n", 360.0*frac((D+(DLAM-DLAMS)/ARC)/TwoPi)); return( 0.5*(1.0 - cos(D+(DLAM-DLAMS)/ARC)) ); */ return (*AGE / 29.530589); - } static double @@ -397,7 +396,6 @@ NewMoon(double ax, double bx, double cx) int MiniMoon(double T, double *RA, double *DEC) { - double L0, L, LS, F, D, H, S, N, DL, CB, L_MOON, B_MOON, V, W, X, Y, Z, RHO; double cosEPS, sinEPS, P2, ARC; diff --git a/epplets/TestEpplet.c b/epplets/TestEpplet.c index 94fa125..62580dc 100644 --- a/epplets/TestEpplet.c +++ b/epplets/TestEpplet.c @@ -9,7 +9,6 @@ static Epplet_gadget prog1, prog2, prog3, prog4, tog, sl1, sl2, da, im; static void cb_timer(void *data __UNUSED__) { - val3++; if (val3 > 100) val3 = 0; diff --git a/epplets/cloak.c b/epplets/cloak.c index 321c9d2..b3774a9 100644 --- a/epplets/cloak.c +++ b/epplets/cloak.c @@ -1398,7 +1398,6 @@ draw_text(void) { for (i = y; i < (y + 19); i++) { - if (x == 1) c = xpm1[i - y][j]; else if (x == 2) diff --git a/epplets/esdcloak.c b/epplets/esdcloak.c index 8ddf69e..9551b14 100644 --- a/epplets/esdcloak.c +++ b/epplets/esdcloak.c @@ -910,7 +910,6 @@ draw_text(void) } else { - for (i = y; i < (y + 19); i++) { switch (enlighten[i - y][j]) diff --git a/epplets/mbox.c b/epplets/mbox.c index 9c906be..bbaff1e 100644 --- a/epplets/mbox.c +++ b/epplets/mbox.c @@ -121,7 +121,7 @@ safe_realloc(void **p, size_t siz) * increased if more space is required to fit the whole line. */ static char * -read_rfc822_line(FILE * f, char *line, size_t * linelen) +read_rfc822_line(FILE * f, char *line, size_t *linelen) { char *buf = line; char ch; @@ -253,7 +253,7 @@ is_from(const char *s, char *path, size_t pathlen) } if (path) { - len = (size_t) (p - s); + len = (size_t)(p - s); if (len + 1 > pathlen) len = pathlen - 1; memcpy(path, s, len); @@ -427,8 +427,7 @@ mbox_folder_count(char *path, int force) file_mtime = 0; return 0; } - if (!force && ((size_t) s.st_size == file_size) - && (s.st_mtime == file_mtime)) + if (!force && ((size_t)s.st_size == file_size) && (s.st_mtime == file_mtime)) { D((" -> Mailbox unchanged.\n")); return 0; diff --git a/epplets/net.c b/epplets/net.c index 47a9501..9474e0f 100644 --- a/epplets/net.c +++ b/epplets/net.c @@ -40,7 +40,6 @@ char ** net_get_devices(unsigned long *count) { - FILE *fp; char buff[256], **names = NULL, *s; unsigned long i; @@ -81,13 +80,11 @@ net_get_devices(unsigned long *count) #else return ((char **)NULL); #endif - } unsigned char net_get_bytes_inout(const char *device, double *in_bytes, double *out_bytes) { - #ifdef __sun__ kstat_ctl_t *kc; kstat_t *ksp; @@ -180,7 +177,6 @@ net_get_bytes_inout(const char *device, double *in_bytes, double *out_bytes) const char * net_strerror(unsigned char code) { - switch (code) { case 0: @@ -210,7 +206,6 @@ net_strerror(unsigned char code) double net_get_bytes_in(const char *device) { - double in_bytes = -1.0; net_get_bytes_inout(device, &in_bytes, (double *)NULL); @@ -220,7 +215,6 @@ net_get_bytes_in(const char *device) double net_get_bytes_out(const char *device) { - double out_bytes = -1.0; net_get_bytes_inout(device, (double *)NULL, &out_bytes); diff --git a/epplets/proc.h b/epplets/proc.h index c332278..2a8d082 100644 --- a/epplets/proc.h +++ b/epplets/proc.h @@ -22,17 +22,14 @@ #define PROC_MEM_SIZE 6 #define PROC_SWAP_SIZE 3 -typedef struct _ProcInfo ProcInfo; - -struct _ProcInfo -{ +typedef struct { unsigned cpu[PROC_CPU_SIZE]; unsigned cpu_now[PROC_CPU_SIZE]; unsigned cpu_last[PROC_CPU_SIZE]; unsigned mem[PROC_MEM_SIZE]; unsigned swap[PROC_SWAP_SIZE]; -}; +} ProcInfo; void proc_read_cpu(ProcInfo *); void proc_read_mem(ProcInfo *);