~ubuntu-branches/ubuntu/vivid/exif/vivid

« back to all changes in this revision

Viewing changes to exif/utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2008-03-31 19:39:44 UTC
  • mfrom: (4.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080331193944-xndxlofl9m7h7a83
Tags: 0.6.15-5
* Adopt the package within pkg-phototools:
  - Set the Maintainer to the group
  - Add Frederic Peters and myself as Uploaders.
  - Add Vcs-Browser and Vcs-Git fields accordingly.
* debian/control:
  - Add a Homepage field.
  - Update Standards-Version to 3.7.3
  - Fix build dep version for libexif-dev.
  - Add build dep on quilt for patches extracted from package diff.
  - Add build dep on gettext for swedish translation.
* debian/copyright:
  - convert file to utf-8.
  - Point to LGPL-2 rather than just LGPL, which now points to
    LGPL-3.
* debian/rules
  - Fix autotools timestamp issues which causes FTBFS (closes: #445609)
  - Fix lintian 'clean error' warning.
* debian/patches
  - Extract swedish translation patch from package diff (cf. bug 397370).
  - Extract patch related to default ifd from package diff (cf. bug 428255).
  - Extract patch related to manpage improvements from package diff (cf.
    bugs 320497 and 321855).

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        const char *name;
33
33
 
34
34
        if (!string)
35
 
                return (0);
 
35
                return 0xffff;
36
36
 
37
37
        /* Is the string a tag's name or title? */
38
38
        for (tag = 0xffff; tag > 0; tag--) {
53
53
                if (string[i] == 'x')
54
54
                        break;
55
55
        if (i == strlen (string))
56
 
                return (0);
 
56
                return 0xffff;
57
57
 
58
58
        string += i + 1;
59
59
        tag = 0;
138
138
 
139
139
        return (-1);
140
140
}
141
 
 
142
 
#ifdef HAVE_MNOTE
143
 
 
144
 
MNoteTag
145
 
mnote_tag_from_string (MNoteData *note, const char *string)
146
 
{
147
 
        MNoteTag tag;
148
 
        unsigned int i, number, factor;
149
 
        const char *name;
150
 
 
151
 
        if (!string)
152
 
                return (0);
153
 
 
154
 
        /* Is the string a tag's name or title? */
155
 
        for (tag = 0xffff; tag > 0; tag--) {
156
 
                name = mnote_tag_get_name (note, tag);
157
 
                if (name && !strcmp (string, name))
158
 
                        return (tag);
159
 
                name = mnote_tag_get_title (note, tag);
160
 
                if (name && !strcmp (string, name))
161
 
                        return (tag);
162
 
        }
163
 
 
164
 
        /* Is the string a decimal number? */
165
 
        if (strspn (string, "0123456789") == strlen (string))
166
 
                return (atoi (string));
167
 
 
168
 
        /* Is the string a hexadecimal number? */
169
 
        for (i = 0; i < strlen (string); i++)
170
 
                if (string[i] == 'x')
171
 
                        break;
172
 
        if (i == strlen (string))
173
 
                return (0);
174
 
 
175
 
        string += i + 1;
176
 
        tag = 0;
177
 
        for (i = strlen (string); i > 0; i--) {
178
 
                switch (string[i - 1]) {
179
 
                case '0':
180
 
                        number = 0;
181
 
                        break;
182
 
                case '1':
183
 
                        number = 1;
184
 
                        break;
185
 
                case '2':
186
 
                        number = 2;
187
 
                        break;
188
 
                case '3':
189
 
                        number = 3;
190
 
                        break;
191
 
                case '4':
192
 
                        number = 4;
193
 
                        break;
194
 
                case '5':
195
 
                        number = 5;
196
 
                        break;
197
 
                case '6':
198
 
                        number = 6;
199
 
                        break;
200
 
                case '7':
201
 
                        number = 7;
202
 
                        break;
203
 
                case '8':
204
 
                        number = 8;
205
 
                        break;
206
 
                case '9':
207
 
                        number = 9;
208
 
                        break;
209
 
                case 'a':
210
 
                case 'A':
211
 
                        number = 10;
212
 
                        break;
213
 
                case 'b':
214
 
                case 'B':
215
 
                        number = 11;
216
 
                        break;
217
 
                case 'c':
218
 
                case 'C':
219
 
                        number = 12;
220
 
                        break;
221
 
                case 'd':
222
 
                case 'D':
223
 
                        number = 13;
224
 
                        break;
225
 
                case 'e':
226
 
                case 'E':
227
 
                        number = 14;
228
 
                        break; 
229
 
                case 'f':
230
 
                case 'F':
231
 
                        number = 15;
232
 
                        break; 
233
 
                default:
234
 
                        return (0);
235
 
                }
236
 
                factor = 1 << ((strlen (string) - i) * 4);
237
 
                tag += (number * factor);
238
 
        }
239
 
 
240
 
        return (tag);
241
 
}
242
 
 
243
 
#endif