dtinfo subtree DtMmdb
This commit is contained in:
committed by
Jon Trulson
parent
b92cf08899
commit
8c8363f4a5
@@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
|
||||
#define LargePICTable YES
|
||||
|
||||
#define CplusplusSource YES
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
|
||||
|
||||
#ifdef DtinfoClient
|
||||
DEFINES= -DC_API -DNO_DB_LOCK -DCDE_NEXT
|
||||
|
||||
@@ -62,7 +62,7 @@ char* get_oid(info_lib* infolib_ptr, char* base_str, char* locator_line)
|
||||
if ( strcmp(locator, " 0000000000000000000000") == 0 ||
|
||||
strcmp(locator, "0") == 0 )
|
||||
{
|
||||
return "0.0";
|
||||
return (char*)"0.0";
|
||||
}
|
||||
|
||||
return get_oid_2(infolib_ptr, base_str, locator);
|
||||
@@ -75,9 +75,9 @@ char* get_oid_2(info_lib* infolib_ptr, char* base_str, char* locator)
|
||||
const char *this_node_locator = x.locator();
|
||||
|
||||
if ( strcmp( this_node_locator, locator) == 0 ) {
|
||||
ostrstream strout(oid_in_string_buf, BUFSIZ, ios::out);
|
||||
ostringstream strout(oid_in_string_buf, ios::out);
|
||||
x.its_oid().asciiOut(strout);
|
||||
oid_in_string_buf[strout.pcount()] = NULL;
|
||||
strcpy(oid_in_string_buf, strout.str().c_str());
|
||||
} else {
|
||||
cerr << "dangling locator " << locator << "\n"
|
||||
<< "mismatches with " << this_node_locator << "\n"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static doc_smart_ptr*
|
||||
getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -51,7 +51,7 @@ getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request)
|
||||
return new doc_smart_ptr(x, seq+1);
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -61,7 +61,7 @@ getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -81,7 +81,7 @@ DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request)
|
||||
const char*
|
||||
DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -93,7 +93,7 @@ DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -103,7 +103,7 @@ DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
const char*
|
||||
DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -115,7 +115,7 @@ DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -124,7 +124,7 @@ DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
|
||||
int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -144,7 +144,7 @@ int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request)
|
||||
const char*
|
||||
DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -156,7 +156,7 @@ DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -165,7 +165,7 @@ DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
|
||||
DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -182,7 +182,8 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le
|
||||
const char* desc = 0;
|
||||
pstring_handler *p = 0;
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
int i;
|
||||
for (i=0; i<count; i++) {
|
||||
p = (pstring_handler *)((*z)->get_component (i+1));
|
||||
|
||||
// The format is the title, a tab char, then the section oid.
|
||||
@@ -211,7 +212,7 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le
|
||||
return u;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -35,7 +35,7 @@ extern OLIAS_DB* mmdb_ptr;
|
||||
int
|
||||
DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
|
||||
|
||||
if ( x == 0 ) return -1;
|
||||
@@ -48,7 +48,7 @@ DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name)
|
||||
return base -> index_id();
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
@@ -58,7 +58,7 @@ DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name)
|
||||
int
|
||||
DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
|
||||
|
||||
if ( x == 0 ) return -1;
|
||||
@@ -81,7 +81,7 @@ DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index)
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
@@ -91,7 +91,7 @@ DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index)
|
||||
int
|
||||
DtMmdbGetBookCaseByLoc(int infolib_descriptor, const char* locator)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
|
||||
|
||||
if ( x == 0 ) return -1;
|
||||
@@ -105,7 +105,7 @@ DtMmdbGetBookCaseByLoc(int infolib_descriptor, const char* locator)
|
||||
return base -> index_id();
|
||||
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
@@ -118,7 +118,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators,
|
||||
int* count_ptr)
|
||||
{
|
||||
|
||||
try {
|
||||
mtry {
|
||||
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -146,7 +146,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators,
|
||||
return ds;
|
||||
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
if (count_ptr) *count_ptr = 0;
|
||||
return 0;
|
||||
@@ -159,7 +159,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators,
|
||||
DtMmdbBookCaseInfo*
|
||||
DtMmdbBookCaseGetInfo(int bookcase_descriptor)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(bookcase_descriptor);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -175,7 +175,7 @@ DtMmdbBookCaseGetInfo(int bookcase_descriptor)
|
||||
return y;
|
||||
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "storage/page_storage.h"
|
||||
#include "api/info_lib.h"
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "schema/store_desc.h"
|
||||
#include "dynhash/data_t.h"
|
||||
#include "index/index.h"
|
||||
@@ -62,7 +63,7 @@ void initialize_MMDB()
|
||||
ostring::input_buf = new char[LBUFSIZ];
|
||||
|
||||
data_t::larson_convertor_ptr = new atoi_larson;
|
||||
data_t::pearson_convertor_ptr = new atoi_pearson(MAXSHORT, 256);
|
||||
data_t::pearson_convertor_ptr = new atoi_pearson(SHRT_MAX, 256);
|
||||
|
||||
ground_ptr = new oid_t(c_code_t(0), i_code_t(0));
|
||||
|
||||
@@ -230,7 +231,7 @@ DtMmdbGraphicInfo* newDtMmdbGraphicInfo()
|
||||
void DtMmdbFreeHandle(DtMmdbHandle* x)
|
||||
{
|
||||
if ( x ) {
|
||||
delete x -> oid_ptr;
|
||||
// delete x -> oid_ptr;
|
||||
free((void*)x);
|
||||
}
|
||||
}
|
||||
@@ -254,7 +255,7 @@ extern int auto_test(int argc, char** argv, OLIAS_DB& db);
|
||||
extern "C" {
|
||||
int auto_test_c_api(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
mtry
|
||||
{
|
||||
#ifdef REGRESSION_TEST
|
||||
OLIAS_DB db;
|
||||
@@ -264,7 +265,7 @@ int auto_test_c_api(int argc, char** argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
cerr << "Exception msg: " << e << "\n";
|
||||
return -1;
|
||||
@@ -331,7 +332,7 @@ char* DtMmdbHandleToString(DtMmdbHandle* x)
|
||||
static char buf[100];
|
||||
if ( x -> oid_ptr) {
|
||||
oid_t *z = (oid_t*)(x -> oid_ptr);
|
||||
sprintf(buf, "%d.%d", z -> ccode(), z -> icode());
|
||||
sprintf(buf, "%d.%d", z -> ccode(), (int)z -> icode());
|
||||
} else
|
||||
buf[0] = 0;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static dlp_smart_ptr*
|
||||
getDlpUsingProid(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -40,7 +40,7 @@ getDlpUsingProid(DtMmdbInfoRequest* request)
|
||||
return 0;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -50,7 +50,7 @@ getDlpUsingProid(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
dlp_smart_ptr* x = getDlpUsingProid(request);
|
||||
if ( x == 0 ) return 0;
|
||||
DtMmdbHandle *z = 0;
|
||||
@@ -64,7 +64,7 @@ DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -74,7 +74,7 @@ DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
dlp_smart_ptr* x = getDlpUsingProid(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -89,7 +89,7 @@ DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static graphic_smart_ptr*
|
||||
getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa
|
||||
return new graphic_smart_ptr(x, *id);
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -56,13 +56,13 @@ getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa
|
||||
const char*
|
||||
DtMmdbGraphicGetData(DtMmdbInfoRequest* request, unsigned int* data_length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " graphicInfo: mmdb_oid = %d.%d\n", (*x).its_oid().ccode(), (*x).its_oid().icode());
|
||||
fprintf(stderr, " graphicInfo: mmdb_oid = %d.%d\n", (int)(*x).its_oid().ccode(), (int)(*x).its_oid().icode());
|
||||
#endif
|
||||
|
||||
const char* y = x -> data();
|
||||
@@ -72,7 +72,7 @@ DtMmdbGraphicGetData(DtMmdbInfoRequest* request, unsigned int* data_length)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -83,7 +83,7 @@ DtMmdbGraphicInfo*
|
||||
DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request)
|
||||
{
|
||||
|
||||
try {
|
||||
mtry {
|
||||
graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -107,7 +107,7 @@ DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -116,7 +116,7 @@ DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request)
|
||||
|
||||
const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -127,7 +127,7 @@ const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -54,7 +54,7 @@ DtMmdbOpenInfoLib(
|
||||
DtMmdbBool delayed_infolib_init
|
||||
)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
|
||||
Boolean option = (delayed_infolib_init == DtMmdbTrue) ? true : false;
|
||||
|
||||
@@ -74,7 +74,7 @@ DtMmdbOpenInfoLib(
|
||||
return i;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
@@ -94,7 +94,7 @@ void DtMmdbCloseInfoLib(int infolib_descriptor)
|
||||
DtMmdbInfoLibInfo*
|
||||
DtMmdbInfoLibGetInfo(int infolib_descriptor)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -111,7 +111,7 @@ DtMmdbInfoLibGetInfo(int infolib_descriptor)
|
||||
return y;
|
||||
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static locator_smart_ptr*
|
||||
getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa
|
||||
*/
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -59,7 +59,7 @@ getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa
|
||||
const char*
|
||||
DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
locator_smart_ptr* x = getLocatorUsingLocAndProid(request, false);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -68,7 +68,7 @@ DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -78,7 +78,7 @@ DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
locator_smart_ptr* x = getLocatorUsingLocAndProid(request, true);
|
||||
if ( x == 0 ) return 0;
|
||||
DtMmdbHandle *z = newDtMmdbHandle(x -> node_id());
|
||||
@@ -86,7 +86,7 @@ DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
const char*
|
||||
DtMmdbSectionGetLoc(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -40,7 +40,7 @@ DtMmdbSectionGetLoc(DtMmdbInfoRequest* request)
|
||||
return y.locator();
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -50,7 +50,7 @@ DtMmdbSectionGetLoc(DtMmdbInfoRequest* request)
|
||||
static node_smart_ptr*
|
||||
getSectionUsingLocAndProid(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -67,7 +67,7 @@ getSectionUsingLocAndProid(DtMmdbInfoRequest* request)
|
||||
return new node_smart_ptr(x, *id);
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -80,7 +80,7 @@ DtMmdbSectionGetLongTitle(
|
||||
unsigned int* title_length
|
||||
)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -98,7 +98,7 @@ DtMmdbSectionGetLongTitle(
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -111,7 +111,7 @@ DtMmdbSectionGetShortTitle(
|
||||
unsigned int* title_length
|
||||
)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -122,7 +122,7 @@ DtMmdbSectionGetShortTitle(
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -136,7 +136,7 @@ DtMmdbSectionGetData
|
||||
unsigned int* data_length
|
||||
)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -147,7 +147,7 @@ DtMmdbSectionGetData
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -156,7 +156,7 @@ DtMmdbSectionGetData
|
||||
|
||||
int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return -1;
|
||||
@@ -167,7 +167,7 @@ int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
@@ -177,7 +177,7 @@ int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request)
|
||||
|
||||
const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -187,7 +187,7 @@ const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -198,7 +198,7 @@ const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbSectionGetBookId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -209,7 +209,7 @@ DtMmdbSectionGetBookId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -219,7 +219,7 @@ DtMmdbSectionGetBookId(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
node_smart_ptr* x = getSectionUsingLocAndProid(request);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -230,7 +230,7 @@ DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static stylesheet_smart_ptr*
|
||||
getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly = false)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -48,7 +48,7 @@ getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly =
|
||||
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -58,7 +58,7 @@ getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly =
|
||||
const char*
|
||||
DtMmdbStylesheetGetName(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
stylesheet_smart_ptr* x = getStylesheetUsingLocAndProid(request, true);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
@@ -67,7 +67,7 @@ DtMmdbStylesheetGetName(DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -77,14 +77,14 @@ DtMmdbStylesheetGetName(DtMmdbInfoRequest* request)
|
||||
const char*
|
||||
DtMmdbStylesheetGetata(DtMmdbInfoRequest* request, unsigned int* data_length)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
stylesheet_smart_ptr* x = getStylesheetUsingLocAndProid(request, false);
|
||||
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " stylesheetInfo: mmdb_oid = %d.%d\n", (*x).its_oid().ccode()
|
||||
, (*x).its_oid().icode());
|
||||
fprintf(stderr, " stylesheetInfo: mmdb_oid = %d.%d\n", (int)(*x).its_oid().ccode()
|
||||
, (int)(*x).its_oid().icode());
|
||||
#endif
|
||||
|
||||
const char* y = x -> online_data();
|
||||
@@ -95,7 +95,7 @@ DtMmdbStylesheetGetata(DtMmdbInfoRequest* request, unsigned int* data_length)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static toc_smart_ptr*
|
||||
getTocUsingProid(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
info_base* x = getBookCase(request -> bookcase_descriptor);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -38,7 +38,7 @@ getTocUsingProid(DtMmdbInfoRequest* request)
|
||||
return new toc_smart_ptr(x, *id);
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -49,7 +49,7 @@ getTocUsingProid(DtMmdbInfoRequest* request)
|
||||
DtMmdbHandle*
|
||||
DtMmdbTocGetParentId(DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
toc_smart_ptr* x = getTocUsingProid(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -64,7 +64,7 @@ DtMmdbTocGetParentId(DtMmdbInfoRequest* request)
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -77,7 +77,7 @@ DtMmdbTocGetChildIds(
|
||||
unsigned int* list_length
|
||||
)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
toc_smart_ptr* x = getTocUsingProid(request);
|
||||
if ( x == 0 ) return 0;
|
||||
|
||||
@@ -92,7 +92,8 @@ DtMmdbTocGetChildIds(
|
||||
//fprintf(stderr, "z=%x\n", (void*)z);
|
||||
if ( z == 0 ) return 0;
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
int i;
|
||||
for (i=0; i<count; i++) {
|
||||
z[i] = newDtMmdbHandle(oid_t(OLIAS_NODE_CODE, ((*y) -> operator()(i+1)).icode()));
|
||||
}
|
||||
|
||||
@@ -107,7 +108,7 @@ DtMmdbTocGetChildIds(
|
||||
return z;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
} end_try;
|
||||
@@ -116,7 +117,7 @@ DtMmdbTocGetChildIds(
|
||||
|
||||
int DtMmdbTocGetNumOfChildren( DtMmdbInfoRequest* request)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
toc_smart_ptr* x = getTocUsingProid(request);
|
||||
if ( x == 0 ) return -1;
|
||||
int y = x -> subtree_size();
|
||||
@@ -124,7 +125,7 @@ int DtMmdbTocGetNumOfChildren( DtMmdbInfoRequest* request)
|
||||
return y;
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return -1;
|
||||
} end_try;
|
||||
|
||||
@@ -60,12 +60,12 @@ void print_doc(doc_smart_ptr& x, ostream& out, Boolean out_it_oid, Boolean out_t
|
||||
int compare_doc(doc_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_doc(pattern, pattern_out, false, false);
|
||||
|
||||
doc_smart_ptr x( base_ptr, pattern.seq_num());
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_doc(x, db_out, false, false);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
|
||||
@@ -174,12 +174,12 @@ int graphic_smart_ptr::data_size()
|
||||
|
||||
const char* graphic_smart_ptr::title()
|
||||
{
|
||||
try
|
||||
mtry
|
||||
{
|
||||
return get_string(BASE_COMPONENT_INDEX+5);
|
||||
}
|
||||
|
||||
catch (mmdbException&,e)
|
||||
mcatch (mmdbException&,e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void print_graphic(graphic_smart_ptr& x, ostream& out, Boolean out_misc)
|
||||
int compare_graphic(graphic_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_graphic(pattern, pattern_out, false);
|
||||
|
||||
char loc[BUFSIZ];
|
||||
@@ -75,7 +75,7 @@ int compare_graphic(graphic_smart_ptr& pattern, info_base* base_ptr)
|
||||
|
||||
graphic_smart_ptr x( base_ptr, loc );
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_graphic(x, db_out, false);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
|
||||
@@ -38,12 +38,12 @@ void print_loc(locator_smart_ptr& x, ostream& out)
|
||||
int compare_locator(locator_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_loc(pattern, pattern_out);
|
||||
|
||||
locator_smart_ptr x( base_ptr, pattern.inside_node_locator_str());
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_loc(x, db_out);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
|
||||
@@ -100,11 +100,11 @@ const char* locator_smart_ptr::label()
|
||||
{
|
||||
const char* rval;
|
||||
|
||||
try
|
||||
mtry
|
||||
{
|
||||
rval = get_string(BASE_COMPONENT_INDEX+2);
|
||||
}
|
||||
catch_any()
|
||||
mcatch_any()
|
||||
{
|
||||
// catch exceptions to ensure backwards compatibility
|
||||
rval = 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ debug(cerr, node_locator);
|
||||
|
||||
mark_set_hd_ptr = uptr->mark_set_hd;
|
||||
|
||||
try {
|
||||
mtry {
|
||||
mbase -> trans().begin();
|
||||
|
||||
abs_storage* marks_store = mark_set_hd_ptr -> its_store();
|
||||
@@ -126,17 +126,17 @@ debug(cerr, int(v_mark_hd));
|
||||
mbase -> trans().end();
|
||||
}
|
||||
|
||||
catch (beginTransException&, e)
|
||||
mcatch (beginTransException&, e)
|
||||
{
|
||||
smart_ptr::_init(ground, 0); // mark the mark obsolete
|
||||
rethrow;
|
||||
}
|
||||
catch (commitTransException&, e)
|
||||
mcatch (commitTransException&, e)
|
||||
{
|
||||
smart_ptr::_init(ground, 0); // mark the mark obsolete
|
||||
rethrow;
|
||||
}
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
smart_ptr::_init(ground, 0); // mark the mark obsolete
|
||||
mbase -> trans().rollback();
|
||||
@@ -156,7 +156,7 @@ debug(cerr, uptr -> get_base_name());
|
||||
debug(cerr, mark_id);
|
||||
#endif
|
||||
|
||||
try
|
||||
mtry
|
||||
{
|
||||
v_loct_hd = (pstring_handler*)
|
||||
get_handler(BASE_COMPONENT_INDEX, STRING_CODE);
|
||||
@@ -164,7 +164,7 @@ debug(cerr, mark_id);
|
||||
get_handler(BASE_COMPONENT_INDEX+1, STRING_CODE);
|
||||
}
|
||||
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
smart_ptr::_init(ground, 0); // mark the mark obsolete
|
||||
rethrow;
|
||||
@@ -187,7 +187,7 @@ void mark_smart_ptr::update_usermark(const pstring& new_mark)
|
||||
void mark_smart_ptr::update_usermark(const char* new_mark_str,
|
||||
int new_mark_str_sz)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
mbase -> trans().begin();
|
||||
|
||||
(*v_mark_hd) -> update(new_mark_str, new_mark_str_sz);
|
||||
@@ -196,15 +196,15 @@ void mark_smart_ptr::update_usermark(const char* new_mark_str,
|
||||
mbase -> trans().end();
|
||||
}
|
||||
|
||||
catch (beginTransException&, e)
|
||||
mcatch (beginTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (commitTransException&, e)
|
||||
mcatch (commitTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
mbase -> trans().rollback();
|
||||
rethrow;
|
||||
@@ -214,7 +214,7 @@ void mark_smart_ptr::update_usermark(const char* new_mark_str,
|
||||
|
||||
void mark_smart_ptr::remove_from_db()
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
mbase -> trans().begin();
|
||||
|
||||
(*mark_set_hd_ptr) -> remove_component(its_oid());
|
||||
@@ -223,15 +223,15 @@ void mark_smart_ptr::remove_from_db()
|
||||
mbase -> trans().end();
|
||||
}
|
||||
|
||||
catch (beginTransException&, e)
|
||||
mcatch (beginTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (commitTransException&, e)
|
||||
mcatch (commitTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
mbase -> trans().rollback();
|
||||
rethrow;
|
||||
|
||||
@@ -78,7 +78,7 @@ OLIAS_DB::~OLIAS_DB()
|
||||
|
||||
int OLIAS_DB::validInfoLibPath(const char* path)
|
||||
{
|
||||
try
|
||||
mtry
|
||||
{
|
||||
if ( exist_dir(path) == false )
|
||||
return 0;
|
||||
@@ -91,7 +91,7 @@ int OLIAS_DB::validInfoLibPath(const char* path)
|
||||
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -104,7 +104,8 @@ info_lib*
|
||||
OLIAS_DB::openInfoLib(const char* infoLibPath, const char* selectedBaseName,
|
||||
const char* infoLibName)
|
||||
{
|
||||
for ( int i=0; i<infolib_array.no_elmts(); i++ ) {
|
||||
int i;
|
||||
for ( i=0; i<infolib_array.no_elmts(); i++ ) {
|
||||
if ( infolib_array[i] == 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,10 @@
|
||||
#include "oliasdb/node_hd.h"
|
||||
|
||||
#ifdef C_API
|
||||
#include "utility/c_strstream.h"
|
||||
#include "utility/c_stringstream.h"
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
MMDB_BODIES(olias_node)
|
||||
|
||||
@@ -51,7 +51,7 @@ void print_node(node_smart_ptr& x, ostream& out, Boolean get_data, Boolean get_d
|
||||
int compare_node(node_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_node(pattern, pattern_out, false, false);
|
||||
|
||||
char loc[BUFSIZ];
|
||||
@@ -59,7 +59,7 @@ int compare_node(node_smart_ptr& pattern, info_base* base_ptr)
|
||||
|
||||
node_smart_ptr x( base_ptr, loc );
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_node(x, db_out, false, false);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
@@ -88,14 +88,14 @@ debug(cerr, loc_size);
|
||||
|
||||
char* db_buf;
|
||||
int data_size ;
|
||||
ostrstream* db_out;
|
||||
ostringstream* db_out;
|
||||
|
||||
if ( doingTest ) {
|
||||
node_smart_ptr x( base_ptr, loc );
|
||||
data_size = x.data_size();
|
||||
|
||||
db_buf = new char[data_size+1];
|
||||
db_out = new ostrstream(db_buf, data_size+1, ios::out);
|
||||
db_out = new ostringstream(db_buf, data_size+1, ios::out);
|
||||
|
||||
const char* z = x.data();
|
||||
for ( int i=0; i<data_size; i++ )
|
||||
@@ -105,7 +105,7 @@ debug(cerr, loc_size);
|
||||
in >> data_size; in.get();
|
||||
|
||||
char* pattern_buf = new char[data_size+1];
|
||||
ostrstream pattern_out(pattern_buf, data_size+1, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, data_size+1, ios::out);
|
||||
|
||||
for ( i=0; i<data_size; i++ )
|
||||
pattern_out.put((char)in.get());
|
||||
|
||||
@@ -70,20 +70,20 @@
|
||||
#define USER_MARK_CODE 1006
|
||||
#define USER_CONFIG_CODE 1007
|
||||
|
||||
#define DOC_SET_NAME "doc"
|
||||
#define NODE_SET_NAME "node"
|
||||
#define TOC_SET_NAME "toc"
|
||||
#define LOCATOR_SET_NAME "loc"
|
||||
#define GRAPHIC_SET_NAME "graphic"
|
||||
#define STYLESHEET_SET_NAME "stylesheet"
|
||||
#define DOC_SET_NAME (char*)"doc"
|
||||
#define NODE_SET_NAME (char*)"node"
|
||||
#define TOC_SET_NAME (char*)"toc"
|
||||
#define LOCATOR_SET_NAME (char*)"loc"
|
||||
#define GRAPHIC_SET_NAME (char*)"graphic"
|
||||
#define STYLESHEET_SET_NAME (char*)"stylesheet"
|
||||
|
||||
#define DLP_LIST_NAME "dlp"
|
||||
#define DLP_LIST_NAME (char*)"dlp"
|
||||
|
||||
#define USER_MARK_SET_NAME "mark"
|
||||
#define USER_CONFIG_SET_NAME "config"
|
||||
#define USER_MARK_SET_NAME (char*)"mark"
|
||||
#define USER_CONFIG_SET_NAME (char*)"config"
|
||||
|
||||
#define MARK_SPEC "mmdb.mark.spec"
|
||||
#define PREF_SPEC "mmdb.pref.spec"
|
||||
#define MARK_SPEC (char*)"mmdb.mark.spec"
|
||||
#define PREF_SPEC (char*)"mmdb.pref.spec"
|
||||
|
||||
#define NODE_SET_POS 0
|
||||
#define TOC_SET_POS 1
|
||||
|
||||
@@ -76,16 +76,16 @@ struct map_record {
|
||||
|
||||
struct map_record set_map[]=
|
||||
{
|
||||
{"loc", LOCATOR_CODE, 0},
|
||||
{"toc", TOC_CODE, 0 },
|
||||
{"doc", DOC_CODE, 0 },
|
||||
{"graphic", GRAPHIC_CODE, 0 },
|
||||
// {"stylesheet", STYLESHEET_CODE, 0 },
|
||||
{(char*)"loc", LOCATOR_CODE, 0},
|
||||
{(char*)"toc", TOC_CODE, 0 },
|
||||
{(char*)"doc", DOC_CODE, 0 },
|
||||
{(char*)"graphic", GRAPHIC_CODE, 0 },
|
||||
// {(char*)"stylesheet", STYLESHEET_CODE, 0 },
|
||||
};
|
||||
|
||||
struct map_record list_map[]=
|
||||
{
|
||||
{"dlp", DLP_CODE, 0},
|
||||
{(char*)"dlp", DLP_CODE, 0},
|
||||
};
|
||||
|
||||
//#define SET_MAP_SZ 5
|
||||
@@ -104,7 +104,8 @@ void insert_to_collection(c_code_t ccode, istream& in)
|
||||
abs_storage* store = 0;
|
||||
handler* hd = 0;
|
||||
|
||||
for ( int i = 0; i<SET_MAP_SZ ; i++ ) {
|
||||
int i;
|
||||
for ( i = 0; i<SET_MAP_SZ ; i++ ) {
|
||||
if ( set_map[i].instance_class_code == ccode ) {
|
||||
obj_type = SET;
|
||||
store = set_map[i].collection_hd -> its_store();
|
||||
@@ -176,7 +177,8 @@ int _load_mixed_objects_from_cin(info_base* base_ptr)
|
||||
|
||||
int _load_mixed_objects(info_base* base_ptr, istream& in)
|
||||
{
|
||||
for ( int i = 0; i<SET_MAP_SZ ; i++ ) {
|
||||
int i;
|
||||
for ( i = 0; i<SET_MAP_SZ ; i++ ) {
|
||||
cset_handlerPtr x = base_ptr -> get_set(set_map[i].col_name);
|
||||
|
||||
if (x==0)
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "oliasdb/olias_test.h"
|
||||
#include "api/utility.h"
|
||||
#include "utility/pm_random.h"
|
||||
#include "misc/unique_id.h"
|
||||
@@ -55,7 +56,6 @@
|
||||
#include "dstr/dstr_test.h"
|
||||
#include "storage/store_test.h"
|
||||
#include "oliasdb/olias_funcs.h"
|
||||
#include "oliasdb/olias_test.h"
|
||||
|
||||
#include "object/random_gen.h"
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
#include "oliasdb/mmdb.h"
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef NODEBUG
|
||||
void test_collector_iterator(info_base* base)
|
||||
{
|
||||
MESSAGE(cerr, "node locators:");
|
||||
@@ -108,7 +108,7 @@ int dump_instances(info_base* base_ptr, char* col_nm, c_code_t ins_code)
|
||||
if ( base_ptr == 0 )
|
||||
throw(stringException("null base ptr"));
|
||||
|
||||
iterator *it = base_ptr -> first(col_nm, ins_code);
|
||||
Iterator *it = base_ptr -> first(col_nm, ins_code);
|
||||
|
||||
if (it==0)
|
||||
throw(stringException("null iterator pointer"));
|
||||
@@ -159,7 +159,8 @@ int cache_test( info_lib* infolib_ptr, const char* base_name, int argc, char** a
|
||||
locator_smart_ptrPtr* ptr_array = new locator_smart_ptrPtr[argc];
|
||||
debug(cerr, argc);
|
||||
|
||||
for ( int i=0; i<argc; i++ ) {
|
||||
int i;
|
||||
for ( i=0; i<argc; i++ ) {
|
||||
ptr_array[i] = new locator_smart_ptr(infolib_ptr, base_name, argv[i]);
|
||||
|
||||
cerr << form("node_id of locator %s:\n", argv[i]);
|
||||
@@ -241,7 +242,8 @@ int generate_stream(info_base* b_ptr, char* path, int num_sections, int min, int
|
||||
if ( !stylesheet_stream )
|
||||
return -1;
|
||||
|
||||
for (int i=0; i<stylesheets; i++ ) {
|
||||
int i;
|
||||
for (i=0; i<stylesheets; i++ ) {
|
||||
// assume the stylesheet and section are of approx. length
|
||||
generate_stylesheet_instance(x, stylesheet_stream, min, max);
|
||||
}
|
||||
@@ -303,12 +305,12 @@ int generate_stream(info_base* b_ptr, char* path, int num_sections, int min, int
|
||||
|
||||
int destroy_stream(char* path)
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
del_file(TEST_STY_FILE, path);
|
||||
del_file(TEST_SEC_FILE, path);
|
||||
del_file(TEST_MIX_FILE, path);
|
||||
}
|
||||
catch_any()
|
||||
mcatch_any()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -323,7 +325,7 @@ int extract_and_compare_objects(istream& in, info_base* base_ptr, int code)
|
||||
|
||||
handler* root_hd_ptr = 0;
|
||||
|
||||
vm_storage st("", "");
|
||||
vm_storage st((char*)"", (char*)"");
|
||||
|
||||
char ccode_buf[LBUFSIZ];
|
||||
int c;
|
||||
@@ -338,9 +340,9 @@ int extract_and_compare_objects(istream& in, info_base* base_ptr, int code)
|
||||
|
||||
if ( c == SGML_CONTENT_CODE ) {
|
||||
if ( code == c || code == 0 )
|
||||
ok |= compare_SGML_content(in, base_ptr, true);
|
||||
ok |= compare_SGML_content(in, base_ptr, (Boolean)true);
|
||||
else
|
||||
compare_SGML_content(in, base_ptr, false);
|
||||
compare_SGML_content(in, base_ptr, (Boolean)false);
|
||||
} else {
|
||||
|
||||
root_hd_ptr = new handler(c, &st);
|
||||
@@ -384,13 +386,13 @@ struct {
|
||||
c_code_t code;
|
||||
} auto_test_spec[] =
|
||||
{
|
||||
{"auto_node_test", OLIAS_NODE_CODE},
|
||||
{"auto_SGML_content_test", SGML_CONTENT_CODE},
|
||||
{"auto_stylesheet_test", STYLESHEET_CODE},
|
||||
{"auto_graphic_test", GRAPHIC_CODE},
|
||||
{"auto_doc_test", DOC_CODE},
|
||||
{"auto_toc_test", TOC_CODE},
|
||||
{"auto_loc_test", LOCATOR_CODE},
|
||||
{(char*)"auto_node_test", OLIAS_NODE_CODE},
|
||||
{(char*)"auto_SGML_content_test", SGML_CONTENT_CODE},
|
||||
{(char*)"auto_stylesheet_test", STYLESHEET_CODE},
|
||||
{(char*)"auto_graphic_test", GRAPHIC_CODE},
|
||||
{(char*)"auto_doc_test", DOC_CODE},
|
||||
{(char*)"auto_toc_test", TOC_CODE},
|
||||
{(char*)"auto_loc_test", LOCATOR_CODE},
|
||||
};
|
||||
|
||||
#define NUM_OF_AUTO_TESTS 7
|
||||
@@ -570,7 +572,7 @@ int select_debug_routine(int argc, char** argv, OLIAS_DB& db)
|
||||
}
|
||||
|
||||
ok =mark_test(argc, argv);
|
||||
#ifdef DEBUG
|
||||
#ifdef NODEBUG
|
||||
if (ok < 0) {
|
||||
cerr << "mark_test failed." << endl;
|
||||
return ok;
|
||||
@@ -604,7 +606,7 @@ int select_debug_routine(int argc, char** argv, OLIAS_DB& db)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef NODEBUG
|
||||
if ( strcmp(argv[1], "random_gen") == 0 ) {
|
||||
if ( argc != 7 ) {
|
||||
cerr << "random_gen args: " << "random_gen base_name path num_sections min_section_len max_sec_len\n";
|
||||
|
||||
@@ -132,7 +132,7 @@ void stylesheet_smart_ptr::update_hardcopy_data(istream& in)
|
||||
void stylesheet_smart_ptr::update_data(istream& in, int index)
|
||||
{
|
||||
transaction trans ;
|
||||
try {
|
||||
mtry {
|
||||
trans.begin();
|
||||
|
||||
update_string(index, in);
|
||||
@@ -140,15 +140,15 @@ void stylesheet_smart_ptr::update_data(istream& in, int index)
|
||||
trans.end();
|
||||
}
|
||||
|
||||
catch (beginTransException&, e)
|
||||
mcatch (beginTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (commitTransException&, e)
|
||||
mcatch (commitTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
trans.rollback();
|
||||
rethrow;
|
||||
@@ -172,7 +172,7 @@ void
|
||||
stylesheet_smart_ptr::update_data(const char* buf, int size, int index)
|
||||
{
|
||||
transaction trans ;
|
||||
try {
|
||||
mtry {
|
||||
trans.begin();
|
||||
|
||||
update_string(index, buf, size);
|
||||
@@ -180,15 +180,15 @@ stylesheet_smart_ptr::update_data(const char* buf, int size, int index)
|
||||
trans.end();
|
||||
}
|
||||
|
||||
catch (beginTransException&, e)
|
||||
mcatch (beginTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (commitTransException&, e)
|
||||
mcatch (commitTransException&, e)
|
||||
{
|
||||
rethrow;
|
||||
}
|
||||
catch (mmdbException&, e)
|
||||
mcatch (mmdbException&, e)
|
||||
{
|
||||
trans.rollback();
|
||||
rethrow;
|
||||
|
||||
@@ -40,7 +40,7 @@ void print_stylesheet(stylesheet_smart_ptr& x, ostream& out)
|
||||
int compare_stylesheet(stylesheet_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_stylesheet(pattern, pattern_out);
|
||||
|
||||
char loc[BUFSIZ];
|
||||
@@ -48,7 +48,7 @@ int compare_stylesheet(stylesheet_smart_ptr& pattern, info_base* base_ptr)
|
||||
|
||||
stylesheet_smart_ptr x( base_ptr, loc );
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_stylesheet(x, db_out);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
|
||||
@@ -47,12 +47,12 @@ void print_toc(toc_smart_ptr& x, ostream& out)
|
||||
int compare_toc(toc_smart_ptr& pattern, info_base* base_ptr)
|
||||
{
|
||||
char pattern_buf[LARGE_BUFSIZ];
|
||||
ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_toc(pattern, pattern_out);
|
||||
|
||||
toc_smart_ptr x(base_ptr, pattern.toc_node_oid());
|
||||
char db_buf[LARGE_BUFSIZ];
|
||||
ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
|
||||
print_toc(x, db_out);
|
||||
|
||||
return compare_stream(pattern_out, db_out);
|
||||
|
||||
@@ -89,7 +89,7 @@ user_base::user_base( const char* spec_path, rw_flag_t rw) :
|
||||
char* name = getenv("USER");
|
||||
|
||||
if ( name == 0 )
|
||||
name = "";
|
||||
name = (char*)"";
|
||||
|
||||
strcpy(base_path, path);
|
||||
strcpy(base_name, name);
|
||||
@@ -119,7 +119,7 @@ user_base::user_base( const char* base_dir,
|
||||
|
||||
user_base::checking_status_t user_base::check_mode()
|
||||
{
|
||||
try {
|
||||
mtry {
|
||||
|
||||
switch ( rw_flag ) {
|
||||
case user_base::READ:
|
||||
@@ -139,7 +139,7 @@ user_base::checking_status_t user_base::check_mode()
|
||||
}
|
||||
}
|
||||
|
||||
catch (systemException&, e)
|
||||
mcatch (systemException&, e)
|
||||
{
|
||||
return user_base::FAIL;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ user_base::checking_status_t user_base::check_lock()
|
||||
|
||||
if (
|
||||
read_lock(atomic_lock_path, write_lock_path,
|
||||
ai_path, access_info("read"), offset, ai_info
|
||||
ai_path, access_info((char*)"read"), offset, ai_info
|
||||
) == false
|
||||
) {
|
||||
if ( ai_info ) {
|
||||
@@ -192,7 +192,7 @@ user_base::checking_status_t user_base::check_lock()
|
||||
|
||||
if (
|
||||
write_lock(atomic_lock_path, write_lock_path,
|
||||
ai_path, access_info("write"), ai_info
|
||||
ai_path, access_info((char*)"write"), ai_info
|
||||
) == false
|
||||
) {
|
||||
if ( ai_info ) {
|
||||
@@ -243,7 +243,7 @@ void user_base::_init()
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
mtry
|
||||
{
|
||||
ubase_trans.begin();
|
||||
|
||||
@@ -254,14 +254,14 @@ void user_base::_init()
|
||||
|
||||
}
|
||||
|
||||
catch (beginTransException &,e)
|
||||
mcatch (beginTransException &,e)
|
||||
{
|
||||
// cases: can't open log or write size info to log
|
||||
checking_status = user_base::FAIL;
|
||||
clean_up();
|
||||
break;
|
||||
}
|
||||
catch (commitTransException &,e)
|
||||
mcatch (commitTransException &,e)
|
||||
{
|
||||
// cases: bad log file, can't write to store, etc.
|
||||
checking_status = user_base::FAIL;
|
||||
@@ -269,7 +269,7 @@ void user_base::_init()
|
||||
break;
|
||||
}
|
||||
// cases: can't do define()
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
checking_status = user_base::FAIL;
|
||||
ubase_trans.rollback();
|
||||
@@ -285,7 +285,7 @@ void user_base::_init()
|
||||
|
||||
case user_base::SUCC:
|
||||
|
||||
try {
|
||||
mtry {
|
||||
ubase_trans.begin();
|
||||
|
||||
first_desc_ptr = f_obj_dict -> init_a_base(base_path, base_name);
|
||||
@@ -293,7 +293,7 @@ void user_base::_init()
|
||||
ubase_trans.end();
|
||||
}
|
||||
|
||||
catch (mmdbException &,e) {
|
||||
mcatch (mmdbException &,e) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mmdbException caught @ %s line:%d.\n",
|
||||
__FILE__, __LINE__);
|
||||
@@ -372,14 +372,14 @@ void user_base::clean_up()
|
||||
store_ptr = desc_ptr -> get_store();
|
||||
|
||||
if ( store_ptr ) {
|
||||
try {
|
||||
mtry {
|
||||
/*
|
||||
MESSAGE(cerr, "removing: ");
|
||||
MESSAGE(cerr, store_ptr -> my_name());
|
||||
*/
|
||||
store_ptr->remove();
|
||||
}
|
||||
catch (mmdbException &,e)
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
} end_try;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user