Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: libexif/sources/test/test-mnote.c

Issue 10535156: Add libexif to deps/third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « libexif/sources/test/test-mem.c ('k') | libexif/sources/test/test-parse.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* exif-mnote.c
2 *
3 * Copyright 2002 Lutz M\uffffller <lutz@users.sourceforge.net>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
19 */
20
21 #include <config.h>
22
23 #include <stdio.h>
24 #include <stdlib.h>
25
26 #include <libexif/exif-data.h>
27
28 static int
29 test_exif_data (ExifData *d)
30 {
31 unsigned int i, c;
32 char v[1024], *p;
33 ExifMnoteData *md;
34
35 fprintf (stdout, "Byte order: %s\n",
36 exif_byte_order_get_name (exif_data_get_byte_order (d)));
37
38 fprintf (stdout, "Parsing maker note...\n");
39 md = exif_data_get_mnote_data (d);
40 if (!md) {
41 fprintf (stderr, "Could not parse maker note!\n");
42 exif_data_unref (d);
43 return 1;
44 }
45
46 fprintf (stdout, "Increasing ref-count...\n");
47 exif_mnote_data_ref (md);
48
49 fprintf (stdout, "Decreasing ref-count...\n");
50 exif_mnote_data_unref (md);
51
52 fprintf (stdout, "Counting entries...\n");
53 c = exif_mnote_data_count (md);
54 fprintf (stdout, "Found %i entries.\n", c);
55 for (i = 0; i < c; i++) {
56 fprintf (stdout, "Dumping entry number %i...\n", i);
57 fprintf (stdout, " Name: '%s'\n",
58 exif_mnote_data_get_name (md, i));
59 fprintf (stdout, " Title: '%s'\n",
60 exif_mnote_data_get_title (md, i));
61 fprintf (stdout, " Description: '%s'\n",
62 exif_mnote_data_get_description (md, i));
63 p = exif_mnote_data_get_value (md, i, v, sizeof (v));
64 if (p) { fprintf (stdout, " Value: '%s'\n", v); }
65 }
66
67 return 0;
68 }
69
70 int
71 main (int argc, char **argv)
72 {
73 ExifData *d;
74 unsigned int buf_size;
75 unsigned char *buf;
76 int r;
77
78 if (argc <= 1) {
79 fprintf (stderr, "You need to supply a filename!\n");
80 return 1;
81 }
82
83 fprintf (stdout, "Loading '%s'...\n", argv[1]);
84 d = exif_data_new_from_file (argv[1]);
85 if (!d) {
86 fprintf (stderr, "Could not load data from '%s'!\n", argv[1]);
87 return 1;
88 }
89 fprintf (stdout, "Loaded '%s'.\n", argv[1]);
90
91 fprintf (stdout, "######### Test 1 #########\n");
92 r = test_exif_data (d);
93 if (r) return r;
94
95 exif_data_save_data (d, &buf, &buf_size);
96 exif_data_unref (d);
97 d = exif_data_new_from_data (buf, buf_size);
98 free (buf);
99
100 fprintf (stdout, "######### Test 2 #########\n");
101 r = test_exif_data (d);
102 if (r) return r;
103
104 fprintf (stdout, "Test successful!\n");
105
106 return 1;
107 }
OLDNEW
« no previous file with comments | « libexif/sources/test/test-mem.c ('k') | libexif/sources/test/test-parse.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698