[brasero/gnome-2-26] Fix #582261 – brasero shows 0% done, while continues burning disc
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero/gnome-2-26] Fix #582261 – brasero shows 0% done, while continues burning disc
- Date: Sun, 28 Jun 2009 12:13:56 +0000 (UTC)
commit 4429f2030f02298ff4426b5e0247f01e0a864440
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Mon Jun 22 22:03:22 2009 +0200
Fix #582261 â?? brasero shows 0% done, while continues burning disc
Fixed an overflow in variable that stopped wodim/cdrecord to work properly for a size over 2GiB
src/burn-job.c | 10 ++++----
src/burn-job.h | 8 +++---
src/burn-task-ctx.c | 8 +++---
src/plugins/cdrkit/burn-wodim.c | 41 ++++++++++++++++++--------------
src/plugins/cdrtools/burn-cdrecord.c | 43 +++++++++++++++++++--------------
5 files changed, 61 insertions(+), 49 deletions(-)
---
diff --git a/src/burn-job.c b/src/burn-job.c
index 9b17572..9468121 100644
--- a/src/burn-job.c
+++ b/src/burn-job.c
@@ -1901,8 +1901,8 @@ brasero_job_set_rate (BraseroJob *self,
BraseroBurnResult
brasero_job_set_output_size_for_current_track (BraseroJob *self,
- gint64 sectors,
- gint64 size)
+ goffset sectors,
+ goffset bytes)
{
BraseroJobPrivate *priv;
@@ -1922,12 +1922,12 @@ brasero_job_set_output_size_for_current_track (BraseroJob *self,
return brasero_task_ctx_set_output_size_for_current_track (priv->ctx,
sectors,
- size);
+ bytes);
}
BraseroBurnResult
brasero_job_set_written_track (BraseroJob *self,
- gint64 written)
+ goffset written)
{
BraseroJobPrivate *priv;
@@ -1943,7 +1943,7 @@ brasero_job_set_written_track (BraseroJob *self,
BraseroBurnResult
brasero_job_set_written_session (BraseroJob *self,
- gint64 written)
+ goffset written)
{
BraseroJobPrivate *priv;
diff --git a/src/burn-job.h b/src/burn-job.h
index f44e239..c3ead7b 100644
--- a/src/burn-job.h
+++ b/src/burn-job.h
@@ -259,10 +259,10 @@ brasero_job_set_rate (BraseroJob *job,
gint64 rate);
BraseroBurnResult
brasero_job_set_written_track (BraseroJob *job,
- gint64 written);
+ goffset written);
BraseroBurnResult
brasero_job_set_written_session (BraseroJob *job,
- gint64 written);
+ goffset written);
BraseroBurnResult
brasero_job_set_progress (BraseroJob *job,
gdouble progress);
@@ -276,8 +276,8 @@ brasero_job_get_current_action (BraseroJob *job,
BraseroBurnAction *action);
BraseroBurnResult
brasero_job_set_output_size_for_current_track (BraseroJob *job,
- gint64 sectors,
- gint64 size);
+ goffset sectors,
+ goffset bytes);
/**
* Used to tell it's (or not) dangerous to interrupt this job
diff --git a/src/burn-task-ctx.c b/src/burn-task-ctx.c
index 445704f..6b84147 100644
--- a/src/burn-task-ctx.c
+++ b/src/burn-task-ctx.c
@@ -526,8 +526,8 @@ brasero_task_ctx_set_rate (BraseroTaskCtx *self,
BraseroBurnResult
brasero_task_ctx_set_output_size_for_current_track (BraseroTaskCtx *self,
- gint64 sectors,
- gint64 size)
+ goffset sectors,
+ goffset bytes)
{
BraseroTaskCtxPrivate *priv;
@@ -545,8 +545,8 @@ brasero_task_ctx_set_output_size_for_current_track (BraseroTaskCtx *self,
if (sectors >= 0)
priv->blocks += sectors;
- if (size >= 0)
- priv->size += size;
+ if (bytes >= 0)
+ priv->size += bytes;
BRASERO_BURN_LOG ("Task output modified %lli blocks %lli bytes",
priv->blocks,
diff --git a/src/plugins/cdrkit/burn-wodim.c b/src/plugins/cdrkit/burn-wodim.c
index 0253984..aeeeeeb 100644
--- a/src/plugins/cdrkit/burn-wodim.c
+++ b/src/plugins/cdrkit/burn-wodim.c
@@ -55,8 +55,8 @@
BRASERO_PLUGIN_BOILERPLATE (BraseroWodim, brasero_wodim, BRASERO_TYPE_PROCESS, BraseroProcess);
struct _BraseroWodimPrivate {
- gint64 current_track_end_pos;
- gint64 current_track_written;
+ goffset current_track_end_pos;
+ goffset current_track_written;
gint current_track_num;
gint track_count;
@@ -202,30 +202,30 @@ brasero_wodim_stderr_read (BraseroProcess *process, const gchar *line)
static void
brasero_wodim_compute (BraseroWodim *wodim,
- gint mb_written,
- gint mb_total,
- gint track_num)
+ goffset mb_written,
+ goffset mb_total,
+ goffset track_num)
{
gboolean track_num_changed = FALSE;
BraseroWodimPrivate *priv;
BraseroJobAction action;
- gint64 this_remain;
- gint64 bytes;
- gint64 total;
+ goffset this_remain;
+ goffset bytes;
+ goffset total;
priv = BRASERO_WODIM_PRIVATE (wodim);
if (mb_total <= 0)
return;
- total = mb_total * 1048576;
+ total = mb_total * (goffset) 1048576LL;
if (track_num > priv->current_track_num) {
track_num_changed = TRUE;
priv->current_track_num = track_num;
- priv->current_track_end_pos += mb_total * 1048576;
+ priv->current_track_end_pos += mb_total * (goffset) 1048576LL;
}
- this_remain = (mb_total - mb_written) * 1048576;
+ this_remain = (mb_total - mb_written) * (goffset) 1048576LL;
bytes = (total - priv->current_track_end_pos) + this_remain;
brasero_job_set_written_session (BRASERO_JOB (wodim), total - bytes);
@@ -270,7 +270,7 @@ brasero_wodim_stdout_read (BraseroProcess *process, const gchar *line)
(gdouble) CD_RATE;
brasero_job_set_rate (BRASERO_JOB (wodim), current_rate);
- priv->current_track_written = mb_written * 1048576;
+ priv->current_track_written = (goffset) mb_written * (goffset) 1048576LL;
brasero_wodim_compute (wodim,
mb_written,
mb_total,
@@ -288,7 +288,7 @@ brasero_wodim_stdout_read (BraseroProcess *process, const gchar *line)
(gdouble) CD_RATE;
brasero_job_set_rate (BRASERO_JOB (wodim), current_rate);
- priv->current_track_written = mb_written * 1048576;
+ priv->current_track_written = (goffset) mb_written * (goffset) 1048576LL;
if (brasero_job_get_fd_in (BRASERO_JOB (wodim), NULL) == BRASERO_BURN_OK) {
gint64 bytes = 0;
@@ -296,7 +296,7 @@ brasero_wodim_stdout_read (BraseroProcess *process, const gchar *line)
brasero_job_get_session_output_size (BRASERO_JOB (wodim),
NULL,
&bytes);
- mb_total = bytes / 1048576;
+ mb_total = bytes / (goffset) 1048576LL;
brasero_wodim_compute (wodim,
mb_written,
mb_total,
@@ -352,10 +352,15 @@ brasero_wodim_stdout_read (BraseroProcess *process, const gchar *line)
}
else if (g_str_has_prefix (line, "Fixating...")
|| g_str_has_prefix (line, "Writing Leadout...")) {
- brasero_job_set_current_action (BRASERO_JOB (process),
- BRASERO_BURN_ACTION_FIXATING,
- NULL,
- FALSE);
+ BraseroJobAction action;
+
+ /* Do this to avoid strange things to appear when erasing */
+ brasero_job_get_action (BRASERO_JOB (wodim), &action);
+ if (action == BRASERO_JOB_ACTION_RECORD)
+ brasero_job_set_current_action (BRASERO_JOB (process),
+ BRASERO_BURN_ACTION_FIXATING,
+ NULL,
+ FALSE);
}
else if (g_str_has_prefix (line, "Last chance to quit, ")) {
brasero_job_set_dangerous (BRASERO_JOB (process), TRUE);
diff --git a/src/plugins/cdrtools/burn-cdrecord.c b/src/plugins/cdrtools/burn-cdrecord.c
index b19caf6..3bdb62c 100644
--- a/src/plugins/cdrtools/burn-cdrecord.c
+++ b/src/plugins/cdrtools/burn-cdrecord.c
@@ -55,8 +55,8 @@
BRASERO_PLUGIN_BOILERPLATE (BraseroCDRecord, brasero_cdrecord, BRASERO_TYPE_PROCESS, BraseroProcess);
struct _BraseroCDRecordPrivate {
- gint64 current_track_end_pos;
- gint64 current_track_written;
+ goffset current_track_end_pos;
+ goffset current_track_written;
gint current_track_num;
gint track_count;
@@ -203,34 +203,36 @@ brasero_cdrecord_stderr_read (BraseroProcess *process, const gchar *line)
static void
brasero_cdrecord_compute (BraseroCDRecord *cdrecord,
- gint mb_written,
- gint mb_total,
- gint track_num)
+ goffset mb_written,
+ goffset mb_total,
+ goffset track_num)
{
gboolean track_num_changed = FALSE;
BraseroCDRecordPrivate *priv;
gchar *action_string;
- gint64 this_remain;
- gint64 bytes;
- gint64 total;
+ goffset this_remain;
+ goffset bytes;
+ goffset total;
priv = BRASERO_CD_RECORD_PRIVATE (cdrecord);
if (mb_total <= 0)
return;
- total = mb_total * 1048576;
+ total = mb_total * (goffset) 1048576LL;
if (track_num > priv->current_track_num) {
track_num_changed = TRUE;
priv->current_track_num = track_num;
- priv->current_track_end_pos += mb_total * 1048576;
+ priv->current_track_end_pos += mb_total * (goffset) 1048576LL;
}
- this_remain = (mb_total - mb_written) * 1048576;
+ this_remain = (mb_total - mb_written) * (goffset) 1048576LL;
bytes = (total - priv->current_track_end_pos) + this_remain;
brasero_job_set_written_session (BRASERO_JOB (cdrecord), total - bytes);
+ /* Translators: %s is the number of the track */
action_string = g_strdup_printf ("Writing track %02i", track_num);
+
brasero_job_set_current_action (BRASERO_JOB (cdrecord),
BRASERO_BURN_ACTION_RECORDING,
action_string,
@@ -259,7 +261,7 @@ brasero_cdrecord_stdout_read (BraseroProcess *process, const gchar *line)
(gdouble) CD_RATE;
brasero_job_set_rate (BRASERO_JOB (cdrecord), current_rate);
- priv->current_track_written = mb_written * 1048576;
+ priv->current_track_written = (goffset) mb_written * (goffset) 1048576LL;
brasero_cdrecord_compute (cdrecord,
mb_written,
mb_total,
@@ -277,7 +279,7 @@ brasero_cdrecord_stdout_read (BraseroProcess *process, const gchar *line)
(gdouble) CD_RATE;
brasero_job_set_rate (BRASERO_JOB (cdrecord), current_rate);
- priv->current_track_written = mb_written * 1048576;
+ priv->current_track_written = (goffset) mb_written * (goffset) 1048576LL;
if (brasero_job_get_fd_in (BRASERO_JOB (cdrecord), NULL) == BRASERO_BURN_OK) {
gint64 bytes = 0;
@@ -285,7 +287,7 @@ brasero_cdrecord_stdout_read (BraseroProcess *process, const gchar *line)
brasero_job_get_session_output_size (BRASERO_JOB (cdrecord),
NULL,
&bytes);
- mb_total = bytes / 1048576;
+ mb_total = bytes / (goffset) 1048576LL;
brasero_cdrecord_compute (cdrecord,
mb_written,
mb_total,
@@ -337,10 +339,15 @@ brasero_cdrecord_stdout_read (BraseroProcess *process, const gchar *line)
}
else if (g_str_has_prefix (line, "Fixating...")
|| g_str_has_prefix (line, "Writing Leadout...")) {
- brasero_job_set_current_action (BRASERO_JOB (process),
- BRASERO_BURN_ACTION_FIXATING,
- NULL,
- FALSE);
+ BraseroJobAction action;
+
+ /* Do this to avoid strange things to appear when erasing */
+ brasero_job_get_action (BRASERO_JOB (process), &action);
+ if (action == BRASERO_JOB_ACTION_RECORD)
+ brasero_job_set_current_action (BRASERO_JOB (process),
+ BRASERO_BURN_ACTION_FIXATING,
+ NULL,
+ FALSE);
}
else if (g_str_has_prefix (line, "Last chance to quit, ")) {
brasero_job_set_dangerous (BRASERO_JOB (process), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]