aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-02 08:24:31 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-02 08:24:31 +0000
commit3ca4175052e8a6c26a6cc93501e92a4436cad3df (patch)
treecd8c6b5f88ff65d5e74c27638eaaf4ec13572828 /src
parente059bc94965dd6cb4afcff3d5efceec32a98a5a0 (diff)
fixed gcc-4.0 warnings.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@457 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/about.c1
-rw-r--r--src/addr_compl.c2
-rw-r--r--src/codeconv.c54
-rw-r--r--src/compose.c15
-rw-r--r--src/imap.c12
-rw-r--r--src/pop.c6
-rw-r--r--src/prefs_account.c7
-rw-r--r--src/procmime.c6
-rw-r--r--src/procmsg.c8
-rw-r--r--src/quote_fmt_parse.y12
-rw-r--r--src/quoted-printable.c9
-rw-r--r--src/textview.c4
-rw-r--r--src/utils.c97
-rw-r--r--src/utils.h6
-rw-r--r--src/xml.c8
15 files changed, 130 insertions, 117 deletions
diff --git a/src/about.c b/src/about.c
index 5374087d..27d817c8 100644
--- a/src/about.c
+++ b/src/about.c
@@ -233,6 +233,7 @@ static void about_create(void)
NULL, NULL, NULL, NULL);
gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
gtk_widget_grab_default(ok_button);
+ gtk_widget_grab_focus(ok_button);
g_signal_connect_closure
(G_OBJECT(ok_button), "clicked",
g_cclosure_new_swap(G_CALLBACK(gtk_widget_hide_on_delete),
diff --git a/src/addr_compl.c b/src/addr_compl.c
index b1f6856f..c0718135 100644
--- a/src/addr_compl.c
+++ b/src/addr_compl.c
@@ -243,7 +243,7 @@ gchar *get_address_from_edit(GtkEntry *entry, gint *start_pos)
return NULL;
#define IS_VALID_CHAR(x) \
- (isalnum(x) || (x) == '"' || (x) == '<' || ((guchar)(x) > 0x7f))
+ (g_ascii_isalnum(x) || (x) == '"' || (x) == '<' || ((guchar)(x) > 0x7f))
/* now scan back until we hit a valid character */
for (; *p && !IS_VALID_CHAR(*p); p = g_utf8_next_char(p))
diff --git a/src/codeconv.c b/src/codeconv.c
index 9ad84724..c135b19c 100644
--- a/src/codeconv.c
+++ b/src/codeconv.c
@@ -131,13 +131,13 @@ static gchar *conv_noconv(const gchar *inbuf, gint *error);
static gchar *conv_jistoeuc(const gchar *inbuf, gint *error)
{
gchar *outbuf;
- const guchar *in = inbuf;
+ const guchar *in = (guchar *)inbuf;
guchar *out;
JISState state = JIS_ASCII;
gint error_ = 0;
outbuf = g_malloc(strlen(inbuf) * 2 + 1);
- out = outbuf;
+ out = (guchar *)outbuf;
while (*in != '\0') {
if (*in == ESC) {
@@ -279,13 +279,13 @@ static gint conv_jis_hantozen(guchar *outbuf, guchar jis_code, guchar sound_sym)
static gchar *conv_euctojis(const gchar *inbuf, gint *error)
{
gchar *outbuf;
- const guchar *in = inbuf;
+ const guchar *in = (guchar *)inbuf;
guchar *out;
JISState state = JIS_ASCII;
gint error_ = 0;
outbuf = g_malloc(strlen(inbuf) * 3 + 4);
- out = outbuf;
+ out = (guchar *)outbuf;
while (*in != '\0') {
if (isascii(*in)) {
@@ -381,12 +381,12 @@ static gchar *conv_euctojis(const gchar *inbuf, gint *error)
static gchar *conv_sjistoeuc(const gchar *inbuf, gint *error)
{
gchar *outbuf;
- const guchar *in = inbuf;
+ const guchar *in = (guchar *)inbuf;
guchar *out;
gint error_ = 0;
outbuf = g_malloc(strlen(inbuf) * 2 + 1);
- out = outbuf;
+ out = (guchar *)outbuf;
while (*in != '\0') {
if (isascii(*in)) {
@@ -680,13 +680,13 @@ static void conv_unreadable_eucjp(gchar *str)
static void conv_unreadable_8bit(gchar *str)
{
- register guchar *p = str;
+ register gchar *p = str;
while (*p != '\0') {
/* convert CR+LF -> LF */
if (*p == '\r' && *(p + 1) == '\n')
memmove(p, p + 1, strlen(p));
- else if (!isascii(*p)) *p = SUBST_CHAR;
+ else if (!isascii(*(guchar *)p)) *p = SUBST_CHAR;
p++;
}
}
@@ -729,7 +729,7 @@ void conv_mb_alnum(gchar *str)
NCV, NCV, NCV, NCV, NCV, NCV, NCV, NCV
};
- register guchar *p = str;
+ register guchar *p = (guchar *)str;
register gint len;
len = strlen(str);
@@ -775,7 +775,7 @@ void conv_mb_alnum(gchar *str)
CharSet conv_guess_ja_encoding(const gchar *str)
{
- const guchar *p = str;
+ const guchar *p = (const guchar *)str;
CharSet guessed = C_US_ASCII;
while (*p != '\0') {
@@ -1662,16 +1662,17 @@ gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding)
#define LBREAK_IF_REQUIRED(cond, is_plain_text) \
{ \
- if (len - (destp - (guchar *)dest) < MAX_LINELEN + 2) { \
+ if (len - (destp - dest) < MAX_LINELEN + 2) { \
*destp = '\0'; \
return; \
} \
\
if ((cond) && *srcp) { \
- if (destp > (guchar *)dest && left < MAX_LINELEN - 1) { \
- if (isspace(*(destp - 1))) \
+ if (destp > dest && left < MAX_LINELEN - 1) { \
+ if (g_ascii_isspace(*(destp - 1))) \
destp--; \
- else if (is_plain_text && isspace(*srcp)) \
+ else if (is_plain_text && \
+ g_ascii_isspace(*srcp)) \
srcp++; \
if (*srcp) { \
*destp++ = '\n'; \
@@ -1690,8 +1691,8 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
gint mimestr_len;
gchar *mimesep_enc;
gint left;
- const guchar *srcp = src;
- guchar *destp = dest;
+ const gchar *srcp = src;
+ gchar *destp = dest;
gboolean use_base64;
g_return_if_fail(g_utf8_validate(src, -1, NULL) == TRUE);
@@ -1718,7 +1719,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
while (*srcp) {
LBREAK_IF_REQUIRED(left <= 0, TRUE);
- while (isspace(*srcp)) {
+ while (g_ascii_isspace(*srcp)) {
*destp++ = *srcp++;
left--;
LBREAK_IF_REQUIRED(left <= 0, TRUE);
@@ -1753,21 +1754,22 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
gchar *part_str;
gchar *out_str;
gchar *enc_str;
- const guchar *p = srcp;
+ const gchar *p = srcp;
gint out_str_len;
gint out_enc_str_len;
gint mime_block_len;
gboolean cont = FALSE;
while (*p != '\0') {
- if (isspace(*p) && !is_next_nonascii(p + 1))
+ if (g_ascii_isspace(*p) &&
+ !is_next_nonascii(p + 1))
break;
/* don't include parentheses in encoded
strings */
if (addr_field && (*p == '(' || *p == ')'))
break;
- mb_len = g_utf8_skip[*p];
+ mb_len = g_utf8_skip[*(guchar *)p];
Xstrndup_a(part_str, srcp, cur_len + mb_len, );
out_str = conv_codeset_strdup
@@ -1783,7 +1785,8 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
out_enc_str_len = B64LEN(out_str_len);
else
out_enc_str_len =
- qp_get_q_encoding_len(out_str);
+ qp_get_q_encoding_len
+ ((guchar *)out_str);
g_free(out_str);
@@ -1814,13 +1817,16 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
out_enc_str_len = B64LEN(out_str_len);
else
out_enc_str_len =
- qp_get_q_encoding_len(out_str);
+ qp_get_q_encoding_len
+ ((guchar *)out_str);
Xalloca(enc_str, out_enc_str_len + 1, );
if (use_base64)
- base64_encode(enc_str, out_str, out_str_len);
+ base64_encode(enc_str,
+ (guchar *)out_str,
+ out_str_len);
else
- qp_q_encode(enc_str, out_str);
+ qp_q_encode(enc_str, (guchar *)out_str);
g_free(out_str);
diff --git a/src/compose.c b/src/compose.c
index 2aa31081..fd3b3fa7 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1509,7 +1509,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
if (msginfo->subject && *msginfo->subject) {
gchar *buf;
- guchar *p;
+ gchar *p;
buf = g_strdup(msginfo->subject);
@@ -1518,7 +1518,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
while (!g_ascii_strncasecmp(buf, "Re:", 3)) {
p = buf + 3;
- while (isspace(*p)) p++;
+ while (g_ascii_isspace(*p)) p++;
memmove(buf, p, strlen(p) + 1);
}
@@ -2867,7 +2867,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
for (i = 0; i < len; i += B64_LINE_SIZE) {
l = MIN(B64_LINE_SIZE, len - i);
- base64_encode(outbuf, buf + i, l);
+ base64_encode(outbuf, (guchar *)buf + i, l);
fputs(outbuf, fp);
fputc('\n', fp);
}
@@ -2876,7 +2876,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
size_t outlen;
outbuf = g_malloc(len * 4);
- qp_encode_line(outbuf, buf);
+ qp_encode_line(outbuf, (guchar *)buf);
outlen = strlen(outbuf);
if (fwrite(outbuf, sizeof(gchar), outlen, fp) != outlen) {
FILE_OP_ERROR(file, "fwrite");
@@ -3311,12 +3311,13 @@ static void compose_write_attach(Compose *compose, FILE *fp,
while ((len = fread(inbuf, sizeof(gchar),
B64_LINE_SIZE, tmp_fp))
== B64_LINE_SIZE) {
- base64_encode(outbuf, inbuf, B64_LINE_SIZE);
+ base64_encode(outbuf, (guchar *)inbuf,
+ B64_LINE_SIZE);
fputs(outbuf, fp);
fputc('\n', fp);
}
if (len > 0 && feof(tmp_fp)) {
- base64_encode(outbuf, inbuf, len);
+ base64_encode(outbuf, (guchar *)inbuf, len);
fputs(outbuf, fp);
fputc('\n', fp);
}
@@ -3330,7 +3331,7 @@ static void compose_write_attach(Compose *compose, FILE *fp,
gchar inbuf[BUFFSIZE], outbuf[BUFFSIZE * 4];
while (fgets(inbuf, sizeof(inbuf), attach_fp) != NULL) {
- qp_encode_line(outbuf, inbuf);
+ qp_encode_line(outbuf, (guchar *)inbuf);
fputs(outbuf, fp);
}
} else {
diff --git a/src/imap.c b/src/imap.c
index 932e643e..bfa88da8 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -2436,7 +2436,7 @@ static GList *imap_parse_namespace_str(gchar *str)
*p = '\0';
p++;
- while (*p && isspace(*p)) p++;
+ while (*p && g_ascii_isspace(*p)) p++;
if (*p == '\0') break;
if (strncmp(p, "NIL", 3) == 0)
separator = NULL;
@@ -2595,7 +2595,7 @@ static gchar *imap_parse_atom(IMAPSession *session, gchar *src,
g_return_val_if_fail(str != NULL, cur_pos);
/* read the next line if the current response buffer is empty */
- while (isspace(*(guchar *)cur_pos)) cur_pos++;
+ while (g_ascii_isspace(*cur_pos)) cur_pos++;
while (*cur_pos == '\0') {
if (sock_getline(SESSION(session)->sock, &nextline) < 0)
return cur_pos;
@@ -2606,7 +2606,7 @@ static gchar *imap_parse_atom(IMAPSession *session, gchar *src,
debug_print("IMAP4< %s\n", nextline);
g_free(nextline);
- while (isspace(*(guchar *)cur_pos)) cur_pos++;
+ while (g_ascii_isspace(*cur_pos)) cur_pos++;
}
if (!strncmp(cur_pos, "NIL", 3)) {
@@ -2666,7 +2666,7 @@ static gchar *imap_get_header(IMAPSession *session, gchar *cur_pos,
g_return_val_if_fail(str != NULL, cur_pos);
- while (isspace(*(guchar *)cur_pos)) cur_pos++;
+ while (g_ascii_isspace(*cur_pos)) cur_pos++;
g_return_val_if_fail(*cur_pos == '{', cur_pos);
@@ -2697,7 +2697,7 @@ static gchar *imap_get_header(IMAPSession *session, gchar *cur_pos,
*headers = g_strndup(cur_pos, len);
cur_pos += len;
- while (isspace(*(guchar *)cur_pos)) cur_pos++;
+ while (g_ascii_isspace(*cur_pos)) cur_pos++;
while (*cur_pos == '\0') {
if (sock_getline(SESSION(session)->sock, &nextline) < 0)
return cur_pos;
@@ -2707,7 +2707,7 @@ static gchar *imap_get_header(IMAPSession *session, gchar *cur_pos,
debug_print("IMAP4< %s\n", nextline);
g_free(nextline);
- while (isspace(*(guchar *)cur_pos)) cur_pos++;
+ while (g_ascii_isspace(*cur_pos)) cur_pos++;
}
return cur_pos;
diff --git a/src/pop.c b/src/pop.c
index 78c41d29..410accc9 100644
--- a/src/pop.c
+++ b/src/pop.c
@@ -696,7 +696,7 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
{
Pop3Session *pop3_session = POP3_SESSION(session);
Pop3ErrorValue val = PS_SUCCESS;
- const guchar *body;
+ const gchar *body;
body = msg;
if (pop3_session->state != POP3_GETRANGE_UIDL_RECV &&
@@ -711,9 +711,9 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
if (*body == '+' || *body == '-')
body++;
- while (isalpha(*body))
+ while (g_ascii_isalpha(*body))
body++;
- while (isspace(*body))
+ while (g_ascii_isspace(*body))
body++;
}
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 90aedd0e..c7d51473 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -337,7 +337,8 @@ static PrefParam param[] = {
&compose.sigfile_radiobtn,
prefs_account_enum_set_data_from_radiobtn,
prefs_account_enum_set_radiobtn},
- {"signature_path", "~/"DEFAULT_SIGNATURE, &tmp_ac_prefs.sig_path, P_STRING,
+ {"signature_path", "~" G_DIR_SEPARATOR_S DEFAULT_SIGNATURE,
+ &tmp_ac_prefs.sig_path, P_STRING,
&compose.sigpath_entry,
prefs_set_data_from_entry, prefs_set_entry},
@@ -527,7 +528,7 @@ PrefsAccount *prefs_account_new(void)
void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
{
- const guchar *p = label;
+ const gchar *p = label;
gchar *rcpath;
gint id;
@@ -541,7 +542,7 @@ void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
g_free(rcpath);
*ac_prefs = tmp_ac_prefs;
- while (*p && !isdigit(*p)) p++;
+ while (*p && !g_ascii_isdigit(*p)) p++;
id = atoi(p);
if (id < 0) g_warning("wrong account id: %d\n", id);
ac_prefs->account_id = id;
diff --git a/src/procmime.c b/src/procmime.c
index 5f067e68..dd576bb6 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -1047,7 +1047,7 @@ static GList *procmime_get_mime_type_list(const gchar *file)
GList *list = NULL;
FILE *fp;
gchar buf[BUFFSIZE];
- guchar *p;
+ gchar *p;
gchar *delim;
MimeType *mime_type;
@@ -1061,7 +1061,7 @@ static GList *procmime_get_mime_type_list(const gchar *file)
g_strstrip(buf);
p = buf;
- while (*p && !isspace(*p)) p++;
+ while (*p && !g_ascii_isspace(*p)) p++;
if (*p) {
*p = '\0';
p++;
@@ -1074,7 +1074,7 @@ static GList *procmime_get_mime_type_list(const gchar *file)
mime_type->type = g_strdup(buf);
mime_type->sub_type = g_strdup(delim + 1);
- while (*p && isspace(*p)) p++;
+ while (*p && g_ascii_isspace(*p)) p++;
if (*p)
mime_type->extension = g_strdup(p);
else
diff --git a/src/procmsg.c b/src/procmsg.c
index 8f30ab11..fb7c0fd4 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -1171,14 +1171,14 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
} else if (hentry[H_X_MAILING_LIST].body != NULL) {
SET_FILTER_KEY("X-Mailing-list", H_X_MAILING_LIST);
} else if (hentry[H_X_SEQUENCE].body != NULL) {
- guchar *p;
+ gchar *p;
SET_FILTER_KEY("X-Sequence", H_X_SEQUENCE);
p = *key;
while (*p != '\0') {
- while (*p != '\0' && !isspace(*p)) p++;
- while (isspace(*p)) p++;
- if (isdigit(*p)) {
+ while (*p != '\0' && !g_ascii_isspace(*p)) p++;
+ while (g_ascii_isspace(*p)) p++;
+ if (g_ascii_isdigit(*p)) {
*p = '\0';
break;
}
diff --git a/src/quote_fmt_parse.y b/src/quote_fmt_parse.y
index 93b46314..dab2befd 100644
--- a/src/quote_fmt_parse.y
+++ b/src/quote_fmt_parse.y
@@ -122,7 +122,7 @@ int quote_fmtwrap(void)
static int isseparator(int ch)
{
- return isspace(ch) || ch == '.' || ch == '-';
+ return g_ascii_isspace(ch) || ch == '.' || ch == '-';
}
%}
@@ -194,14 +194,14 @@ special:
| SHOW_FIRST_NAME
{
if (msginfo->fromname) {
- guchar *p;
+ gchar *p;
gchar *str;
str = alloca(strlen(msginfo->fromname) + 1);
if (str != NULL) {
strcpy(str, msginfo->fromname);
p = str;
- while (*p && !isspace(*p)) p++;
+ while (*p && !g_ascii_isspace(*p)) p++;
*p = '\0';
INSERT(str);
}
@@ -212,15 +212,15 @@ special:
#define MAX_SENDER_INITIAL 20
if (msginfo->fromname) {
gchar tmp[MAX_SENDER_INITIAL];
- guchar *p;
+ gchar *p;
gchar *cur;
gint len = 0;
p = msginfo->fromname;
cur = tmp;
while (*p) {
- if (*p && isalnum(*p)) {
- *cur = toupper(*p);
+ if (*p && g_ascii_isalnum(*p)) {
+ *cur = g_ascii_toupper(*p);
cur++;
len++;
if (len >= MAX_SENDER_INITIAL - 1)
diff --git a/src/quoted-printable.c b/src/quoted-printable.c
index bf99a234..cea0b704 100644
--- a/src/quoted-printable.c
+++ b/src/quoted-printable.c
@@ -92,9 +92,10 @@ gint qp_decode_line(gchar *str)
while (*inp != '\0') {
if (*inp == '=') {
if (inp[1] && inp[2] &&
- get_hex_value(outp, inp[1], inp[2]) == TRUE) {
+ get_hex_value((guchar *)outp, inp[1], inp[2])
+ == TRUE) {
inp += 3;
- } else if (inp[1] == '\0' || isspace((guchar)inp[1])) {
+ } else if (inp[1] == '\0' || g_ascii_isspace(inp[1])) {
/* soft line break */
break;
} else {
@@ -150,7 +151,7 @@ gint qp_get_q_encoding_len(const guchar *str)
if (*inp == 0x20)
len++;
else if (*inp == '=' || *inp == '?' || *inp == '_' ||
- *inp < 32 || *inp > 127 || isspace(*inp))
+ *inp < 32 || *inp > 127 || g_ascii_isspace(*inp))
len += 3;
else
len++;
@@ -170,7 +171,7 @@ void qp_q_encode(gchar *out, const guchar *in)
if (*inp == 0x20)
*outp++ = '_';
else if (*inp == '=' || *inp == '?' || *inp == '_' ||
- *inp < 32 || *inp > 127 || isspace(*inp)) {
+ *inp < 32 || *inp > 127 || g_ascii_isspace(*inp)) {
*outp++ = '=';
get_hex_str(outp, *inp);
outp += 2;
diff --git a/src/textview.c b/src/textview.c
index a0332c84..7df5e385 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -842,11 +842,11 @@ static gchar *make_uri_string(const gchar *bp, const gchar *ep)
(isascii(ch) && \
(ch) > 32 && \
(ch) != 127 && \
- !isspace(ch) && \
+ !g_ascii_isspace(ch) && \
!strchr("(),;<>\"", (ch)))
/* alphabet and number within 7bit ASCII */
-#define IS_ASCII_ALNUM(ch) (isascii(ch) && isalnum(ch))
+#define IS_ASCII_ALNUM(ch) (isascii(ch) && g_ascii_isalnum(ch))
/* get_email_part() - retrieves an email address. Returns TRUE if succesful */
static gboolean get_email_part(const gchar *start, const gchar *scanpos,
diff --git a/src/utils.c b/src/utils.c
index 932c8320..56c60c0f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -147,12 +147,12 @@ gboolean str_case_find_equal(const gchar *haystack, const gchar *needle)
gint to_number(const gchar *nstr)
{
- register const guchar *p;
+ register const gchar *p;
if (*nstr == '\0') return -1;
for (p = nstr; *p != '\0'; p++)
- if (!isdigit(*p)) return -1;
+ if (!g_ascii_isdigit(*p)) return -1;
return atoi(nstr);
}
@@ -322,14 +322,14 @@ gchar *strncpy2(gchar *dest, const gchar *src, size_t n)
#if !HAVE_ISWALNUM
int iswalnum(wint_t wc)
{
- return isalnum((int)wc);
+ return g_ascii_isalnum((int)wc);
}
#endif
#if !HAVE_ISWSPACE
int iswspace(wint_t wc)
{
- return isspace((int)wc);
+ return g_ascii_isspace((int)wc);
}
#endif
@@ -525,26 +525,26 @@ gint get_mbs_len(const gchar *s)
}
/* Examine if next block is non-ASCII string */
-gboolean is_next_nonascii(const guchar *s)
+gboolean is_next_nonascii(const gchar *s)
{
- const guchar *p;
+ const gchar *p;
/* skip head space */
- for (p = s; *p != '\0' && isspace(*p); p++)
+ for (p = s; *p != '\0' && g_ascii_isspace(*p); p++)
;
- for (; *p != '\0' && !isspace(*p); p++) {
- if (*p > 127 || *p < 32)
+ for (; *p != '\0' && !g_ascii_isspace(*p); p++) {
+ if (*(guchar *)p > 127 || *(guchar *)p < 32)
return TRUE;
}
return FALSE;
}
-gint get_next_word_len(const guchar *s)
+gint get_next_word_len(const gchar *s)
{
gint len = 0;
- for (; *s != '\0' && !isspace(*s); s++, len++)
+ for (; *s != '\0' && !g_ascii_isspace(*s); s++, len++)
;
return len;
@@ -586,7 +586,7 @@ gint subject_compare_for_sort(const gchar *s1, const gchar *s2)
void trim_subject_for_compare(gchar *str)
{
- guchar *srcp;
+ gchar *srcp;
eliminate_parenthesis(str, '[', ']');
eliminate_parenthesis(str, '(', ')');
@@ -594,34 +594,34 @@ void trim_subject_for_compare(gchar *str)
while (!g_ascii_strncasecmp(str, "Re:", 3)) {
srcp = str + 3;
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(str, srcp, strlen(srcp) + 1);
}
}
void trim_subject_for_sort(gchar *str)
{
- guchar *srcp;
+ gchar *srcp;
g_strstrip(str);
while (!g_ascii_strncasecmp(str, "Re:", 3)) {
srcp = str + 3;
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(str, srcp, strlen(srcp) + 1);
}
}
void trim_subject(gchar *str)
{
- register guchar *srcp, *destp;
+ register gchar *srcp, *destp;
gchar op, cl;
gint in_brace;
destp = str;
while (!g_ascii_strncasecmp(destp, "Re:", 3)) {
destp += 3;
- while (isspace(*destp)) destp++;
+ while (g_ascii_isspace(*destp)) destp++;
}
if (*destp == '[') {
@@ -644,13 +644,13 @@ void trim_subject(gchar *str)
if (in_brace == 0)
break;
}
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(destp, srcp, strlen(srcp) + 1);
}
void eliminate_parenthesis(gchar *str, gchar op, gchar cl)
{
- register guchar *srcp, *destp;
+ register gchar *srcp, *destp;
gint in_brace;
srcp = destp = str;
@@ -667,7 +667,7 @@ void eliminate_parenthesis(gchar *str, gchar op, gchar cl)
if (in_brace == 0)
break;
}
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(destp, srcp, strlen(srcp) + 1);
}
}
@@ -732,14 +732,14 @@ void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
void eliminate_quote(gchar *str, gchar quote_chr)
{
- register guchar *srcp, *destp;
+ register gchar *srcp, *destp;
srcp = destp = str;
while ((destp = strchr(destp, quote_chr))) {
if ((srcp = strchr(destp + 1, quote_chr))) {
srcp++;
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(destp, srcp, strlen(srcp) + 1);
} else {
*destp = '\0';
@@ -762,7 +762,7 @@ void extract_quote(gchar *str, gchar quote_chr)
void eliminate_address_comment(gchar *str)
{
- register guchar *srcp, *destp;
+ register gchar *srcp, *destp;
gint in_brace;
srcp = destp = str;
@@ -773,7 +773,7 @@ void eliminate_address_comment(gchar *str)
if (*srcp == '@') {
destp = srcp + 1;
} else {
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(destp, srcp, strlen(srcp) + 1);
}
} else {
@@ -796,7 +796,7 @@ void eliminate_address_comment(gchar *str)
if (in_brace == 0)
break;
}
- while (isspace(*srcp)) srcp++;
+ while (g_ascii_isspace(*srcp)) srcp++;
memmove(destp, srcp, strlen(srcp) + 1);
}
}
@@ -994,12 +994,12 @@ void remove_return(gchar *str)
void remove_space(gchar *str)
{
- register guchar *p = str;
+ register gchar *p = str;
register gint spc;
while (*p) {
spc = 0;
- while (isspace(*(p + spc)))
+ while (g_ascii_isspace(*(p + spc)))
spc++;
if (spc)
memmove(p, p + spc, strlen(p + spc) + 1);
@@ -1010,14 +1010,14 @@ void remove_space(gchar *str)
void unfold_line(gchar *str)
{
- register guchar *p = str;
+ register gchar *p = str;
register gint spc;
while (*p) {
if (*p == '\n' || *p == '\r') {
*p++ = ' ';
spc = 0;
- while (isspace(*(p + spc)))
+ while (g_ascii_isspace(*(p + spc)))
spc++;
if (spc)
memmove(p, p + spc, strlen(p + spc) + 1);
@@ -1077,14 +1077,16 @@ gboolean is_header_line(const gchar *str)
return FALSE;
}
-gboolean is_ascii_str(const guchar *str)
+gboolean is_ascii_str(const gchar *str)
{
- while (*str != '\0') {
- if (*str != '\t' && *str != ' ' &&
- *str != '\r' && *str != '\n' &&
- (*str < 32 || *str >= 127))
+ const guchar *p = (const guchar *)str;
+
+ while (*p != '\0') {
+ if (*p != '\t' && *p != ' ' &&
+ *p != '\r' && *p != '\n' &&
+ (*p < 32 || *p >= 127))
return FALSE;
- str++;
+ p++;
}
return TRUE;
@@ -1092,15 +1094,15 @@ gboolean is_ascii_str(const guchar *str)
gint get_quote_level(const gchar *str)
{
- const guchar *first_pos;
- const guchar *last_pos;
- const guchar *p = str;
+ const gchar *first_pos;
+ const gchar *last_pos;
+ const gchar *p = str;
gint quote_level = -1;
/* speed up line processing by only searching to the last '>' */
if ((first_pos = strchr(str, '>')) != NULL) {
/* skip a line if it contains a '<' before the initial '>' */
- if (memchr(str, '<', first_pos - (const guchar *)str) != NULL)
+ if (memchr(str, '<', first_pos - str) != NULL)
return -1;
last_pos = strrchr(first_pos, '>');
} else
@@ -1108,7 +1110,7 @@ gint get_quote_level(const gchar *str)
while (p <= last_pos) {
while (p < last_pos) {
- if (isspace(*p))
+ if (g_ascii_isspace(*p))
p++;
else
break;
@@ -1116,9 +1118,9 @@ gint get_quote_level(const gchar *str)
if (*p == '>')
quote_level++;
- else if (*p != '-' && !isspace(*p) && p <= last_pos) {
+ else if (*p != '-' && !g_ascii_isspace(*p) && p <= last_pos) {
/* any characters are allowed except '-' and space */
- while (*p != '-' && *p != '>' && !isspace(*p) &&
+ while (*p != '-' && *p != '>' && !g_ascii_isspace(*p) &&
p < last_pos)
p++;
if (*p == '>')
@@ -1257,7 +1259,7 @@ gchar **strsplit_parenthesis(const gchar *str, gchar op, gchar cl,
n++;
str = s_cl + 1;
- while (*str && isspace(*(guchar *)str)) str++;
+ while (*str && g_ascii_isspace(*str)) str++;
if (*str != op) {
string_list = g_slist_prepend(string_list,
g_strdup(""));
@@ -1428,14 +1430,14 @@ gchar *trim_string_before(const gchar *str, gint len)
GList *uri_list_extract_filenames(const gchar *uri_list)
{
GList *result = NULL;
- const guchar *p, *q;
+ const gchar *p, *q;
gchar *file;
p = uri_list;
while (p) {
if (*p != '#') {
- while (isspace(*p)) p++;
+ while (g_ascii_isspace(*p)) p++;
if (!strncmp(p, "file:", 5)) {
p += 5;
while (*p == '/' && *(p + 1) == '/') p++;
@@ -1444,7 +1446,8 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
if (q > p) {
q--;
- while (q > p && isspace(*q)) q--;
+ while (q > p && g_ascii_isspace(*q))
+ q--;
file = g_malloc(q - p + 2);
strncpy(file, p, q - p + 1);
file[q - p + 1] = '\0';
@@ -2867,7 +2870,7 @@ gchar *file_read_to_str(const gchar *file)
gchar *file_read_stream_to_str(FILE *fp)
{
GByteArray *array;
- gchar buf[BUFSIZ];
+ guchar buf[BUFSIZ];
gint n_read;
gchar *str;
diff --git a/src/utils.h b/src/utils.h
index e3cfa75f..bbd26fa2 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -234,8 +234,8 @@ wchar_t *wcscasestr (const wchar_t *haystack,
const wchar_t *needle);
gint get_mbs_len (const gchar *s);
-gboolean is_next_nonascii (const guchar *s);
-gint get_next_word_len (const guchar *s);
+gboolean is_next_nonascii (const gchar *s);
+gint get_next_word_len (const gchar *s);
/* functions for string parsing */
gint subject_compare (const gchar *s1,
@@ -297,7 +297,7 @@ void subst_null (gchar *str,
gchar subst);
void subst_for_filename (gchar *str);
gboolean is_header_line (const gchar *str);
-gboolean is_ascii_str (const guchar *str);
+gboolean is_ascii_str (const gchar *str);
gint get_quote_level (const gchar *str);
gint check_line_length (const gchar *str,
gint max_chars,
diff --git a/src/xml.c b/src/xml.c
index c804d443..f07dc95b 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -189,7 +189,7 @@ gint xml_get_dtd(XMLFile *file)
gint xml_parse_next_tag(XMLFile *file)
{
gchar buf[XMLBUFSIZE];
- guchar *bufp = buf;
+ gchar *bufp = buf;
gchar *tag_str;
XMLTag *tag;
gint len;
@@ -229,7 +229,7 @@ gint xml_parse_next_tag(XMLFile *file)
return -1;
}
- while (*bufp != '\0' && !isspace(*bufp)) bufp++;
+ while (*bufp != '\0' && !g_ascii_isspace(*bufp)) bufp++;
if (*bufp == '\0') {
tag_str = conv_codeset_strdup(buf, file->encoding, CS_INTERNAL);
if (tag_str) {
@@ -258,7 +258,7 @@ gint xml_parse_next_tag(XMLFile *file)
gchar *p;
gchar quote;
- while (isspace(*bufp)) bufp++;
+ while (g_ascii_isspace(*bufp)) bufp++;
attr_name = bufp;
if ((p = strchr(attr_name, '=')) == NULL) {
g_warning("xml_parse_next_tag(): Syntax error in tag\n");
@@ -266,7 +266,7 @@ gint xml_parse_next_tag(XMLFile *file)
}
bufp = p;
*bufp++ = '\0';
- while (isspace(*bufp)) bufp++;
+ while (g_ascii_isspace(*bufp)) bufp++;
if (*bufp != '"' && *bufp != '\'') {
g_warning("xml_parse_next_tag(): Syntax error in tag\n");