Kouhei Sutou
null+****@clear*****
Tue Mar 5 17:18:38 JST 2013
Kouhei Sutou 2013-03-05 17:18:38 +0900 (Tue, 05 Mar 2013) New Revision: 620416d2ee583b935ad4049f6841ce4a1c1d2051 https://github.com/groonga/groonga/commit/620416d2ee583b935ad4049f6841ce4a1c1d2051 Log: Add more details to warning message Move error details in comments in grn_str_charlen_utf8() to warning messages. Modified files: lib/str.c Modified: lib/str.c (+7 -6) =================================================================== --- lib/str.c 2013-03-05 17:14:53 +0900 (d112ad0) +++ lib/str.c 2013-03-05 17:18:38 +0900 (5b4e2c3) @@ -40,19 +40,20 @@ grn_str_charlen_utf8(grn_ctx *ctx, const unsigned char *str, const unsigned char GRN_BIT_SCAN_REV(~(*str << 24), len); len = 31 - len; if ((unsigned int)(len - 2) >= 3) { /* (len == 1 || len >= 5) */ - /* Error: invalid first byte. */ - GRN_LOG(ctx, GRN_LOG_WARNING, "invalid utf8 string(1) on grn_str_charlen_utf8"); + GRN_LOG(ctx, GRN_LOG_WARNING, + "grn_str_charlen_utf8(): first byte is invalid"); return 0; } if (str + len > end) { - /* Error: the character is incomplete. */ - GRN_LOG(ctx, GRN_LOG_WARNING, "invalid utf8 string(2) on grn_str_charlen_utf8"); + GRN_LOG(ctx, GRN_LOG_WARNING, + "grn_str_charlen_utf8(): imcomplete character"); return 0; } for (i = 1; i < len; ++i) { if ((str[i] & 0xc0) != 0x80) { - /* Error: the (i+1)-th byte is invalid. */ - GRN_LOG(ctx, GRN_LOG_WARNING, "invalid utf8 string(3) on grn_str_charlen_utf8"); + GRN_LOG(ctx, GRN_LOG_WARNING, + "grn_str_charlen_utf8(): <%d>th byte is invalid", + i + 1); return 0; } } -------------- next part -------------- HTML����������������������������...Download