~ubuntu-branches/ubuntu/wily/brasero/wily

« back to all changes in this revision

Viewing changes to src/plugins/checksum/burn-checksum-files.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-11-18 11:30:50 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20081118113050-hoy0pi04uv7ww9d8
Tags: 0.8.3-0ubuntu1
* New upstream release (LP: #299411)
  - allow use of remote files
  - drives are now probed asynchronously and may not popup immediatly
    but brasero starts faster
  - some parts of GUI were revisited (in particular the burn
    option dialogs)
  - command line option for video projects (LP: #273140)
  - brasero crashed with SIGSEGV in g_main_context_dispatch()
    (LP: #281599)
  - Brasero main GUI appears after closing the dialog
    when opening an ISO file using Nautilus (LP: #242022)
  - brasero delete original files in VIDEO_TS folder (LP: #280835)
  - brasero crashed with SIGSEGV in 
    brasero_mkisofs_base_write_to_files() (LP: #275312)
  - brasero crashed with SIGSEGV in 
    brasero_project_save_project_as() (LP: #275086)
  - brasero crashed with SIGSEGV in 
    IA__g_sequence_iter_get_sequence() (LP: #282622)
  - brasero crashed with SIGSEGV in brasero_medium_get_drive()
    (LP: #283197)
  - Dialog contains a lot of empty space (LP: #190192)
 * debian/patches/008-add-gettext-domain-to-desktop-file.patch:
   - Dropped, we don't need this anymore
 * debian/control:
  - Add Build-deps on libeel2-dev and libnautilus-extension-dev
 * debian/brasero.install:
  - Install nautilus extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
 
97
97
        file = fopen (path, "r");
98
98
        if (!file) {
 
99
                int errsv;
99
100
                gchar *name = NULL;
100
101
 
101
102
                /* If the file doesn't exist carry on with next */
104
105
 
105
106
                name = g_path_get_basename (path);
106
107
 
 
108
                errsv = errno;
107
109
                g_set_error (error,
108
110
                             BRASERO_BURN_ERROR,
109
111
                             BRASERO_BURN_ERROR_GENERAL,
110
112
                             _("the file %s couldn't be read (%s)"),
111
113
                             name,
112
 
                             strerror (errno));
 
114
                             g_strerror (errsv));
113
115
                g_free (name);
114
116
 
115
117
                return BRASERO_BURN_ERR;
165
167
        g_free (checksum_string);
166
168
 
167
169
        if (written != 1) {
 
170
                int errsv = errno;
168
171
                g_set_error (error,
169
172
                             BRASERO_BURN_ERROR,
170
173
                             BRASERO_BURN_ERROR_GENERAL,
171
174
                             _("the md5 file couldn't be written to (%s)"),
172
 
                             strerror (errno));
 
175
                             g_strerror (errsv));
173
176
                        
174
177
                return BRASERO_BURN_ERR;
175
178
        }
187
190
                          priv->file);
188
191
 
189
192
        if (written != 1) {
 
193
                int errsv = errno;
190
194
                g_set_error (error,
191
195
                             BRASERO_BURN_ERROR,
192
196
                             BRASERO_BURN_ERROR_GENERAL,
193
197
                             _("the md5 file couldn't be written to (%s)"),
194
 
                             strerror (errno));
 
198
                             g_strerror (errsv));
195
199
 
196
200
                return BRASERO_BURN_ERR;
197
201
        }
334
338
                g_set_error (error,
335
339
                             BRASERO_BURN_ERROR,
336
340
                             BRASERO_BURN_ERROR_GENERAL,
337
 
                             strerror (errno));
 
341
                             "%s",
 
342
                             g_strerror (errno));
338
343
                return BRASERO_BURN_ERR;
339
344
        }
340
345
 
342
347
                g_set_error (error,
343
348
                             BRASERO_BURN_ERROR,
344
349
                             BRASERO_BURN_ERROR_GENERAL,
345
 
                             strerror (errno));
 
350
                             "%s",
 
351
                             g_strerror (errno));
346
352
                return BRASERO_BURN_ERR;
347
353
        }
348
354
 
380
386
 
381
387
        /* try every file and make sure they are of the same type */
382
388
        brasero_job_get_device (BRASERO_JOB (self), &device);
383
 
        dev_handle = brasero_device_handle_open (device, NULL);
 
389
        dev_handle = brasero_device_handle_open (device, FALSE, NULL);
384
390
        g_free (device);
385
391
 
386
392
        vol = brasero_volume_source_open_device_handle (dev_handle, error);
540
546
 
541
547
        priv->file = fopen (priv->sums_path, "w");
542
548
        if (!priv->file) {
 
549
                int errsv = errno;
543
550
                g_set_error (error,
544
551
                             BRASERO_BURN_ERROR,
545
552
                             BRASERO_BURN_ERROR_GENERAL,
546
553
                             _("md5 file couldn't be opened (%s)"),
547
 
                             strerror (errno));
 
554
                             g_strerror (errsv));
548
555
 
549
556
                return BRASERO_BURN_ERR;
550
557
        }
586
593
                BraseroGraftPt *graft;
587
594
                gchar *graft_path;
588
595
                gchar *path;
589
 
                gchar *uri;
590
596
 
591
597
                if (priv->cancel) {
592
598
                        result = BRASERO_BURN_CANCEL;
598
604
                        continue;
599
605
 
600
606
                /* get the current and future paths */
601
 
                uri = graft->uri;
602
 
                path = g_filename_from_uri (uri, NULL, NULL);
 
607
                /* FIXME: graft->uri can be path or URIs ... This should be
 
608
                 * fixed for graft points. */
 
609
                if (!graft->uri)
 
610
                        path = NULL;
 
611
                else if (graft->uri [0] == '/')
 
612
                        path = g_strdup (graft->uri);
 
613
                else if (g_str_has_prefix (graft->uri, "file://"))
 
614
                        path = g_filename_from_uri (graft->uri, NULL, NULL);
 
615
                else
 
616
                        path = NULL;
 
617
 
603
618
                graft_path = graft->path;
604
619
 
605
620
                if (g_file_test (path, G_FILE_TEST_IS_DIR))
656
671
                g_set_error (error,
657
672
                             BRASERO_BURN_ERROR,
658
673
                             BRASERO_BURN_ERROR_GENERAL,
659
 
                             strerror (errno));
 
674
                             "%s",
 
675
                             g_strerror (errno));
660
676
                return -1;
661
677
        }
662
678
 
678
694
        const gchar *name;
679
695
        gint checksum_len;
680
696
        BraseroTrack *track;
 
697
        GValue *value = NULL;
681
698
        BraseroMedium *medium;
682
 
        gboolean has_wrongsums;
683
699
        GChecksumType gchecksum_type;
684
 
        BraseroChecksumFilesPrivate *priv;
 
700
        GArray *wrong_checksums = NULL;
685
701
        gchar filename [MAXPATHLEN + 1];
 
702
        BraseroChecksumFilesPrivate *priv;
686
703
        BraseroBurnResult result = BRASERO_BURN_OK;
687
704
 
688
705
        priv = BRASERO_CHECKSUM_FILES_PRIVATE (self);
689
706
 
690
 
        has_wrongsums = FALSE;
691
 
 
692
707
        brasero_job_get_current_track (BRASERO_JOB (self), &track);
693
708
        medium = brasero_track_get_medium_source (track);
694
709
        root = brasero_volume_get_mount_point (BRASERO_VOLUME (medium), FALSE);
709
724
                g_set_error (error,
710
725
                             BRASERO_BURN_ERROR,
711
726
                             BRASERO_BURN_ERROR_GENERAL,
712
 
                             strerror (errno));
 
727
                             "%s",
 
728
                             g_strerror (errno));
