2004-11-18 [paul] 0.9.12cvs158.1
[claws.git] / src / common / utils.h
index 434c6f9a2990500bc6ae6a42550007ff48674229..96bdadc65700d66bedd89b45d79ad29e2e46c10c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
        ptr = __tmp; \
 }
 
+#define AUTORELEASE_STR(str, iffail) \
+{ \
+       gchar *__str; \
+       Xstrdup_a(__str, str, iffail); \
+       g_free(str); \
+       str = __str; \
+}
+
 #define FILE_OP_ERROR(file, func) \
 { \
        fprintf(stderr, "%s: ", file); \
        perror(func); \
 }
 
+#define IS_ASCII(c) (((guchar) c) <= 0177 ? 1 : 0)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef gpointer (*GNodeMapFunc)       (gpointer nodedata, gpointer data);
 
 /* debug functions */
@@ -161,6 +175,18 @@ guint str_case_hash                (gconstpointer   key);
 
 void ptr_array_free_strings    (GPtrArray      *array);
 
+typedef gboolean (*StrFindFunc) (const gchar   *haystack,
+                                const gchar    *needle);
+
+gboolean str_find              (const gchar    *haystack,
+                                const gchar    *needle);
+gboolean str_case_find         (const gchar    *haystack,
+                                const gchar    *needle);
+gboolean str_find_equal                (const gchar    *haystack,
+                                const gchar    *needle);
+gboolean str_case_find_equal   (const gchar    *haystack,
+                                const gchar    *needle);
+
 /* number-string conversion */
 gint to_number                 (const gchar *nstr);
 gchar *itos_buf                        (gchar       *nstr,
@@ -368,6 +394,10 @@ gint copy_file                     (const gchar    *src,
 gint move_file                 (const gchar    *src,
                                 const gchar    *dest,
                                 gboolean        overwrite);
+gint copy_file_part_to_fp      (FILE           *fp,
+                                off_t           offset,
+                                size_t          length,
+                                FILE           *dest_fp);
 gint copy_file_part            (FILE           *fp,
                                 off_t           offset,
                                 size_t          length,
@@ -429,18 +459,22 @@ const gchar * line_has_quote_char (const gchar *str,
 const gchar * line_has_quote_char_last (const gchar *str,
                                         const gchar *quote_chars);
 
-/* used in extended search */
-gchar * expand_search_string   (const gchar *str);
-
 guint g_stricase_hash  (gconstpointer gptr);
 gint g_stricase_equal  (gconstpointer gptr1, gconstpointer gptr2);
 gint g_int_compare     (gconstpointer a, gconstpointer b);
 
-gchar *generate_msgid          (const gchar *address, gchar *buf, gint len);
+gchar *generate_msgid          (gchar *buf, gint len);
 gchar *generate_mime_boundary  (const gchar *prefix);
 
 gint quote_cmd_argument(gchar * result, guint size,
                        const gchar * path);
 GNode *g_node_map(GNode *node, GNodeMapFunc func, gpointer data);
 
+gboolean get_hex_value(guchar *out, gchar c1, gchar c2);
+void get_hex_str(gchar *out, guchar ch);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __UTILS_H__ */