1 /*
2 * Copyright (C) 2008, 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 General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 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 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU 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 #include "tracker-test-helpers.h"
20
21 static gchar *nonutf8_str = NULL;
22
23 const gchar *
tracker_test_helpers_get_nonutf8(void)24 tracker_test_helpers_get_nonutf8 (void)
25 {
26 GMappedFile *file = NULL;
27
28 if (!nonutf8_str) {
29 file = g_mapped_file_new (TEST_TEXT, FALSE, NULL);
30 nonutf8_str = g_strdup (g_mapped_file_get_contents (file));
31 nonutf8_str [g_mapped_file_get_length (file) -1] = '\0';
32 g_mapped_file_unref (file);
33 }
34
35 return nonutf8_str;
36 }
37
38 void
tracker_test_helpers_free_nonutf8(void)39 tracker_test_helpers_free_nonutf8 (void)
40 {
41 if (nonutf8_str) {
42 g_free (nonutf8_str);
43 nonutf8_str = NULL;
44 }
45 }
46