713
729
                return BRASERO_BURN_ERR;
714
730
        }
715
731
 
719
735
                g_set_error (error,
720
736
                             BRASERO_BURN_ERROR,
721
737
                             BRASERO_BURN_ERROR_GENERAL,
722
 
                             strerror (errno));
 
738
                             "%s",
 
739
                             g_strerror (errno));
723
740
                fclose (file);
724
741
                return BRASERO_BURN_ERR;
725
742
        }
763
780
                                g_set_error (error,
764
781
                                             BRASERO_BURN_ERROR,
765
782
                                             BRASERO_BURN_ERROR_GENERAL,
766
 
                                             strerror (errno));
 
783
                                             "%s",
 
784
                                             g_strerror (errno));
767
785
                        break;
768
786
                }
769
787
                checksum_file [checksum_len] = '\0';
785
803
                                g_set_error (error,
786
804
                                             BRASERO_BURN_ERROR,
787
805
                                             BRASERO_BURN_ERROR_GENERAL,
788
 
                                             strerror (errno));
 
806
                                             "%s",
 
807
                                             g_strerror (errno));
789
808
                                goto end;
790
809
                        }
791
810
 
809
828
                                g_set_error (error,
810
829
                                             BRASERO_BURN_ERROR,
811
830
                                             BRASERO_BURN_ERROR_GENERAL,
812
 
                                             strerror (errno));
 
