1 diff -Naur -x '*~' flac-1.1.3-beta2/src/metaflac/.gdb_history mine/src/metaflac/.gdb_history
2 --- flac-1.1.3-beta2/src/metaflac/.gdb_history 1970-01-01 00:00:00.000000000 +0000
3 +++ mine/src/metaflac/.gdb_history 2006-10-28 08:24:22.000000000 +0000
7 diff -Naur -x '*~' flac-1.1.3-beta2/src/metaflac/operations.c mine/src/metaflac/operations.c
8 --- flac-1.1.3-beta2/src/metaflac/operations.c 2006-09-28 18:18:45.000000000 +0000
9 +++ mine/src/metaflac/operations.c 2006-10-28 08:39:01.000000000 +0000
11 case OP__EXPORT_CUESHEET_TO:
12 ok = do_shorthand_operation__cuesheet(filename, chain, operation, needs_write);
14 + case OP__EXPORT_PICTURE:
15 case OP__IMPORT_PICTURE:
16 ok = do_shorthand_operation__picture(filename, chain, operation, needs_write);
18 diff -Naur -x '*~' flac-1.1.3-beta2/src/metaflac/operations_shorthand_picture.c mine/src/metaflac/operations_shorthand_picture.c
19 --- flac-1.1.3-beta2/src/metaflac/operations_shorthand_picture.c 2006-10-10 00:09:39.000000000 +0000
20 +++ mine/src/metaflac/operations_shorthand_picture.c 2006-10-29 08:15:36.000000000 +0000
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 static FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *specification, FLAC__bool *needs_write);
35 +/* Write all of buf, even if write(2) is interrupted. */
37 +full_write(int fd, const char *buf, size_t nbytes)
41 + /* Loop until nbytes of buf have been written. */
42 + while (w < nbytes) {
43 + /* Keep trying until write succeeds without interruption. */
45 + r = write(fd, buf + w, nbytes - w);
46 + } while (r < 0 && errno == EINTR);
58 FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write)
60 FLAC__bool ok = true, has_type1 = false, has_type2 = false;
61 FLAC__StreamMetadata *picture = 0;
62 FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new();
63 + FLAC__StreamMetadata *block;
66 die("out of memory allocating iterator");
71 + case OP__EXPORT_PICTURE:
73 + block = FLAC__metadata_iterator_get_block(iterator);
76 + fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename);
79 + if (block->type != FLAC__METADATA_TYPE_PICTURE)
81 + if (block->data.picture.type != FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER)
83 + int fd = open(operation->argument.specification.value, O_WRONLY | O_EXCL | O_CREAT, 0644);
90 + if(0 != block->data.picture.data)
91 + if (full_write(fd, block->data.picture.data, block->data.picture.data_length) != block->data.picture.data_length) {
96 + if (fsync(fd) < 0) {
101 + if (close(fd) < 0) {
106 + } while(ok && FLAC__metadata_iterator_next(iterator));
111 diff -Naur -x '*~' flac-1.1.3-beta2/src/metaflac/options.c mine/src/metaflac/options.c
112 --- flac-1.1.3-beta2/src/metaflac/options.c 2006-09-26 00:52:23.000000000 +0000
113 +++ mine/src/metaflac/options.c 2006-10-28 10:47:20.000000000 +0000
115 { "export-tags-to", 1, 0, 0 },
116 { "import-cuesheet-from", 1, 0, 0 },
117 { "export-cuesheet-to", 1, 0, 0 },
118 + { "stupid-export-picture", 1, 0, 0 },
119 { "import-picture", 1, 0, 0 },
120 { "add-seekpoint", 1, 0, 0 },
121 { "add-replay-gain", 0, 0, 0 },
126 + else if(0 == strcmp(opt, "stupid-export-picture")) {
127 + op = append_shorthand_operation(options, OP__EXPORT_PICTURE);
128 + FLAC__ASSERT(0 != option_argument);
129 + if(!parse_string(option_argument, &(op->argument.specification.value))) {
130 + fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
134 else if(0 == strcmp(opt, "import-picture")) {
135 op = append_shorthand_operation(options, OP__IMPORT_PICTURE);
136 FLAC__ASSERT(0 != option_argument);
137 diff -Naur -x '*~' flac-1.1.3-beta2/src/metaflac/options.h mine/src/metaflac/options.h
138 --- flac-1.1.3-beta2/src/metaflac/options.h 2006-09-25 15:21:49.000000000 +0000
139 +++ mine/src/metaflac/options.h 2006-10-28 07:50:44.000000000 +0000
142 OP__IMPORT_CUESHEET_FROM,
143 OP__EXPORT_CUESHEET_TO,
144 + OP__EXPORT_PICTURE,