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:
parent
99b566ae26
commit
4e3a9fbc8c
7 changed files with 184 additions and 148 deletions
|
|
@ -979,7 +979,9 @@ static void mysetenv(const char *name, const char *value)
|
|||
* @param loc Locale
|
||||
* @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;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static int set_current_language(const char *restrict loc)
|
||||
{
|
||||
|
|
|
|||
18
src/macos.c
18
src/macos.c
|
|
@ -16,13 +16,16 @@ const char* macos_fontsPath()
|
|||
{
|
||||
static char *p = NULL;
|
||||
|
||||
if(!p) {
|
||||
if (!p)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
|
||||
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
|
||||
|
||||
if(p) sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
|
||||
else perror("macos_fontsPath");
|
||||
if (p)
|
||||
sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
|
||||
else
|
||||
perror("macos_fontsPath");
|
||||
}
|
||||
|
||||
return p;
|
||||
|
|
@ -36,13 +39,16 @@ const char* macos_preferencesPath()
|
|||
{
|
||||
static char *p = NULL;
|
||||
|
||||
if(!p) {
|
||||
if (!p)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
|
||||
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
|
||||
|
||||
if(p) sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
|
||||
else perror("macos_preferencesPath");
|
||||
if (p)
|
||||
sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
|
||||
else
|
||||
perror("macos_preferencesPath");
|
||||
}
|
||||
|
||||
return p;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
#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);
|
||||
#endif
|
||||
if (override || !Mix_Playing(chan))
|
||||
|
|
|
|||
|
|
@ -306,8 +306,10 @@ int do_ps_save(FILE * fi,
|
|||
child_pid = pclose(fi);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("pclose returned %d\n", child_pid); fflush(stdout);
|
||||
printf("errno = %d\n", errno); fflush(stdout);
|
||||
printf("pclose returned %d\n", child_pid);
|
||||
fflush(stdout);
|
||||
printf("errno = %d\n", errno);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if (child_pid < 0 || (errno != 0 && errno != EAGAIN))
|
||||
|
|
@ -324,14 +326,25 @@ int do_ps_save(FILE * fi,
|
|||
w = waitpid(child_pid, &status, 0);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); }
|
||||
if (WIFEXITED(status)) {
|
||||
if (w == -1)
|
||||
{
|
||||
perror("waitpid");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
printf("exited, status=%d\n", WEXITSTATUS(status));
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
}
|
||||
else if (WIFSIGNALED(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));
|
||||
} else if (WIFCONTINUED(status)) {
|
||||
}
|
||||
else if (WIFCONTINUED(status))
|
||||
{
|
||||
printf("continued\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1960,7 +1960,8 @@ static void get_new_file_id(void);
|
|||
static int do_quit(int tool);
|
||||
static int do_open(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_sel(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;
|
||||
|
||||
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) */
|
||||
) * (event.button.x -
|
||||
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
||||
) * (event.button.x - (WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
||||
|
||||
#ifdef DEBUG
|
||||
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;
|
||||
h = CUR_STAMP_H;
|
||||
|
||||
stamp_data[stamp_group][cur_stamp[stamp_group]]->size =
|
||||
(((MAX_STAMP_SIZE - MIN_STAMP_SIZE +
|
||||
1
|
||||
stamp_data[stamp_group][cur_stamp[stamp_group]]->size = (((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) */
|
||||
) * (event.button.x -
|
||||
(WINDOW_WIDTH - 96))) / 96) + MIN_STAMP_SIZE;
|
||||
(WINDOW_WIDTH - 96))) / 96) +
|
||||
MIN_STAMP_SIZE;
|
||||
|
||||
#ifdef DEBUG
|
||||
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;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
fprintf(f,
|
||||
"\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" */
|
||||
"\n",
|
||||
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
|
||||
* 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)
|
||||
&& (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)
|
||||
{
|
||||
// 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;
|
||||
no_prompt_on_quit = 1;
|
||||
if (sig == SIGUSR1) {
|
||||
if (sig == SIGUSR1)
|
||||
{
|
||||
promptless_save = SAVE_OVER_NO;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
promptless_save = SAVE_OVER_ALWAYS;
|
||||
}
|
||||
raise(SIGTERM);
|
||||
|
|
@ -11885,11 +11890,13 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
int valhat_x, valhat_y, hatmotioner;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(snd >= 0) {
|
||||
if (snd >= 0)
|
||||
{
|
||||
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
|
||||
fflush(stdout);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
printf("Prompt without sound\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
|
@ -18716,7 +18723,8 @@ static int do_new_dialog(void)
|
|||
|
||||
white_in_palette = -1;
|
||||
|
||||
if (!new_colors_last) {
|
||||
if (!new_colors_last)
|
||||
{
|
||||
first_color = 0;
|
||||
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): */
|
||||
|
||||
if (new_colors_last) {
|
||||
if (new_colors_last)
|
||||
{
|
||||
first_color = num_files;
|
||||
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
|
||||
printf("%d files and colors were found!\n", num_files);
|
||||
#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: */
|
||||
|
|
@ -19477,7 +19487,8 @@ static int do_new_dialog(void)
|
|||
label_node_to_edit = NULL;
|
||||
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: */
|
||||
|
||||
|
|
@ -19682,7 +19693,9 @@ static int do_new_dialog(void)
|
|||
normally appears at the beginning (above Starts & Templates),
|
||||
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 added;
|
||||
Uint8 r, g, b;
|
||||
|
|
@ -22435,6 +22448,7 @@ static void setup_config(char *argv[])
|
|||
savedir = strdup(macos_preferencesPath());
|
||||
#else
|
||||
int tmp;
|
||||
|
||||
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
|
||||
if (tmp < 0)
|
||||
{
|
||||
|
|
@ -24959,4 +24973,3 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
|
|||
if (!ignore)
|
||||
SDL_PushEvent(&ev);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ DIR * opendir(const char *pSpec)
|
|||
char pathname[MAX_PATH + 2];
|
||||
|
||||
DIR *pDir = calloc(1, sizeof(DIR));
|
||||
|
||||
if (!pDir)
|
||||
return NULL;
|
||||
strcpy(pathname, pSpec);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue