From ca9f280d0ac4173cdd29f745fd574a3b597969e7 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 3 Oct 2014 14:05:56 +0000 Subject: Imported Upstream version 0.998 --- src/cursor/cursor_autoraise_scanarea.xbm | 7 - src/cursor/cursor_autoraise_scanarea_mask.xbm | 7 - src/cursor/cursor_pipette_black | 8 - src/cursor/cursor_pipette_gray | 8 - src/cursor/cursor_pipette_mask | 8 - src/cursor/cursor_pipette_white | 8 - src/cursor/cursor_zoom_select.xbm | 7 - src/cursor/cursor_zoom_select_mask.xbm | 7 - src/xsane-back-gtk.c | 6 +- src/xsane-batch-scan.c | 2 +- src/xsane-device-preferences.c | 2 +- src/xsane-email-project.c | 20 ++- src/xsane-fax-project.c | 2 +- src/xsane-front-gtk.c | 8 +- src/xsane-gamma.c | 2 +- src/xsane-icon.rc | 0 src/xsane-icons.c | 2 +- src/xsane-multipage-project.c | 2 +- src/xsane-preferences.c | 2 +- src/xsane-preview.c | 9 +- src/xsane-rc-io.c | 2 +- src/xsane-save.c | 232 +++++++++++++++----------- src/xsane-scan.c | 5 +- src/xsane-setup.c | 20 +-- src/xsane-viewer.c | 2 +- src/xsane.c | 10 +- src/xsane.h | 4 +- 27 files changed, 178 insertions(+), 214 deletions(-) delete mode 100644 src/cursor/cursor_autoraise_scanarea.xbm delete mode 100644 src/cursor/cursor_autoraise_scanarea_mask.xbm delete mode 100644 src/cursor/cursor_pipette_black delete mode 100644 src/cursor/cursor_pipette_gray delete mode 100644 src/cursor/cursor_pipette_mask delete mode 100644 src/cursor/cursor_pipette_white delete mode 100644 src/cursor/cursor_zoom_select.xbm delete mode 100644 src/cursor/cursor_zoom_select_mask.xbm mode change 100755 => 100644 src/xsane-icon.rc (limited to 'src') diff --git a/src/cursor/cursor_autoraise_scanarea.xbm b/src/cursor/cursor_autoraise_scanarea.xbm deleted file mode 100644 index d5895f7..0000000 --- a/src/cursor/cursor_autoraise_scanarea.xbm +++ /dev/null @@ -1,7 +0,0 @@ -/* Erzeugt mit Gimp */ -#define cursor_autoraise_scanare_width 16 -#define cursor_autoraise_scanare_height 16 -static unsigned char cursor_autoraise_scanare_bits[] = { - 0xaa, 0x2a, 0xc1, 0x41, 0xe0, 0x03, 0x81, 0x40, 0x80, 0x00, 0x85, 0x50, - 0x86, 0x30, 0x7f, 0x7f, 0x86, 0x30, 0x85, 0x50, 0x80, 0x00, 0x81, 0x40, - 0xe0, 0x03, 0xc1, 0x41, 0xaa, 0x2a, 0x00, 0x00 }; diff --git a/src/cursor/cursor_autoraise_scanarea_mask.xbm b/src/cursor/cursor_autoraise_scanarea_mask.xbm deleted file mode 100644 index e4adeda..0000000 --- a/src/cursor/cursor_autoraise_scanarea_mask.xbm +++ /dev/null @@ -1,7 +0,0 @@ -/* Erzeugt mit Gimp */ -#define cursor_autoraise_scanare_width 16 -#define cursor_autoraise_scanare_height 16 -static unsigned char cursor_autoraise_scanare_bits[] = { - 0xea, 0x2b, 0xe1, 0x43, 0xf0, 0x07, 0xc1, 0x41, 0xc4, 0x11, 0xc7, 0x71, - 0xff, 0x7f, 0x7f, 0x7f, 0xff, 0x7f, 0xc7, 0x71, 0xc4, 0x11, 0xc1, 0x41, - 0xf0, 0x07, 0xe1, 0x43, 0xea, 0x2b, 0x00, 0x00 }; diff --git a/src/cursor/cursor_pipette_black b/src/cursor/cursor_pipette_black deleted file mode 100644 index 9fc4d56..0000000 --- a/src/cursor/cursor_pipette_black +++ /dev/null @@ -1,8 +0,0 @@ -#define cursor_pipette_black_width 16 -#define cursor_pipette_black_height 16 -#define cursor_pipette_black_x_hot 1 -#define cursor_pipette_black_y_hot 14 -static unsigned char cursor_pipette_black_bits[] = { - 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, - 0x40, 0x18, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, - 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/src/cursor/cursor_pipette_gray b/src/cursor/cursor_pipette_gray deleted file mode 100644 index 7cbea80..0000000 --- a/src/cursor/cursor_pipette_gray +++ /dev/null @@ -1,8 +0,0 @@ -#define cursor_pipette_gray_width 16 -#define cursor_pipette_gray_height 16 -#define cursor_pipette_gray_x_hot 1 -#define cursor_pipette_gray_y_hot 14 -static unsigned char cursor_pipette_gray_bits[] = { - 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, - 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, - 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/src/cursor/cursor_pipette_mask b/src/cursor/cursor_pipette_mask deleted file mode 100644 index 36c7757..0000000 --- a/src/cursor/cursor_pipette_mask +++ /dev/null @@ -1,8 +0,0 @@ -#define cursor_pipette_mask_width 16 -#define cursor_pipette_mask_height 16 -#define cursor_pipette_mask_x_hot 1 -#define cursor_pipette_mask_y_hot 14 -static unsigned char cursor_pipette_mask_bits[] = { - 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7f, 0x80, 0x3f, - 0xc0, 0x1f, 0xe0, 0x17, 0xf0, 0x13, 0xf8, 0x01, 0xfc, 0x00, 0x7c, 0x00, - 0x3e, 0x00, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/src/cursor/cursor_pipette_white b/src/cursor/cursor_pipette_white deleted file mode 100644 index 9952441..0000000 --- a/src/cursor/cursor_pipette_white +++ /dev/null @@ -1,8 +0,0 @@ -#define cursor_pipette_white_width 16 -#define cursor_pipette_white_height 16 -#define cursor_pipette_white_x_hot 1 -#define cursor_pipette_white_y_hot 14 -static unsigned char cursor_pipette_white_bits[] = { - 0x00, 0x70, 0x00, 0xf8, 0x80, 0xff, 0x00, 0xfe, 0x00, 0x7d, 0x80, 0x38, - 0x40, 0x18, 0x20, 0x14, 0x10, 0x12, 0x08, 0x01, 0x84, 0x00, 0x44, 0x00, - 0x32, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00}; diff --git a/src/cursor/cursor_zoom_select.xbm b/src/cursor/cursor_zoom_select.xbm deleted file mode 100644 index 4c88a36..0000000 --- a/src/cursor/cursor_zoom_select.xbm +++ /dev/null @@ -1,7 +0,0 @@ -/* Erzeugt mit Gimp */ -#define cursor_zoom_select_width 16 -#define cursor_zoom_select_height 16 -static unsigned char cursor_zoom_select_bits[] = { - 0x00, 0x00, 0xf0, 0x01, 0x08, 0x02, 0x44, 0x04, 0x42, 0x08, 0x42, 0x08, - 0xba, 0x0b, 0x42, 0x08, 0x42, 0x08, 0x44, 0x04, 0x08, 0x06, 0xf0, 0x0f, - 0x00, 0x1c, 0x00, 0x38, 0x00, 0x70, 0x00, 0xe0 }; diff --git a/src/cursor/cursor_zoom_select_mask.xbm b/src/cursor/cursor_zoom_select_mask.xbm deleted file mode 100644 index 81f1b9c..0000000 --- a/src/cursor/cursor_zoom_select_mask.xbm +++ /dev/null @@ -1,7 +0,0 @@ -/* Erzeugt mit Gimp */ -#define cursor_zoom_select_mask_width 16 -#define cursor_zoom_select_mask_height 16 -static unsigned char cursor_zoom_select_mask_bits[] = { - 0xf0, 0x01, 0xf8, 0x03, 0x0c, 0x06, 0x46, 0x0c, 0x53, 0x19, 0xe3, 0x18, - 0xbb, 0x1b, 0xe3, 0x18, 0x53, 0x19, 0x46, 0x0c, 0x0c, 0x0e, 0xf8, 0x1f, - 0xf0, 0x3f, 0x00, 0x7c, 0x00, 0xf8, 0x00, 0xf0 }; diff --git a/src/xsane-back-gtk.c b/src/xsane-back-gtk.c index 671b02d..4701dc6 100644 --- a/src/xsane-back-gtk.c +++ b/src/xsane-back-gtk.c @@ -3,7 +3,7 @@ xsane-back-gtk.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -2004,9 +2004,6 @@ void xsane_back_gtk_range_new(GtkWidget *parent, const char *name, gfloat val, gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); elem->data = gtk_adjustment_new(val, min, max, quant, quant*10, 0); - //elem->data = gtk_adjustment_new(val, min, max, quant, quant*10, (max-min) * 1e-30); - /* 1e-30 => hscrollbar has an unwanted side effect: the maximum is not the maximum */ - /* of the given range, it is reduced by the page_size, so it has to be very small */ /* value label */ if (preferences.show_range_mode & 8) @@ -2124,7 +2121,6 @@ void xsane_back_gtk_value_new(GtkWidget *parent, const char *name, gfloat val, gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); elem->data = gtk_adjustment_new(val, -1e29, 1e29, 1, 10, 0); - //elem->data = gtk_adjustment_new(val, -1e29, 1e29, 1, 10, 1e-30); /* spinbutton */ #ifndef HAVE_GTK2 diff --git a/src/xsane-batch-scan.c b/src/xsane-batch-scan.c index 85b259c..90cc0e0 100644 --- a/src/xsane-batch-scan.c +++ b/src/xsane-batch-scan.c @@ -3,7 +3,7 @@ xsane-batch-scan.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-device-preferences.c b/src/xsane-device-preferences.c index 011e054..d4ee710 100644 --- a/src/xsane-device-preferences.c +++ b/src/xsane-device-preferences.c @@ -3,7 +3,7 @@ xsane-device-preferences.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-email-project.c b/src/xsane-email-project.c index 87b6574..23fc942 100644 --- a/src/xsane-email-project.c +++ b/src/xsane-email-project.c @@ -3,7 +3,7 @@ xsane-email-project.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -493,6 +493,7 @@ static void xsane_email_project_display_status() char filename[PATH_MAX]; int val; int i, c; + int items_done; DBG(DBG_proc, "xsane_email_project_display_status\n"); @@ -510,7 +511,7 @@ static void xsane_email_project_display_status() } buf[i-1] = 0; - fscanf(lockfile, "%d\n", &val); + items_done = fscanf(lockfile, "%d\n", &val); fclose(lockfile); @@ -1514,6 +1515,7 @@ static void xsane_create_email(int fd) int use_attachment = 0; int email_text_size = 0; int display_images_inline = FALSE; + size_t bytes_written; DBG(DBG_proc, "xsane_create_email\n"); @@ -1654,7 +1656,7 @@ static void xsane_create_email(int fd) { snprintf(buf, sizeof(buf), "

\r\n", content_id); } - write(fd, buf, strlen(buf)); + bytes_written = write(fd, buf, strlen(buf)); } else /* more images selected than available */ { @@ -1663,11 +1665,11 @@ static void xsane_create_email(int fd) else if (*email_text_pos == 10) /* new line */ { snprintf(buf, sizeof(buf), "
\r\n"); - write(fd, buf, strlen(buf)); + bytes_written = write(fd, buf, strlen(buf)); } else { - write(fd, email_text_pos, 1); + bytes_written = write(fd, email_text_pos, 1); } email_text_pos++; } @@ -1683,11 +1685,11 @@ static void xsane_create_email(int fd) { snprintf(buf, sizeof(buf), "

\r\n", content_id); } - write(fd, buf, strlen(buf)); + bytes_written = write(fd, buf, strlen(buf)); } snprintf(buf, sizeof(buf), "\r\n"); - write(fd, buf, strlen(buf)); + bytes_written = write(fd, buf, strlen(buf)); for (i=0; i - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-front-gtk.c b/src/xsane-front-gtk.c index 533655c..35aa89d 100644 --- a/src/xsane-front-gtk.c +++ b/src/xsane-front-gtk.c @@ -3,7 +3,7 @@ xsane-front-gtk.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -1136,9 +1136,6 @@ void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc, gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 1); *data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, 0); - // *data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30); - /* 1e-30 => hscrollbar has an unwanted side effect: the maximum is not the maximum */ - /* of the given range, it is reduced by the page_size, so it has to be very small */ /* value label */ if (preferences.show_range_mode & 8) @@ -1231,9 +1228,6 @@ void xsane_range_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char * gdk_drawable_unref(mask); *data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, 0); - //*data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30); - /* 1e-30 => hscrollbar has an unwanted side effect: the maximum is not the maximum */ - /* of the given range, it is reduced by the page_size, so it has to be very small */ /* value label */ if (preferences.show_range_mode & 8) diff --git a/src/xsane-gamma.c b/src/xsane-gamma.c index 8304f07..7951354 100644 --- a/src/xsane-gamma.c +++ b/src/xsane-gamma.c @@ -3,7 +3,7 @@ xsane-gamma.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-icon.rc b/src/xsane-icon.rc old mode 100755 new mode 100644 diff --git a/src/xsane-icons.c b/src/xsane-icons.c index 6b0c9f2..426ac06 100644 --- a/src/xsane-icons.c +++ b/src/xsane-icons.c @@ -3,7 +3,7 @@ xsane-icons.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-multipage-project.c b/src/xsane-multipage-project.c index 99b0106..f23e5f8 100644 --- a/src/xsane-multipage-project.c +++ b/src/xsane-multipage-project.c @@ -3,7 +3,7 @@ xsane-multipage-project.c Oliver Rauch - Copyright (C) 2005-2007 Oliver Rauch + Copyright (C) 2005-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-preferences.c b/src/xsane-preferences.c index 4f866f1..f9ecc93 100644 --- a/src/xsane-preferences.c +++ b/src/xsane-preferences.c @@ -3,7 +3,7 @@ xsane-preferences.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-preview.c b/src/xsane-preview.c index c6122d5..f089dd1 100644 --- a/src/xsane-preview.c +++ b/src/xsane-preview.c @@ -3,7 +3,7 @@ xsane-preview.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -2100,6 +2100,7 @@ int preview_create_batch_icon_from_file(Preview *p, FILE *in, Batch_Scan_Paramet int xx, yy; int offset = 0; guchar *data; + size_t bytes_read; DBG(DBG_proc, "preview_create_batch_icon_from_file\n"); @@ -2245,13 +2246,13 @@ int preview_create_batch_icon_from_file(Preview *p, FILE *in, Batch_Scan_Paramet { fseek(in, header + (xoffset + (int)(x * scale) + (yoffset + (int)(y * scale)) * image_width) * 6, SEEK_SET); - fread(&r, 2, 1, in); /* read 16 bit value in machines byte order */ + bytes_read = fread(&r, 2, 1, in); /* read 16 bit value in machines byte order */ r = preview_gamma_data_red[r >> rotate16]; - fread(&g, 2, 1, in); + bytes_read = fread(&g, 2, 1, in); g = preview_gamma_data_green[g >> rotate16]; - fread(&b, 2, 1, in); + bytes_read = fread(&b, 2, 1, in); b = preview_gamma_data_blue[b >> rotate16]; c = r * 65536 + g * 256 + b; diff --git a/src/xsane-rc-io.c b/src/xsane-rc-io.c index 39a29ef..21392a0 100644 --- a/src/xsane-rc-io.c +++ b/src/xsane-rc-io.c @@ -3,7 +3,7 @@ xsane-rc-io.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane-save.c b/src/xsane-save.c index 97c40eb..84f5d59 100644 --- a/src/xsane-save.c +++ b/src/xsane-save.c @@ -3,7 +3,7 @@ xsane-save.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -423,6 +423,7 @@ void xsane_read_pnm_header(FILE *file, Image_info *image_info) { int max_val, filetype_nr; char buf[TEXTBUFSIZE]; + int items_done; fgets(buf, sizeof(buf)-1, file); DBG(DBG_info, "filetype header :%s", buf); @@ -514,13 +515,13 @@ void xsane_read_pnm_header(FILE *file, Image_info *image_info) } } - fscanf(file, "%d %d", &image_info->image_width, &image_info->image_height); + items_done = fscanf(file, "%d %d", &image_info->image_width, &image_info->image_height); image_info->depth = 1; if (filetype_nr != 4) /* P4 = lineart */ { - fscanf(file, "%d", &max_val); + items_done = fscanf(file, "%d", &max_val); if (max_val == 255) { @@ -545,7 +546,7 @@ void xsane_read_pnm_header(FILE *file, Image_info *image_info) #ifdef SUPPORT_RGBA else if (buf[0] == 'S') /* RGBA format */ { - fscanf(file, "%d %d\n%d", &image_info->image_width, &image_info->image_height, &max_val); + items_done = fscanf(file, "%d %d\n%d", &image_info->image_width, &image_info->image_height, &max_val); fgetc(file); /* read exactly one newline character */ image_info->depth = 1; @@ -1032,6 +1033,7 @@ int xsane_save_scaled_image(FILE *outfile, FILE *imagefile, Image_info *image_in float factor, x_factor, y_factor; guint16 color; int read_line; + size_t bytes_read; DBG(DBG_proc, "xsane_save_scaled_image\n"); @@ -1102,7 +1104,7 @@ int xsane_save_scaled_image(FILE *outfile, FILE *imagefile, Image_info *image_in if (read_line) { DBG(DBG_info, "xsane_save_scaled_image: reading original line %d\n", (int) y); - fread(original_line, original_image_width, image_info->channels * bytespp, imagefile); /* read one line */ + bytes_read = fread(original_line, original_image_width, image_info->channels * bytespp, imagefile); /* read one line */ original_line16 = (guint16 *) original_line; } @@ -1285,7 +1287,7 @@ int xsane_save_scaled_image(FILE *outfile, FILE *imagefile, Image_info *image_in for (; ((int) original_y) - old_original_y; old_original_y += 1) { - fread(original_line, original_image_width, image_info->channels * bytespp, imagefile); /* read one line */ + bytes_read = fread(original_line, original_image_width, image_info->channels * bytespp, imagefile); /* read one line */ } for (x = 0; x < new_image_width; x++) @@ -1330,6 +1332,7 @@ int xsane_save_despeckle_image(FILE *outfile, FILE *imagefile, Image_info *image int bytespp = 1; int color_radius; int color_width = image_info->image_width * image_info->channels; + size_t bytes_read; radius--; /* correct radius : 1 means nothing happens */ @@ -1354,7 +1357,7 @@ int xsane_save_despeckle_image(FILE *outfile, FILE *imagefile, Image_info *image return -1; } - fread(line_cache, color_width * bytespp, (2 * radius + 1), imagefile); + bytes_read = fread(line_cache, color_width * bytespp, (2 * radius + 1), imagefile); color_cache = malloc((size_t) sizeof(guint16) * (2*radius+1)*(2*radius+1)); @@ -1502,7 +1505,7 @@ int xsane_save_despeckle_image(FILE *outfile, FILE *imagefile, Image_info *image { memcpy(line_cache, line_cache + color_width * bytespp, color_width * bytespp * 2 * radius); - fread(line_cache + color_width * bytespp * 2 * radius, + bytes_read = fread(line_cache + color_width * bytespp * 2 * radius, color_width * bytespp, 1, imagefile); } } @@ -1530,6 +1533,7 @@ int xsane_save_blur_image(FILE *outfile, FILE *imagefile, Image_info *image_info int xmax_flag; int ymin_flag; int ymax_flag; + size_t bytes_read; *cancel_save = 0; @@ -1551,7 +1555,7 @@ int xsane_save_blur_image(FILE *outfile, FILE *imagefile, Image_info *image_info return -1; } - fread(line_cache, image_info->image_width * image_info->channels * bytespp, (2 * intradius + 1), imagefile); + bytes_read = fread(line_cache, image_info->image_width * image_info->channels * bytespp, (2 * intradius + 1), imagefile); for (y = 0; y < image_info->image_height; y++) { @@ -1716,7 +1720,7 @@ int xsane_save_blur_image(FILE *outfile, FILE *imagefile, Image_info *image_info { memcpy(line_cache, line_cache + image_info->image_width * image_info->channels * bytespp, image_info->image_width * image_info->channels * bytespp * 2 * intradius); - fread(line_cache + image_info->image_width * image_info->channels * bytespp * 2 * intradius, + bytes_read = fread(line_cache + image_info->image_width * image_info->channels * bytespp * 2 * intradius, image_info->image_width * image_info->channels * bytespp, 1, imagefile); } } @@ -1756,7 +1760,7 @@ int xsane_save_blur_image(FILE *outfile, FILE *imagefile, Image_info *image_info return -1; } - fread(line_cache, image_info->image_width * image_info->channels * bytespp, (2 * radius + 1), imagefile); + bytes_read = fread(line_cache, image_info->image_width * image_info->channels * bytespp, (2 * radius + 1), imagefile); for (y = 0; y < image_info->image_height; y++) { @@ -1830,7 +1834,7 @@ int xsane_save_blur_image(FILE *outfile, FILE *imagefile, Image_info *image_info { memcpy(line_cache, line_cache + image_info->image_width * image_info->channels * bytespp, image_info->image_width * image_info->channels * bytespp * 2 * radius); - fread(line_cache + image_info->image_width * image_info->channels * bytespp * 2 * radius, + bytes_read = fread(line_cache + image_info->image_width * image_info->channels * bytespp * 2 * radius, image_info->image_width * image_info->channels * bytespp, 1, imagefile); } } @@ -3059,6 +3063,7 @@ static int xsane_save_ps_pdf_gray(FILE *outfile, FILE *imagefile, Image_info *im unsigned char *line = NULL, *linep = NULL, *line16 = NULL; int bytes_per_line; int bytes_per_line16 = 0; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *line_raw = NULL; #endif @@ -3157,7 +3162,7 @@ static int xsane_save_ps_pdf_gray(FILE *outfile, FILE *imagefile, Image_info *im for (x = 0; x < image_info->image_width; x++) { - fread(&val, 2, 1, imagefile); + bytes_read = fread(&val, 2, 1, imagefile); line[x] = val/256; } #endif @@ -3165,13 +3170,13 @@ static int xsane_save_ps_pdf_gray(FILE *outfile, FILE *imagefile, Image_info *im #ifdef HAVE_LIBLCMS if (do_transform && (hTransform != NULL)) { - fread(line_raw, 2, image_info->image_width, imagefile); + bytes_read = fread(line_raw, 2, image_info->image_width, imagefile); cmsDoTransform(hTransform, line_raw, line16, image_info->image_width); } else #endif { - fread(line16, 2, image_info->image_width, imagefile); + bytes_read = fread(line16, 2, image_info->image_width, imagefile); } linep = line; @@ -3218,13 +3223,13 @@ static int xsane_save_ps_pdf_gray(FILE *outfile, FILE *imagefile, Image_info *im #ifdef HAVE_LIBLCMS if (do_transform && (hTransform != NULL)) { - fread(line_raw, 1, image_info->image_width, imagefile); + bytes_read = fread(line_raw, 1, image_info->image_width, imagefile); cmsDoTransform(hTransform, line_raw, line, image_info->image_width); } else #endif { - fread(line, 1, image_info->image_width, imagefile); + bytes_read = fread(line, 1, image_info->image_width, imagefile); } } @@ -3309,6 +3314,7 @@ static int xsane_save_ps_pdf_color(FILE *outfile, FILE *imagefile, Image_info *i unsigned char *line = NULL, *linep = NULL, *line16 = NULL; int bytes_per_line; int bytes_per_line16 = 0; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *line_raw = NULL; #endif @@ -3412,13 +3418,13 @@ static int xsane_save_ps_pdf_color(FILE *outfile, FILE *imagefile, Image_info *i #ifdef HAVE_LIBLCMS if (do_transform && (hTransform != NULL)) { - fread(line_raw, 6, image_info->image_width, imagefile); + bytes_read = fread(line_raw, 6, image_info->image_width, imagefile); cmsDoTransform(hTransform, line_raw, line16, image_info->image_width); } else #endif { - fread(line16, 6, image_info->image_width, imagefile); + bytes_read = fread(line16, 6, image_info->image_width, imagefile); } #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -3472,13 +3478,13 @@ static int xsane_save_ps_pdf_color(FILE *outfile, FILE *imagefile, Image_info *i #ifdef HAVE_LIBLCMS if (do_transform && (hTransform != NULL)) { - fread(line_raw, 3, image_info->image_width, imagefile); + bytes_read = fread(line_raw, 3, image_info->image_width, imagefile); cmsDoTransform(hTransform, line_raw, line, image_info->image_width); } else #endif { - fread(line, 3, image_info->image_width, imagefile); + bytes_read = fread(line, 3, image_info->image_width, imagefile); } } @@ -4370,6 +4376,7 @@ int xsane_save_jpeg(FILE *outfile, int quality, FILE *imagefile, Image_info *ima struct jpeg_compress_struct cinfo; xsane_jpeg_error_mgr jerr; JSAMPROW row_pointer[1]; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *data_raw = NULL; #endif @@ -4496,13 +4503,13 @@ int xsane_save_jpeg(FILE *outfile, int quality, FILE *imagefile, Image_info *ima #ifdef HAVE_LIBLCMS if (apply_ICM_profile && (cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && (hTransform != NULL)) { - fread(data_raw, components * 2, image_info->image_width, imagefile); + bytes_read = fread(data_raw, components * 2, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, components * 2, image_info->image_width, imagefile); + bytes_read = fread(data, components * 2, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width * components; x++) @@ -4516,13 +4523,13 @@ int xsane_save_jpeg(FILE *outfile, int quality, FILE *imagefile, Image_info *ima #ifdef HAVE_LIBLCMS if (apply_ICM_profile && (cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && (hTransform != NULL)) { - fread(data_raw, components, image_info->image_width, imagefile); + bytes_read = fread(data_raw, components, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, components, image_info->image_width, imagefile); + bytes_read = fread(data, components, image_info->image_width, imagefile); } } @@ -4615,6 +4622,7 @@ int xsane_save_tiff_page(TIFF *tiffile, int page, int pages, int quality, FILE * int bytes; struct tm *ptm; time_t now; + size_t bytes_read; #ifdef HAVE_LIBLCMS char *data_raw = NULL; #endif @@ -4769,13 +4777,13 @@ int xsane_save_tiff_page(TIFF *tiffile, int page, int pages, int quality, FILE * #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && (hTransform != NULL)) { - fread(data_raw, 1, w, imagefile); + bytes_read = fread(data_raw, 1, w, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 1, w, imagefile); + bytes_read = fread(data, 1, w, imagefile); } if (TIFFWriteScanline(tiffile, data, y, 0) != 1) @@ -4877,6 +4885,7 @@ int xsane_save_png(FILE *outfile, int compression, FILE *imagefile, Image_info * char buf[TEXTBUFSIZE]; int colortype, components, byte_width; int y; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *data_raw = NULL; #endif @@ -5017,13 +5026,13 @@ int xsane_save_png(FILE *outfile, int compression, FILE *imagefile, Image_info * #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && (hTransform != NULL)) { - fread(data_raw, components, byte_width, imagefile); + bytes_read = fread(data_raw, components, byte_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, components, byte_width, imagefile); + bytes_read = fread(data, components, byte_width, imagefile); } row_ptr = data; @@ -5066,6 +5075,7 @@ int xsane_save_png_16(FILE *outfile, int compression, FILE *imagefile, Image_inf char buf[TEXTBUFSIZE]; int colortype, components; int y; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *data_raw = NULL; #endif @@ -5189,13 +5199,13 @@ int xsane_save_png_16(FILE *outfile, int compression, FILE *imagefile, Image_inf #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && (hTransform != NULL)) { - fread(data_raw, components * 2, image_info->image_width, imagefile); + bytes_read = fread(data_raw, components * 2, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, components * 2, image_info->image_width, imagefile); + bytes_read = fread(data, components * 2, image_info->image_width, imagefile); } #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -5207,7 +5217,7 @@ int xsane_save_png_16(FILE *outfile, int compression, FILE *imagefile, Image_inf { unsigned char help; - help = data[x*2+1]; + help = data[x*2+0]; data[x*2+0] = data[x*2+1]; data[x*2+1] = help; } @@ -5246,6 +5256,7 @@ static int xsane_save_pnm_16_ascii_gray(FILE *outfile, FILE *imagefile, Image_in int x,y; guint16 *data; int count = 0; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint16 *data_raw = NULL; #endif @@ -5290,13 +5301,13 @@ static int xsane_save_pnm_16_ascii_gray(FILE *outfile, FILE *imagefile, Image_in #ifdef HAVE_LIBLCMS if ((apply_ICM_profile) && (hTransform != NULL)) { - fread(data_raw, 2, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 2, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 2, image_info->image_width, imagefile); + bytes_read = fread(data, 2, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -5353,6 +5364,7 @@ static int xsane_save_pnm_16_ascii_color(FILE *outfile, FILE *imagefile, Image_i int x,y; guint16 *data; int count = 0; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint16 *data_raw = NULL; #endif @@ -5398,13 +5410,13 @@ static int xsane_save_pnm_16_ascii_color(FILE *outfile, FILE *imagefile, Image_i #ifdef HAVE_LIBLCMS if ((apply_ICM_profile) && (hTransform != NULL)) { - fread(data_raw, 6, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 6, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 6, image_info->image_width, imagefile); + bytes_read = fread(data, 6, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -5461,6 +5473,7 @@ static int xsane_save_pnm_16_binary_gray(FILE *outfile, FILE *imagefile, Image_i { int x,y; guint16 *data; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint16 *data_raw = NULL; #endif @@ -5505,13 +5518,13 @@ static int xsane_save_pnm_16_binary_gray(FILE *outfile, FILE *imagefile, Image_i #ifdef HAVE_LIBLCMS if (hTransform != NULL) { - fread(data_raw, 2, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 2, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 2, image_info->image_width, imagefile); + bytes_read = fread(data, 2, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -5558,6 +5571,7 @@ static int xsane_save_pnm_16_binary_color(FILE *outfile, FILE *imagefile, Image_ { int x,y; guint16 *data; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint16 *data_raw = NULL; #endif @@ -5602,13 +5616,13 @@ static int xsane_save_pnm_16_binary_color(FILE *outfile, FILE *imagefile, Image_ #ifdef HAVE_LIBLCMS if (hTransform != NULL) { - fread(data_raw, 6, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 6, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 6, image_info->image_width, imagefile); + bytes_read = fread(data, 6, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -5659,6 +5673,7 @@ static int xsane_save_pnm_8_gray(FILE *outfile, FILE *imagefile, Image_info *ima { int x,y; guint8 *data; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint8 *data_raw = NULL; #endif @@ -5703,13 +5718,13 @@ static int xsane_save_pnm_8_gray(FILE *outfile, FILE *imagefile, Image_info *ima #ifdef HAVE_LIBLCMS if (hTransform != NULL) { - fread(data_raw, 1, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 1, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 1, image_info->image_width, imagefile); + bytes_read = fread(data, 1, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -5754,6 +5769,7 @@ static int xsane_save_pnm_8_color(FILE *outfile, FILE *imagefile, Image_info *im { int x,y; guint8 *data; + size_t bytes_read; #ifdef HAVE_LIBLCMS guint8 *data_raw = NULL; #endif @@ -5798,13 +5814,13 @@ static int xsane_save_pnm_8_color(FILE *outfile, FILE *imagefile, Image_info *im #ifdef HAVE_LIBLCMS if (hTransform != NULL) { - fread(data_raw, 3, image_info->image_width, imagefile); + bytes_read = fread(data_raw, 3, image_info->image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info->image_width); } else #endif { - fread(data, 3, image_info->image_width, imagefile); + bytes_read = fread(data, 3, image_info->image_width, imagefile); } for (x = 0; x < image_info->image_width; x++) @@ -6730,6 +6746,7 @@ int xsane_transfer_to_gimp(char *input_filename, int apply_ICM_profile, int cms_ int bytes; unsigned char *data = NULL; guint16 *data16 = NULL; + size_t bytes_read; #ifdef HAVE_LIBLCMS unsigned char *data_raw = NULL; cmsHTRANSFORM hTransform = NULL; @@ -6935,13 +6952,13 @@ int xsane_transfer_to_gimp(char *input_filename, int apply_ICM_profile, int cms_ #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && apply_ICM_profile && (hTransform != NULL)) { - fread(data_raw, 1, image_info.image_width, imagefile); + bytes_read = fread(data_raw, 1, image_info.image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info.image_width); } else #endif { - fread(data, 1, image_info.image_width, imagefile); + bytes_read = fread(data, 1, image_info.image_width, imagefile); } for (x = 0; x < image_info.image_width; x++) @@ -6973,13 +6990,13 @@ int xsane_transfer_to_gimp(char *input_filename, int apply_ICM_profile, int cms_ #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && apply_ICM_profile && (hTransform != NULL)) { - fread(data_raw, 2, image_info.image_width, imagefile); + bytes_read = fread(data_raw, 2, image_info.image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info.image_width); } else #endif { - fread(data, 2, image_info.image_width, imagefile); + bytes_read = fread(data, 2, image_info.image_width, imagefile); } for (x = 0; x < image_info.image_width; x++) @@ -7019,13 +7036,13 @@ int xsane_transfer_to_gimp(char *input_filename, int apply_ICM_profile, int cms_ #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && apply_ICM_profile && (hTransform != NULL)) { - fread(data_raw, 3, image_info.image_width, imagefile); + bytes_read = fread(data_raw, 3, image_info.image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info.image_width); } else #endif { - fread(data, 3, image_info.image_width, imagefile); + bytes_read = fread(data, 3, image_info.image_width, imagefile); } for (x = 0; x < image_info.image_width; x++) @@ -7060,13 +7077,13 @@ int xsane_transfer_to_gimp(char *input_filename, int apply_ICM_profile, int cms_ #ifdef HAVE_LIBLCMS if ((cms_function != XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE) && apply_ICM_profile && (hTransform != NULL)) { - fread(data_raw, 6, image_info.image_width, imagefile); + bytes_read = fread(data_raw, 6, image_info.image_width, imagefile); cmsDoTransform(hTransform, data_raw, data, image_info.image_width); } else #endif { - fread(data, 6, image_info.image_width, imagefile); + bytes_read = fread(data, 6, image_info.image_width, imagefile); } for (x = 0; x < image_info.image_width; x++) @@ -7194,6 +7211,7 @@ static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx static void write_3chars_as_base64(unsigned char c1, unsigned char c2, unsigned char c3, int pads, int fd_socket) { char buf[4]; + ssize_t bytes_written; buf[0] = base64[c1>>2]; /* wirte bits 7-2 of first char */ buf[1] = base64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)]; /* write bits 1,0 of first and bits 7-4 of second char */ @@ -7214,7 +7232,7 @@ static void write_3chars_as_base64(unsigned char c1, unsigned char c2, unsigned buf[3] = base64[c3 & 0x3F]; /* write bits 5-0 of third char as lsb */ } - write(fd_socket, buf, 4); + bytes_written = write(fd_socket, buf, 4); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7224,6 +7242,7 @@ void write_string_base64(int fd_socket, char *string, int len) int i; int pad; unsigned char c1, c2, c3; + ssize_t bytes_written; for (i = 0; i < len; i+=3) { @@ -7249,7 +7268,7 @@ void write_string_base64(int fd_socket, char *string, int len) write_3chars_as_base64(c1, c2, c3, pad, fd_socket); } - write(fd_socket, "\r\n", 2); + bytes_written = write(fd_socket, "\r\n", 2); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7258,6 +7277,7 @@ void write_base64(int fd_socket, FILE *infile) { int c1, c2, c3; int pos = 0; + ssize_t bytes_written; while ((c1 = getc(infile)) != EOF) { @@ -7282,7 +7302,7 @@ void write_base64(int fd_socket, FILE *infile) pos += 4; if (pos > 71) { - write(fd_socket, "\r\n", 2); + bytes_written = write(fd_socket, "\r\n", 2); pos = 0; } @@ -7297,7 +7317,7 @@ void write_base64(int fd_socket, FILE *infile) if (pos) { - write(fd_socket, "\r\n", 2); + bytes_written = write(fd_socket, "\r\n", 2); } xsane.email_progress_val = 1.0; @@ -7309,35 +7329,36 @@ void write_base64(int fd_socket, FILE *infile) void write_email_header(int fd_socket, char *from, char *reply_to, char *to, char *subject, char *boundary, int related) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "From: %s\r\n", from); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Reply-To: %s\r\n", reply_to); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "To: %s\r\n", to); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Subject: %s\r\n", subject); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "MIME-Version: 1.0\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); if (related) /* related means that we need a special link in the html part to display the image */ { snprintf(buf, sizeof(buf), "Content-Type: multipart/related;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } else { snprintf(buf, sizeof(buf), "Content-Type: multipart/mixed;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } snprintf(buf, sizeof(buf), " boundary=\"%s\"\r\n\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7345,9 +7366,10 @@ void write_email_header(int fd_socket, char *from, char *reply_to, char *to, cha void write_email_footer(int fd_socket, char *boundary) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "--%s--\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7355,18 +7377,19 @@ void write_email_footer(int fd_socket, char *boundary) void write_email_mime_ascii(int fd_socket, char *boundary) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "--%s\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Type: text/plain;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), " charset=\"iso-8859-1\"\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Transfer-Encoding: 8bit\r\n\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7374,24 +7397,25 @@ void write_email_mime_ascii(int fd_socket, char *boundary) void write_email_mime_html(int fd_socket, char *boundary) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "--%s\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Type: text/html;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), " charset=\"us-ascii\"\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Transfer-Encoding: 7bit\r\n\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -7399,30 +7423,31 @@ void write_email_mime_html(int fd_socket, char *boundary) void write_email_attach_image(int fd_socket, char *boundary, char *content_id, char *content_type, FILE *infile, char *filename) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "--%s\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Type: %s\r\n", content_type); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); if (content_id) { snprintf(buf, sizeof(buf), "Content-ID: <%s>\r\n", content_id); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); } snprintf(buf, sizeof(buf), "Content-Transfer-Encoding: base64\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Disposition: inline;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), " filename=\"%s\"\r\n", filename); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); write_base64(fd_socket, infile); } @@ -7432,27 +7457,28 @@ void write_email_attach_image(int fd_socket, char *boundary, char *content_id, c void write_email_attach_file(int fd_socket, char *boundary, FILE *infile, char *filename) { char buf[1024]; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "--%s\r\n", boundary); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Type: application/octet-stream\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), " name=\"%s\"\r\n", filename); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Transfer-Encoding: base64\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "Content-Disposition: attachment;\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), " filename=\"%s\"\r\n", filename); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "\r\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); write_base64(fd_socket, infile); } @@ -7521,6 +7547,7 @@ int pop3_login(int fd_socket, char *user, char *passwd) { char buf[1024]; int len; + ssize_t bytes_written; len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) @@ -7531,7 +7558,7 @@ int pop3_login(int fd_socket, char *user, char *passwd) snprintf(buf, sizeof(buf), "USER %s\r\n", user); DBG(DBG_info2, "> USER xxx\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7545,7 +7572,7 @@ int pop3_login(int fd_socket, char *user, char *passwd) snprintf(buf, sizeof(buf), "PASS %s\r\n", passwd); DBG(DBG_info2, "> PASS xxx\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7559,7 +7586,7 @@ int pop3_login(int fd_socket, char *user, char *passwd) snprintf(buf, sizeof(buf), "QUIT\r\n"); DBG(DBG_info2, "> QUIT\n"); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7576,6 +7603,7 @@ int asmtp_authentication(int fd_socket, int auth_type, char *user, char *passwd) { int len; char buf[1024]; + ssize_t bytes_written; DBG(DBG_proc, "asmtp_authentication\n"); @@ -7584,7 +7612,7 @@ int asmtp_authentication(int fd_socket, int auth_type, char *user, char *passwd) case EMAIL_AUTH_ASMTP_PLAIN: snprintf(buf, sizeof(buf), "AUTH PLAIN "); DBG(DBG_info2, "> %s\\0(USER)\\0(PASSWORD)\n", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); snprintf(buf, sizeof(buf), "%c%s%c%s", 0, user, 0, passwd); write_string_base64(fd_socket, buf, strlen(user)+strlen(passwd)+2); len = read(fd_socket, buf, sizeof(buf)); @@ -7598,7 +7626,7 @@ int asmtp_authentication(int fd_socket, int auth_type, char *user, char *passwd) case EMAIL_AUTH_ASMTP_LOGIN: snprintf(buf, sizeof(buf), "AUTH LOGIN\r\n"); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7646,7 +7674,7 @@ int asmtp_authentication(int fd_socket, int auth_type, char *user, char *passwd) case EMAIL_AUTH_ASMTP_CRAM_MD5: snprintf(buf, sizeof(buf), "AUTH CRAM-MD5\r\n"); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7675,6 +7703,7 @@ int write_smtp_header(int fd_socket, char *from, char *to, int auth_type, char * char to_line[1024]; char *to_pos = NULL; char *pos = NULL; + ssize_t bytes_written; len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) @@ -7692,7 +7721,7 @@ int write_smtp_header(int fd_socket, char *from, char *to, int auth_type, char * snprintf(buf, sizeof(buf), "EHLO localhost\r\n"); } DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7726,7 +7755,7 @@ int write_smtp_header(int fd_socket, char *from, char *to, int auth_type, char * } snprintf(buf, sizeof(buf), "MAIL FROM: <%s>\r\n", from); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7766,7 +7795,7 @@ int write_smtp_header(int fd_socket, char *from, char *to, int auth_type, char * snprintf(buf, sizeof(buf), "RCPT TO: <%s>\r\n", to_pos); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7799,7 +7828,7 @@ int write_smtp_header(int fd_socket, char *from, char *to, int auth_type, char * snprintf(buf, sizeof(buf), "DATA\r\n"); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7830,10 +7859,11 @@ int write_smtp_footer(int fd_socket) { char buf[1024]; int len; + ssize_t bytes_written; snprintf(buf, sizeof(buf), "\r\n.\r\n"); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { @@ -7843,7 +7873,7 @@ int write_smtp_footer(int fd_socket) snprintf(buf, sizeof(buf), "QUIT\r\n"); DBG(DBG_info2, "> %s", buf); - write(fd_socket, buf, strlen(buf)); + bytes_written = write(fd_socket, buf, strlen(buf)); len = read(fd_socket, buf, sizeof(buf)); if (len >= 0) { diff --git a/src/xsane-scan.c b/src/xsane-scan.c index fb32ba6..88f954a 100644 --- a/src/xsane-scan.c +++ b/src/xsane-scan.c @@ -3,7 +3,7 @@ xsane-scan.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -141,6 +141,7 @@ static void xsane_read_image_data(gpointer data, gint source, GdkInputCondition SANE_Int len; int i, j; char buf[TEXTBUFSIZE]; + size_t bytes_read; DBG(DBG_proc, "xsane_read_image_data\n"); @@ -394,7 +395,7 @@ static void xsane_read_image_data(gpointer data, gint source, GdkInputCondition long fpos = ftell(xsane.out); fseek(xsane.out, 0, SEEK_CUR); /* sync between write and read */ - fread(rgbbuf, 1, bytes - 1, xsane.out); + bytes_read = fread(rgbbuf, 1, bytes - 1, xsane.out); fseek(xsane.out, fpos, SEEK_SET); } diff --git a/src/xsane-setup.c b/src/xsane-setup.c index 1ea961c..f047584 100644 --- a/src/xsane-setup.c +++ b/src/xsane-setup.c @@ -3,7 +3,7 @@ xsane-setup.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -910,7 +910,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 256 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 256); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -920,7 +920,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 128 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 128); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -930,7 +930,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 64 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_SEARCH); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 64); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -948,7 +948,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 32 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 32); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -957,7 +957,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 16 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 16); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -966,7 +966,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 8 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_SEARCH); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 8); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -984,7 +984,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 4 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 4); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -993,7 +993,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 2 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 2); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); @@ -1002,7 +1002,7 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 1 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_SEARCH); - gtk_widget_set_size_request(button, 21, -1); + gtk_widget_set_size_request(button, 26, -1); gtk_widget_set_name(button, name); g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 1); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); diff --git a/src/xsane-viewer.c b/src/xsane-viewer.c index ac14e71..69a444d 100644 --- a/src/xsane-viewer.c +++ b/src/xsane-viewer.c @@ -3,7 +3,7 @@ xsane-viewer.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify diff --git a/src/xsane.c b/src/xsane.c index 66072a4..775610e 100644 --- a/src/xsane.c +++ b/src/xsane.c @@ -3,7 +3,7 @@ xsane.c Oliver Rauch - Copyright (C) 1998-2007 Oliver Rauch + Copyright (C) 1998-2010 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -1218,7 +1218,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */ gtk_widget_show(pixmapwidget); /* adf pages maximum */ - adjustment = gtk_adjustment_new(preferences.adf_pages_max, 1, 9999, 1, 10, 1); + adjustment = gtk_adjustment_new(preferences.adf_pages_max, 1, 9999, 1, 10, 0); xsane_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 0, 0); gtk_widget_set_size_request(xsane_spinbutton, 55, -1); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(xsane_spinbutton), FALSE); @@ -1317,7 +1317,7 @@ GtkWidget *xsane_update_xsane_callback() /* creates the XSane option window */ /* number of copies */ - adjustment = gtk_adjustment_new(xsane.copy_number, 1, 99, 1, 10, 1); + adjustment = gtk_adjustment_new(xsane.copy_number, 1, 99, 1, 10, 0); xsane_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 0, 0); gtk_widget_set_size_request(xsane_spinbutton, 40, -1); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(xsane_spinbutton), FALSE); @@ -3219,7 +3219,7 @@ static void xsane_info_dialog(GtkWidget *widget, gpointer data) } else { - snprintf(buf, sizeof(buf), xsane.devlist[xsane.selected_dev]->name); + snprintf(buf, sizeof(buf), "%s", xsane.devlist[xsane.selected_dev]->name); } label = xsane_info_table_text_new(table, buf, 1, 3); @@ -4995,7 +4995,7 @@ static void xsane_device_dialog(void) snprintf(buf, sizeof(buf), ":%s", devname); snprintf(buf, sizeof(buf), "/%s", (strrchr(buf, ':')+1)); - sprintf(textptr, (strrchr(buf, '/')+1)); + sprintf(textptr, "%s", (strrchr(buf, '/')+1)); xsane.device_text = strdup(devicetext); diff --git a/src/xsane.h b/src/xsane.h index 6aa0f2a..cf6111f 100644 --- a/src/xsane.h +++ b/src/xsane.h @@ -91,10 +91,10 @@ /* ---------------------------------------------------------------------------------------------------------------------- */ -#define XSANE_VERSION "0.997" +#define XSANE_VERSION "0.998" #define XSANE_AUTHOR "Oliver Rauch" #define XSANE_COPYRIGHT "Oliver Rauch" -#define XSANE_DATE "1998-2007" +#define XSANE_DATE "1998-2010" #define XSANE_EMAIL_ADR "Oliver.Rauch@xsane.org" #define XSANE_HOMEPAGE "http://www.xsane.org" #define XSANE_COPYRIGHT_TXT XSANE_DATE " " XSANE_COPYRIGHT -- cgit v1.2.3