summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2011-01-23 18:41:25 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2011-01-23 18:41:25 +0100
commitede4432dab952314a57c94d8e713814e651f83ca (patch)
tree97faf17bec0e041cf19d7ec27b41fb8b7c2f4ab0 /src
parent49abd46d162e1d5013a42947c200544b75ab9da1 (diff)
downloadcataract-ede4432dab952314a57c94d8e713814e651f83ca.tar.xz
Indentation fixes
Diffstat (limited to 'src')
-rw-r--r--src/block-parser.c6
-rw-r--r--src/gallery-utils.c5
-rw-r--r--src/generators.c29
-rw-r--r--src/items.c21
-rw-r--r--src/job-manager.c6
5 files changed, 29 insertions, 38 deletions
diff --git a/src/block-parser.c b/src/block-parser.c
index 688776f..d4a04c1 100644
--- a/src/block-parser.c
+++ b/src/block-parser.c
@@ -168,8 +168,7 @@ push_string (BlockParser *parser, const gchar *piece)
data->data = s;
data->used = FALSE;
}
- else
- {
+ else {
s = g_strdup_printf ("%s%s", parser->current_line, piece);
g_free (parser->current_line);
parser->current_line = s;
@@ -240,8 +239,7 @@ block_parser_read_and_parse (BlockParser *parser, FILE *stream)
if (data == NULL || data != g_queue_peek_head (parser->active_tree)) {
log_error ("block_parser_read_and_parse: something is wrong with the parser table: expected '%s'\n", (gchar *) l->data);
}
- else
- {
+ else {
g_queue_pop_head (parser->active_tree);
/* push the replacement placeholder */
if (data->replace_key)
diff --git a/src/gallery-utils.c b/src/gallery-utils.c
index 9553e47..494900c 100644
--- a/src/gallery-utils.c
+++ b/src/gallery-utils.c
@@ -125,7 +125,7 @@ copy_file (const gchar *src, const gchar *dst)
buffer = g_malloc0 (BUFFER_SIZE);
size_r = BUFFER_SIZE;
- while ((! feof (fin)) && (size_r == BUFFER_SIZE)) {
+ while (! feof (fin) && size_r == BUFFER_SIZE) {
size_r = fread (buffer, 1, BUFFER_SIZE, fin);
written = fwrite (buffer, 1, size_r, fout);
if (written < size_r) {
@@ -276,8 +276,7 @@ remove_tags (gchar **str, const gchar *tag_begin, const gchar *tag_end)
src = g_strdup (dest);
g_free (dest);
}
- else
- {
+ else {
/* break in case of malformed tag structure, avoid endless loop */
log_error ("remove_tags: malformed tag structure detected, strange things may happen\n");
break;
diff --git a/src/generators.c b/src/generators.c
index a11ebcd..a8bdc36 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -161,7 +161,7 @@ generate_image (TGallerySetup *setup,
if (res) {
get_image_sizes (img_src_full, &new_w, &new_h);
- if ((new_w > 0) && (new_h > 0)) {
+ if (new_w > 0 && new_h > 0) {
stats_images_inc ();
source_img_portrait = (new_w / new_h) < 1;
@@ -170,7 +170,7 @@ generate_image (TGallerySetup *setup,
get_image_sizes (thumb_src_full, &thumb_w, &thumb_h);
*thumb_portrait = (thumb_w / thumb_h) < 1;
- if ((thumb_w > 0) && (thumb_h > 0)) {
+ if (thumb_w > 0 && thumb_h > 0) {
/* Squared thumbnails */
if (setup->squared_thumbnail_type != THUMBNAIL_SQUARE_TYPE_NONE) {
thumb_w = setup->thumbnail_square_size;
@@ -183,8 +183,9 @@ generate_image (TGallerySetup *setup,
calculate_sizes (setup->thumbnail_portrait_width, setup->thumbnail_portrait_height, &thumb_w, &thumb_h);
if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb_h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type))
log_error ("generate_image: error resizing thumbnail %s\n", thumb_src_full);
- } else
+ } else {
log_error ("generate_image: thumbnail %s sizes are %lux%lu\n", thumb_src_full, thumb_w, thumb_h);
+ }
/* Generate/copy preview image */
@@ -192,21 +193,21 @@ generate_image (TGallerySetup *setup,
if (item->preview == NULL) {
/* No preview image supplied, generate it from original */
bigq = setup->preview_quality;
- if ((items->quality > 0) && (items->quality <= 100))
+ if (items->quality > 0 && items->quality <= 100)
bigq = items->quality;
- if ((item->quality > 0) && (item->quality <= 100))
+ if (item->quality > 0 && item->quality <= 100)
bigq = item->quality;
- if ((item->width > 0) && (item->height > 0)) {
+ if (item->width > 0 && item->height > 0) {
calculate_sizes (item->width, item->height, &new_w, &new_h);
} else {
if (! source_img_portrait) {
- if ((items->landscape_width > 0) && (items->landscape_height > 0))
+ if (items->landscape_width > 0 && items->landscape_height > 0)
calculate_sizes (items->landscape_width, items->landscape_height, &new_w, &new_h);
else
calculate_sizes (setup->preview_landscape_width, setup->preview_landscape_height, &new_w, &new_h);
} else {
- if ((items->portrait_width > 0) && (items->portrait_height > 0))
+ if (items->portrait_width > 0 && items->portrait_height > 0)
calculate_sizes (items->portrait_width, items->portrait_height, &new_w, &new_h);
else
calculate_sizes (setup->preview_portrait_width, setup->preview_portrait_height, &new_w, &new_h);
@@ -217,8 +218,7 @@ generate_image (TGallerySetup *setup,
if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE, 0))
log_error ("generate_image: error resizing big image %s\n", img_src_full);
}
- else
- {
+ else {
/* Copy the preview (big) image provided */
big_src = g_build_filename (path_info->src_dir, item->preview, NULL);
if (! copy_file (big_src, big_dst))
@@ -447,8 +447,7 @@ write_html_album (TGallerySetup *setup,
block = g_strdup ("");
/* Now we have all block placeholders read, generate the items: */
- for (i = 0; i < items->items->len; i++)
- {
+ for (i = 0; i < items->items->len; i++) {
item = g_ptr_array_index (items->items, i);
if (item == NULL) {
log_error ("write_html_index: error getting item %d\n", i);
@@ -686,8 +685,10 @@ write_html_image (TGallerySetup *setup,
str_replace (&title_desc, "\n", "<br />");
}
}
- if (title) title = g_strstrip (title);
- if (title_desc) title_desc = g_strstrip (title_desc);
+ if (title)
+ title = g_strstrip (title);
+ if (title_desc)
+ title_desc = g_strstrip (title_desc);
/* Page title */
s1 = (title && strlen (title) > 0) ? g_strdup_printf ("%s | ", title) : NULL;
diff --git a/src/items.c b/src/items.c
index faedead..5fc1963 100644
--- a/src/items.c
+++ b/src/items.c
@@ -164,15 +164,13 @@ parse_album_xml (const gchar *filename)
atom_feed_item_set_path (feed_item, s);
g_free (s);
}
-
}
/* Section Items */
count = xml_file_node_get_children_count (xml, "/gallery/items/*");
- index->items = g_ptr_array_new();
+ index->items = g_ptr_array_new ();
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
s = g_strdup_printf ("/gallery/items/*[%d]", i + 1);
node_name = xml_file_get_node_name (xml, s);
g_free (s);
@@ -244,15 +242,12 @@ parse_album_xml (const gchar *filename)
g_free (s);
}
- if (item->path || item->preview)
- {
- g_ptr_array_add (index->items, item);
- }
- else
- {
- log_error ("%s: No image src specified, skipping!\n", filename);
- free_album_item (item);
- }
+ if (item->path || item->preview) {
+ g_ptr_array_add (index->items, item);
+ } else {
+ log_error ("%s: No image src specified, skipping!\n", filename);
+ free_album_item (item);
+ }
}
else
if (strcmp (node_name, "separator") == 0) {
diff --git a/src/job-manager.c b/src/job-manager.c
index 174c28a..01515ec 100644
--- a/src/job-manager.c
+++ b/src/job-manager.c
@@ -272,8 +272,7 @@ build_tree (TGallerySetup *setup,
g_free (thumb_dir);
/* Prepare target preview and orig directories */
- if (items->type == GALLERY_TYPE_ALBUM)
- {
+ if (items->type == GALLERY_TYPE_ALBUM) {
res = TRUE;
img_big_dir = g_build_path (G_DIR_SEPARATOR_S, path_info->dest_dir, setup->img_big_dir, NULL);
img_orig_dir = g_build_path (G_DIR_SEPARATOR_S, path_info->dest_dir, setup->img_orig_dir, NULL);
@@ -331,8 +330,7 @@ build_tree (TGallerySetup *setup,
#ifdef G_THREADS_ENABLED
thread_list = NULL;
- for (i = 0; i < jobs; i++)
- {
+ for (i = 0; i < jobs; i++) {
error = NULL;
thread = g_thread_create (thread_func, job, TRUE, &error);
if (thread)