X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-z-cache.cpp;h=3ab0ba6c5dd9bd48d56cf774bacda7c8f753ecd6;hb=db245a81abf7ad888e4b3829d703b69a4c30e414;hp=0bc13e16862f62d7ef2e99da560913fbddefdaee;hpb=d53e0ff85ad63de947da013a0d25a434d12eed40;p=yazpp-moved-to-github.git diff --git a/src/yaz-z-cache.cpp b/src/yaz-z-cache.cpp index 0bc13e1..3ab0ba6 100644 --- a/src/yaz-z-cache.cpp +++ b/src/yaz-z-cache.cpp @@ -1,8 +1,11 @@ /* This file is part of the yazpp toolkit. - * Copyright (C) 1998-2010 Index Data and Mike Taylor + * Copyright (C) 1998-2012 Index Data and Mike Taylor * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -31,7 +34,7 @@ RecordCache::~RecordCache () nmem_destroy(m_mem); } -void RecordCache::set_max_size(int sz) +void RecordCache::set_max_size(size_t sz) { m_max_size = sz; } @@ -69,7 +72,7 @@ void RecordCache::copy_presentRequest(Z_PresentRequest *pr) { ODR encode = odr_createmem(ODR_ENCODE); ODR decode = odr_createmem(ODR_DECODE); - + m_searchRequest = 0; m_presentRequest = 0; int v = z_PresentRequest (encode, &pr, 1, 0); @@ -130,7 +133,7 @@ int RecordCache::match (RecordCache_Entry *entry, int match = 0; ODR o1 = odr_createmem(ODR_ENCODE); ODR o2 = odr_createmem(ODR_ENCODE); - + z_RecordComposition(o1, &comp, 1, 0); z_RecordComposition(o2, &entry->m_comp, 1, 0); @@ -138,12 +141,12 @@ int RecordCache::match (RecordCache_Entry *entry, char *buf1 = odr_getbuf(o1, &len1, 0); int len2 = -1; char *buf2 = odr_getbuf(o2, &len2, 0); - + if (buf1 && buf2 && len1 && len1 == len2 && !memcmp(buf1, buf2, len1)) match = 1; else if (!buf1 && !buf2 && !len1 && !len2) match = 1; - + odr_destroy(o1); odr_destroy(o2); if (!match)