svnno****@sourc*****
svnno****@sourc*****
Fri Mar 7 03:12:21 JST 2008
Revision: 3443 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3443 Author: pal_gene Date: 2008-03-07 03:12:21 +0900 (Fri, 07 Mar 2008) Log Message: ----------- Cleanup execute path. Modified Paths: -------------- kazehakase/trunk/module/search/kz-hyper-estraier-search.c Modified: kazehakase/trunk/module/search/kz-hyper-estraier-search.c =================================================================== --- kazehakase/trunk/module/search/kz-hyper-estraier-search.c 2008-03-06 18:12:18 UTC (rev 3442) +++ kazehakase/trunk/module/search/kz-hyper-estraier-search.c 2008-03-06 18:12:21 UTC (rev 3443) @@ -730,55 +730,54 @@ } else { - gchar *uri, *title, *contents; - gchar *encoding = NULL; + gchar *uri, *title, *contents, *encoding; GTime mtime; struct stat st; /* filter for time-stamp */ //TODO:history search result, optional /* NOTE:string pointer compare is designed */ - if(path == he_search->cache_path && strcmp(file, "time-stamp") == 0) + if (path == he_search->cache_path && strcmp(file, "time-stamp") == 0) continue; g_file_get_contents(new_path, &contents, NULL, NULL); - g_stat(new_path, &st); - mtime = st.st_mtime; - uri = create_uri_from_filename(new_path + - he_search->cache_path_len + - 1); encoding = get_document_encoding(contents); if (!encoding) encoding = g_strdup(est_enc_name(contents, strlen(contents), ESTLANGJA)); - - if (encoding && strcmp(encoding, "UTF-8")) + if (encoding) { - gchar *utf8_contents; - utf8_contents = g_convert(contents, -1, - "UTF-8", encoding, - NULL, NULL, - NULL); - - if (utf8_contents) + if (strcmp(encoding, "UTF-8") != 0) { - title = get_document_title(utf8_contents); - register_document(search, uri, title, utf8_contents, mtime); - g_free(utf8_contents); - if (title) - g_free(title); + gchar *utf8_contents; + utf8_contents = g_convert(contents, -1, + "UTF-8", encoding, + NULL, NULL, + NULL); + if (utf8_contents) + { + g_free(contents); + contents = utf8_contents; + } + else + { + g_warning("encoding convert fail. [enc:file] [%s:%s]\n", + encoding, new_path); + } } - } - else - { - title = get_document_title(contents); - register_document(search, uri, title, contents, mtime); - if (title) - g_free(title); - } - if (encoding) g_free(encoding); + } + g_stat(new_path, &st); + mtime = st.st_mtime; + title = get_document_title(contents); + uri = create_uri_from_filename(new_path + + he_search->cache_path_len + + 1); + register_document(search, uri, title, contents, mtime); + + if (title) + g_free(title); g_free(uri); g_free(contents); }