X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-marc-sample.cpp;h=a3d05ab848a5f2abbca9ccac8737c594ce17e7f4;hb=5e3f7e1a720a08d30c407049c94c6ca825a5ed27;hp=9895359e4f6e3325f1481fc1f31718ef545bfee6;hpb=566650da59cb3b83840321e1921714dcc3d66cb7;p=yazpp-moved-to-github.git diff --git a/src/yaz-marc-sample.cpp b/src/yaz-marc-sample.cpp index 9895359..a3d05ab 100644 --- a/src/yaz-marc-sample.cpp +++ b/src/yaz-marc-sample.cpp @@ -2,12 +2,12 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-marc-sample.cpp,v 1.4 2003-09-23 16:26:16 mike Exp $ + * $Id: yaz-marc-sample.cpp,v 1.6 2005-05-17 13:00:56 adam Exp $ */ #include -static char *marc_records[] = { +static const char *marc_records[] = { "\x30\x30\x33\x36\x36\x6E\x61\x6D\x20\x20\x32\x32\x30\x30\x31\x36" "\x39\x38\x61\x20\x34\x35\x30\x30\x30\x30\x31\x30\x30\x31\x33\x30" "\x30\x30\x30\x30\x30\x30\x33\x30\x30\x30\x34\x30\x30\x30\x31\x33" @@ -1480,7 +1480,8 @@ static char *marc_records[] = { const char *Yaz_USMARC::get_record(int position) { - int max = sizeof(marc_records) / sizeof(*marc_records); - int eff_pos = (position-1) % max; - return marc_records[eff_pos]; + if (position >= 1 && position <= ( + sizeof(marc_records) / sizeof(*marc_records))) + return marc_records[position-1]; + return 0; }