Re-ran indent on .c files

Also, added a few places where indent is disabled
(via `/* *INDENT-OFF* */`).

See https://sourceforge.net/p/tuxpaint/mailman/message/36077409/
from Oct. 2017.
This commit is contained in:
Bill Kendrick 2019-04-13 12:00:44 -07:00
parent 99b566ae26
commit 4e3a9fbc8c
7 changed files with 184 additions and 148 deletions

View file

@ -979,7 +979,9 @@ static void mysetenv(const char *name, const char *value)
* @param loc Locale * @param loc Locale
* @return The Y-nudge value for font rendering in the language. * @return The Y-nudge value for font rendering in the language.
*/ */
/* *INDENT-OFF* */
static int set_current_language(const char *restrict locale_choice) MUST_CHECK; static int set_current_language(const char *restrict locale_choice) MUST_CHECK;
/* *INDENT-ON* */
static int set_current_language(const char *restrict loc) static int set_current_language(const char *restrict loc)
{ {

View file

@ -16,13 +16,16 @@ const char* macos_fontsPath()
{ {
static char *p = NULL; static char *p = NULL;
if(!p) { if (!p)
{
const char *home = getenv("HOME"); const char *home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1); p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
if(p) sprintf(p, MACOS_FONTS_PATH, getenv("HOME")); if (p)
else perror("macos_fontsPath"); sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
else
perror("macos_fontsPath");
} }
return p; return p;
@ -36,13 +39,16 @@ const char* macos_preferencesPath()
{ {
static char *p = NULL; static char *p = NULL;
if(!p) { if (!p)
{
const char *home = getenv("HOME"); const char *home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1); p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
if(p) sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME")); if (p)
else perror("macos_preferencesPath"); sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
else
perror("macos_preferencesPath");
} }
return p; return p;

View file

@ -55,7 +55,8 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
if (!mute && use_sound && s != SND_NONE) if (!mute && use_sound && s != SND_NONE)
{ {
#ifdef DEBUG #ifdef DEBUG
printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ", sounds[s]); printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ",
sounds[s]);
fflush(stdout); fflush(stdout);
#endif #endif
if (override || !Mix_Playing(chan)) if (override || !Mix_Playing(chan))

View file

@ -306,8 +306,10 @@ int do_ps_save(FILE * fi,
child_pid = pclose(fi); child_pid = pclose(fi);
#ifdef DEBUG #ifdef DEBUG
printf("pclose returned %d\n", child_pid); fflush(stdout); printf("pclose returned %d\n", child_pid);
printf("errno = %d\n", errno); fflush(stdout); fflush(stdout);
printf("errno = %d\n", errno);
fflush(stdout);
#endif #endif
if (child_pid < 0 || (errno != 0 && errno != EAGAIN)) if (child_pid < 0 || (errno != 0 && errno != EAGAIN))
@ -324,14 +326,25 @@ int do_ps_save(FILE * fi,
w = waitpid(child_pid, &status, 0); w = waitpid(child_pid, &status, 0);
#ifdef DEBUG #ifdef DEBUG
if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); } if (w == -1)
if (WIFEXITED(status)) { {
perror("waitpid");
exit(EXIT_FAILURE);
}
if (WIFEXITED(status))
{
printf("exited, status=%d\n", WEXITSTATUS(status)); printf("exited, status=%d\n", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) { }
else if (WIFSIGNALED(status))
{
printf("killed by signal %d\n", WTERMSIG(status)); printf("killed by signal %d\n", WTERMSIG(status));
} else if (WIFSTOPPED(status)) { }
else if (WIFSTOPPED(status))
{
printf("stopped by signal %d\n", WSTOPSIG(status)); printf("stopped by signal %d\n", WSTOPSIG(status));
} else if (WIFCONTINUED(status)) { }
else if (WIFCONTINUED(status))
{
printf("continued\n"); printf("continued\n");
} }
#endif #endif

View file

@ -1960,7 +1960,8 @@ static void get_new_file_id(void);
static int do_quit(int tool); static int do_quit(int tool);
static int do_open(void); static int do_open(void);
static int do_new_dialog(void); static int do_new_dialog(void);
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette); static int do_new_dialog_add_colors(SDL_Surface * *thumbs, int num_files, int *d_places, char * *d_names,
char * *d_exts, int *white_in_palette);
static int do_color_picker(void); static int do_color_picker(void);
static int do_color_sel(void); static int do_color_sel(void);
static int do_slideshow(void); static int do_slideshow(void);
@ -3546,11 +3547,9 @@ static void mainloop(void)
old_size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size; old_size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size;
stamp_data[stamp_group][cur_stamp[stamp_group]]->size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size =
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE + (((MAX_STAMP_SIZE - MIN_STAMP_SIZE + 1
1
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */ /* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
) * (event.button.x - ) * (event.button.x - (WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
#ifdef DEBUG #ifdef DEBUG
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice, printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
@ -5362,12 +5361,11 @@ static void mainloop(void)
w = CUR_STAMP_W; w = CUR_STAMP_W;
h = CUR_STAMP_H; h = CUR_STAMP_H;
stamp_data[stamp_group][cur_stamp[stamp_group]]->size = stamp_data[stamp_group][cur_stamp[stamp_group]]->size = (((MAX_STAMP_SIZE - MIN_STAMP_SIZE + 1
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE +
1
/* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */ /* +1 to address lack of ability to get back to max default stamp size (SF Bug #1668235 -bjk 2011.01.08) */
) * (event.button.x - ) * (event.button.x -
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE; (WINDOW_WIDTH - 96))) / 96) +
MIN_STAMP_SIZE;
#ifdef DEBUG #ifdef DEBUG
printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice, printf("Old size = %d, Chose %0.4f, New size =%d\n", old_size, choice,
@ -6399,6 +6397,7 @@ void show_usage(int exitcode)
{ {
FILE *f = exitcode ? stderr : stdout; FILE *f = exitcode ? stderr : stdout;
/* *INDENT-OFF* */
fprintf(f, fprintf(f,
"\n" "\n"
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n" "Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
@ -6483,6 +6482,7 @@ void show_usage(int exitcode)
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */ /* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
"\n", "\n",
progname); progname);
/* *INDENT-ON* */
} }
@ -7542,7 +7542,8 @@ static void loadstamp_callback(SDL_Surface * screen,
* Showing the progress bar across the screen can be CPU-intensive, so * Showing the progress bar across the screen can be CPU-intensive, so
* update infrequently. * update infrequently.
*/ */
if((i % 32) == 0) show_progress_bar(screen); if ((i % 32) == 0)
show_progress_bar(screen);
if (dotext > files[i].str && !strcasecmp(dotext, ext) if (dotext > files[i].str && !strcasecmp(dotext, ext)
&& (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname)) && (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname))
@ -7736,12 +7737,16 @@ static int generate_fontconfig_cache(void *vp)
static void signal_handler(int sig) static void signal_handler(int sig)
{ {
// It is not legal to call printf or most other functions here! // It is not legal to call printf or most other functions here!
if (sig == SIGUSR1 || sig == SIGUSR2) { if (sig == SIGUSR1 || sig == SIGUSR2)
{
autosave_on_quit = 1; autosave_on_quit = 1;
no_prompt_on_quit = 1; no_prompt_on_quit = 1;
if (sig == SIGUSR1) { if (sig == SIGUSR1)
{
promptless_save = SAVE_OVER_NO; promptless_save = SAVE_OVER_NO;
} else { }
else
{
promptless_save = SAVE_OVER_ALWAYS; promptless_save = SAVE_OVER_ALWAYS;
} }
raise(SIGTERM); raise(SIGTERM);
@ -11885,11 +11890,13 @@ static int do_prompt_image_flash_snd(const char *const text,
int valhat_x, valhat_y, hatmotioner; int valhat_x, valhat_y, hatmotioner;
#ifdef DEBUG #ifdef DEBUG
if(snd >= 0) { if (snd >= 0)
{
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]); printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
fflush(stdout); fflush(stdout);
} }
else { else
{
printf("Prompt without sound\n"); printf("Prompt without sound\n");
fflush(stdout); fflush(stdout);
} }
@ -18716,7 +18723,8 @@ static int do_new_dialog(void)
white_in_palette = -1; white_in_palette = -1;
if (!new_colors_last) { if (!new_colors_last)
{
first_color = 0; first_color = 0;
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette); num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
} }
@ -19024,7 +19032,8 @@ static int do_new_dialog(void)
/* Throw the color palette at the end (alternative option): */ /* Throw the color palette at the end (alternative option): */
if (new_colors_last) { if (new_colors_last)
{
first_color = num_files; first_color = num_files;
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette); num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
} }
@ -19033,7 +19042,8 @@ static int do_new_dialog(void)
#ifdef DEBUG #ifdef DEBUG
printf("%d files and colors were found!\n", num_files); printf("%d files and colors were found!\n", num_files);
#endif #endif
printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter, first_template, num_files); printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter,
first_template, num_files);
/* Let user choose a color or image: */ /* Let user choose a color or image: */
@ -19477,7 +19487,8 @@ static int do_new_dialog(void)
label_node_to_edit = NULL; label_node_to_edit = NULL;
have_to_rec_label_node = FALSE; have_to_rec_label_node = FALSE;
if (which >= first_starter && (first_template == -1 || which < first_template) && (!new_colors_last || which < first_color)) if (which >= first_starter && (first_template == -1 || which < first_template)
&& (!new_colors_last || which < first_color))
{ {
/* Load a starter: */ /* Load a starter: */
@ -19682,7 +19693,9 @@ static int do_new_dialog(void)
normally appears at the beginning (above Starts & Templates), normally appears at the beginning (above Starts & Templates),
but may be placed at the end with the "--newcolorslast" option. but may be placed at the end with the "--newcolorslast" option.
*/ */
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette) { static int do_new_dialog_add_colors(SDL_Surface * *thumbs, int num_files, int *d_places, char * *d_names,
char * *d_exts, int *white_in_palette)
{
int j; int j;
int added; int added;
Uint8 r, g, b; Uint8 r, g, b;
@ -22435,6 +22448,7 @@ static void setup_config(char *argv[])
savedir = strdup(macos_preferencesPath()); savedir = strdup(macos_preferencesPath());
#else #else
int tmp; int tmp;
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint"); tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
if (tmp < 0) if (tmp < 0)
{ {
@ -24959,4 +24973,3 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
if (!ignore) if (!ignore)
SDL_PushEvent(&ev); SDL_PushEvent(&ev);
} }

View file

@ -47,6 +47,7 @@ DIR * opendir(const char *pSpec)
char pathname[MAX_PATH + 2]; char pathname[MAX_PATH + 2];
DIR *pDir = calloc(1, sizeof(DIR)); DIR *pDir = calloc(1, sizeof(DIR));
if (!pDir) if (!pDir)
return NULL; return NULL;
strcpy(pathname, pSpec); strcpy(pathname, pSpec);