tracker-0.16.2/src/libtracker-extract/tracker-encoding.c

No issues found

 1 /*
 2  * Copyright (C) 2011 Nokia <ivan.frade@nokia.com>
 3  *
 4  * This library is free software; you can redistribute it and/or
 5  * modify it under the terms of the GNU Lesser General Public
 6  * License as published by the Free Software Foundation; either
 7  * version 2.1 of the License, or (at your option) any later version.
 8  *
 9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19 
20 #include "config.h"
21 
22 #include <glib.h>
23 #include "tracker-encoding.h"
24 
25 #ifdef HAVE_ENCA
26 #include "tracker-encoding-enca.h"
27 #endif
28 
29 #ifdef HAVE_MEEGOTOUCH
30 #include "tracker-encoding-meegotouch.h"
31 #endif
32 
33 gboolean
34 tracker_encoding_can_guess (void)
35 {
36 #if defined (HAVE_ENCA) || defined (HAVE_MEEGOTOUCH)
37 	return TRUE;
38 #else
39 	return FALSE;
40 #endif
41 }
42 
43 gchar *
44 tracker_encoding_guess (const gchar *buffer,
45                         gsize        size)
46 {
47 	gchar *encoding = NULL;
48 
49 #ifdef HAVE_MEEGOTOUCH
50 	encoding = tracker_encoding_guess_meegotouch (buffer, size);
51 #endif /* HAVE_MEEGOTOUCH */
52 
53 #ifdef HAVE_ENCA
54 	if (!encoding)
55 		encoding = tracker_encoding_guess_enca (buffer, size);
56 #endif /* HAVE_ENCA */
57 
58 	return encoding;
59 }