brasero r1024 - in trunk: . src src/plugins/cdrdao src/plugins/cdrkit src/plugins/cdrtools src/plugins/dvdcss src/plugins/growisofs



Author: philippr
Date: Sat Jul 19 18:30:15 2008
New Revision: 1024
URL: http://svn.gnome.org/viewvc/brasero?rev=1024&view=rev

Log:
	Improve and fix #542718 â Creating large ISO fails due to filesystem restrictions
	Also fix variable overflow in mkisofs, genisoimage, cdrdao when they reported
	size of output

	* src/brasero-drive-properties.c
	(brasero_drive_properties_set_tmpdir_info),
	(brasero_drive_properties_tmpdir_changed_cb),
	(brasero_drive_properties_set_tmpdir),
	(brasero_drive_properties_init),
	(brasero_drive_properties_finalize):
	* src/burn-job.c (brasero_job_check_output_volume_space):
	* src/plugins/cdrdao/burn-cdrdao.c
	(brasero_cdrdao_read_stderr_image), (brasero_cdrdao_set_argv):
	* src/plugins/cdrkit/burn-genisoimage.c
	(brasero_genisoimage_read_isosize):
	* src/plugins/cdrkit/burn-readom.c (brasero_readom_get_size):
	* src/plugins/cdrtools/burn-mkisofs.c
	(brasero_mkisofs_read_isosize):
	* src/plugins/cdrtools/burn-readcd.c (brasero_readcd_get_size):
	* src/plugins/dvdcss/burn-dvdcss-private.h:
	* src/plugins/growisofs/burn-growisofs.c
	(brasero_growisofs_read_stderr):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-drive-properties.c
   trunk/src/burn-job.c
   trunk/src/plugins/cdrdao/burn-cdrdao.c
   trunk/src/plugins/cdrkit/burn-genisoimage.c
   trunk/src/plugins/cdrkit/burn-readom.c
   trunk/src/plugins/cdrtools/burn-mkisofs.c
   trunk/src/plugins/cdrtools/burn-readcd.c
   trunk/src/plugins/dvdcss/burn-dvdcss-private.h
   trunk/src/plugins/growisofs/burn-growisofs.c

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Sat Jul 19 18:30:15 2008
@@ -61,6 +61,10 @@
 
 	GtkWidget *tmpdir;
 	GtkWidget *tmpdir_size;
+
+	gchar *previous_path;
+
+	guint check_filesystem:1;
 };
 
 #define BRASERO_DRIVE_PROPERTIES_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DRIVE_PROPERTIES, BraseroDrivePropertiesPrivate))
@@ -129,14 +133,14 @@
 	return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->tmpdir));
 }
 
-void
-brasero_drive_properties_set_tmpdir (BraseroDriveProperties *self,
-				     const gchar *path)
+static gboolean
+brasero_drive_properties_set_tmpdir_info (BraseroDriveProperties *self,
+					  const gchar *path,
+					  gboolean warn)
 {
 	GFile *file;
 	gchar *string;
 	GFileInfo *info;
-	gchar *directory;
 	GError *error = NULL;
 	guint64 vol_size = 0;
 	const gchar *filesystem;
@@ -144,23 +148,17 @@
 
 	priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (self);
 
-	if (!path)
-		path = g_get_tmp_dir ();
-
 	/* get the volume free space */
-	directory = g_path_get_dirname (path);
-	file = g_file_new_for_commandline_arg (directory);
-	g_free (directory);
-
-	if (file == NULL) {
+	file = g_file_new_for_commandline_arg (path);
+	if (!file) {
 		BRASERO_BURN_LOG ("impossible to retrieve size for %s", path);
 		gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), _("unknown"));
-		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir), path);
-		return;
+		return FALSE;
 	}
 
 	info = g_file_query_filesystem_info (file,
-					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ",",
+					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
+					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
 					     NULL,
 					     &error);
 	g_object_unref (file);
@@ -172,7 +170,7 @@
 		g_error_free (error);
 
 		gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), _("unknown"));
-		return;
+		return FALSE;
 	}
 
 	/* NOTE/FIXME: also check, probably best at start or in a special dialog
@@ -183,7 +181,9 @@
 	 * filesystems have a maximum file size limit of 4 Gio and more than
 	 * often we need a temporary file size of 4 Gio or more. */
 	filesystem = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
-	if (filesystem && !strcmp (filesystem, "msdos")) {
+	if (priv->check_filesystem
+	&&  filesystem
+	&& !strcmp (filesystem, "msdos")) {
 		gint answer;
 		GtkWidget *dialog;
 		GtkWidget *toplevel;
@@ -211,11 +211,11 @@
 
 		if (answer != GTK_RESPONSE_OK) {
 			g_object_unref (info);
-			return;
+			return FALSE;
 		}
-	}
 
-	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir), path);
+		priv->check_filesystem = 1;
+	}
 
 	vol_size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
 	g_object_unref (info);
@@ -223,6 +223,72 @@
 	string = brasero_utils_get_size_string (vol_size, TRUE, TRUE);
 	gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), string);
 	g_free (string);