831
                                             "%s",
 
832
                                             g_strerror (errno));
813
833
                                goto end;
814
834
                        }
815
835
 
847
867
                                 filename, checksum_file, checksum_real);
848
868
 
849
869
                if (strcmp (checksum_file, checksum_real)) {
850
 
                        has_wrongsums = TRUE;
851
 
                        brasero_job_add_wrong_checksum (BRASERO_JOB (self), filename);
 
870
                        gchar *string;
 
871
                        if (!wrong_checksums)
 
872
                                wrong_checksums = g_array_new (TRUE,
 
873
                                                               TRUE, 
 
874
                                                               sizeof (gchar *));
 
875
 
 
876
                        string = g_strdup (filename);
 
877
                        wrong_checksums = g_array_append_val (wrong_checksums,
 
878
                                                              string);
852
879
                }
853
880
 
854
881
                g_free (checksum_real);
863
890
        if (result != BRASERO_BURN_OK)
864
891
                return result;
865
892
 
866
 
        if (has_wrongsums) {
867
 
                g_set_error (error,
868
 
                             BRASERO_BURN_ERROR,
869
 
                             BRASERO_BURN_ERROR_BAD_CHECKSUM,
870
 
                             _("some files may be corrupted on the disc"));
871
 
                return BRASERO_BURN_ERR;
872
 
        }
873
 
 
874
 
        return BRASERO_BURN_OK;
 
893
        if (!wrong_checksums)
 
894
                return BRASERO_BURN_OK;
 
895
 
 
896
        /* add the tag */
 
897
        value = g_new0 (GValue, 1);
 
898
        g_value_init (value, G_TYPE_STRV);
 
899
        g_value_take_boxed (value, wrong_checksums->data);
 
900
        g_array_free (wrong_checksums, FALSE);
 
901
 
 
902
        brasero_track_tag_add (track,
 
903
                               BRASERO_TRACK_MEDIUM_WRONG_CHECKSUM_TAG,
 
904
                               value);
 
905
 
 
906
        g_set_error (error,
 
907
                     BRASERO_BURN_ERROR,
 
908
                     BRASERO_BURN_ERROR_BAD_CHECKSUM,
 
909
                     _("some files may be corrupted on the disc"));
 
910
 
 
911
        return BRASERO_BURN_ERR;
875
912
}
876
913
 
877
914
struct _BraseroChecksumFilesThreadCtx {
1100
1137
                return BRASERO_BURN_OK;
1101
1138
 
1102
1139
        /* see that a file with graft "/BRASERO_CHECKSUM_FILE" doesn't already
1103
 
         * exists (possible when doing several copies) */
 
1140
         * exists (possible when doing several copies) or when a simulation 
 
1141
         * already took place before. */
1104
1142
        brasero_job_get_current_track (job, &track);
1105
1143
        grafts = brasero_track_get_data_grafts_source (track);
1106
1144
        for (; grafts; grafts = grafts->next) {
1231
1269
        brasero_plugin_process_caps (plugin, input);
1232
1270
        g_slist_free (input);
1233
1271
 
 
1272
        /* we can run on initial track or later for whatever a DATA track */
1234
1273
        brasero_plugin_set_process_flags (plugin,
1235
 
                                          BRASERO_PLUGIN_RUN_FIRST|
1236
 
                                          BRASERO_PLUGIN_RUN_LAST);
 
1274
                                          BRASERO_PLUGIN_RUN_PREPROCESSING|
 
1275
                                          BRASERO_PLUGIN_RUN_BEFORE_TARGET);
1237
1276
 
1238
1277
        /* For discs, we can only check each files on a disc against an md5sum 
1239
1278
         * file (provided we managed to mount the disc).
1242
1281
         * equivalent instead */
1243
1282
        input = brasero_caps_disc_new (BRASERO_MEDIUM_CD|
1244
1283
                                       BRASERO_MEDIUM_DVD|
1245
 
                                       BRASERO_MEDIUM_DVD_DL|
 
1284
                                       BRASERO_MEDIUM_DUAL_L|
1246
1285
                                       BRASERO_MEDIUM_PLUS|
1247
1286
                                       BRASERO_MEDIUM_RESTRICTED|
1248
1287
                                       BRASERO_MEDIUM_SEQUENTIAL|