null+****@clear*****
null+****@clear*****
2012年 5月 24日 (木) 21:54:45 JST
Daijiro MORI 2012-05-24 21:54:45 +0900 (Thu, 24 May 2012)
New Revision: 5217ae4f86e17d0a095bef14794983152a760c04
Log:
Fix returning wrong result when &! oeperater is used in a nested expression.
refs #1372
Modified files:
data/images/logo/groonga-powered-by-banner-large.png
lib/expr.c
Modified: data/images/logo/groonga-powered-by-banner-large.png (+0 -0)
===================================================================
(Binary files differ)
Modified: lib/expr.c (+2 -3)
===================================================================
--- lib/expr.c 2012-05-24 16:40:28 +0900 (c22f495)
+++ lib/expr.c 2012-05-24 21:54:45 +0900 (fed1063)
@@ -3448,7 +3448,6 @@ static scan_info **
put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int start)
{
int nparens = 1, ndifops = 0, i = *ip, j = i, r = 0;
- grn_operator op_ = op == GRN_OP_BUT ? GRN_OP_AND : op;
while (j--) {
scan_info *s_ = sis[j];
if (s_->flags & SCAN_POP) {
@@ -3459,7 +3458,7 @@ put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int star
if (!(--nparens)) {
if (!r) {
if (ndifops) {
- if (j) {
+ if (j && op != GRN_OP_BUT) {
nparens = 1;
ndifops = 0;
r = j;
@@ -3494,7 +3493,7 @@ put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int star
}
}
} else {
- if (op_ != (s_->logical_op == GRN_OP_BUT ? GRN_OP_AND : s_->logical_op)) {
+ if ((op == GRN_OP_BUT) || (op != s_->logical_op)) {
ndifops++;
}
}