+
+	return TRUE;
+}
+
+static void
+brasero_drive_properties_tmpdir_changed_cb (GtkFileChooser *chooser,
+					    BraseroDriveProperties *self)
+{
+	gchar *path;
+	gboolean result;
+	BraseroDrivePropertiesPrivate *priv;
+
+	priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (self);
+
+	priv->check_filesystem = 1;
+	path = gtk_file_chooser_get_filename (chooser);
+	result = brasero_drive_properties_set_tmpdir_info (self, path, TRUE);
+	g_free (path);
+
+	if (result) {
+		if (priv->previous_path)
+			g_free (priv->previous_path);
+
+		priv->previous_path = gtk_file_chooser_get_filename (chooser);
+		return;
+	}
+
+	g_signal_handlers_block_by_func (chooser,
+					 brasero_drive_properties_tmpdir_changed_cb,
+					 self);
+	if (priv->previous_path)
+		gtk_file_chooser_set_filename (chooser, priv->previous_path);
+	else
+		gtk_file_chooser_set_filename (chooser, g_get_tmp_dir ());
+
+	g_signal_handlers_unblock_by_func (chooser,
+					   brasero_drive_properties_tmpdir_changed_cb,
+					   self);
+}
+
+void
+brasero_drive_properties_set_tmpdir (BraseroDriveProperties *self,
+				     const gchar *path)
+{
+	BraseroDrivePropertiesPrivate *priv;
+
+	priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (self);
+
+	if (!path)
+		path = g_get_tmp_dir ();
+
+	priv->check_filesystem = 0;
+	brasero_drive_properties_set_tmpdir_info (self, path, FALSE);
+
+	g_signal_handlers_block_by_func (GTK_FILE_CHOOSER (priv->tmpdir),
+					 brasero_drive_properties_tmpdir_changed_cb,
+					 self);
+	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir), path);
+	g_signal_handlers_unblock_by_func (GTK_FILE_CHOOSER (priv->tmpdir),
+					   brasero_drive_properties_tmpdir_changed_cb,
+					   self);
+
+	if (priv->previous_path)
+		g_free (priv->previous_path);
+
+	priv->previous_path = g_strdup (path);
 }
 
 static void
@@ -451,12 +517,26 @@
 	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir),
 				       g_get_tmp_dir ());
 
+	g_signal_connect (priv->tmpdir,
+			  "file-set",
+			  G_CALLBACK (brasero_drive_properties_tmpdir_changed_cb),
+			  object);
+
 	gtk_widget_show_all (GTK_DIALOG (object)->vbox);
 }
 
 static void
 brasero_drive_properties_finalize (GObject *object)
 {
+	BraseroDrivePropertiesPrivate *priv;
+
+	priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (object);
+
+	if (priv->previous_path) {
+		g_free (priv->previous_path);
+		priv->previous_path = NULL;
+	}
+
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 

Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c	(original)
+++ trunk/src/burn-job.c	Sat Jul 19 18:30:15 2008
@@ -458,13 +458,17 @@
 
 	g_object_unref (file);
 
+	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
+
 	/* Now check the filesystem type: the problem here is that some
 	 * filesystems have a maximum file size limit of 4 Gio and more than
 	 * often we need a temporary file size of 4 Gio or more. */
 	filesystem = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
 	BRASERO_BURN_LOG ("%s filesystem detected", filesystem);
 
-	if (filesystem && !strcmp (filesystem, "msdos")) {
+	if (output_size >= 2147483648ULL
+	&&  filesystem
+	&& !strcmp (filesystem, "msdos")) {
 		/* FIXME: This string should mention that the location is on the
 		 * hard drive and not the medium itself to prevent any confusion
 		 * as seen in #533149 */
@@ -473,8 +477,7 @@
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_DISK_SPACE,
-			     _("the selected location does not have enough free space to store the disc image (%ld MiB needed)"),
-			     (unsigned long) output_size / 1048576);
+			     _("The filesystem you chose to store the temporary image on cannot hold files with a size over 2 Gio."));
 		return BRASERO_BURN_ERR;
 	}
 
@@ -482,8 +485,6 @@
 	g_object_unref (info);
 
 	/* get the size of the output this job is supposed to create */
-	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
-
 	BRASERO_BURN_LOG ("Volume size %lli, output size %lli", vol_size, output_size);
 
 	/* it's fine here to check size in bytes */

Modified: trunk/src/plugins/cdrdao/burn-cdrdao.c
==============================================================================
--- trunk/src/plugins/cdrdao/burn-cdrdao.c	(original)
+++ trunk/src/plugins/cdrdao/burn-cdrdao.c	Sat Jul 19 18:30:15 2008
@@ -70,7 +70,7 @@
 		brasero_job_get_action (BRASERO_JOB (cdrdao), &action);
 		if (action == BRASERO_JOB_ACTION_SIZE) {
 			/* get the number of sectors. As we added -raw sector = 2352 bytes */
-			brasero_job_set_output_size_for_current_track (BRASERO_JOB (cdrdao), s1, s1 * 2352);
+			brasero_job_set_output_size_for_current_track (BRASERO_JOB (cdrdao), s1, (gint64) s1 * 2352ULL);
 			brasero_job_finished_session (BRASERO_JOB (cdrdao));
 		}
 	}
