dtinfo subdirectory DtMmdb

This commit is contained in:
Ulrich Wilkens
2013-08-28 19:16:37 +02:00
committed by Jon Trulson
parent 0be684281d
commit fbd81ef151
159 changed files with 735 additions and 588 deletions

View File

@@ -51,7 +51,7 @@
#include "schema/container_desc.h"
container_desc::container_desc(int code, const char* comment) :
index_nms(10), stored_object_desc(code, comment)
stored_object_desc(code, comment), index_nms(10)
{
}

View File

@@ -56,8 +56,8 @@
#include "index/btree_index.h"
index_desc::index_desc(int class_code, const char* comment) : position(0),
stored_object_desc(class_code, comment)
index_desc::index_desc(int class_code, const char* comment) :
stored_object_desc(class_code, comment), position(0)
{
inv_nm = strdup("");
agent_nm = strdup("");
@@ -73,18 +73,12 @@ void index_desc::set_inv_nm(const char* str)
{
delete inv_nm;
inv_nm = strdup(str);
//strncpy(inv_nm, str, NAMESIZ-1);
//inv_nm[strlen(str)] = 0;
}
void index_desc::set_agent_nm(const char* str)
{
delete agent_nm;
agent_nm = strdup(str);
//strncpy(agent_nm, str, NAMESIZ-1);
//agent_nm[strlen(str)] = 0;
}
ostream& index_desc::asciiOut(ostream& out, Boolean last)

View File

@@ -104,7 +104,9 @@ desc* object_dict::init_a_base(char* db_path, char* db_name)
{
//MESSAGE(cerr, "object_dict::init_a_base()");
//debug(cerr, db_path);
strcpy(v_db_path, db_path);
int len = MIN(strlen(db_path), PATHSIZ - 1);
*((char *) memcpy(v_db_path, db_path, len) + len) = '\0';
desc* x = 0;
@@ -131,7 +133,7 @@ desc* object_dict::init_a_base(char* db_path, char* db_name)
x = parse(schema_path);
} else {
int sz = bytes(schema_path) - strlen(schema_header) - 1;
unsigned int sz = bytes(schema_path) - strlen(schema_header) - 1;
char* buf = new char[sz];
if ( !in.read(buf, sz) )
@@ -171,10 +173,14 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path,
//debug(cerr, db_path);
//debug(cerr, db_name);
strcpy(v_db_path, db_path);
int len;
len = MIN(strlen(db_path), PATHSIZ - 1);
*((char *) memcpy(v_db_path, db_path, len) + len) = '\0';
if ( db_name ) {
strcpy(replace_string, db_name);
len = MIN(strlen(db_name), PATHSIZ - 1);
*((char *) memcpy(replace_string, db_name, len) + len) = '\0';
replace_string_len = strlen(replace_string);
} else {
replace_string[0] = 0;
@@ -188,11 +194,11 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path,
throw(stringException(form("%s does not exist.", define_desc_path)));
}
unsigned long len = bytes(define_desc_path)*4;
unsigned long llen = bytes(define_desc_path)*4;
in_test.close();
if ( disk_space(v_db_path) < len ) {
if ( disk_space(v_db_path) < llen ) {
throw(stringException(form("no enough space on %s", v_db_path)));
}
@@ -213,7 +219,7 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path,
throw(streamException(in.rdstate()));
}
int sz = bytes(define_desc_path);
unsigned int sz = bytes(define_desc_path);
in.close();
char* schema_buf = new char[sz*3];
@@ -225,7 +231,8 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path,
x -> asciiOutList(*string_out);
strcpy(schema_buf, string_out->str().c_str());
len = MIN((unsigned int) string_out->str().size(), sz*3 - 1);
*((char *) memcpy(schema_buf, string_out->str().c_str(), len) + len) = '\0';
delete string_out;
sz = strlen(schema_buf);

View File

@@ -92,10 +92,10 @@ protected:
void _quit_descs(desc* start_ptr, desc* end_ptr = 0);
protected:
bset v_dict; // name to oid mapping
desc * v_desc_ptr; // list of stored object desc cells
desc * v_last_desc_ptr; // tail cell
char v_db_path[PATHSIZ]; // db_path
bset v_dict; // name to oid mapping
};
#endif

View File

@@ -22,7 +22,7 @@
*/
// $TOG: sheet.C /main/4 1997/12/23 11:20:35 bill $
#ifndef lint
static char schemasccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
static const char schemasccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#endif
#define schemaBYACC 1
@@ -370,7 +370,7 @@ int
* schemassp = schemastate = 0;
schemaloop:
if ( scheman = schemadefred[ schemastate]) goto schemareduce;
if ( (scheman = schemadefred[ schemastate])) goto schemareduce;
if ( schemachar < 0)
{
if (( schemachar = schemalex()) < 0) schemachar = 0;

View File

@@ -115,15 +115,13 @@ void store_desc::set_mode(const char* str)
delete mode_str;
mode_str = strdup(str);
//strncpy(mode_str, str, NAMESIZ-1);
get_mode(); // check
}
int store_desc::get_mode()
{
int mode = 0;
for ( int i=0; i<strlen(mode_str); i++ ) {
for ( unsigned int i=0; i<strlen(mode_str); i++ ) {
switch ( mode_str[i] ) {
case 'r':
mode |= ios::in;

View File

@@ -500,7 +500,9 @@ static int schema_did_buffer_switch_on_eof;
static schema_state_type schema_get_previous_state schema_PROTO(( void ));
static schema_state_type schema_try_NUL_trans schema_PROTO(( schema_state_type current_state ));
static int schema_get_next_buffer schema_PROTO(( void ));
#if 0
static void schemaunput schema_PROTO(( schema_CHAR c, schema_CHAR *buf_ptr ));
#endif
void schemarestart schema_PROTO(( FILE *input_file ));
void schema_switch_to_buffer schema_PROTO(( schema_BUFFER_STATE new_buffer ));
void schema_load_buffer_state schema_PROTO(( void ));
@@ -775,7 +777,10 @@ case 34:
case 35:
{
if ( replace_string[0] != 0 && schematext[0] == '$' ) {
strcpy(replace_string + replace_string_len, (char*) schematext+1);
int len = MIN(strlen((char*) schematext+1),
(unsigned int)(PATHSIZ - replace_string_len - 1));
*((char *) memcpy(replace_string + replace_string_len,
(char*) schematext+1, len) + len) = '\0';
schemalval.string = replace_string;
} else
schemalval.string = (char*) schematext;
@@ -1064,6 +1069,7 @@ register schema_state_type schema_current_state;
}
#if 0
#ifdef schema_USE_PROTOS
static void schemaunput( schema_CHAR c, register schema_CHAR * schema_bp )
#else
@@ -1107,6 +1113,7 @@ register schema_CHAR * schema_bp;
*/
schema_DO_BEFORE_ACTION; /* set up schematext again */
}
#endif
#ifdef __cplusplus