indent dirwalk.c dirwalk.h
Ran indent on dirwalk code; quite a bit of change.
This commit is contained in:
parent
ba686d601b
commit
b37621c2f0
2 changed files with 247 additions and 246 deletions
|
|
@ -76,6 +76,7 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
{
|
||||
int loadable = 0;
|
||||
const char *restrict const cp = strchr(files[i].str, '.');
|
||||
|
||||
show_progress_bar(screen);
|
||||
if (cp)
|
||||
{
|
||||
|
|
@ -83,6 +84,7 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
const char * /*restrict */ const suffixes[] =
|
||||
{ "ttc", "dfont", "pfa", "pfb", "otf", "ttf", };
|
||||
int j = sizeof suffixes / sizeof suffixes[0];
|
||||
|
||||
while (j--)
|
||||
{
|
||||
// only check part, because of potential .gz or .bz2 suffix
|
||||
|
|
@ -106,6 +108,7 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
{
|
||||
char fname[512];
|
||||
TuxPaint_Font *font;
|
||||
|
||||
snprintf(fname, sizeof fname, "%s/%s", dir, files[i].str);
|
||||
#ifdef DEBUG
|
||||
printf("Loading font: %s (locale is: %s)\n", fname, (locale ? locale : "NULL")); //EP
|
||||
|
|
@ -113,6 +116,7 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
if (locale && strstr(fname, "locale") && !all_locale_fonts)
|
||||
{
|
||||
char fname_check[512];
|
||||
|
||||
/* We're (probably) loading from our locale fonts folder; ONLY load our locale's font */
|
||||
snprintf(fname_check, sizeof fname_check, "%s/%s.ttf", dir, locale);
|
||||
#ifdef DEBUG
|
||||
|
|
@ -135,12 +139,11 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
|
||||
#ifdef DEBUG
|
||||
int numfaces = TTF_FontFaces(font->ttf_font);
|
||||
if (numfaces != 1)
|
||||
printf("Found %d faces in %s, %s, %s\n", numfaces, files[i].str,
|
||||
family, style);
|
||||
|
||||
printf("success: tpf: 0x%x tpf->ttf_font: 0x%x\n",
|
||||
(unsigned int)(intptr_t) font, (unsigned int)(intptr_t) font->ttf_font); //EP added (intptr_t) to avoid warning on x64
|
||||
if (numfaces != 1)
|
||||
printf("Found %d faces in %s, %s, %s\n", numfaces, files[i].str, family, style);
|
||||
|
||||
printf("success: tpf: 0x%x tpf->ttf_font: 0x%x\n", (unsigned int)(intptr_t) font, (unsigned int)(intptr_t) font->ttf_font); //EP added (intptr_t) to avoid warning on x64
|
||||
#endif
|
||||
|
||||
// These fonts crash Tux Paint via a library bug.
|
||||
|
|
@ -165,19 +168,17 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
// impossible for a user to type ASCII letters.
|
||||
//
|
||||
// Most translators should use scoring instead.
|
||||
if(!charset_works(font, gettext("qx")) || !charset_works(font, gettext("QX")))
|
||||
if (!charset_works(font, gettext("qx")) || !charset_works(font, gettext("QX")))
|
||||
blacklisted = 1;
|
||||
|
||||
if(!blacklisted){
|
||||
if (!blacklisted)
|
||||
{
|
||||
if (num_font_styles == num_font_styles_max)
|
||||
{
|
||||
num_font_styles_max = num_font_styles_max * 5 / 4 + 30;
|
||||
user_font_styles =
|
||||
realloc(user_font_styles,
|
||||
num_font_styles_max * sizeof *user_font_styles);
|
||||
user_font_styles = realloc(user_font_styles, num_font_styles_max * sizeof *user_font_styles);
|
||||
}
|
||||
user_font_styles[num_font_styles] =
|
||||
malloc(sizeof *user_font_styles[num_font_styles]);
|
||||
user_font_styles[num_font_styles] = malloc(sizeof *user_font_styles[num_font_styles]);
|
||||
user_font_styles[num_font_styles]->directory = strdup(dir);
|
||||
user_font_styles[num_font_styles]->filename = files[i].str; // steal it (mark NULL below)
|
||||
user_font_styles[num_font_styles]->family = strdup(family);
|
||||
|
|
@ -213,8 +214,8 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
#if 0
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<1>spare-1a"));
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<1>spare-1b"));
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<9>spare-9a"))*9;
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<9>spare-9b"))*9;
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<9>spare-9a")) * 9;
|
||||
user_font_styles[num_font_styles]->score += charset_works(font, gettext("<9>spare-9b")) * 9;
|
||||
#endif
|
||||
|
||||
// this really should be dynamic, avoiding the need for a special build
|
||||
|
|
@ -233,8 +234,7 @@ void loadfont_callback(SDL_Surface * screen, const char *restrict const dir,
|
|||
{
|
||||
#if 0
|
||||
// THREADED_FONTS
|
||||
printf("Font is too defective: %s, %s, %s\n", files[i].str, family,
|
||||
style);
|
||||
printf("Font is too defective: %s, %s, %s\n", files[i].str, family, style);
|
||||
#endif
|
||||
}
|
||||
TuxPaint_Font_CloseFont(font);
|
||||
|
|
@ -258,6 +258,7 @@ int compare_ftw_str(const void *v1, const void *v2)
|
|||
{
|
||||
const char *restrict const s1 = ((tp_ftw_str *) v1)->str;
|
||||
const char *restrict const s2 = ((tp_ftw_str *) v2)->str;
|
||||
|
||||
return -strcmp(s1, s2); /* FIXME: Should we try strcasecmp, to group things together despite uppercase/lowercase in filenames (e.g., Jigsaw* vs jigsaw* Starters)??? -bjk 2009.10.11 */
|
||||
}
|
||||
|
||||
|
|
@ -265,8 +266,7 @@ void tp_ftw(SDL_Surface * screen, char *restrict const dir, unsigned dirlen,
|
|||
int rsrc, void (*fn) (SDL_Surface * screen,
|
||||
const char *restrict const dir,
|
||||
unsigned dirlen, tp_ftw_str * files,
|
||||
unsigned count, const char *restrict const locale),
|
||||
const char *restrict const locale)
|
||||
unsigned count, const char *restrict const locale), const char *restrict const locale)
|
||||
{
|
||||
DIR *d;
|
||||
unsigned num_file_names = 0;
|
||||
|
|
@ -326,6 +326,7 @@ void tp_ftw(SDL_Surface * screen, char *restrict const dir, unsigned dirlen,
|
|||
if (filetype == TP_FTW_UNKNOWN)
|
||||
{
|
||||
struct stat sbuf;
|
||||
|
||||
memcpy(dir + dirlen, f->d_name, d_namlen + 1);
|
||||
if (stat(dir, &sbuf))
|
||||
continue; // oh well... try the next one
|
||||
|
|
@ -362,6 +363,7 @@ void tp_ftw(SDL_Surface * screen, char *restrict const dir, unsigned dirlen,
|
|||
if (filetype == TP_FTW_DIRECTORY)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
if (num_dir_names == max_dir_names)
|
||||
{
|
||||
max_dir_names = max_dir_names * 5 / 4 + 3;
|
||||
|
|
@ -399,8 +401,7 @@ void tp_ftw(SDL_Surface * screen, char *restrict const dir, unsigned dirlen,
|
|||
qsort(dir_names, num_dir_names, sizeof *dir_names, compare_ftw_str);
|
||||
while (num_dir_names--)
|
||||
{
|
||||
memcpy(dir + dirlen, dir_names[num_dir_names].str,
|
||||
dir_names[num_dir_names].len + 1);
|
||||
memcpy(dir + dirlen, dir_names[num_dir_names].str, dir_names[num_dir_names].len + 1);
|
||||
tp_ftw(screen, dir, dirlen + dir_names[num_dir_names].len, rsrc, fn, locale);
|
||||
free(dir_names[num_dir_names].str);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue