Mercurial > pidgin
comparison libpurple/plugins/log_reader.c @ 18175:038c14fcadb8
setting error to NULL before using
| author | Michael Shkutkov <mshkutkov@soc.pidgin.im> |
|---|---|
| date | Thu, 21 Jun 2007 22:07:53 +0000 |
| parents | bb228f608b61 |
| children | b14dfa2f49a1 |
comparison
equal
deleted
inserted
replaced
| 18174:bb228f608b61 | 18175:038c14fcadb8 |
|---|---|
| 1811 logdir, username, "History", filename, NULL); | 1811 logdir, username, "History", filename, NULL); |
| 1812 | 1812 |
| 1813 purple_debug(PURPLE_DEBUG_INFO, "QIP logger list", | 1813 purple_debug(PURPLE_DEBUG_INFO, "QIP logger list", |
| 1814 "Reading %s\n", path); | 1814 "Reading %s\n", path); |
| 1815 | 1815 |
| 1816 error = NULL: | |
| 1816 if (!g_file_get_contents(path, &contents, &length, &error)) | 1817 if (!g_file_get_contents(path, &contents, &length, &error)) |
| 1817 if (error) { | 1818 if (error) { |
| 1818 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", | 1819 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", |
| 1819 "Couldn't read file %s \n", path); | 1820 "Couldn't read file %s \n", path); |
| 1820 | 1821 |
| 1827 | 1828 |
| 1828 purple_debug(PURPLE_DEBUG_INFO, "QIP logger list", | 1829 purple_debug(PURPLE_DEBUG_INFO, "QIP logger list", |
| 1829 "File %s is found\n", filename); | 1830 "File %s is found\n", filename); |
| 1830 | 1831 |
| 1831 /* We should convert file contents from Cp1251 to UTF-8 codeset */ | 1832 /* We should convert file contents from Cp1251 to UTF-8 codeset */ |
| 1833 error = NULL; | |
| 1832 if (!(utf8_string = g_convert(contents, length, "UTF-8", "Cp1251", NULL, NULL, &error))) { | 1834 if (!(utf8_string = g_convert(contents, length, "UTF-8", "Cp1251", NULL, NULL, &error))) { |
| 1833 if (error) { | 1835 if (error) { |
| 1834 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", | 1836 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", |
| 1835 "Couldn't convert file %s to UTF-8\n", filename); | 1837 "Couldn't convert file %s to UTF-8\n", filename); |
| 1836 g_error_free(error); | 1838 g_error_free(error); |
| 1933 g_return_val_if_fail(data->length > 0, g_strdup("")); | 1935 g_return_val_if_fail(data->length > 0, g_strdup("")); |
| 1934 | 1936 |
| 1935 purple_debug(PURPLE_DEBUG_INFO, "QIP logger read", | 1937 purple_debug(PURPLE_DEBUG_INFO, "QIP logger read", |
| 1936 "Reading %s\n", data->path); | 1938 "Reading %s\n", data->path); |
| 1937 | 1939 |
| 1940 error = NULL; | |
| 1938 if (!g_file_get_contents(data->path, &contents, &length, &error)) | 1941 if (!g_file_get_contents(data->path, &contents, &length, &error)) |
| 1939 if (error) { | 1942 if (error) { |
| 1940 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", | 1943 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger list", |
| 1941 "Couldn't read file %s \n", data->path); | 1944 "Couldn't read file %s \n", data->path); |
| 1942 | 1945 |
| 1944 } | 1947 } |
| 1945 if (contents) { | 1948 if (contents) { |
| 1946 gchar * utf8_string; | 1949 gchar * utf8_string; |
| 1947 | 1950 |
| 1948 /* We should convert file contents from Cp1251 to UTF-8 codeset */ | 1951 /* We should convert file contents from Cp1251 to UTF-8 codeset */ |
| 1952 error = NULL; | |
| 1949 if (!(utf8_string = g_convert (contents, length, "UTF-8", "Cp1251", NULL, NULL, &error))) { | 1953 if (!(utf8_string = g_convert (contents, length, "UTF-8", "Cp1251", NULL, NULL, &error))) { |
| 1950 if (error) { | 1954 if (error) { |
| 1951 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger read", | 1955 purple_debug(PURPLE_DEBUG_ERROR, "QIP logger read", |
| 1952 "Couldn't convert file %s to UTF-8\n", data->path); | 1956 "Couldn't convert file %s to UTF-8\n", data->path); |
| 1953 g_error_free(error); | 1957 g_error_free(error); |
| 2263 #if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ | 2267 #if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ |
| 2264 GKeyFile *key_file; | 2268 GKeyFile *key_file; |
| 2265 | 2269 |
| 2266 purple_debug(PURPLE_DEBUG_INFO, "Trillian talk.ini read", | 2270 purple_debug(PURPLE_DEBUG_INFO, "Trillian talk.ini read", |
| 2267 "Reading %s\n", path); | 2271 "Reading %s\n", path); |
| 2272 | |
| 2273 error = NULL; | |
| 2268 if (!g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, GError &error)) { | 2274 if (!g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, GError &error)) { |
| 2269 purple_debug(PURPLE_DEBUG_ERROR, "Trillian talk.ini read", | 2275 purple_debug(PURPLE_DEBUG_ERROR, "Trillian talk.ini read", |
| 2270 "Error reading talk.ini\n"); | 2276 "Error reading talk.ini\n"); |
| 2271 if (error) | 2277 if (error) |
| 2272 g_error_free(error); | 2278 g_error_free(error); |
