[Groonga-commit] groonga/groonga [master] Fix a bug that latin1 and koi8r normalizations require \0

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Nov 17 00:28:30 JST 2012


Kouhei Sutou	2012-11-17 00:28:30 +0900 (Sat, 17 Nov 2012)

  New Revision: f6706836f68c3a2c6ea12b546ab9eaabb3e6c1ba
  https://github.com/groonga/groonga/commit/f6706836f68c3a2c6ea12b546ab9eaabb3e6c1ba

  Log:
    Fix a bug that latin1 and koi8r normalizations require \0

  Modified files:
    lib/string.c

  Modified: lib/string.c (+2 -2)
===================================================================
--- lib/string.c    2012-11-16 19:06:56 +0900 (b05b797)
+++ lib/string.c    2012-11-17 00:28:30 +0900 (19aea58)
@@ -804,7 +804,7 @@ latin1_normalize(grn_ctx *ctx, int nargs, grn_obj **args,
   const unsigned char *s, *s_, *e;
   unsigned char *d, *d0, *d_;
   uint_least8_t *cp, *ctypes, ctype;
-  size_t size = strlen(nstr->original), length = 0;
+  size_t size = nstr->original_length_in_bytes, length = 0;
   int removeblankp = nstr->flags & GRN_STRING_REMOVE_BLANK;
   if (!(nstr->normalized = GRN_MALLOC(size + 1))) {
     ERR(GRN_NO_MEMORY_AVAILABLE,
@@ -941,7 +941,7 @@ koi8r_normalize(grn_ctx *ctx, int nargs, grn_obj **args,
   const unsigned char *s, *s_, *e;
   unsigned char *d, *d0, *d_;
   uint_least8_t *cp, *ctypes, ctype;
-  size_t size = strlen(nstr->original), length = 0;
+  size_t size = nstr->original_length_in_bytes, length = 0;
   int removeblankp = nstr->flags & GRN_STRING_REMOVE_BLANK;
   if (!(nstr->normalized = GRN_MALLOC(size + 1))) {
     ERR(GRN_NO_MEMORY_AVAILABLE,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index