Beispiel #1
0
static int
test (char *argv[])
{
	GsfInput   *input;
	GsfInfile  *infile;
	GsfOutput  *output;
	GsfOutfile *outfile;
	GError    *err = NULL;

	fprintf (stderr, "%s\n", argv [1]);
	input = gsf_input_stdio_new (argv[1], &err);
	if (input == NULL) {

		g_return_val_if_fail (err != NULL, 1);

		g_warning ("'%s' error: %s", argv[1], err->message);
		g_error_free (err);
		return 1;
	}

	infile = gsf_infile_zip_new (input, &err);
	g_object_unref (G_OBJECT (input));

	if (infile == NULL) {
		g_return_val_if_fail (err != NULL, 1);

		g_warning ("'%s' Not a zip file: %s", argv[1], err->message);
		g_error_free (err);
		return 1;
	}

	output = gsf_output_stdio_new (argv[2], &err);
	if (output == NULL) {

		g_return_val_if_fail (err != NULL, 1);

		g_warning ("'%s' error: %s", argv[2], err->message);
		g_error_free (err);
		g_object_unref (G_OBJECT (infile));
		return 1;
	}

	outfile = gsf_outfile_zip_new (output, &err);
	g_object_unref (G_OBJECT (output));
	clone_ (infile, outfile);

	return 0;
}
 LangAltValue::AutoPtr LangAltValue::clone() const
 {
     return AutoPtr(clone_());
 }
 XmpArrayValue::AutoPtr XmpArrayValue::clone() const
 {
     return AutoPtr(clone_());
 }
 XmpTextValue::AutoPtr XmpTextValue::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #5
0
 //! @name Accessors
 //@{
 AutoPtr clone() const { return AutoPtr(clone_()); }
Beispiel #6
0
 Key::AutoPtr Key::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #7
0
 OlympusMakerNote::AutoPtr OlympusMakerNote::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #8
0
 FujiMakerNote::AutoPtr FujiMakerNote::clone(bool alloc) const
 {
     return AutoPtr(clone_(alloc));
 }
Beispiel #9
0
 FujiMakerNote::AutoPtr FujiMakerNote::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #10
0
 Nikon3MakerNote::AutoPtr Nikon3MakerNote::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #11
0
 SonyMakerNote::AutoPtr SonyMakerNote::clone() const
 {
     return AutoPtr(clone_());
 }
Beispiel #12
0
static void
clone_ (GsfInfile *in, GsfOutfile *out)
{
	GsfInput *input = GSF_INPUT (in);
	GsfOutput *output = GSF_OUTPUT (out);

	if (gsf_input_size (input) > 0) {
		size_t len;
		while ((len = gsf_input_remaining (input)) > 0) {
			guint8 const *data;
			/* copy in odd sized chunks to exercise system */
			if (len > 314)
				len = 314;
			if (NULL == (data = gsf_input_read (input, len, NULL))) {
				g_warning ("error reading ?");
				break;
			}
			if (!gsf_output_write (output, len, data)) {
				g_warning ("error writing ?");
				break;
			}
		}
	} else {
		int i, n = gsf_infile_num_children (in);
		for (i = 0 ; i < n; i++) {
			int level;
			gboolean is_dir;
			char const *name = gsf_infile_name_by_index (in, i);
			char *display_name = name
				? g_filename_display_name (name)
				: NULL;

			input = gsf_infile_child_by_index (in, i);
			if (NULL == input) {
				g_print ("Error opening '%s, index = %d\n",
					 display_name ? display_name : "?", i);
				g_free (display_name);
				continue;
			}

			is_dir = gsf_infile_num_children (GSF_INFILE (input)) >= 0;

			g_object_get (G_OBJECT (input), "compression-level", &level, NULL);

			g_print ("%s: size=%ld, level=%d, %s\n",
				 display_name ? display_name : "?",
				 (long)gsf_input_size (input),
				 level,
				 is_dir ? "directory" : "file");
			g_free (display_name);

			output = gsf_outfile_new_child_full  (out, name, is_dir,
							      "compression-level", level,
							      NULL);
			clone_ (GSF_INFILE (input), GSF_OUTFILE (output));
		}
	}
	gsf_output_close (GSF_OUTPUT (out));
	g_object_unref (G_OBJECT (out));
	g_object_unref (G_OBJECT (in));
}
Beispiel #13
0
 PanasonicMakerNote::AutoPtr PanasonicMakerNote::clone() const
 {
     return AutoPtr(clone_());
 }