projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid truncating hit counts because Odr_int is 64-bit
[idzebra-moved-to-github.git]
/
index
/
zebrasrv.c
diff --git
a/index/zebrasrv.c
b/index/zebrasrv.c
index
c024465
..
8707531
100644
(file)
--- a/
index/zebrasrv.c
+++ b/
index/zebrasrv.c
@@
-1,8
+1,5
@@
-/* $Id: zebrasrv.c,v 1.21 2007-10-29 09:25:41 adam Exp $
- Copyright (C) 1995-2007
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ Copyright (C) 1994-2011 Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-227,7
+224,7
@@
static void search_terms(ZebraHandle zh, bend_search_rr *r)
se->subqueryId = term_ref_id ?
odr_strdup(r->stream, term_ref_id) : 0;
se->subqueryId = term_ref_id ?
odr_strdup(r->stream, term_ref_id) : 0;
- se->fullQuery = odr_intdup(r->stream, 0);
+ se->fullQuery = odr_booldup(r->stream, 0);
se->subqueryExpression =
odr_malloc(r->stream, sizeof(Z_QueryExpression));
se->subqueryExpression->which =
se->subqueryExpression =
odr_malloc(r->stream, sizeof(Z_QueryExpression));
se->subqueryExpression->which =
@@
-256,9
+253,7
@@
static void search_terms(ZebraHandle zh, bend_search_rr *r)
se->subqueryExpression->u.term->termComment = 0;
se->subqueryInterpretation = 0;
se->subqueryRecommendation = 0;
se->subqueryExpression->u.term->termComment = 0;
se->subqueryInterpretation = 0;
se->subqueryRecommendation = 0;
- if (count > 2147483646)
- count = 2147483647;
- se->subqueryCount = odr_intdup(r->stream, CAST_ZINT_TO_INT(count));
+ se->subqueryCount = odr_intdup(r->stream, count);
se->subqueryWeight = 0;
se->resultsByDB = 0;
}
se->subqueryWeight = 0;
se->resultsByDB = 0;
}
@@
-299,9
+294,7
@@
int bend_search(void *handle, bend_search_rr *r)
zebra_result(zh, &r->errcode, &r->errstring);
else
{
zebra_result(zh, &r->errcode, &r->errstring);
else
{
- if (zhits > 2147483646)
- zhits = 2147483647;
- r->hits = CAST_ZINT_TO_INT(zhits);
+ r->hits = zhits;
search_terms(zh, r);
}
break;
search_terms(zh, r);
}
break;
@@
-385,8
+378,7
@@
static int bend_scan(void *handle, bend_scan_rr *r)
{
r->entries[i].term = entries[i].term;
r->entries[i].display_term = entries[i].display_term;
{
r->entries[i].term = entries[i].term;
r->entries[i].display_term = entries[i].display_term;
- r->entries[i].occurrences =
- CAST_ZINT_TO_INT(entries[i].occurrences);
+ r->entries[i].occurrences = entries[i].occurrences;
}
}
else
}
}
else
@@
-519,10
+511,10
@@
int bend_esrequest(void *handle, bend_esrequest_rr *rr)
{
ZebraHandle zh = (ZebraHandle) handle;
{
ZebraHandle zh = (ZebraHandle) handle;
- yaz_log(YLOG_LOG, "function: %d", *rr->esr->function);
+ yaz_log(YLOG_LOG, "function: " ODR_INT_PRINTF, *rr->esr->function);
if (rr->esr->packageName)
yaz_log(YLOG_LOG, "packagename: %s", rr->esr->packageName);
if (rr->esr->packageName)
yaz_log(YLOG_LOG, "packagename: %s", rr->esr->packageName);
- yaz_log(YLOG_LOG, "Waitaction: %d", *rr->esr->waitAction);
+ yaz_log(YLOG_LOG, "Waitaction: " ODR_INT_PRINTF, *rr->esr->waitAction);
if (!rr->esr->taskSpecificParameters)
{
if (!rr->esr->taskSpecificParameters)
{
@@
-569,7
+561,8
@@
int bend_esrequest(void *handle, bend_esrequest_rr *rr)
yaz_log(YLOG_LOG, "start");
break;
default:
yaz_log(YLOG_LOG, "start");
break;
default:
- yaz_log(YLOG_LOG, " unknown (%d)", *toKeep->action);
+ yaz_log(YLOG_LOG, " unknown (" ODR_INT_PRINTF ")",
+ *toKeep->action);
}
}
if (toKeep->databaseName)
}
}
if (toKeep->databaseName)
@@
-773,7
+766,11
@@
static void bend_start(struct statserv_options_block *sob)
char pidstr[30];
sprintf(pidstr, "%ld", (long) getpid());
char pidstr[30];
sprintf(pidstr, "%ld", (long) getpid());
- write(fd, pidstr, strlen(pidstr));
+ if (write(fd, pidstr, strlen(pidstr)) != strlen(pidstr))
+ {
+ yaz_log(YLOG_ERRNO|YLOG_FATAL, "write fail %s", pidfname);
+ exit(1);
+ }
}
}
#endif
}
}
#endif
@@
-807,6
+804,7
@@
int main(int argc, char **argv)
sob->bend_start = bend_start;
sob->bend_stop = bend_stop;
#ifdef WIN32
sob->bend_start = bend_start;
sob->bend_stop = bend_stop;
#ifdef WIN32
+ strcpy(sob->service_name, "zebrasrv");
strcpy(sob->service_display_name, "Zebra Server");
#endif
statserv_setcontrol(sob);
strcpy(sob->service_display_name, "Zebra Server");
#endif
statserv_setcontrol(sob);
@@
-816,6
+814,7
@@
int main(int argc, char **argv)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab