summaryrefslogtreecommitdiff
path: root/enc
diff options
context:
space:
mode:
Diffstat (limited to 'enc')
-rw-r--r--enc/emacs_mule.c2
-rw-r--r--enc/euc_jp.c4
-rw-r--r--enc/iso_8859_1.c4
-rw-r--r--enc/iso_8859_2.c6
4 files changed, 10 insertions, 6 deletions
diff --git a/enc/emacs_mule.c b/enc/emacs_mule.c
index be7f842259..246593b7eb 100644
--- a/enc/emacs_mule.c
+++ b/enc/emacs_mule.c
@@ -264,7 +264,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
if (enclen(enc, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
- return p - buf;
+ return (int)(p - buf);
}
static int
diff --git a/enc/euc_jp.c b/enc/euc_jp.c
index eb7777a8e5..6388455b7d 100644
--- a/enc/euc_jp.c
+++ b/enc/euc_jp.c
@@ -193,7 +193,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
if (enclen(enc, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
- return p - buf;
+ return (int)(p - buf);
}
static int
@@ -299,7 +299,7 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return ctype;
+ return (int)ctype;
}
static int
diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c
index b73f8ca379..a10a7679b8 100644
--- a/enc/iso_8859_1.c
+++ b/enc/iso_8859_1.c
@@ -29,6 +29,8 @@
#include "regenc.h"
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
#define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
((EncISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
@@ -107,7 +109,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, f, arg);
}
diff --git a/enc/iso_8859_2.c b/enc/iso_8859_2.c
index 9783f1cd02..6c0d2d7dc1 100644
--- a/enc/iso_8859_2.c
+++ b/enc/iso_8859_2.c
@@ -29,6 +29,8 @@
#include "regenc.h"
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
#define ENC_ISO_8859_2_TO_LOWER_CASE(c) EncISO_8859_2_ToLowerCaseTable[c]
#define ENC_IS_ISO_8859_2_CTYPE(code,ctype) \
((EncISO_8859_2_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
@@ -195,7 +197,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, f, arg);
}
@@ -206,7 +208,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}