@@ -495,7 +495,7 @@
 
 			brasero_job_set_output_size_for_current_track (BRASERO_JOB (cdrdao),
 								       sectors,
-								       sectors * 2352);
+								       sectors * 2352ULL);
 		}
 		else
 			return BRASERO_BURN_NOT_SUPPORTED;

Modified: trunk/src/plugins/cdrkit/burn-genisoimage.c
==============================================================================
--- trunk/src/plugins/cdrkit/burn-genisoimage.c	(original)
+++ trunk/src/plugins/cdrkit/burn-genisoimage.c	Sat Jul 19 18:30:15 2008
@@ -60,7 +60,7 @@
 static BraseroBurnResult
 brasero_genisoimage_read_isosize (BraseroProcess *process, const gchar *line)
 {
-	gint sectors;
+	gint64 sectors;
 
 	sectors = strtoll (line, NULL, 10);
 	if (!sectors)
@@ -69,7 +69,7 @@
 	/* genisoimage reports blocks of 2048 bytes */
 	brasero_job_set_output_size_for_current_track (BRASERO_JOB (process),
 						       sectors,
-						       sectors * 2048);
+						       (gint64) sectors * 2048ULL);
 	return BRASERO_BURN_OK;
 }
 

Modified: trunk/src/plugins/cdrkit/burn-readom.c
==============================================================================
--- trunk/src/plugins/cdrkit/burn-readom.c	(original)
+++ trunk/src/plugins/cdrkit/burn-readom.c	Sat Jul 19 18:30:15 2008
@@ -214,12 +214,12 @@
 	if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_BIN) {
 		brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
 							       blocks,
-							       blocks * 2048);
+							       blocks * 2048ULL);
 	}
 	else if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE) {
 		brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
 							       blocks,
-							       blocks * 2448);
+							       blocks * 2448ULL);
 	}
 	else
 		return BRASERO_BURN_NOT_SUPPORTED;

Modified: trunk/src/plugins/cdrtools/burn-mkisofs.c
==============================================================================
--- trunk/src/plugins/cdrtools/burn-mkisofs.c	(original)
+++ trunk/src/plugins/cdrtools/burn-mkisofs.c	Sat Jul 19 18:30:15 2008
@@ -61,7 +61,7 @@
 static BraseroBurnResult
 brasero_mkisofs_read_isosize (BraseroProcess *process, const gchar *line)
 {
-	gint sectors;
+	gint64 sectors;
 
 	sectors = strtoll (line, NULL, 10);
 	if (!sectors)
@@ -70,7 +70,7 @@
 	/* mkisofs reports blocks of 2048 bytes */
 	brasero_job_set_output_size_for_current_track (BRASERO_JOB (process),
 						       sectors,
-						       sectors * 2048);
+						       sectors * 2048ULL);
 	return BRASERO_BURN_OK;
 }
 

Modified: trunk/src/plugins/cdrtools/burn-readcd.c
==============================================================================
--- trunk/src/plugins/cdrtools/burn-readcd.c	(original)
+++ trunk/src/plugins/cdrtools/burn-readcd.c	Sat Jul 19 18:30:15 2008
@@ -214,12 +214,12 @@
 	if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_BIN) {
 		brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
 							       blocks,
-							       blocks * 2048);
+							       blocks * 2048ULL);
 	}
 	else if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE) {
 		brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
 							       blocks,
-							       blocks * 2448);
+							       blocks * 2448ULL);
 	}
 	else
 		return BRASERO_BURN_NOT_SUPPORTED;

Modified: trunk/src/plugins/dvdcss/burn-dvdcss-private.h
==============================================================================
--- trunk/src/plugins/dvdcss/burn-dvdcss-private.h	(original)
+++ trunk/src/plugins/dvdcss/burn-dvdcss-private.h	Sat Jul 19 18:30:15 2008
@@ -41,7 +41,7 @@
 #define DVDCSS_SEEK_MPEG	(1 << 0)
 #define DVDCSS_SEEK_KEY		(1 << 1)
 
-#define DVDCSS_BLOCK_SIZE	2048
+#define DVDCSS_BLOCK_SIZE	2048ULL
 
 static dvdcss_handle *
 (*dvdcss_open)	(const gchar *device) = NULL;

Modified: trunk/src/plugins/growisofs/burn-growisofs.c
==============================================================================
--- trunk/src/plugins/growisofs/burn-growisofs.c	(original)
+++ trunk/src/plugins/growisofs/burn-growisofs.c	Sat Jul 19 18:30:15 2008
@@ -150,7 +150,7 @@
 			/* NOTE: this has to be a multiple of 2048 */
 			brasero_job_set_output_size_for_current_track (BRASERO_JOB (process),
 								       sectors,
-								       sectors * 2048);
+								       sectors * 2048ULL);
 
 			/* we better tell growisofs to stop here as it returns 
 			 * a value of 1 when mkisofs is run with --print-size */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]