diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ChangeLog.ja | 8 | ||||
-rw-r--r-- | libsylph/utils.c | 211 | ||||
-rw-r--r-- | libsylph/utils.h | 39 | ||||
-rw-r--r-- | src/addr_compl.c | 4 | ||||
-rw-r--r-- | src/compose.c | 5 | ||||
-rw-r--r-- | src/gtkutils.c | 5 | ||||
-rw-r--r-- | src/gtkutils.h | 3 | ||||
-rw-r--r-- | src/undo.c | 3 |
9 files changed, 18 insertions, 269 deletions
@@ -1,5 +1,14 @@ 2005-09-21 + * libsylph/utils.[ch] + src/compose.c + src/gtkutils.[ch] + src/undo.c + src/addr_compl.c: removed mbs/wcs functions which are no longer + required. + +2005-09-21 + * src/account_dialog.c: don't display checkbox if 'get all' is unavailable. diff --git a/ChangeLog.ja b/ChangeLog.ja index 0be11054..6a478136 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,13 @@ 2005-09-21 + * libsylph/utils.[ch] + src/compose.c + src/gtkutils.[ch] + src/undo.c + src/addr_compl.c: 既に不要になった mbs/wcs 関数を削除。 + +2005-09-21 + * src/account_dialog.c: 「全受信」が指定不可の場合はチェックボックス を表示しないようにした。 diff --git a/libsylph/utils.c b/libsylph/utils.c index 09632f64..5c0ba893 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -29,11 +29,6 @@ #include <string.h> #include <ctype.h> #include <errno.h> - -#if (HAVE_WCTYPE_H && HAVE_WCHAR_H) -# include <wchar.h> -# include <wctype.h> -#endif #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> @@ -46,6 +41,7 @@ #include <time.h> #ifdef G_OS_WIN32 +# include <wchar.h> # include <direct.h> # include <io.h> #endif @@ -429,211 +425,6 @@ gchar *strncpy2(gchar *dest, const gchar *src, size_t n) return dest; } -#if !HAVE_ISWALNUM -int iswalnum(wint_t wc) -{ - return g_ascii_isalnum((int)wc); -} -#endif - -#if !HAVE_ISWSPACE -int iswspace(wint_t wc) -{ - return g_ascii_isspace((int)wc); -} -#endif - -#if !HAVE_TOWLOWER -wint_t towlower(wint_t wc) -{ - if (wc >= L'A' && wc <= L'Z') - return wc + L'a' - L'A'; - - return wc; -} -#endif - -#if !HAVE_WCSLEN -size_t wcslen(const wchar_t *s) -{ - size_t len = 0; - - while (*s != L'\0') - ++len, ++s; - - return len; -} -#endif - -#if !HAVE_WCSCPY -/* Copy SRC to DEST. */ -wchar_t *wcscpy(wchar_t *dest, const wchar_t *src) -{ - wint_t c; - wchar_t *s = dest; - - do { - c = *src++; - *dest++ = c; - } while (c != L'\0'); - - return s; -} -#endif - -#if !HAVE_WCSNCPY -/* Copy no more than N wide-characters of SRC to DEST. */ -wchar_t *wcsncpy (wchar_t *dest, const wchar_t *src, size_t n) -{ - wint_t c; - wchar_t *s = dest; - - do { - c = *src++; - *dest++ = c; - if (--n == 0) - return s; - } while (c != L'\0'); - - /* zero fill */ - do - *dest++ = L'\0'; - while (--n > 0); - - return s; -} -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -wchar_t *wcsdup(const wchar_t *s) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, wcslen(s) + 1); - wcscpy(new_str, s); - } else - new_str = NULL; - - return new_str; -} - -/* Duplicate no more than N wide-characters of S, - returning an identical malloc'd string. */ -wchar_t *wcsndup(const wchar_t *s, size_t n) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, n + 1); - wcsncpy(new_str, s, n); - new_str[n] = (wchar_t)0; - } else - new_str = NULL; - - return new_str; -} - -wchar_t *strdup_mbstowcs(const gchar *s) -{ - wchar_t *new_str; - - if (s) { - new_str = g_new(wchar_t, strlen(s) + 1); - if (mbstowcs(new_str, s, strlen(s) + 1) < 0) { - g_free(new_str); - new_str = NULL; - } else - new_str = g_realloc(new_str, - sizeof(wchar_t) * (wcslen(new_str) + 1)); - } else - new_str = NULL; - - return new_str; -} - -gchar *strdup_wcstombs(const wchar_t *s) -{ - gchar *new_str; - size_t len; - - if (s) { - len = wcslen(s) * MB_CUR_MAX + 1; - new_str = g_new(gchar, len); - if (wcstombs(new_str, s, len) < 0) { - g_free(new_str); - new_str = NULL; - } else - new_str = g_realloc(new_str, strlen(new_str) + 1); - } else - new_str = NULL; - - return new_str; -} - -/* Compare S1 and S2, ignoring case. */ -gint wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - wint_t c1; - wint_t c2; - - while (n--) { - c1 = towlower(*s1++); - c2 = towlower(*s2++); - if (c1 != c2) - return c1 - c2; - else if (c1 == 0 && c2 == 0) - break; - } - - return 0; -} - -/* Find the first occurrence of NEEDLE in HAYSTACK, ignoring case. */ -wchar_t *wcscasestr(const wchar_t *haystack, const wchar_t *needle) -{ - register size_t haystack_len, needle_len; - - haystack_len = wcslen(haystack); - needle_len = wcslen(needle); - - if (haystack_len < needle_len || needle_len == 0) - return NULL; - - while (haystack_len >= needle_len) { - if (!wcsncasecmp(haystack, needle, needle_len)) - return (wchar_t *)haystack; - else { - haystack++; - haystack_len--; - } - } - - return NULL; -} - -gint get_mbs_len(const gchar *s) -{ - const gchar *p = s; - gint mb_len; - gint len = 0; - - if (!p) - return -1; - - while (*p != '\0') { - mb_len = g_utf8_skip[*(guchar *)p]; - if (mb_len == 0) - break; - else - len++; - - p += mb_len; - } - - return len; -} - /* Examine if next block is non-ASCII string */ gboolean is_next_nonascii(const gchar *s) { diff --git a/libsylph/utils.h b/libsylph/utils.h index 7301c59b..41760bb5 100644 --- a/libsylph/utils.h +++ b/libsylph/utils.h @@ -35,9 +35,6 @@ #if HAVE_ALLOCA_H # include <alloca.h> #endif -#if HAVE_WCHAR_H -# include <wchar.h> -#endif /* Wrappers for C library function that take pathname arguments. */ #if GLIB_CHECK_VERSION(2, 6, 0) @@ -237,42 +234,6 @@ gchar *strncpy2 (gchar *dest, const gchar *src, size_t n); -/* wide-character functions */ -#if !HAVE_ISWALNUM -int iswalnum (wint_t wc); -#endif -#if !HAVE_ISWSPACE -int iswspace (wint_t wc); -#endif -#if !HAVE_TOWLOWER -wint_t towlower (wint_t wc); -#endif - -#if !HAVE_WCSLEN -size_t wcslen (const wchar_t *s); -#endif -#if !HAVE_WCSCPY -wchar_t *wcscpy (wchar_t *dest, - const wchar_t *src); -#endif -#if !HAVE_WCSNCPY -wchar_t *wcsncpy (wchar_t *dest, - const wchar_t *src, - size_t n); -#endif - -wchar_t *wcsdup (const wchar_t *s); -wchar_t *wcsndup (const wchar_t *s, - size_t n); -wchar_t *strdup_mbstowcs (const gchar *s); -gchar *strdup_wcstombs (const wchar_t *s); -gint wcsncasecmp (const wchar_t *s1, - const wchar_t *s2, - size_t n); -wchar_t *wcscasestr (const wchar_t *haystack, - const wchar_t *needle); -gint get_mbs_len (const gchar *s); - gboolean is_next_nonascii (const gchar *s); gint get_next_word_len (const gchar *s); diff --git a/src/addr_compl.c b/src/addr_compl.c index c0718135..f1f82b84 100644 --- a/src/addr_compl.c +++ b/src/addr_compl.c @@ -35,10 +35,6 @@ #include <string.h> #include <ctype.h> -#if (HAVE_WCTYPE_H && HAVE_WCHAR_H) -# include <wchar.h> -# include <wctype.h> -#endif #include "xml.h" #include "addr_compl.h" diff --git a/src/compose.c b/src/compose.c index 3e1e543d..511bc935 100644 --- a/src/compose.c +++ b/src/compose.c @@ -74,11 +74,6 @@ #include <signal.h> #include <errno.h> -#if (HAVE_WCTYPE_H && HAVE_WCHAR_H) -# include <wchar.h> -# include <wctype.h> -#endif - #include "main.h" #include "mainwindow.h" #include "compose.h" diff --git a/src/gtkutils.c b/src/gtkutils.c index bbdbb409..71674a33 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -42,11 +42,6 @@ #include <stdlib.h> #include <stdarg.h> -#if (HAVE_WCTYPE_H && HAVE_WCHAR_H) -# include <wchar.h> -# include <wctype.h> -#endif - #include "gtkutils.h" #include "utils.h" #include "codeconv.h" diff --git a/src/gtkutils.h b/src/gtkutils.h index df23a4e5..2a867660 100644 --- a/src/gtkutils.h +++ b/src/gtkutils.h @@ -40,9 +40,6 @@ #include <gtk/gtkstock.h> #include <stdlib.h> -#if HAVE_WCHAR_H -# include <wchar.h> -#endif typedef struct _ComboButton ComboButton; @@ -27,9 +27,6 @@ #include <glib.h> #include <gtk/gtktextview.h> -#include <string.h> /* for strlen */ -#include <stdlib.h> /* for mbstowcs */ - #include "undo.h" #include "utils.h" #include "prefs_common.h" |