1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

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

@ -55,12 +55,12 @@ public:
featureProcessorPtr* ptrs; featureProcessorPtr* ptrs;
int count; int count;
const char* f_QuaddingString;
const Element* f_element; const Element* f_element;
const FeatureSet* f_local; const FeatureSet* f_local;
const FeatureSet* f_complete; const FeatureSet* f_complete;
const FeatureSet* f_parent; const FeatureSet* f_parent;
const char* f_QuaddingString;
}; };
#endif #endif

View file

@ -34,16 +34,20 @@ char* loutFeatureProcessor::empty_string()
char* char*
loutFeatureProcessor::prepend(const char* header, const char* body) loutFeatureProcessor::prepend(const char* header, const char* body)
{ {
char* x = new char[strlen(header)+strlen(body)+1]; int hlen = strlen(header);
strcpy(x, header); int blen = strlen(body);
strcat(x, body);
char* x = new char[hlen + blen + 1];
*((char *) memcpy (x, header, hlen) + hlen) = '\0';
*((char *) memcpy (x + hlen, body, blen) + blen) = '\0';
return x; return x;
} }
void void
loutFeatureProcessor::handleData(const char *data, unsigned int size, ostream& out) loutFeatureProcessor::handleData(const char *data, unsigned int size, ostream& out)
{ {
for (int i=0; i<size; i++ ) for (unsigned int i=0; i<size; i++ )
out << data[i]; out << data[i];
} }
@ -135,15 +139,13 @@ loutFeatureProcessor::dimensionToCharPtr(const FeatureValue* f,
if ( dimensionToFloat(y, unitOfY, f, u) ) { if ( dimensionToFloat(y, unitOfY, f, u) ) {
FeatureValueDimension::Unit unit;
if ( u != FeatureValueDimension::NONE ) { if ( u != FeatureValueDimension::NONE ) {
unitOfY = u; unitOfY = u;
} }
switch ( unitOfY ) { switch ( unitOfY ) {
case FeatureValueDimension::INCH: case FeatureValueDimension::INCH:
sprintf(dBuf, "%.2fi", y); snprintf(dBuf, sizeof(dBuf), "%.2fi", y);
break; break;
case FeatureValueDimension::PICA: case FeatureValueDimension::PICA:
@ -151,11 +153,11 @@ loutFeatureProcessor::dimensionToCharPtr(const FeatureValue* f,
break; break;
case FeatureValueDimension::POINT: case FeatureValueDimension::POINT:
sprintf(dBuf, "%.2fp", y); snprintf(dBuf, sizeof(dBuf), "%.2fp", y);
break; break;
case FeatureValueDimension::CM: case FeatureValueDimension::CM:
sprintf(dBuf, "%.2fc", y); snprintf(dBuf, sizeof(dBuf), "%.2fc", y);
break; break;
case FeatureValueDimension::PIXEL: case FeatureValueDimension::PIXEL:

View file

@ -122,7 +122,7 @@ protected:
public: public:
loutFeatureProcessor(loutFeatureProcessor& x) : loutFeatureProcessor(loutFeatureProcessor& x) :
f_change(x.f_change), featureProcessor(x) {}; featureProcessor(x), f_change(x.f_change) {};
loutFeatureProcessor(const char* name) : loutFeatureProcessor(const char* name) :
featureProcessor(name), f_change(false) {}; featureProcessor(name), f_change(false) {};

View file

@ -139,9 +139,11 @@ const char*
autoNumberNumeric::getValue() autoNumberNumeric::getValue()
{ {
char* ptr = f_buf.get_base(); char* ptr = f_buf.get_base();
int ptrlen = f_buf.buf_sz();
if (f_values.entries()) if (f_values.entries())
sprintf(ptr, "%s", form("%s%d%s", f_prefix, f_values.top(), f_postfix)); snprintf(ptr, ptrlen, "%s",
form("%s%d%s", f_prefix, f_values.top(), f_postfix));
else else
*ptr = 0; *ptr = 0;
@ -154,7 +156,7 @@ autoNumberNumeric::getValue()
autoNumberCased::autoNumberCased(const char* nm, autoNumberType an_t, autoNumberCased::autoNumberCased(const char* nm, autoNumberType an_t,
int delta, enum CaseType ct, const char* prefix, const char* postfix) : int delta, enum CaseType ct, const char* prefix, const char* postfix) :
f_case(ct), autoNumber(nm, an_t, delta, prefix, postfix) autoNumber(nm, an_t, delta, prefix, postfix), f_case(ct)
{ {
} }
@ -204,7 +206,7 @@ int autoNumberAlphabetic::alphaToInt(const char* alpha, enum CaseType a_case)
{ {
int digits = strlen(alpha); int digits = strlen(alpha);
int i; int i;
int offset; int offset = 0;
switch ( a_case ) { switch ( a_case ) {
case UPPER: case UPPER:
@ -321,9 +323,10 @@ void autoNumberAlphabetic::setNextValue()
const char* autoNumberAlphabetic::getValue() const char* autoNumberAlphabetic::getValue()
{ {
char* ptr = f_buf.get_base(); char* ptr = f_buf.get_base();
int ptrlen = f_buf.buf_sz();
if (f_values.entries()) if (f_values.entries())
sprintf(ptr, "%s", form("%s%s%s", f_prefix, snprintf(ptr, ptrlen, "%s", form("%s%s%s", f_prefix,
intToAlpha(f_values.top(), f_case), f_postfix)); intToAlpha(f_values.top(), f_case), f_postfix));
else else
*ptr = 0; *ptr = 0;
@ -472,6 +475,8 @@ const char* romanCardinals[4][9] =
const char* const char*
autoNumberRoman::ArabicToRoman(int x) autoNumberRoman::ArabicToRoman(int x)
{ {
unsigned int len, slen;
RomanNumberBuf[0] = 0; RomanNumberBuf[0] = 0;
if ( x > 3999 ) { if ( x > 3999 ) {
MESSAGE(cerr, "Value too large."); MESSAGE(cerr, "Value too large.");
@ -481,7 +486,7 @@ autoNumberRoman::ArabicToRoman(int x)
char* buf = form("%d", x); char* buf = form("%d", x);
int j=strlen(buf)-1; int j=strlen(buf)-1;
for ( int i=0; i<strlen(buf); i++ ) { for ( unsigned int i=0; i<strlen(buf); i++ ) {
if ( buf[i] != '0' ) if ( buf[i] != '0' )
{ {
const char* romanCardinal = romanCardinals[j][buf[i]-'1']; const char* romanCardinal = romanCardinals[j][buf[i]-'1'];
@ -498,7 +503,11 @@ autoNumberRoman::ArabicToRoman(int x)
precise_romanCardinal[k] = tolower(romanCardinal[k]); precise_romanCardinal[k] = tolower(romanCardinal[k]);
precise_romanCardinal[k] = 0; precise_romanCardinal[k] = 0;
} }
strcat(RomanNumberBuf, precise_romanCardinal);
slen = strlen(RomanNumberBuf);
len = MIN(strlen(precise_romanCardinal), 256 - 1 - slen);
*((char *) memcpy(RomanNumberBuf + slen,
precise_romanCardinal, len) + len) = '\0';
} }
j--; j--;
} }

View file

@ -42,7 +42,7 @@ public:
enum autoNumberType { NUMERIC, ALPHABETIC, ROMAN }; enum autoNumberType { NUMERIC, ALPHABETIC, ROMAN };
autoNumber(const char* nm, enum autoNumberType, int delta, const char* prefix, const char* postfix); autoNumber(const char* nm, enum autoNumberType, int delta, const char* prefix, const char* postfix);
~autoNumber(); virtual ~autoNumber();
void setNumTagsSeen(); void setNumTagsSeen();
@ -59,11 +59,11 @@ public:
protected: protected:
static buffer f_buf; static buffer f_buf;
char* f_name;
enum autoNumberType f_type;
int f_delta; int f_delta;
char* f_prefix; char* f_prefix;
char* f_postfix; char* f_postfix;
char* f_name;
enum autoNumberType f_type;
int f_initialValue; int f_initialValue;
Stack<int> f_values; Stack<int> f_values;
@ -179,7 +179,7 @@ class autoNumberListT : public CC_TPtrSlist<autoNumber>
{ {
public: public:
autoNumberListT() {}; autoNumberListT() {};
~autoNumberListT() {}; virtual ~autoNumberListT() {};
unsigned int operator==(const autoNumberListT&); unsigned int operator==(const autoNumberListT&);
} ; } ;

View file

@ -284,7 +284,7 @@ autoNumberFP::defineAutoNumber(const char* nm, const FeatureValue* f)
const char* gi = 0; const char* gi = 0;
autoNumberListT* anList = 0; autoNumberListT* anList = 0;
int i; unsigned int i;
for (i=0; i<controlList -> length(); i++ ) { for (i=0; i<controlList -> length(); i++ ) {
gi = stringToCharPtr((*controlList)[i]); gi = stringToCharPtr((*controlList)[i]);

View file

@ -57,9 +57,9 @@ EXTRALIBRARYDEPS = $(DONES)
XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir
#undef TopLevelProject #undef TopLevelProject
#define TopLevelProject DtInfo #define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \ IMAKE_DEF_DTINFO = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \ -DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>' -DProjectRulesFile='<DtInfo.rules>'
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
ForceSubdirs($(SUBDIRS)) ForceSubdirs($(SUBDIRS))

View file

@ -38,7 +38,7 @@ class AttributeList : private CC_TPtrSlist<Attribute>
{ {
public: public:
AttributeList(); AttributeList();
~AttributeList(); virtual ~AttributeList();
void add(Attribute *); void add(Attribute *);

View file

@ -51,7 +51,7 @@ void BitVector::setAllBitsTo(unsigned int initValue)
{ {
unsigned int fill = ( initValue == 0 ) ? 0x0 : ~0x0; unsigned int fill = ( initValue == 0 ) ? 0x0 : ~0x0;
for ( int i=0; i<f_words; i++ ) for ( unsigned int i=0; i<f_words; i++ )
f_array[i]=fill; f_array[i]=fill;
} }
@ -70,14 +70,14 @@ void BitVector::setTo(BitVector& v)
f_bits = v.f_bits; f_bits = v.f_bits;
f_words = v.f_words; f_words = v.f_words;
for ( int i=0; i<f_words; i++ ) for ( unsigned int i=0; i<f_words; i++ )
f_array[i]=v.f_array[i]; f_array[i]=v.f_array[i];
} }
void BitVector::setBitTo(int i, unsigned int x) void BitVector::setBitTo(int i, unsigned int x)
{ {
int wordIndex = i / WORD_SIZE; unsigned int wordIndex = i / WORD_SIZE;
int bitIndex = i % WORD_SIZE; unsigned int bitIndex = i % WORD_SIZE;
if ( x == 1 ) { if ( x == 1 ) {
if ( wordIndex < f_words - 1 ) if ( wordIndex < f_words - 1 )
@ -106,20 +106,20 @@ void BitVector::recordPositions(unsigned int PTPos, unsigned int BITPos)
unsigned int BitVector::getBit(int i) unsigned int BitVector::getBit(int i)
{ {
int wordIndex = i / WORD_SIZE; unsigned int wordIndex = i / WORD_SIZE;
int bitIndex = i % WORD_SIZE; unsigned int bitIndex = i % WORD_SIZE;
if ( wordIndex < f_words - 1 ) if ( wordIndex < f_words - 1 )
return BIT_TEST(f_array[wordIndex], (0x1 << bitIndex)) ? 1 : 0; return BIT_TEST((int)f_array[wordIndex], (0x1 << bitIndex)) ? 1 : 0;
else else
return BIT_TEST(f_array[wordIndex], return BIT_TEST((int)f_array[wordIndex],
(0x1 << (WORD_SIZE - f_bits % WORD_SIZE + bitIndex)) (0x1 << (WORD_SIZE - f_bits % WORD_SIZE + bitIndex))
) ? 1 : 0; ) ? 1 : 0;
} }
BitVector& BitVector::operator &=(BitVector& b) BitVector& BitVector::operator &=(BitVector& b)
{ {
for ( int i=0; i<f_words; i++ ) for ( unsigned int i=0; i<f_words; i++ )
f_array[i] &= b.f_array[i]; f_array[i] &= b.f_array[i];
return *this; return *this;
@ -127,7 +127,7 @@ BitVector& BitVector::operator &=(BitVector& b)
BitVector& BitVector::operator ^=(BitVector& b) BitVector& BitVector::operator ^=(BitVector& b)
{ {
for ( int i=0; i<f_words; i++ ) for ( unsigned int i=0; i<f_words; i++ )
f_array[i] ^= b.f_array[i]; f_array[i] ^= b.f_array[i];
return *this; return *this;
@ -135,7 +135,7 @@ BitVector& BitVector::operator ^=(BitVector& b)
BitVector& BitVector::operator |=(BitVector& b) BitVector& BitVector::operator |=(BitVector& b)
{ {
for ( int i=0; i<f_words; i++ ) for ( unsigned int i=0; i<f_words; i++ )
f_array[i] |= b.f_array[i]; f_array[i] |= b.f_array[i];
return *this; return *this;
@ -146,7 +146,7 @@ BitVector& BitVector::shiftRightOneBit()
unsigned int msb = 0; unsigned int msb = 0;
unsigned int lsb = 0; unsigned int lsb = 0;
for ( int i=0; i<f_words; i++ ) { for ( unsigned int i=0; i<f_words; i++ ) {
lsb = ( BIT_TEST(f_array[i], 0x1) ) ? 0x1 : 0x0; lsb = ( BIT_TEST(f_array[i], 0x1) ) ? 0x1 : 0x0;
f_array[i] = f_array[i] >> 1; f_array[i] = f_array[i] >> 1;
f_array[i] |= msb; f_array[i] |= msb;
@ -164,8 +164,8 @@ BitVector& BitVector::shiftLeftOneBit()
unsigned int lsb = 0; unsigned int lsb = 0;
for ( int i=f_words-1; i>=0; i++ ) { for ( unsigned int i=f_words-1; i>=0; i++ ) {
msb = ( BIT_TEST(f_array[i], wordWithMSBSet) ) ? wordWithMSBSet : 0x0; msb = (BIT_TEST((int)f_array[i], wordWithMSBSet)) ? wordWithMSBSet : 0x0;
f_array[i] = f_array[i] << 1; f_array[i] = f_array[i] << 1;
f_array[i] |= lsb; f_array[i] |= lsb;
lsb = msb; lsb = msb;

View file

@ -60,10 +60,10 @@ typedef CC_TValSlistIterator<posRecord> positionArrayIteratorT;
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
class BitVector class BitVector
{ {
positionArrayT *f_positionArray;
unsigned int *f_array; unsigned int *f_array;
unsigned int f_bits; unsigned int f_bits;
unsigned int f_words; unsigned int f_words;
positionArrayT *f_positionArray;
public: public:
BitVector(int bits, unsigned int initValue); BitVector(int bits, unsigned int initValue);

View file

@ -39,8 +39,8 @@
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
static ostrstream& terminate(ostrstream& ost) static ostrstream& terminate(ostrstream& ost)
{ {
char* string = ost.str(); char* pstring = ost.str();
*(string + ost.pcount()) = 0; *(pstring + ost.pcount()) = '\0';
return ost; return ost;
} }
@ -53,7 +53,7 @@ DocParser::DocParser(Resolver &r)
f_output(f_buffer, DATA_BUF_SIZ) f_output(f_buffer, DATA_BUF_SIZ)
#else #else
f_streambuf(new stringbuf()), f_streambuf(new stringbuf()),
f_output(f_streambuf) f_output()
#endif #endif
{ {
} }
@ -81,6 +81,8 @@ DocParser::parse(istream &input)
unsigned int unsigned int
DocParser::rawParse(istream &input) DocParser::rawParse(istream &input)
{ {
string data;
input.unsetf(ios::skipws); input.unsetf(ios::skipws);
f_ignoring_element = 0 ; f_ignoring_element = 0 ;
@ -93,18 +95,15 @@ DocParser::rawParse(istream &input)
Symbol name(gElemSymTab->intern(terminate(f_output).str())); Symbol name(gElemSymTab->intern(terminate(f_output).str()));
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = (char *)f_streambuf->str().c_str(); data = f_output.str().c_str();
/* /*
MESSAGE(cerr, "StartTag case:"); MESSAGE(cerr, "StartTag case:");
debug(cerr, f_streambuf->pcount()); debug(cerr, f_output.str().size());
debug(cerr, data); debug(cerr, data.c_str());
*/ */
#if !defined(SC3) && !defined(__osf__) Symbol name(gElemSymTab->intern(data.c_str()));
data[f_streambuf->str().size()] = 0;
#endif
Symbol name(gElemSymTab->intern(data));
#endif #endif
process(input, f_output, name, 1, 1); process(input, f_output, name, 1, 1);
} }
@ -139,7 +138,7 @@ update_last_seen_child_name(Symbol*& last_seen_child_name, unsigned int& child_r
} }
void void
DocParser::process(istream &input, ostream &output, DocParser::process(istream &input, ostringstream &output,
const Symbol &name, const Symbol &name,
unsigned int sibling_number, unsigned int this_sibling_number) unsigned int sibling_number, unsigned int this_sibling_number)
{ {
@ -151,6 +150,11 @@ DocParser::process(istream &input, ostream &output,
unsigned int child = 1 ; // sibling numbers for child elements unsigned int child = 1 ; // sibling numbers for child elements
#if !defined(SC3) && !defined(__osf__)
string pstring;
#endif
string data;
char c ; char c ;
while ((input >> c) && (c == '\n')); while ((input >> c) && (c == '\n'));
input.putback(c); input.putback(c);
@ -193,11 +197,11 @@ DocParser::process(istream &input, ostream &output,
process(input, output, name, child++, child_relative_sibling_number); process(input, output, name, child++, child_relative_sibling_number);
#else #else
char *data = (char *)f_streambuf->str().c_str(); data = f_output.str().c_str();
#if !defined(SC3) && !defined(__osf__) //#if !defined(SC3) && !defined(__osf__)
data[f_streambuf->str().size()] = 0; // data[f_output.str().size()] = '\0';
#endif //#endif
Symbol name(gElemSymTab->intern(data)); Symbol name(gElemSymTab->intern(data.c_str()));
update_last_seen_child_name(last_seen_child_name, update_last_seen_child_name(last_seen_child_name,
child_relative_sibling_number, name); child_relative_sibling_number, name);
@ -211,17 +215,17 @@ DocParser::process(istream &input, ostream &output,
#ifdef DEBUG #ifdef DEBUG
{ {
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char *data = terminate(f_output).str(); data = terminate(f_output).str();
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = (char*)f_streambuf->str().c_str(); data = f_output.str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) //#if !defined(SC3) && !defined(__osf__)
data[f_streambuf->str().size()] = 0; // data[f_output.str().size()] = '\0';
//#endif
#endif #endif
#endif cerr << "EndTag: " << data.c_str() << endl;
cerr << "EndTag: " << data << endl; assert(gElemSymTab->intern(data.c_str()) == name);
assert(gElemSymTab->intern(data) == name);
} }
#endif #endif
@ -312,20 +316,14 @@ DocParser::process(istream &input, ostream &output,
// and increment the pcount, so we must make sure it gets // and increment the pcount, so we must make sure it gets
// called first // called first
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char *string = terminate(f_output).str(); char *pstring = terminate(f_output).str();
int size = f_output.pcount(); int size = f_output.pcount();
f_resolver.data(string, size); f_resolver.data(pstring, size);
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *string = (char *)f_streambuf->str().c_str(); pstring = f_output.str().c_str();
//#ifdef _IBMR2 int size = pstring.size() + 1;
#if !defined(SC3) && !defined(__osf__) f_resolver.data(pstring.c_str(), size);
string[f_streambuf->str().size()] = 0;
int size = f_streambuf->str().size() ;
#else
int size = f_streambuf->pcount() - 1 ;
#endif
f_resolver.data(string, size);
#endif #endif
} }
} }
@ -340,25 +338,18 @@ DocParser::process(istream &input, ostream &output,
///////////////////////////// /////////////////////////////
// second child and beyond. // second child and beyond.
///////////////////////////// /////////////////////////////
data = f_output.str().c_str();
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char *data = f_output.str();
*(data + f_output.pcount()) = 0;
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else
char *data = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__)
data[f_streambuf->str().size()] = 0;
#endif
#endif #endif
/* /*
MESSAGE(cerr, "StartTag case2"); MESSAGE(cerr, "StartTag case2");
debug(cerr, data); debug(cerr, data);
debug(cerr, f_streambuf->pcount ()); debug(cerr, f_output.str().size());
*/ */
Symbol name(gElemSymTab->intern(data)); Symbol name(gElemSymTab->intern(data.c_str()));
update_last_seen_child_name(last_seen_child_name, update_last_seen_child_name(last_seen_child_name,
child_relative_sibling_number, name); child_relative_sibling_number, name);
@ -382,21 +373,15 @@ debug(cerr, f_streambuf->pcount ());
// and increment the pcount, so we must make sure it gets // and increment the pcount, so we must make sure it gets
// called first // called first
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char *string = f_output.str(); char *pstring = f_output.str();
int size = f_output.pcount(); int size = f_output.pcount();
*(string + size) = 0; *(pstring + size) = 0;
f_resolver.data(string, size); f_resolver.data(pstring, size);
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *string = (char *)f_streambuf->str().c_str(); pstring = f_output.str().c_str();
//#ifdef _IBMR2 int size = pstring.size() + 1;
#if !defined(SC3) && !defined(__osf__) f_resolver.data(pstring.c_str(), size);
string[f_streambuf->str().size()] = 0;
int size = f_streambuf->str().size() ;
#else
int size = f_streambuf->pcount() - 1 ;
#endif
f_resolver.data(string, size);
#endif #endif
} }
} }
@ -404,17 +389,13 @@ debug(cerr, f_streambuf->pcount ());
#ifdef DEBUG #ifdef DEBUG
{ {
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char *data = terminate(f_output).str(); data = terminate(f_output).str();
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = (char*)f_streambuf->str().c_str(); data = f_output.str().c_str();
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__)
data[f_streambuf->str().size()] = 0;
#endif #endif
#endif cerr << "EndTag: " << data.c_str() << endl;
cerr << "EndTag: " << data << endl; assert(gElemSymTab->intern(data.c_str()) == name);
assert(gElemSymTab->intern(data) == name);
} }
#endif #endif
// hit end tag, end processing // hit end tag, end processing
@ -436,10 +417,13 @@ debug(cerr, f_streambuf->pcount ());
void void
DocParser::process_attributes(istream &input, ostream &output, DocParser::process_attributes(istream &input, ostringstream &output,
AttributeList *&attrs, AttributeList *&attrs,
AttributeList *&olias_attrs) AttributeList *&olias_attrs)
{ {
#if !defined(SC3) && !defined(__osf__)
string theData;
#endif
TagType tt ; TagType tt ;
Attribute* newAttribute = 0; Attribute* newAttribute = 0;
@ -447,8 +431,6 @@ DocParser::process_attributes(istream &input, ostream &output,
AttributeList* orig_attrs = attrs; AttributeList* orig_attrs = attrs;
AttributeList* orig_olias_attrs = olias_attrs; AttributeList* orig_olias_attrs = olias_attrs;
char *theData = 0;
mtry { mtry {
while ((tt = read_tag(input,output)) != NoTag) while ((tt = read_tag(input,output)) != NoTag)
{ {
@ -456,10 +438,8 @@ DocParser::process_attributes(istream &input, ostream &output,
{ {
case StartTag: case StartTag:
{ {
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
theData = (char *)f_streambuf->str().c_str(); theData = f_output.str().c_str();
theData[f_streambuf->str().size()] = 0;
#endif #endif
if (!attrs) if (!attrs)
attrs = new AttributeList ; attrs = new AttributeList ;
@ -468,13 +448,9 @@ DocParser::process_attributes(istream &input, ostream &output,
process_attribute(input, output, process_attribute(input, output,
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
gSymTab->intern(terminate(f_output).str()), gSymTab->intern(terminate(f_output).str()),
#else
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__)
gSymTab->intern(theData),
#else
gSymTab->intern(f_streambuf->str()), gSymTab->intern(f_streambuf->str()),
#endif #else
gSymTab->intern(theData.c_str()),
#endif #endif
StartTag StartTag
); );
@ -488,10 +464,8 @@ DocParser::process_attributes(istream &input, ostream &output,
throw(CASTDPUTEXCEPT docParserUnexpectedTag()); throw(CASTDPUTEXCEPT docParserUnexpectedTag());
break; break;
case OliasAttribute: case OliasAttribute:
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
theData = (char *)f_streambuf->str().c_str(); theData = f_output.str().c_str();
theData[f_streambuf->str().size()] = 0;
#endif #endif
// mirrors attribute // mirrors attribute
if (!olias_attrs) if (!olias_attrs)
@ -501,13 +475,9 @@ DocParser::process_attributes(istream &input, ostream &output,
process_attribute(input, output, process_attribute(input, output,
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
gSymTab->intern(terminate(f_output).str()), gSymTab->intern(terminate(f_output).str()),
#else
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__)
gSymTab->intern(theData),
#else
gSymTab->intern(f_streambuf->str()), gSymTab->intern(f_streambuf->str()),
#endif #else
gSymTab->intern(theData.c_str()),
#endif #endif
OliasAttribute OliasAttribute
); );
@ -540,9 +510,11 @@ DocParser::process_attributes(istream &input, ostream &output,
} }
Attribute * Attribute *
DocParser::process_attribute(istream &input, ostream &output, DocParser::process_attribute(istream &input, ostringstream &output,
const Symbol &name, TagType tt) const Symbol &name, TagType tt)
{ {
string data;
//ON_DEBUG(cerr << "process_attribute: " << name << endl); //ON_DEBUG(cerr << "process_attribute: " << name << endl);
// If the attribute is OLIAS internal, we use DocParser's // If the attribute is OLIAS internal, we use DocParser's
@ -562,14 +534,11 @@ DocParser::process_attribute(istream &input, ostream &output,
char *data = f_output.str(); char *data = f_output.str();
*(data + f_output.pcount()) = 0; *(data + f_output.pcount()) = 0;
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else
char *data = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__)
data[f_streambuf->str().size()] = 0;
#endif
#endif
Attribute *attr = new Attribute(name, strdup(data)); Attribute *attr = new Attribute(name, strdup(data));
#else
data = f_output.str().c_str();
Attribute *attr = new Attribute(name, strdup(data.c_str()));
#endif
switch (read_tag(input, output)) switch (read_tag(input, output))
{ {
@ -593,7 +562,7 @@ DocParser::process_attribute(istream &input, ostream &output,
DocParser::TagType DocParser::TagType
DocParser::read_tag(istream &input, ostream &output) DocParser::read_tag(istream &input, ostringstream &output)
{ {
output.seekp(streampos(0)); output.seekp(streampos(0));
@ -643,13 +612,14 @@ DocParser::read_tag(istream &input, ostream &output)
// get (remainder of) tag name // get (remainder of) tag name
while ((input >> c) && (c != '>')) while ((input >> c) && (c != '>'))
output << c ; output << c ;
output << ends;
return tt ; return tt ;
} }
void void
DocParser::read_data(istream &input, ostream &output) DocParser::read_data(istream &input, ostringstream &output)
{ {
char c ; char c ;
@ -701,6 +671,8 @@ DocParser::read_data(istream &input, ostream &output)
output << c; output << c;
} }
output << ends;
// can never run out of input while reading data, tags must be balanced // can never run out of input while reading data, tags must be balanced
if (input.eof()) if (input.eof())
throw(CASTDPUEEXCEPT docParserUnexpectedEof()); throw(CASTDPUEEXCEPT docParserUnexpectedEof());

View file

@ -64,29 +64,29 @@ public:
unsigned int rawParse(istream &); unsigned int rawParse(istream &);
protected: protected:
virtual void read_data(istream &, ostream &); virtual void read_data(istream &, ostringstream &);
private: private:
void process(istream &, ostream &, const Symbol &tagname, void process(istream &, ostringstream &, const Symbol &tagname,
unsigned int sibling_number, unsigned int sibling_number,
unsigned int relative_sibling_number); unsigned int relative_sibling_number);
TagType read_tag(istream &, ostream &); TagType read_tag(istream &, ostringstream &);
void process_entity(istream &, ostream &); void process_entity(istream &, ostringstream &);
void process_attributes(istream &, ostream &, void process_attributes(istream &, ostringstream &,
AttributeList *&attrs, AttributeList *&attrs,
AttributeList *&olias_attrs); AttributeList *&olias_attrs);
Attribute *process_attribute(istream &, ostream &, const Symbol &name, TagType); Attribute *process_attribute(istream &, ostringstream &, const Symbol &name, TagType);
private: private:
unsigned int f_ignoring_element ; unsigned int f_ignoring_element ;
Resolver &f_resolver;
#if defined(SC3) || defined(__osf__) #if defined(SC3) || defined(__osf__)
char* const f_buffer; char* const f_buffer;
ostrstream f_output; ostrstream f_output;
#else #else
stringbuf *f_streambuf; stringbuf *f_streambuf;
ostream f_output; ostringstream f_output;
#endif #endif
Resolver &f_resolver;
}; };

View file

@ -69,17 +69,17 @@ public:
ostream &print(ostream &) const ; ostream &print(ostream &) const ;
private: private:
unsigned int f_freeAttrLists; Symbol f_gi ;
unsigned int f_sibling_number ; // counting all children of a parent unsigned int f_sibling_number ; // counting all children of a parent
AttributeList *f_attributes;
AttributeList *f_olias_attributes;
unsigned int f_freeAttrLists;
unsigned int f_relative_sibling_number ; // counting all unsigned int f_relative_sibling_number ; // counting all
// consecutive children // consecutive children
// of same types of a // of same types of a
// parent // parent
int f_last_child; int f_last_child;
int f_relatively_last_child; int f_relatively_last_child;
Symbol f_gi ;
AttributeList *f_attributes;
AttributeList *f_olias_attributes;
}; };
inline inline

View file

@ -57,7 +57,7 @@ class Expression
public: public:
Expression(TermNode *root); Expression(TermNode *root);
Expression(const Expression&); Expression(const Expression&);
~Expression(); virtual ~Expression();
virtual FeatureValue *evaluate() const; virtual FeatureValue *evaluate() const;
ostream &print(ostream &) const; ostream &print(ostream &) const;

View file

@ -107,7 +107,7 @@ public:
FeatureSet(const FeatureSet &); /* copy */ FeatureSet(const FeatureSet &); /* copy */
FeatureSet(const FeatureSet &, FeatureSet(const FeatureSet &,
const FeatureSet &); /* merge */ const FeatureSet &); /* merge */
~FeatureSet(); virtual ~FeatureSet();
void add(Feature *); void add(Feature *);
const Feature *lookup(const Symbol *) const ; const Feature *lookup(const Symbol *) const ;

View file

@ -143,7 +143,7 @@ FeatureSet::print(ostream &o) const
// cast to non-const to get iterator // cast to non-const to get iterator
CC_TPtrSlistIterator<Feature> next(*(CC_TPtrSlist<Feature>*)this); CC_TPtrSlistIterator<Feature> next(*(CC_TPtrSlist<Feature>*)this);
int i; unsigned int i;
for (i = 0 ; i < f_print_indent_level; i++) for (i = 0 ; i < f_print_indent_level; i++)
o << " " ; o << " " ;
@ -153,7 +153,7 @@ FeatureSet::print(ostream &o) const
while (++next) while (++next)
{ {
for (int i = 0 ; i < f_print_indent_level; i++) for (unsigned int i = 0 ; i < f_print_indent_level; i++)
o << " " ; o << " " ;
o << *next.key() << endl ; o << *next.key() << endl ;
} }

View file

@ -2336,23 +2336,23 @@ FeatureValueDimension::doConvert(Unit unit) const
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
FeatureValueArray::FeatureValueArray(const char* nm, int size) : FeatureValueArray::FeatureValueArray(const char* nm, int size) :
f_name(strdup(nm)), FeatureValue(array), pointer_vector<FeatureValue>(size, 0) FeatureValue(array), pointer_vector<FeatureValue>(size, 0), f_name(strdup(nm))
{ {
} }
FeatureValueArray::FeatureValueArray(const FeatureValueArray& x) : FeatureValueArray::FeatureValueArray(const FeatureValueArray& x) :
f_name(strdup(x.f_name)), FeatureValue(array), FeatureValue(array), pointer_vector<FeatureValue>(x.length(), 0),
pointer_vector<FeatureValue>(x.length(), 0) f_name(strdup(x.f_name))
{ {
mtry mtry
{ {
for ( int i=0; i<length(); i++ ) for ( unsigned int i=0; i<length(); i++ )
(*this)[i] = x[i] -> clone(); (*this)[i] = x[i] -> clone();
return; return;
} }
mcatch_any() mcatch_any()
{ {
for ( int i=0; i<length(); i++ ) for ( unsigned int i=0; i<length(); i++ )
delete (*this)[i]; delete (*this)[i];
rethrow; rethrow;
} }
@ -2361,7 +2361,7 @@ FeatureValueArray::FeatureValueArray(const FeatureValueArray& x) :
FeatureValueArray::~FeatureValueArray() FeatureValueArray::~FeatureValueArray()
{ {
for ( int i=0; i<length(); i++ ) for ( unsigned int i=0; i<length(); i++ )
delete (*this)[i]; delete (*this)[i];
delete f_name; delete f_name;
@ -2374,7 +2374,7 @@ FeatureValueArray::evaluate() const
mtry mtry
{ {
for ( int i=0; i<length(); i++ ) { for ( unsigned int i=0; i<length(); i++ ) {
(*result)[i] = (*this)[i] -> evaluate(); (*result)[i] = (*this)[i] -> evaluate();
} }
return result; return result;
@ -2392,7 +2392,7 @@ FeatureValueArray::print(ostream& out) const
{ {
out << f_name << "[\n"; out << f_name << "[\n";
for ( int i=0; i<length(); i++ ) { for ( unsigned int i=0; i<length(); i++ ) {
if ( (*this)[i] == 0 ) { if ( (*this)[i] == 0 ) {
MESSAGE(cerr, form("%d is a null slot", i)); MESSAGE(cerr, form("%d is a null slot", i));

View file

@ -644,8 +644,8 @@ public:
private: private:
FeatureValue *f_value ; FeatureValue *f_value ;
Unit f_unit ;
float f_cachedValue; float f_cachedValue;
Unit f_unit ;
private: private:
float convert(float y, Unit dimensionOfy, Unit dimensionOfReturn); float convert(float y, Unit dimensionOfy, Unit dimensionOfReturn);

View file

@ -70,7 +70,7 @@ PQPosition::evaluate(const Element &element)
{ {
switch ( f_optype ) { switch ( f_optype ) {
case PQEqual: case PQEqual:
if ( f_position == element.sibling_number() || if ( f_position == (int) element.sibling_number() ||
( f_position==-1 && element.last_child() ) ( f_position==-1 && element.last_child() )
) )
return PQTrue; return PQTrue;
@ -85,7 +85,7 @@ PQPosition::evaluate(const Element &element)
else else
return PQFalse; return PQFalse;
} else } else
if ( f_position != element.sibling_number() ) if ( f_position != (int) element.sibling_number() )
return PQTrue; return PQTrue;
else else
return PQFalse; return PQFalse;
@ -104,7 +104,7 @@ PQSibling::evaluate(const Element &element)
{ {
switch ( f_optype ) { switch ( f_optype ) {
case PQEqual: case PQEqual:
if ( f_sibling == element.relative_sibling_number() || if ( f_sibling == (int) element.relative_sibling_number() ||
( f_sibling ==-1 && element.relatively_last_child() ) ( f_sibling ==-1 && element.relatively_last_child() )
) )
return PQTrue; return PQTrue;
@ -119,7 +119,7 @@ PQSibling::evaluate(const Element &element)
else else
return PQFalse; return PQFalse;
} else } else
if ( f_sibling != element.relative_sibling_number() ) if ( f_sibling != (int) element.relative_sibling_number() )
return PQTrue; return PQTrue;
else else
return PQFalse; return PQFalse;

View file

@ -74,8 +74,8 @@ public:
virtual PQBoolean evaluate(const Element &); virtual PQBoolean evaluate(const Element &);
private: private:
int f_position ;
PQEqOp f_optype; PQEqOp f_optype;
int f_position ;
}; };
class PQSibling: public PQExpr class PQSibling: public PQExpr
@ -85,8 +85,8 @@ public:
virtual PQBoolean evaluate(const Element &); virtual PQBoolean evaluate(const Element &);
private: private:
int f_sibling;
PQEqOp f_optype; PQEqOp f_optype;
int f_sibling;
}; };
class PQAttributeSelector : public PQExpr class PQAttributeSelector : public PQExpr

View file

@ -41,7 +41,7 @@ EncodedPath::~EncodedPath()
} }
EncodedPath::EncodedPath(SSPath* p, unsigned int asPattern) : EncodedPath::EncodedPath(SSPath* p, unsigned int asPattern) :
f_size(p -> entries()), f_SVectors(letterHash), f_patternSize(0), f_size(p -> entries()), f_patternSize(0), f_SVectors(letterHash),
f_wildCard(gElemSymTab -> wildCardId()), f_wildCard(gElemSymTab -> wildCardId()),
f_unlimitedWildCard(gElemSymTab -> unlimitedWildCardId()), f_unlimitedWildCard(gElemSymTab -> unlimitedWildCardId()),
f_copyOfS(new BitVector(WORD_SIZE, 0)) f_copyOfS(new BitVector(WORD_SIZE, 0))
@ -478,7 +478,7 @@ void PathTable::initLastSymIndex()
{ {
f_lastSymIndexCount = gElemSymTab -> IdsAssigned()+1; f_lastSymIndexCount = gElemSymTab -> IdsAssigned()+1;
f_lastSymIndex = new CC_TPtrDlist_PathFeature_Ptr_T[f_lastSymIndexCount]; f_lastSymIndex = new CC_TPtrDlist_PathFeature_Ptr_T[f_lastSymIndexCount];
for (int i=0; i<f_lastSymIndexCount; i++) for (unsigned int i=0; i<f_lastSymIndexCount; i++)
f_lastSymIndex[i] = new CC_TPtrDlist<PathFeature>; f_lastSymIndex[i] = new CC_TPtrDlist<PathFeature>;

View file

@ -47,15 +47,15 @@ typedef unsigned int LetterType;
class EncodedPath class EncodedPath
{ {
int f_patternSize;
int f_size; int f_size;
int f_patternSize;
LetterType* f_array; LetterType* f_array;
hashTable<LetterType, BitVector> f_SVectors;
LetterType f_wildCard; LetterType f_wildCard;
LetterType f_unlimitedWildCard; LetterType f_unlimitedWildCard;
hashTable<LetterType, BitVector> f_SVectors;
BitVector* f_copyOfS; // copy of S vector, used in match() BitVector* f_copyOfS; // copy of S vector, used in match()
public: public:
@ -98,7 +98,7 @@ class PathFeature : public basePathFeature
public: public:
PathFeature(SSPath* p,FeatureSet* f,EncodedPath* e=0, unsigned int id=0): PathFeature(SSPath* p,FeatureSet* f,EncodedPath* e=0, unsigned int id=0):
f_encodedPath(e), f_id(id), basePathFeature(p, f) {}; basePathFeature(p, f), f_id(id), f_encodedPath(e) {};
~PathFeature(); ~PathFeature();
EncodedPath* encodedPath() { return f_encodedPath; }; EncodedPath* encodedPath() { return f_encodedPath; };
@ -117,7 +117,7 @@ class PathFeatureList : public CC_TPtrDlist<PathFeature>
public: public:
PathFeatureList() {}; PathFeatureList() {};
~PathFeatureList(); virtual ~PathFeatureList();
void appendList(PathFeatureList&); void appendList(PathFeatureList&);
}; };

View file

@ -47,7 +47,7 @@ class Renderer : public Destructable
{ {
public: public:
Renderer() {}; Renderer() {};
~Renderer() {}; virtual ~Renderer() {};
virtual FeatureSet *initialize() = 0; /* return default feature set */ virtual FeatureSet *initialize() = 0; /* return default feature set */

View file

@ -71,12 +71,12 @@ public:
private: private:
SSPath f_path ; SSPath f_path ;
ResolverStack f_resolverStack;
PathTable &f_pathTable; PathTable &f_pathTable;
// NOTE: this one could be a pointer so we can change them on the fly // NOTE: this one could be a pointer so we can change them on the fly
Renderer &f_Renderer; Renderer &f_Renderer;
ResolverStack f_resolverStack;
}; };
#endif /* _Resolver_h */ #endif /* _Resolver_h */

View file

@ -75,7 +75,7 @@ private:
public: public:
SSPath(char*, unsigned int assignId); // for test purpose SSPath(char*, unsigned int assignId); // for test purpose
SSPath(); SSPath();
~SSPath(); virtual ~SSPath();
// this call update f_containPathQualifier field // this call update f_containPathQualifier field
void appendPathTerm(PathTerm*); void appendPathTerm(PathTerm*);

View file

@ -22,7 +22,7 @@
*/ */
// $TOG: defParser.C /main/5 1997/12/23 11:16:25 bill $ // $TOG: defParser.C /main/5 1997/12/23 11:16:25 bill $
#ifndef lint #ifndef lint
static char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; static const char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#endif #endif
#define defParserBYACC 1 #define defParserBYACC 1
#include <stdio.h> #include <stdio.h>
@ -230,7 +230,7 @@ defParserparse()
*defParserssp = defParserstate = 0; *defParserssp = defParserstate = 0;
defParserloop: defParserloop:
if (defParsern = defParserdefred[defParserstate]) goto defParserreduce; if ((defParsern = defParserdefred[defParserstate])) goto defParserreduce;
if (defParserchar < 0) if (defParserchar < 0)
{ {
if ((defParserchar = defParserlex()) < 0) defParserchar = 0; if ((defParserchar = defParserlex()) < 0) defParserchar = 0;

View file

@ -483,7 +483,9 @@ static int defParser_did_buffer_switch_on_eof;
static defParser_state_type defParser_get_previous_state defParser_PROTO(( void )); static defParser_state_type defParser_get_previous_state defParser_PROTO(( void ));
static defParser_state_type defParser_try_NUL_trans defParser_PROTO(( defParser_state_type current_state )); static defParser_state_type defParser_try_NUL_trans defParser_PROTO(( defParser_state_type current_state ));
static int defParser_get_next_buffer defParser_PROTO(( void )); static int defParser_get_next_buffer defParser_PROTO(( void ));
#if 0
static void defParserunput defParser_PROTO(( defParser_CHAR c, defParser_CHAR *buf_ptr )); static void defParserunput defParser_PROTO(( defParser_CHAR c, defParser_CHAR *buf_ptr ));
#endif
void defParserrestart defParser_PROTO(( FILE *input_file )); void defParserrestart defParser_PROTO(( FILE *input_file ));
void defParser_switch_to_buffer defParser_PROTO(( defParser_BUFFER_STATE new_buffer )); void defParser_switch_to_buffer defParser_PROTO(( defParser_BUFFER_STATE new_buffer ));
void defParser_load_buffer_state defParser_PROTO(( void )); void defParser_load_buffer_state defParser_PROTO(( void ));
@ -1055,6 +1057,7 @@ register defParser_state_type defParser_current_state;
} }
#if 0
#ifdef defParser_USE_PROTOS #ifdef defParser_USE_PROTOS
static void defParserunput( defParser_CHAR c, register defParser_CHAR *defParser_bp ) static void defParserunput( defParser_CHAR c, register defParser_CHAR *defParser_bp )
#else #else
@ -1098,6 +1101,7 @@ register defParser_CHAR *defParser_bp;
*/ */
defParser_DO_BEFORE_ACTION; /* set up defParsertext again */ defParser_DO_BEFORE_ACTION; /* set up defParsertext again */
} }
#endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -22,7 +22,7 @@
*/ */
// $TOG: style.C /main/6 1998/04/17 11:51:49 mgreess $ // $TOG: style.C /main/6 1998/04/17 11:51:49 mgreess $
#ifndef lint #ifndef lint
static char stylesccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; static const char stylesccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#endif #endif
#define styleBYACC 1 #define styleBYACC 1
#include <stdio.h> #include <stdio.h>
@ -70,7 +70,7 @@ const char* toUpperCase(unsigned char* string)
{ {
static char buffer[512]; static char buffer[512];
int j=0; int j=0;
for ( int i=0; i<strlen((const char*)string); i++ ) for ( unsigned int i=0; i<strlen((const char*)string); i++ )
{ {
if (islower(string[i])) if (islower(string[i]))
buffer[j] = toupper(string[i]) ; buffer[j] = toupper(string[i]) ;
@ -488,7 +488,7 @@ styleparse()
*stylessp = stylestate = 0; *stylessp = stylestate = 0;
styleloop: styleloop:
if (stylen = styledefred[stylestate]) goto stylereduce; if ((stylen = styledefred[stylestate])) goto stylereduce;
if (stylechar < 0) if (stylechar < 0)
{ {
if ((stylechar = stylelex()) < 0) stylechar = 0; if ((stylechar = stylelex()) < 0) stylechar = 0;
@ -1123,7 +1123,7 @@ case 63:
/* char handling better too? */ /* char handling better too? */
if ( gGI_CASE_SENSITIVE == false ) if ( gGI_CASE_SENSITIVE == false )
{ {
for (int i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++) for (unsigned int i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++)
if ( islower(stylevsp[0].charPtrData[i]) ) if ( islower(stylevsp[0].charPtrData[i]) )
stylevsp[0].charPtrData[i] = toupper(stylevsp[0].charPtrData[i]); stylevsp[0].charPtrData[i] = toupper(stylevsp[0].charPtrData[i]);
} }
@ -1135,21 +1135,33 @@ case 64:
break; break;
case 65: case 65:
{ {
int l = strlen((char*)stylevsp[-3].charPtrData) + strlen((char*)stylevsp[0].charPtrData) + 2; int l3 = strlen((char*)stylevsp[-3].charPtrData);
int l0 = strlen((char*)stylevsp[0].charPtrData);
int l = l3 + l0 + 2;
styleval.charPtrData=new unsigned char[l]; styleval.charPtrData=new unsigned char[l];
strcpy((char*)styleval.charPtrData, (char*)stylevsp[-3].charPtrData);
strcat((char*)styleval.charPtrData, "."); *((char *) memcpy((char*)styleval.charPtrData,
strcat((char*)styleval.charPtrData, (char*)stylevsp[0].charPtrData); (char*)stylevsp[-3].charPtrData, l3) + l3) = '\0';
*((char *) memcpy((char*)(styleval.charPtrData + l3),
".", 1) + 1) = '\0';
*((char *) memcpy((char*)(styleval.charPtrData + l3 + 1),
(char*)stylevsp[0].charPtrData, l0) + l0) = '\0';
delete stylevsp[-3].charPtrData; delete stylevsp[-3].charPtrData;
delete stylevsp[0].charPtrData; delete stylevsp[0].charPtrData;
} }
break; break;
case 66: case 66:
{ {
int l = strlen((char*)stylevsp[-1].charPtrData) + 2; int l1 = strlen((char*)stylevsp[-1].charPtrData);
int l = l1 + 2;
styleval.charPtrData=new unsigned char[l]; styleval.charPtrData=new unsigned char[l];
strcpy((char*)styleval.charPtrData, (char*)stylevsp[-1].charPtrData);
strcat((char*)styleval.charPtrData, "."); *((char *) memcpy((char*)styleval.charPtrData,
(char*)stylevsp[-1].charPtrData, l1) + l1) = '\0';
*((char *) memcpy((char*)styleval.charPtrData + l1,
".", 1) + 1) = '\0';
delete stylevsp[-1].charPtrData; delete stylevsp[-1].charPtrData;
} }
break; break;
@ -1160,7 +1172,7 @@ case 67:
break; break;
case 68: case 68:
{ {
int i; unsigned int i;
for (i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++) { for (i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++) {

View file

@ -586,7 +586,9 @@ static int style_did_buffer_switch_on_eof;
static style_state_type style_get_previous_state style_PROTO(( void )); static style_state_type style_get_previous_state style_PROTO(( void ));
static style_state_type style_try_NUL_trans style_PROTO(( style_state_type current_state )); static style_state_type style_try_NUL_trans style_PROTO(( style_state_type current_state ));
static int style_get_next_buffer style_PROTO(( void )); static int style_get_next_buffer style_PROTO(( void ));
#if 0
static void styleunput style_PROTO(( style_CHAR c, style_CHAR *buf_ptr )); static void styleunput style_PROTO(( style_CHAR c, style_CHAR *buf_ptr ));
#endif
void stylerestart style_PROTO(( FILE *input_file )); void stylerestart style_PROTO(( FILE *input_file ));
void style_switch_to_buffer style_PROTO(( style_BUFFER_STATE new_buffer )); void style_switch_to_buffer style_PROTO(( style_BUFFER_STATE new_buffer ));
void style_load_buffer_state style_PROTO(( void )); void style_load_buffer_state style_PROTO(( void ));
@ -1305,6 +1307,7 @@ register style_state_type style_current_state;
} }
#if 0
#ifdef style_USE_PROTOS #ifdef style_USE_PROTOS
static void styleunput( style_CHAR c, register style_CHAR *style_bp ) static void styleunput( style_CHAR c, register style_CHAR *style_bp )
#else #else
@ -1348,6 +1351,7 @@ register style_CHAR *style_bp;
*/ */
style_DO_BEFORE_ACTION; /* set up styletext again */ style_DO_BEFORE_ACTION; /* set up styletext again */
} }
#endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -70,23 +70,27 @@ base::base(object_dict* obj_dict,
num_cset_ptrs(0), num_list_ptrs(0), num_cset_ptrs(0), num_list_ptrs(0),
f_obj_dict(obj_dict) f_obj_dict(obj_dict)
{ {
int len = MIN(strlen(base_dir), PATHSIZ - 1);
if ( base_dir ) if ( base_dir )
strcpy(base_path, base_dir); *((char *) memcpy (base_path, base_dir, len) + len) = '\0';
else else
base_path[0] = 0; base_path[0] = 0;
len = MIN(strlen(base_nm), PATHSIZ - 1);
if ( base_nm ) if ( base_nm )
strcpy(base_name, base_nm); *((char *) memcpy (base_name, base_nm, len) + len) = '\0';
else else
base_name[0] = 0; base_name[0] = 0;
len = MIN(strlen(base_ds), PATHSIZ - 1);
if ( base_ds ) if ( base_ds )
strcpy(base_desc, base_ds); *((char *) memcpy (base_desc, base_ds, len) + len) = '\0';
else else
base_desc[0] = 0; base_desc[0] = 0;
len = MIN(strlen(base_uid_str), UIDSIZ - 1);
if ( base_uid_str ) if ( base_uid_str )
strcpy(base_uid, base_uid_str); *((char *) memcpy (base_uid, base_uid_str, len) + len) = '\0';
else else
base_uid[0] = 0; base_uid[0] = 0;

View file

@ -88,18 +88,17 @@ public:
protected: protected:
object_dict* f_obj_dict;
char base_path[PATHSIZ]; char base_path[PATHSIZ];
char base_name[PATHSIZ]; char base_name[PATHSIZ];
char base_desc[PATHSIZ]; char base_desc[PATHSIZ];
char base_uid[UIDSIZ]; char base_uid[UIDSIZ];
int num_cset_ptrs;
int num_list_ptrs;
char** info_base_set_names; char** info_base_set_names;
char** info_base_list_names; char** info_base_list_names;
int num_cset_ptrs;
int num_list_ptrs;
object_dict* f_obj_dict;
}; };
typedef base* basePtr; typedef base* basePtr;

View file

@ -72,8 +72,9 @@ debug(cerr, base_dir);
debug(cerr, base_nm); debug(cerr, base_nm);
debug(cerr, base_ds); debug(cerr, base_ds);
*/ */
int len = MIN(strlen(base_locale), PATHSIZ - 1);
if (base_locale) if (base_locale)
strcpy(info_base_locale, base_locale); *((char *) memcpy (info_base_locale, base_locale, len) + len) = '\0';
else else
*info_base_locale = 0; *info_base_locale = 0;
@ -131,7 +132,6 @@ info_base::~info_base()
int info_base::get_set_pos(const char* set_nm) int info_base::get_set_pos(const char* set_nm)
{ {
char* nm = 0;
for ( int i=0; i<num_cset_ptrs; i++ ) { for ( int i=0; i<num_cset_ptrs; i++ ) {
if ( strcmp(set_nm, info_base_set_names[i]) == 0 ) if ( strcmp(set_nm, info_base_set_names[i]) == 0 )
return i; return i;
@ -221,7 +221,7 @@ Iterator* info_base::first(char* col_nm, c_code_t code)
handler* x = get_set(col_nm); handler* x = get_set(col_nm);
if ( x == 0 ) { if ( x == 0 ) {
handler* x = get_list(col_nm); x = get_list(col_nm);
} }
if ( x == 0 ) { if ( x == 0 ) {
@ -299,7 +299,7 @@ int stdin_sgml_data_getchar(unsigned char* buf, int max_sz)
chars_to_read = MIN(max_sz, remain_chars); chars_to_read = MIN(max_sz, remain_chars);
if ( fread((char*)buf, 1, chars_to_read, stdin) != chars_to_read ) { if ( (int)fread((char*)buf, 1, chars_to_read, stdin) != chars_to_read ) {
throw(stringException("sgml_data_getchar(): fread() failed")); throw(stringException("sgml_data_getchar(): fread() failed"));
} }

View file

@ -79,6 +79,8 @@ f_bad_info_base_names(0), f_bad_info_base_paths(0), f_descriptor(des)
//debug(cerr, info_lib_dir); //debug(cerr, info_lib_dir);
//debug(cerr, infoLibName); //debug(cerr, infoLibName);
int len;
f_obj_dict = new object_dict; f_obj_dict = new object_dict;
if ( info_lib_dir == 0 ) { if ( info_lib_dir == 0 ) {
@ -91,8 +93,10 @@ f_bad_info_base_names(0), f_bad_info_base_paths(0), f_descriptor(des)
) )
); );
strcpy(info_lib_path, info_lib_dir); len = MIN(strlen(info_lib_dir), PATHSIZ -1);
strcpy(info_lib_name, infoLibName); *((char *) memcpy (info_lib_path, info_lib_dir, len) + len) = '\0';
len = MIN(strlen(infoLibName), PATHSIZ -1);
*((char *) memcpy (info_lib_name, infoLibName, len) + len) = '\0';
fstream *map_in = 0; fstream *map_in = 0;
@ -163,9 +167,10 @@ f_bad_info_base_names(0), f_bad_info_base_paths(0), f_descriptor(des)
strcmp("C.ISO-8859-1", base_locale) == 0)) strcmp("C.ISO-8859-1", base_locale) == 0))
{ {
strcpy(db_path_name, len = MIN(strlen(info_lib_dir) + strlen(base_name) +1, PATHSIZ -1);
form("%s/%s", info_lib_dir, base_name) *((char *) memcpy (db_path_name,
); form("%s/%s", info_lib_dir, base_name),
len) + len) = '\0';
mm_version mmv_code(MAJOR, MINOR); mm_version mmv_code(MAJOR, MINOR);
mm_version mmv_base_data(2, 1); mm_version mmv_base_data(2, 1);
@ -363,10 +368,17 @@ info_lib::define_info_base( char* base_name, char* base_desc,
char new_db_path[PATHSIZ]; char new_db_path[PATHSIZ];
char f_name[PATHSIZ]; char f_name[PATHSIZ];
char base_uid[UIDSIZ]; char base_uid[UIDSIZ];
int len;
const char* uid;
strcpy(new_db_path, form("%s/%s", info_lib_path, base_name)); len = MIN(strlen(info_lib_path) + strlen(base_name) + 1, PATHSIZ -1);
*((char *) memcpy (new_db_path,
form("%s/%s", info_lib_path, base_name),
len) + len) = '\0';
strcpy(base_uid, unique_id()); uid = unique_id();
len = MIN(strlen(uid), UIDSIZ -1);
*((char *) memcpy(base_uid, uid, len) + len) = '\0';
g_mode_8_3 = 1; g_mode_8_3 = 1;
@ -387,15 +399,24 @@ info_lib::define_info_base( char* base_name, char* base_desc,
// remove any old files // remove any old files
////////////////////////// //////////////////////////
strcpy(f_name, form("%s.%s", base_name, DATA_FILE_SUFFIX)); len = MIN(strlen(base_name) + strlen(DATA_FILE_SUFFIX) +1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, DATA_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true ) if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path); del_file(f_name, new_db_path);
strcpy(f_name, form("%s.%s", base_name, INDEX_FILE_SUFFIX)); len = MIN(strlen(base_name) + strlen(INDEX_FILE_SUFFIX) + 1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, INDEX_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true ) if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path); del_file(f_name, new_db_path);
strcpy(f_name, form("%s.%s", base_name, SCHEMA_FILE_SUFFIX)); len = MIN(strlen(base_name) + strlen(SCHEMA_FILE_SUFFIX) +1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, SCHEMA_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true ) if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path); del_file(f_name, new_db_path);

View file

@ -132,8 +132,8 @@ protected:
int f_bad_base_array_size; int f_bad_base_array_size;
int f_bad_info_bases; int f_bad_info_bases;
char** f_bad_info_base_paths;
char** f_bad_info_base_names; char** f_bad_info_base_names;
char** f_bad_info_base_paths;
int f_descriptor; int f_descriptor;

View file

@ -65,7 +65,8 @@ server::server(char* x_infolib_path) :
) )
); );
strcpy(info_lib_dir, x_infolib_path); int len = MIN(strlen(x_infolib_path), PATHSIZ - 1);
*((char *) memcpy(info_lib_dir, x_infolib_path, len) + len) = '\0';
} }

View file

@ -288,7 +288,7 @@ void smart_ptr::update_oid(int i, const oid_t& x)
handler* z = get_handler(i, OID_CODE); handler* z = get_handler(i, OID_CODE);
oid_handler* y = (oid_handler*)z; oid_handler* y = (oid_handler*)z;
sprintf(buf, "%d.%d\n", x.ccode(), (int)x.icode()); snprintf(buf, sizeof(buf), "%d.%d\n", x.ccode(), (int)x.icode());
istringstream in(buf); istringstream in(buf);
(*y) -> asciiIn(in); (*y) -> asciiIn(in);
@ -305,16 +305,18 @@ void smart_ptr::update_string(int i, istream& in)
io_status ok; io_status ok;
switch ( x -> its_oid().ccode() ) { switch ( x -> its_oid().ccode() ) {
case STRING_CODE: case STRING_CODE:
ok = (*(pstring_handler*)x) -> asciiIn(in); ok =(*(pstring_handler*)x) -> asciiIn(in);
break; break;
case COMPRESSED_STRING_CODE: case COMPRESSED_STRING_CODE:
ok = (*(compressed_pstring_handler*)x) -> _asciiIn(in); ok =(*(compressed_pstring_handler*)x) -> _asciiIn(in);
break; break;
default: default:
throw(stringException("invalid node data class code")); throw(stringException("invalid node data class code"));
} }
if(ok) { ; }
delete x; delete x;
} }

View file

@ -128,6 +128,8 @@ Boolean btree::insert(data_t& w)
case RET_SUCCESS: case RET_SUCCESS:
return true; return true;
} }
return false;
} }
Boolean btree::remove(data_t& w) Boolean btree::remove(data_t& w)
@ -145,6 +147,8 @@ Boolean btree::remove(data_t& w)
case RET_SUCCESS: case RET_SUCCESS:
return true; return true;
} }
return false;
} }
Boolean btree::member(data_t& w) Boolean btree::member(data_t& w)
@ -169,6 +173,8 @@ Boolean btree::member(data_t& w)
memcpy((char*)&w.dt, data_DBT.data, data_DBT.size); memcpy((char*)&w.dt, data_DBT.data, data_DBT.size);
return true; return true;
} }
return false;
} }
ostream& btree::asciiOut(ostream& out) ostream& btree::asciiOut(ostream& out)

View file

@ -141,7 +141,7 @@ __bt_sync(dbp, flags)
BTREE *t; BTREE *t;
int status; int status;
PAGE *h; PAGE *h;
void *p; void *p = NULL;
t = dbp->internal; t = dbp->internal;

View file

@ -143,7 +143,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
*/ */
if (b.psize && if (b.psize &&
(b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
b.psize & sizeof(indx_t) - 1)) b.psize & (sizeof(indx_t) - 1)))
goto einval; goto einval;
/* Minimum number of keys per page; absolute minimum is 2. */ /* Minimum number of keys per page; absolute minimum is 2. */
@ -268,7 +268,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
if (m.m_magic != BTREEMAGIC || m.m_version != BTREEVERSION) if (m.m_magic != BTREEMAGIC || m.m_version != BTREEVERSION)
goto eftype; goto eftype;
if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET + 1 || if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET + 1 ||
m.m_psize & sizeof(indx_t) - 1) m.m_psize & (sizeof(indx_t) - 1))
goto eftype; goto eftype;
if (m.m_flags & ~SAVEMETA) if (m.m_flags & ~SAVEMETA)
goto eftype; goto eftype;
@ -301,8 +301,8 @@ __bt_open(fname, flags, mode, openinfo, dflags)
t->bt_psize = b.psize; t->bt_psize = b.psize;
/* Set the cache size; must be a multiple of the page size. */ /* Set the cache size; must be a multiple of the page size. */
if (b.cachesize && b.cachesize & b.psize - 1) if (b.cachesize && b.cachesize & (b.psize - 1))
b.cachesize += (~b.cachesize & b.psize - 1) + 1; b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
if (b.cachesize < b.psize * MINCACHE) if (b.cachesize < b.psize * MINCACHE)
b.cachesize = b.psize * MINCACHE; b.cachesize = b.psize * MINCACHE;

View file

@ -95,7 +95,7 @@ __bt_put(dbp, key, data, flags)
{ {
BTREE *t; BTREE *t;
DBT tkey, tdata; DBT tkey, tdata;
EPG *e; EPG *e = NULL;
PAGE *h; PAGE *h;
indx_t index, nxtindex; indx_t index, nxtindex;
pgno_t pg; pgno_t pg;
@ -243,7 +243,7 @@ delete: if (__bt_dleaf(t, h, index) == RET_ERROR) {
dest = (char *)h + h->upper; dest = (char *)h + h->upper;
WR_BLEAF(dest, key, data, dflags); WR_BLEAF(dest, key, data, dflags);
if (t->bt_order == NOT) if (t->bt_order == NOT) {
if (h->nextpg == P_INVALID) { if (h->nextpg == P_INVALID) {
if (index == NEXTINDEX(h) - 1) { if (index == NEXTINDEX(h) - 1) {
t->bt_order = FORWARD; t->bt_order = FORWARD;
@ -257,6 +257,7 @@ delete: if (__bt_dleaf(t, h, index) == RET_ERROR) {
t->bt_last.pgno = h->pgno; t->bt_last.pgno = h->pgno;
} }
} }
}
mpool_put(t->bt_mp, h, MPOOL_DIRTY); mpool_put(t->bt_mp, h, MPOOL_DIRTY);

View file

@ -111,13 +111,15 @@ __bt_split(t, sp, key, data, flags, ilen, skip)
size_t ilen; size_t ilen;
u_int skip; u_int skip;
{ {
BINTERNAL *bi; BINTERNAL *bi = NULL;
BLEAF *bl, *tbl; BLEAF *bl = NULL;
BLEAF *tbl;
DBT a, b; DBT a, b;
EPGNO *parent; EPGNO *parent;
PAGE *h, *l, *r, *lchild, *rchild; PAGE *h, *l, *r, *lchild, *rchild;
indx_t nxtindex; indx_t nxtindex;
size_t n, nbytes, nksize; size_t n, nbytes;
size_t nksize = 0;
int parentsplit; int parentsplit;
char *dest; char *dest;
@ -640,7 +642,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
RLEAF *rl; RLEAF *rl;
EPGNO *c; EPGNO *c;
PAGE *rval; PAGE *rval;
void *src; void *src = NULL;
indx_t full, half, nxt, off, skip, top, used; indx_t full, half, nxt, off, skip, top, used;
size_t nbytes; size_t nbytes;
int bigkeycnt, isbigkey; int bigkeycnt, isbigkey;

View file

@ -229,7 +229,7 @@ __bt_defcmp(a, b)
len = MIN(a->size, b->size); len = MIN(a->size, b->size);
for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2) for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2)
if (diff = *p1 - *p2) if ((diff = *p1 - *p2))
return (diff); return (diff);
return (a->size - b->size); return (a->size - b->size);
} }

View file

@ -67,7 +67,9 @@
#define __END_DECLS }; #define __END_DECLS };
#endif #endif
#else #else
#undef __BEGIN_DECLS
#define __BEGIN_DECLS #define __BEGIN_DECLS
#undef __END_DECLS
#define __END_DECLS #define __END_DECLS
#endif #endif
@ -119,6 +121,7 @@
* define them only if compiling without this. * define them only if compiling without this.
*/ */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#undef __dead
#define __dead __volatile #define __dead __volatile
#ifndef __pure #ifndef __pure
#define __pure __const #define __pure __const

View file

@ -86,10 +86,10 @@ typedef unsigned int sigset_t;
#endif #endif
/* /*
* If your system's vsprintf returns a char *, not an int, * If your system's vsnprintf returns a char *, not an int,
* change the 0 to a 1. * change the 0 to a 1.
*/ */
#if !defined(_AIX) && !defined(__osf__) #if !defined(_AIX) && !defined(__osf__) && !defined(linux) && !defined(CSRG_BASED)
#define VSPRINTF_CHARSTAR #define VSPRINTF_CHARSTAR
#endif #endif

View file

@ -94,6 +94,8 @@ dbopen(fname, flags, mode, type, openinfo)
return (__rec_open(fname, flags & USE_OPEN_FLAGS, return (__rec_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS)); mode, openinfo, flags & DB_FLAGS));
*/ */
default:
break;
} }
errno = EINVAL; errno = EINVAL;
return (NULL); return (NULL);

View file

@ -60,6 +60,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -72,7 +73,7 @@ extern int errno;
static int _gettemp(); static int _gettemp();
mkstemp(path) int mkstemp(path)
char *path; char *path;
{ {
int fd; int fd;
@ -87,7 +88,7 @@ mktemp(path)
return(_gettemp(path, (int *)NULL) ? path : (char *)NULL); return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
} }
static static int
_gettemp(path, doopen) _gettemp(path, doopen)
char *path; char *path;
register int *doopen; register int *doopen;

View file

@ -215,7 +215,7 @@ mpool_get(mp, pgno, flags)
* If asking for a specific page that is already in the cache, find * If asking for a specific page that is already in the cache, find
* it and return it. * it and return it.
*/ */
if (b = mpool_look(mp, pgno)) { if ((b = mpool_look(mp, pgno))) {
#ifdef STATISTICS #ifdef STATISTICS
++mp->pageget; ++mp->pageget;
#endif #endif

View file

@ -26,6 +26,7 @@
#include <compat.h> #include <compat.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#ifdef __STDC__ #ifdef __STDC__
#include <stdarg.h> #include <stdarg.h>
@ -45,24 +46,30 @@ snprintf(str, n, fmt, va_alist)
#endif #endif
{ {
va_list ap; va_list ap;
#ifdef VSPRINTF_CHARSTAR
char *rp; char *rp;
#else
int rval; int rval;
#endif
#ifdef __STDC__ #ifdef __STDC__
va_start(ap, fmt); va_start(ap, fmt);
#else #else
va_start(ap); va_start(ap);
#endif #endif
#ifdef VSPRINTF_CHARSTAR #ifdef VSPRINTF_CHARSTAR
rp = (char*)(size_t)vsprintf(str, fmt, ap); rp = (char*)(size_t)vsnprintf(str, n, fmt, ap);
va_end(ap); va_end(ap);
return (strlen(rp)); return (strlen(rp));
#else #else
rval = vsprintf(str, fmt, ap); rval = vsnprintf(str, n, fmt, ap);
va_end(ap); va_end(ap);
return (rval); return (rval);
#endif #endif
} }
#if 0
int int
vsnprintf(str, n, fmt, ap) vsnprintf(str, n, fmt, ap)
char *str; char *str;
@ -71,8 +78,9 @@ vsnprintf(str, n, fmt, ap)
va_list ap; va_list ap;
{ {
#ifdef VSPRINTF_CHARSTAR #ifdef VSPRINTF_CHARSTAR
return (strlen((char*)(size_t)vsprintf(str, fmt, ap))); return (strlen((char*)(size_t)vsnprintf(str, fmt, ap)));
#else #else
return (vsprintf(str, fmt, ap)); return (vsnprintf(str, fmt, ap));
#endif #endif
} }
#endif

View file

@ -63,8 +63,8 @@ class encoding_unit
public: public:
ostring* word; ostring* word;
int bits; int bits;
unsigned int code;
unsigned int freq; unsigned int freq;
unsigned int code;
htr_node* leaf_htr_node; htr_node* leaf_htr_node;
public: public:

View file

@ -109,7 +109,7 @@ void huff::build_tree()
heap htr_node_set(htr_eq, htr_ls, cts); heap htr_node_set(htr_eq, htr_ls, cts);
htr_node* x ; htr_node* x ;
for (int i=0; i<cts; i++ ) { for (unsigned int i=0; i<cts; i++ ) {
if ( e_units[i] ) { if ( e_units[i] ) {
x = new htr_node(e_units[i]); x = new htr_node(e_units[i]);
e_units[i] -> leaf_htr_node = x; e_units[i] -> leaf_htr_node = x;
@ -146,7 +146,7 @@ void huff::calculate_code()
htr_node* x ; htr_node* x ;
htr_node* parent; htr_node* parent;
for (int i=0; i<cts; i++ ) { for (unsigned int i=0; i<cts; i++ ) {
if ( e_units[i] == 0 ) if ( e_units[i] == 0 )
continue; continue;
@ -175,7 +175,7 @@ void huff::calculate_code()
x = parent; x = parent;
e_units[i] -> bits++; e_units[i] -> bits++;
if ( e_units[i] -> bits > BITS_IN(unsigned long) ) { if ( e_units[i] -> bits > (int) BITS_IN(unsigned long) ) {
debug(cerr, e_units[i] -> bits); debug(cerr, e_units[i] -> bits);
throw(stringException("huffman tree too deep")); throw(stringException("huffman tree too deep"));
} }
@ -191,7 +191,7 @@ ostream& huff::print_alphabet(ostream& out)
unsigned long total_uncmp = 0; unsigned long total_uncmp = 0;
unsigned long int total_cmp = 0; unsigned long int total_cmp = 0;
for (int i=0; i<cts; i++ ) { for (unsigned int i=0; i<cts; i++ ) {
if ( e_units[i] == 0 ) if ( e_units[i] == 0 )
continue; continue;
@ -400,7 +400,7 @@ io_status huff::cdrOut(buffer& buf)
//MESSAGE(cerr, "huff::cdrOut"); //MESSAGE(cerr, "huff::cdrOut");
//debug(cerr, my_oid()); //debug(cerr, my_oid());
static buffer v_out_buf(LBUFSIZ); static buffer v_out_buf(LBUFSIZ);
int i; unsigned int i;
if ( cts > 0 ) { if ( cts > 0 ) {
//MESSAGE(cerr, "huff::cdrOut: dict out"); //MESSAGE(cerr, "huff::cdrOut: dict out");
@ -454,7 +454,7 @@ io_status huff::cdrIn(buffer& buf)
unsigned int word_freq; unsigned int word_freq;
//ostring *z = 0; //ostring *z = 0;
for ( int i=0; i<cts; i++ ) { for ( unsigned int i=0; i<cts; i++ ) {
v_in_buf.get(word_sz); v_in_buf.get(word_sz);
v_in_buf.get(word_buf, int(word_sz)); v_in_buf.get(word_buf, int(word_sz));

View file

@ -60,11 +60,11 @@
class htr_node class htr_node
{ {
public: public:
htr_node* parent;
htr_node* left; htr_node* left;
htr_node* right; htr_node* right;
unsigned long freq;
encoding_unit* eu; encoding_unit* eu;
unsigned long freq;
htr_node* parent;
public: public:
htr_node(encoding_unit* eu, htr_node* lt = 0, htr_node* rt = 0); htr_node(encoding_unit* eu, htr_node* lt = 0, htr_node* rt = 0);
@ -80,10 +80,10 @@ class huff : public compress_agent
{ {
protected: protected:
htr_node* htr_root;
encoding_unit** e_units; encoding_unit** e_units;
trie* tri;
unsigned int cts ; unsigned int cts ;
trie* tri;
htr_node* htr_root;
protected: protected:
void build_tree(); void build_tree();

View file

@ -415,7 +415,9 @@ static int ps_did_buffer_switch_on_eof;
static ps_state_type ps_get_previous_state ps_PROTO(( void )); static ps_state_type ps_get_previous_state ps_PROTO(( void ));
static ps_state_type ps_try_NUL_trans ps_PROTO(( ps_state_type current_state )); static ps_state_type ps_try_NUL_trans ps_PROTO(( ps_state_type current_state ));
static int ps_get_next_buffer ps_PROTO(( void )); static int ps_get_next_buffer ps_PROTO(( void ));
#if 0
static void psunput ps_PROTO(( ps_CHAR c, ps_CHAR *buf_ptr )); static void psunput ps_PROTO(( ps_CHAR c, ps_CHAR *buf_ptr ));
#endif
void psrestart ps_PROTO(( FILE *input_file )); void psrestart ps_PROTO(( FILE *input_file ));
void ps_switch_to_buffer ps_PROTO(( ps_BUFFER_STATE new_buffer )); void ps_switch_to_buffer ps_PROTO(( ps_BUFFER_STATE new_buffer ));
void ps_load_buffer_state ps_PROTO(( void )); void ps_load_buffer_state ps_PROTO(( void ));
@ -807,6 +809,7 @@ register ps_state_type ps_current_state;
} }
#if 0
#ifdef ps_USE_PROTOS #ifdef ps_USE_PROTOS
static void psunput( ps_CHAR c, register ps_CHAR *ps_bp ) static void psunput( ps_CHAR c, register ps_CHAR *ps_bp )
#else #else
@ -850,6 +853,7 @@ register ps_CHAR *ps_bp;
*/ */
ps_DO_BEFORE_ACTION; /* set up pstext again */ ps_DO_BEFORE_ACTION; /* set up pstext again */
} }
#endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -421,7 +421,9 @@ static int sgml_did_buffer_switch_on_eof;
static sgml_state_type sgml_get_previous_state sgml_PROTO(( void )); static sgml_state_type sgml_get_previous_state sgml_PROTO(( void ));
static sgml_state_type sgml_try_NUL_trans sgml_PROTO(( sgml_state_type current_state )); static sgml_state_type sgml_try_NUL_trans sgml_PROTO(( sgml_state_type current_state ));
static int sgml_get_next_buffer sgml_PROTO(( void )); static int sgml_get_next_buffer sgml_PROTO(( void ));
#if 0
static void sgmlunput sgml_PROTO(( sgml_CHAR c, sgml_CHAR *buf_ptr )); static void sgmlunput sgml_PROTO(( sgml_CHAR c, sgml_CHAR *buf_ptr ));
#endif
void sgmlrestart sgml_PROTO(( FILE *input_file )); void sgmlrestart sgml_PROTO(( FILE *input_file ));
void sgml_switch_to_buffer sgml_PROTO(( sgml_BUFFER_STATE new_buffer )); void sgml_switch_to_buffer sgml_PROTO(( sgml_BUFFER_STATE new_buffer ));
void sgml_load_buffer_state sgml_PROTO(( void )); void sgml_load_buffer_state sgml_PROTO(( void ));
@ -818,6 +820,7 @@ register sgml_state_type sgml_current_state;
} }
#if 0
#ifdef sgml_USE_PROTOS #ifdef sgml_USE_PROTOS
static void sgmlunput( sgml_CHAR c, register sgml_CHAR *sgml_bp ) static void sgmlunput( sgml_CHAR c, register sgml_CHAR *sgml_bp )
#else #else
@ -861,6 +864,7 @@ register sgml_CHAR *sgml_bp;
*/ */
sgml_DO_BEFORE_ACTION; /* set up sgmltext again */ sgml_DO_BEFORE_ACTION; /* set up sgmltext again */
} }
#endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -147,7 +147,7 @@ trie::~trie()
delete root; delete root;
delete sorted_freqs; delete sorted_freqs;
for ( int i=0; i<alphabet_sz; i++ ) for ( unsigned int i=0; i<alphabet_sz; i++ )
delete alphabet[i]; delete alphabet[i];
delete alphabet; delete alphabet;
@ -155,7 +155,7 @@ trie::~trie()
void trie::extend_alphabet() void trie::extend_alphabet()
{ {
if ( alphabet_sz >= estimated_sz ) { if ( (int) alphabet_sz >= estimated_sz ) {
encoding_unitPtr* new_alphabet = new encoding_unitPtr[2* estimated_sz]; encoding_unitPtr* new_alphabet = new encoding_unitPtr[2* estimated_sz];
for ( int k=0; k< estimated_sz; k++ ) { for ( int k=0; k< estimated_sz; k++ ) {
@ -175,13 +175,10 @@ void trie::add(unsigned char* word, int sz, int fq)
// cerr << word[k]; // cerr << word[k];
//cerr << "\n"; //cerr << "\n";
static int j, level = 0; static int j;
static trie_node* x = 0; static trie_node* x = 0;
static trie_node_info* y = 0; static trie_node_info* y = 0;
static char buf[1];
static ostring *z;
if ( root == 0 ) if ( root == 0 )
root = new trie_node(0); root = new trie_node(0);

View file

@ -117,16 +117,16 @@ class trie
{ {
protected: protected:
trie_node* root;
int max_trie_level; int max_trie_level;
int total_nodes; int total_nodes;
int level_sz[MAX_LEVELS]; int level_sz[MAX_LEVELS];
trie_node* root;
heap* sorted_freqs; heap* sorted_freqs;
int estimated_sz;
encoding_unit** alphabet; encoding_unit** alphabet;
unsigned int alphabet_sz; unsigned int alphabet_sz;
int estimated_sz;
protected: protected:
void collect_freqs(trie_node* rt, int level); void collect_freqs(trie_node* rt, int level);

View file

@ -73,6 +73,7 @@ void zip::compress(const buffer& uncompressed, buffer& compressed)
out.close(); out.close();
ret = system(form("gzip -c %s > %s", (char*)UNCOMPRESSED,(char*)COMPRESSED)); ret = system(form("gzip -c %s > %s", (char*)UNCOMPRESSED,(char*)COMPRESSED));
if(ret != 0) throw(systemException(ret));
fstream in(COMPRESSED, ios::in); fstream in(COMPRESSED, ios::in);
@ -107,6 +108,7 @@ void zip::decompress(buffer& compressed, buffer& uncompressed)
out.close(); out.close();
ret = system(form("gzip -cd %s > %s",(char*)COMPRESSED,(char*)UNCOMPRESSED)); ret = system(form("gzip -cd %s > %s",(char*)COMPRESSED,(char*)UNCOMPRESSED));
if(ret != 0) throw(systemException(ret));
fstream in(UNCOMPRESSED, ios::in); fstream in(UNCOMPRESSED, ios::in);

View file

@ -74,8 +74,8 @@ public:
protected: protected:
int v_buckets; int v_buckets;
disk_bucket* v_cached_bucket_ptr;
page_storage* v_key_store; page_storage* v_key_store;
disk_bucket* v_cached_bucket_ptr;
}; };
typedef bucket_array* bucket_arrayPtr; typedef bucket_array* bucket_arrayPtr;

View file

@ -95,12 +95,13 @@ protected:
page* bucket_page(); page* bucket_page();
protected: protected:
int v_bucket_num;
page_storage* v_key_store;
Boolean v_overflowed; Boolean v_overflowed;
//unsigned int v_k; //unsigned int v_k;
//unsigned int v_r; //unsigned int v_r;
int v_bucket_num;
page_storage* v_key_store;
buffer& buf; buffer& buf;
}; };

View file

@ -79,7 +79,7 @@ index_agent(), key_store(store), buf(store -> aux_buf())
init_params(prime, expected_n); init_params(prime, expected_n);
bucket_vector = new bucket_array(M+v, store); bucket_vector = new bucket_array(M+v, store);
hash_vector = new void_ptr_array(2*MAX(expected_n, n)); hash_vector = new void_ptr_array(2*MAX(expected_n, (int) n));
k_vector = new void_ptr_array(M+v); k_vector = new void_ptr_array(M+v);
r_vector = new void_ptr_array(M+v); r_vector = new void_ptr_array(M+v);
@ -159,7 +159,7 @@ Boolean disk_hash::rehash(data_t& w)
{ {
//MESSAGE(cerr, "REHASH:"); //MESSAGE(cerr, "REHASH:");
char tmp_name[PATHSIZ]; char tmp_name[PATHSIZ];
sprintf(tmp_name, "%s.tmp", key_store -> my_name()); snprintf(tmp_name, sizeof(tmp_name), "%s.tmp", key_store -> my_name());
fstream pool(form("%s/%s", key_store -> my_path(), tmp_name), fstream pool(form("%s/%s", key_store -> my_path(), tmp_name),
ios::in | ios::out ios::in | ios::out
@ -271,7 +271,7 @@ Boolean disk_hash::_insert(data_t& w, Boolean rehash_if_fail)
//MESSAGE(cerr, "INSERT to overflow buckets"); //MESSAGE(cerr, "INSERT to overflow buckets");
//debug(cerr, hash); //debug(cerr, hash);
for ( hash %= v; hash < v; hash++ ) { for ( hash %= v; hash < (int) v; hash++ ) {
disk_bucket& overflowb = bucket_vector -> get_bucket(hash+M); disk_bucket& overflowb = bucket_vector -> get_bucket(hash+M);
@ -386,7 +386,7 @@ Boolean disk_hash::member(data_t& w, disk_bucket*& b, int& slot_num) const
if ( b -> overflow() == true ) { if ( b -> overflow() == true ) {
for ( hash %= v; hash<v; hash++ ) { for ( hash %= v; hash < (int) v; hash++ ) {
b = &bucket_vector -> get_bucket(hash+M); b = &bucket_vector -> get_bucket(hash+M);
@ -411,7 +411,7 @@ disk_bucket* disk_hash::get_bucket(int& ind)
void disk_hash::next_bucket(int& ind) void disk_hash::next_bucket(int& ind)
{ {
ind = ( ind >= M+v-1 ) ? -1 : (ind+1); ind = ( ind >= (int)(M+v-1) ) ? -1 : (ind+1);
} }

View file

@ -123,7 +123,7 @@ protected:
unsigned int k; // parameter used in the 1st level hash function unsigned int k; // parameter used in the 1st level hash function
unsigned int p; // prime number p unsigned int p; // prime number p
//unsigned int n; // current key set size unsigned int n; // current key set size
bucket_array* bucket_vector; // bucket array bucket_array* bucket_vector; // bucket array

View file

@ -67,7 +67,7 @@ Boolean void_eq(const void* o1, const void* o2)
//************************************************************** //**************************************************************
bset::bset(cmp_func_ptr_t eq, cmp_func_ptr_t ls): v_setroot(0), set(eq, ls) bset::bset(cmp_func_ptr_t eq, cmp_func_ptr_t ls): set(eq, ls), v_setroot(0)
{ {
//assert ( eq && ls ); //assert ( eq && ls );
} }

View file

@ -85,9 +85,9 @@ public:
long last(); // 0 if the list is empty long last(); // 0 if the list is empty
protected: protected:
int v_ct; // cell in the list
dlist_cell *v_head; // head pointer dlist_cell *v_head; // head pointer
dlist_cell *v_tail; // tail pointer dlist_cell *v_tail; // tail pointer
int v_ct; // cell in the list
int remove_cells_when_done; int remove_cells_when_done;
}; };

View file

@ -84,7 +84,7 @@ int heap::count()
Boolean heap::insert(voidPtr elm) Boolean heap::insert(voidPtr elm)
{ {
if ( buf_sz() < content_sz() + 2*sizeof(voidPtr) ) if ( buf_sz() < (int)(content_sz() + 2*sizeof(voidPtr)) )
buffer::expand_chunk(2*buf_sz()) ; buffer::expand_chunk(2*buf_sz()) ;
long x = long(elm); long x = long(elm);

View file

@ -93,9 +93,9 @@ public:
long last(); // 0 if the list is empty long last(); // 0 if the list is empty
protected: protected:
int v_ct; // cell in the list
slist_cell *v_head; // head pointer slist_cell *v_head; // head pointer
slist_cell *v_tail; // tail pointer slist_cell *v_tail; // tail pointer
int v_ct; // cell in the list
}; };

View file

@ -99,7 +99,7 @@ void token_stack::new_token()
void token_stack::add_partial_token(char* x) void token_stack::add_partial_token(char* x)
{ {
if ( v_curr_token_buf -> remaining_sz() < strlen(x) + 1) { if ( v_curr_token_buf -> remaining_sz() < (int)(strlen(x) + 1) ) {
int partial_str_len = curr_token_start ? strlen(curr_token_start) : 0; int partial_str_len = curr_token_start ? strlen(curr_token_start) : 0;

View file

@ -33,7 +33,7 @@
template <class T> template <class T>
CC_Boolean CC_TPtrDlistIterator<T>::operator+=(size_t n) CC_Boolean CC_TPtrDlistIterator<T>::operator+=(size_t n)
{ {
for ( int i = 0; i < n ; i++ ) { for ( size_t i = 0; i < n ; i++ ) {
if ( !(++(*this)) ) { if ( !(++(*this)) ) {
return (FALSE); return (FALSE);
} }

View file

@ -46,7 +46,7 @@ template<class T>
T *CC_TPtrSlist<T>::removeAt(size_t pos) { T *CC_TPtrSlist<T>::removeAt(size_t pos) {
CC_TPtrSlistIterator<T> iter( *this ); CC_TPtrSlistIterator<T> iter( *this );
for( int i = 0; i <= pos; i++ ) { for( size_t i = 0; i <= pos; i++ ) {
if ( !(++iter) ) { if ( !(++iter) ) {
throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); throw(CASTCCBEXCEPT ccBoundaryException(0,0,i));
} }

View file

@ -82,7 +82,7 @@ public:
CC_TPtrSlist(const CC_TPtrSlist<T> &); CC_TPtrSlist(const CC_TPtrSlist<T> &);
CC_TPtrSlist() { destructed = FALSE; } CC_TPtrSlist() { destructed = FALSE; }
~CC_TPtrSlist(); virtual ~CC_TPtrSlist();
virtual void clearAndDestroy(); virtual void clearAndDestroy();
virtual void clear(); /* clear only removes item, but not calling virtual void clear(); /* clear only removes item, but not calling
@ -104,7 +104,7 @@ public:
{ {
// Hack to get it passed to iter // Hack to get it passed to iter
CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)this ); CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)this );
for ( int i = 0; i <=pos; i++ ) { for ( size_t i = 0; i <=pos; i++ ) {
if ( !(++iter) ) { if ( !(++iter) ) {
throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); throw(CASTCCBEXCEPT ccBoundaryException(0,0,i));
} }
@ -161,7 +161,7 @@ public:
CC_Boolean get_destructed() const CC_Boolean get_destructed() const
{ return (destructed); } { return (destructed); }
CC_Boolean set_destructed(CC_Boolean what) void set_destructed(CC_Boolean what)
{ destructed = what; } { destructed = what; }
}; };

View file

@ -34,8 +34,9 @@ public: // functions
CC_String (const char *string) CC_String (const char *string)
{ {
f_string = new char[strlen(string) + 1]; int len = strlen(string);
strcpy (f_string, string); f_string = new char[len + 1];
*((char *) memcpy(f_string, string, len) + len) = '\0';
} }
CC_String() CC_String()

View file

@ -27,8 +27,9 @@
//-------------------------------------------------------------- //--------------------------------------------------------------
CC_Tokenizer::CC_Tokenizer( const CC_String &s ) CC_Tokenizer::CC_Tokenizer( const CC_String &s )
{ {
str_ = new char [s.length()+1]; int len = s.length();
strcpy(str_, s.data() ); str_ = new char [len + 1];
*((char *) memcpy(str_, s.data(), len) + len) = '\0';
current_ptr = str_; current_ptr = str_;
touched = FALSE; touched = FALSE;
} }

View file

@ -58,7 +58,7 @@ hashTable<K,V>::~hashTable()
CC_TPtrSlist<kv_pair<K, V> > * b = 0; CC_TPtrSlist<kv_pair<K, V> > * b = 0;
kv_pair<K, V> * r = 0; kv_pair<K, V> * r = 0;
for (int i=0; i<f_buckets.length(); i++ ) { for (size_t i=0; i<f_buckets.length(); i++ ) {
b = f_buckets[i]; b = f_buckets[i];
@ -78,7 +78,7 @@ void hashTable<K,V>::clearAndDestroy()
CC_TPtrSlist<kv_pair<K, V> >* b = 0; CC_TPtrSlist<kv_pair<K, V> >* b = 0;
for (int i=0; i<f_buckets.length(); i++ ) { for (size_t i=0; i<f_buckets.length(); i++ ) {
b = f_buckets[i]; b = f_buckets[i];
if ( b ) { if ( b ) {

View file

@ -66,8 +66,8 @@ template <class K, class V> class hashTable
friend class hashTableIterator<K, V>; friend class hashTableIterator<K, V>;
protected: protected:
pointer_vector<CC_TPtrSlist<kv_pair<K, V> > > f_buckets;
unsigned (*f_hash_func_ptr)(const K&); unsigned (*f_hash_func_ptr)(const K&);
pointer_vector<CC_TPtrSlist<kv_pair<K, V> > > f_buckets;
size_t f_items; size_t f_items;
protected: protected:

View file

@ -53,7 +53,7 @@ public:
{ {
// Hack to get it passed to iter // Hack to get it passed to iter
CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)this ); CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)this );
for ( int i = 0; i <=pos; i++ ) { for ( size_t i = 0; i <=pos; i++ ) {
if ( !(++iter) ) { if ( !(++iter) ) {
throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); throw(CASTCCBEXCEPT ccBoundaryException(0,0,i));
} }

View file

@ -39,7 +39,7 @@ template <class T>
pointer_vector<T>::pointer_vector(size_t n, T* t) pointer_vector<T>::pointer_vector(size_t n, T* t)
: f_array(new Tptr[n]), f_size(n), f_items(0) : f_array(new Tptr[n]), f_size(n), f_items(0)
{ {
for ( int i=0; i<f_size; i++ ) for ( size_t i=0; i<f_size; i++ )
f_array[i] = t; f_array[i] = t;
} }
@ -52,7 +52,7 @@ pointer_vector<T>::~pointer_vector()
template <class T> template <class T>
T* pointer_vector<T>::operator[](ptrdiff_t i) const T* pointer_vector<T>::operator[](ptrdiff_t i) const
{ {
if ( i<0 || i>= f_size ) if ( i < 0 || i >= (ptrdiff_t)f_size )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
else else
return f_array[i]; return f_array[i];
@ -61,7 +61,7 @@ T* pointer_vector<T>::operator[](ptrdiff_t i) const
template <class T> template <class T>
T*& pointer_vector<T>::operator[](ptrdiff_t i) T*& pointer_vector<T>::operator[](ptrdiff_t i)
{ {
if ( i<0 || i>= f_size ) if ( i < 0 || i >= (ptrdiff_t)f_size )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
else else
return f_array[i]; return f_array[i];

View file

@ -32,4 +32,7 @@ typedef unsigned int CC_Boolean;
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
#undef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif #endif

View file

@ -40,7 +40,7 @@ char *Exception::g_next_avail = Exception::g_temp_space;
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
Exception::Exception() Exception::Exception()
: f_line(0), f_thrown_as_pointer(1), f_thrown(0), f_temporary(0) : f_thrown(0), f_thrown_as_pointer(1), f_temporary(0), f_line(0)
{ {
PRINTF (("Constructed Exception obj @ %p\n", this)); PRINTF (("Constructed Exception obj @ %p\n", this));
} }
@ -76,19 +76,17 @@ Exception::operator delete (void *place)
void * void *
Exception::operator new (size_t size, int) Exception::operator new (size_t size, int)
{ {
if (g_next_avail + size <= g_temp_space + G_TEMP_SPACE_SIZE) if (g_next_avail + size > g_temp_space + G_TEMP_SPACE_SIZE)
{
void *p = g_next_avail;
g_next_avail += size;
PRINTF (("Allocate EXC @ %p, size = %ld\n", p, (long)size));
return (p);
}
else
{ {
Exceptions::error (Exceptions::f_msg_out_of_exception_memory, Exceptions::error (Exceptions::f_msg_out_of_exception_memory,
Exceptions::INTERNAL_ERROR); Exceptions::INTERNAL_ERROR);
terminate(); terminate();
} }
void *p = g_next_avail;
g_next_avail += size;
PRINTF (("Allocate EXC @ %p, size = %ld\n", p, (long)size));
return (p);
} }
@ -248,8 +246,8 @@ Exception::is (const char *type, const char *this_class)
PRINTF ((" var part is <%s>\n", type)); PRINTF ((" var part is <%s>\n", type));
// See if one's a pointer and the other isn't. // See if one's a pointer and the other isn't.
if (*type == '*' && !f_thrown_as_pointer || if ((*type == '*' && !f_thrown_as_pointer) ||
*type != '*' && f_thrown_as_pointer) (*type != '*' && f_thrown_as_pointer))
return (0); return (0);
// Otherwise they are either both pointers or both objects/references. // Otherwise they are either both pointers or both objects/references.
return (1); return (1);

View file

@ -162,28 +162,35 @@ Exceptions::set_error_handler (error_handler_t error_handler)
void void
Exceptions::error (const char *message, error_type_t error_type) Exceptions::error (const char *message, error_type_t error_type)
{ {
static char buffer[3][100]; unsigned int bufferlen = 100;
char buffer[3][bufferlen];
static char *lines[3] = { buffer[0], buffer[1], buffer[2] }; static char *lines[3] = { buffer[0], buffer[1], buffer[2] };
int count = 0; int len, count = 0;
if (error_type == INTERNAL_ERROR) if (error_type == INTERNAL_ERROR) {
strcpy (buffer[count++], f_msg_internal_error); len = MIN(strlen(f_msg_internal_error), bufferlen - 1);
else if (error_type == APPLICATION_ERROR) *((char *) memcpy(buffer[count++], f_msg_internal_error, len) + len) = '\0';
strcpy (buffer[count++], f_msg_application_error); }
else else if (error_type == APPLICATION_ERROR) {
strcpy (buffer[count++], f_msg_throw_message); len = MIN(strlen(f_msg_application_error), bufferlen - 1);
*((char *) memcpy(buffer[count++], f_msg_application_error,len)+len) = '\0';
}
else {
len = MIN(strlen(f_msg_throw_message), bufferlen - 1);
*((char *) memcpy(buffer[count++], f_msg_throw_message, len) + len) = '\0';
}
// Don't use fprintf because it may try to allocate memory. // Don't use fprintf because it may try to allocate memory.
if (Exception::g_current_exception != NULL) if (Exception::g_current_exception != NULL)
{ {
sprintf (buffer[count++], snprintf (buffer[count++], bufferlen,
" In exception thrown in file \"%s\", line %d,", " In exception thrown in file \"%s\", line %d,",
Exception::g_current_exception->f_file, Exception::g_current_exception->f_file,
Exception::g_current_exception->f_line); Exception::g_current_exception->f_line);
} }
if (message != NULL) if (message != NULL)
sprintf (buffer[count++], " %s", message); snprintf (buffer[count++], bufferlen, " %s", message);
// Call user print function if set, otherwise just dump lines. // Call user print function if set, otherwise just dump lines.
if (g_error_handler != NULL) if (g_error_handler != NULL)

View file

@ -4,6 +4,9 @@
#define _Exceptions_hh_active #define _Exceptions_hh_active
#undef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#ifndef C_API #ifndef C_API
#ifndef NATIVE_EXCEPTIONS #ifndef NATIVE_EXCEPTIONS
#define NATIVE_EXCEPTIONS #define NATIVE_EXCEPTIONS
@ -48,6 +51,16 @@ extern "C" {
#endif #endif
#endif #endif
#ifndef UNUSED_VARIABLE
# if defined(__GNUC__)
# define UNUSED_VARIABLE(x) x __attribute__((unused))
# elif defined(__LCLINT__)
# define UNUSED_VARIABLE(x) /*@unused@*/ x
# else
# define UNUSED_VARIABLE(x) x
# endif
#endif
#endif /* NATIVE_EXCEPTIONS */ #endif /* NATIVE_EXCEPTIONS */
#include "terminate.hh" #include "terminate.hh"
@ -130,7 +143,7 @@ extern "C" {
#define mcatch(TYPE,OBJ) \ #define mcatch(TYPE,OBJ) \
mcatch_noarg (TYPE) \ mcatch_noarg (TYPE) \
TYPE OBJ = (TYPE) Exception::current_exception(); TYPE UNUSED_VARIABLE(OBJ) = (TYPE) Exception::current_exception();
#define end_try \ #define end_try \
} else { \ } else { \

View file

@ -44,7 +44,7 @@ Unwind_Record Unwind_Stack::g_stack[UNWIND_STACK_SIZE];
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
Jump_Environment::Jump_Environment() Jump_Environment::Jump_Environment()
: f_unwinding (0), f_active_exception (NULL) : f_active_exception (NULL), f_unwinding (0)
{ {
PRINTF (("<%d> New Jump_Environment @ %p\n", ++g_level, this)); PRINTF (("<%d> New Jump_Environment @ %p\n", ++g_level, this));
// Push this on to the top of the jump env stack. // Push this on to the top of the jump env stack.

View file

@ -78,7 +78,7 @@ data_t::data_t(data_t& d)
{ {
int sz = strlen(d.key.str_key); int sz = strlen(d.key.str_key);
key.str_key = new char[sz+1]; key.str_key = new char[sz+1];
strcpy(key.str_key, d.key.str_key); *((char *) memcpy(key.str_key, d.key.str_key, sz) + sz) = '\0';
key.str_key[sz] = 0; key.str_key[sz] = 0;
flag = STRING; flag = STRING;
@ -104,8 +104,10 @@ data_t::data_t(const char* str, int sz, voidPtr d) : dt(d)
key.str_key = new char[sz+1]; key.str_key = new char[sz+1];
if ( sz > 0 ) if ( sz > 0 ) {
strcpy(key.str_key, str); int len = MIN(strlen(str), (unsigned int) sz);
*((char *) memcpy(key.str_key, str, len) + len) = '\0';
}
key.str_key[sz] = 0; key.str_key[sz] = 0;
} }
@ -146,6 +148,8 @@ int data_t::operator==(data_t& d)
case VOID: case VOID:
throw(stringException("VOID type in operator==()")); throw(stringException("VOID type in operator==()"));
} }
return 0;
} }
data_t& data_t::operator =(data_t& d) data_t& data_t::operator =(data_t& d)
@ -161,13 +165,12 @@ data_t& data_t::operator =(data_t& d)
case STRING: case STRING:
{ {
int d_sz = strlen(d.key.str_key); unsigned int d_sz = strlen(d.key.str_key);
if ( strlen(key.str_key) < d_sz ) { if ( strlen(key.str_key) < d_sz ) {
delete key.str_key; delete key.str_key;
key.str_key = new char[d_sz+1]; key.str_key = new char[d_sz+1];
} }
strcpy(key.str_key, d.key.str_key); *((char *) memcpy(key.str_key, d.key.str_key, d_sz) + d_sz) = '\0';
key.str_key[d_sz] = 0;
flag = STRING; flag = STRING;
break; break;
} }
@ -222,8 +225,7 @@ istream& operator >>(istream& i, data_t& d)
if ( d.flag == data_t::STRING ) { if ( d.flag == data_t::STRING ) {
int sz = strlen(key_ptr); int sz = strlen(key_ptr);
d.key.str_key = new char[sz+1]; d.key.str_key = new char[sz+1];
strcpy(d.key.str_key, key_ptr); *((char *) memcpy(d.key.str_key, key_ptr, sz) + sz) = '\0';
d.key.str_key[sz] = 0;
} }
return i; return i;
@ -243,6 +245,8 @@ ostream& operator <<(ostream& o, data_t& d)
case data_t::STRING: case data_t::STRING:
o << d.key.str_key; o << d.key.str_key;
break; break;
default:
break;
} }
o << " " << (long)(d.dt); o << " " << (long)(d.dt);

View file

@ -83,12 +83,12 @@ protected:
public: public:
enum flag_type { INT=0, STRING=1, VOID=2 }; enum flag_type { INT=0, STRING=1, VOID=2 };
voidPtr dt; // rest of information in the record
flag_type flag; flag_type flag;
union { union {
int int_key; int int_key;
char* str_key; char* str_key;
} key; } key;
voidPtr dt; // rest of information in the record
data_t(): dt(0), flag(data_t::VOID) {} ; data_t(): dt(0), flag(data_t::VOID) {} ;
data_t(data_t&) ; data_t(data_t&) ;

View file

@ -93,12 +93,12 @@ protected:
int k; // parameter used in the 1st level hash function int k; // parameter used in the 1st level hash function
int p; // prime number p int p; // prime number p
int n; // current key set size
int H; // current hash table size int H; // current hash table size
int B; // current bucket table size int B; // current bucket table size
int n; // current key set size
data_tPtr* hash_table; // the hash table
imp_bucketPtr* bucket_array; // bucket array imp_bucketPtr* bucket_array; // bucket array
data_tPtr* hash_table; // the hash table
bucket_holder* free_list_head ; // free bucket holder list head bucket_holder* free_list_head ; // free bucket holder list head
bucket_holder* collected_records; // collected bucket list head bucket_holder* collected_records; // collected bucket list head

View file

@ -60,12 +60,13 @@ bucket::bucket(char* key, int orig_position, Boolean copy) :
{ {
char* x = 0; char* x = 0;
int len;
switch (copy) { switch (copy) {
case true: case true:
x = new char[strlen(key)+1]; len = strlen(key);
strcpy(x, key); x = new char[len + 1];
x[strlen(key)] = 0; *((char *) memcpy(x, key, len) + len) = '\0';
break; break;
case false: case false:
x = key; x = key;
@ -90,12 +91,13 @@ bucket::~bucket()
int bucket::add_key(char* key, Boolean copy) int bucket::add_key(char* key, Boolean copy)
{ {
char *x = 0; char *x = 0;
int len;
switch (copy) { switch (copy) {
case true: case true:
x = new char[strlen(key)+1]; len = strlen(key);
strcpy(x, key); x = new char[len + 1];
x[strlen(key)] = 0; *((char *) memcpy(x, key, len) + len) = '\0';
break; break;
case false: case false:
x = key; x = key;
@ -140,8 +142,8 @@ h_convertor(pms.v_n, 128, rnd)
{ {
v_bucket_array = new bucketPtr[v_no_buckets]; v_bucket_array = new bucketPtr[v_no_buckets];
int i; unsigned int i;
for ( i=0; i<v_no_buckets; v_bucket_array[i++] = 0); for ( i=0; i < (unsigned int) v_no_buckets; v_bucket_array[i++] = 0);
//debug(cerr, pms); //debug(cerr, pms);
@ -188,7 +190,7 @@ int buckets::bucket_num(char* k, params& pms)
//debug(cerr, sum); //debug(cerr, sum);
if ( sum < pms.v_p1 ) { if ( sum < (int) pms.v_p1 ) {
sum %= pms.v_p2; sum %= pms.v_p2;
} else { } else {
sum %= (pms.v_b - pms.v_p2); sum %= (pms.v_b - pms.v_p2);

View file

@ -79,10 +79,10 @@ public:
protected: protected:
short v_no_keys; short v_no_keys;
int v_orig_pos; int v_count;
int v_control_bit; int v_control_bit;
int v_g_value; int v_g_value;
int v_count; int v_orig_pos;
slist_void_ptr_cell* key_ptr; slist_void_ptr_cell* key_ptr;
friend class buckets; friend class buckets;

View file

@ -277,7 +277,8 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer)
int compact(buckets& bs, unsigned s[], int t, Boolean swap) int compact(buckets& bs, unsigned s[], int t, Boolean swap)
{ {
int target, k, i, remaining_bits, branch; int target, k, i, remaining_bits, branch;
unsigned unsigned_g, high_part_bits, lower_part_bits; unsigned unsigned_g, high_part_bits;
unsigned lower_part_bits = 0;
remaining_bits = BITS_IN(unsigned); remaining_bits = BITS_IN(unsigned);
k = target = 0; k = target = 0;
@ -331,7 +332,7 @@ debug(cerr, "=====");
branch = 0; branch = 0;
} else { } else {
high_part_bits = getbits(unsigned_g,t,remaining_bits); high_part_bits = getbits(unsigned_g,t,remaining_bits);
lower_part_bits = unsigned_g & ~(~0 << t-remaining_bits); lower_part_bits = unsigned_g & ~(~0 << (t-remaining_bits));
lower_part_bits <<= (BITS_IN(unsigned)- (t-remaining_bits)); lower_part_bits <<= (BITS_IN(unsigned)- (t-remaining_bits));
s[k++] = target | high_part_bits; s[k++] = target | high_part_bits;

View file

@ -62,9 +62,9 @@ struct partition_t {
void params::select_value(float bts) void params::select_value(float bts)
{ {
int i; unsigned int i;
for ( i=0; ; i++ ) { for ( i=0; ; i++ ) {
if ( v_n <= partition_tbl[i].upper_bound ) if ( (int)v_n <= partition_tbl[i].upper_bound )
break; break;
} }

View file

@ -97,7 +97,7 @@ dyn_memory_index::~dyn_memory_index()
my_oid().asciiOut(oid_t_out); my_oid().asciiOut(oid_t_out);
*/ */
abs_storage* x = get_store(); get_store();
fstream out( fstream out(
form("%s.%s", storage_ptr->my_path(), storage_ptr->my_name()), form("%s.%s", storage_ptr->my_path(), storage_ptr->my_name()),
ios::out ios::out

View file

@ -241,6 +241,8 @@ debug(cerr, t);
int fast_mphf::hashTo(const key_type& k) int fast_mphf::hashTo(const key_type& k)
{ {
unsigned int i;
if ( v_long_string_core_indexed == false ) { if ( v_long_string_core_indexed == false ) {
v_long_string_core_indexed = true; v_long_string_core_indexed = true;
} }
@ -255,7 +257,7 @@ debug(cerr, k);
throw(stringException("hash table empty")); throw(stringException("hash table empty"));
} }
int i = v_tbl0 -> atoi(k.get(), k.size(), r, v_key_set_sz); // for halmphf i = v_tbl0 -> atoi(k.get(), k.size(), r, v_key_set_sz); // for halmphf
if ( i < v_p1 ) { if ( i < v_p1 ) {
@ -281,7 +283,7 @@ debug(cerr, k);
int fast_mphf::gValue(int i, int& gvalue, int& ctl_bit) int fast_mphf::gValue(int i, int& gvalue, int& ctl_bit)
{ {
if ( !INRANGE(i, 0, v_no_ps-1) ) { if ( !INRANGE(i, 0, (int) v_no_ps-1) ) {
throw(boundaryException(0, v_no_ps-1, i)); throw(boundaryException(0, v_no_ps-1, i));
} }
@ -428,7 +430,7 @@ fast_mphf::print_mapping(const char *key_file, int option)
} }
char *hash_table = new char[v_hash_tbl_sz]; char *hash_table = new char[v_hash_tbl_sz];
for (int i = 0; i < v_hash_tbl_sz; hash_table[i++] = 0 ); for (unsigned int i = 0; i < v_hash_tbl_sz; hash_table[i++] = 0 );
ostring lbuf(LBUFSIZ); ostring lbuf(LBUFSIZ);
@ -470,7 +472,7 @@ void fast_mphf::print_tbls(ostream& out)
void fast_mphf::print_gvalues(ostream& out) void fast_mphf::print_gvalues(ostream& out)
{ {
int gv, cbit; int gv, cbit;
for (int i = 0; i<v_no_ps; i++ ) { for (unsigned int i = 0; i<v_no_ps; i++ ) {
out << i; out << i;
gValue(i, gv, cbit); gValue(i, gv, cbit);
out << " " << gv << " " << cbit << "\n"; out << " " << gv << " " << cbit << "\n";
@ -479,7 +481,7 @@ void fast_mphf::print_gvalues(ostream& out)
int fast_mphf::print_bits(unsigned x, ostream& out) int fast_mphf::print_bits(unsigned x, ostream& out)
{ {
for ( int i=0; i<8*sizeof(unsigned); i++ ) { for ( unsigned int i=0; i<8*sizeof(unsigned); i++ ) {
if ( BIT_TEST(x, 0x80000000) ) if ( BIT_TEST(x, 0x80000000) )
out << "1"; out << "1";
else else

View file

@ -107,11 +107,13 @@ oid_t c_index::first_of_invlist(int ind)
Boolean c_index::get_key_string(const handler& t) const Boolean c_index::get_key_string(const handler& t) const
{ {
ostringstream out(v_static_key.get()); ostringstream out;
int len;
((handler&)t) -> asciiOut(out); ((handler&)t) -> asciiOut(out);
v_static_key.set_size(out.str().size()); len = out.str().size();
strcpy(v_static_key.get(), out.str().c_str()); v_static_key.set_size(len);
*((char *) memcpy(v_static_key.get(), out.str().c_str(), len) + len) = '\0';
return true; return true;
} }
@ -119,12 +121,14 @@ Boolean c_index::get_key_string(const handler& t) const
Boolean c_index::get_key_string(const oid_t& t) const Boolean c_index::get_key_string(const oid_t& t) const
{ {
v_static_key.reset(); v_static_key.reset();
int len;
ostringstream out(v_static_key.get()); ostringstream out(v_static_key.get());
t.asciiOut(out); t.asciiOut(out);
v_static_key.set_size(out.str().size()); len = out.str().size();
strcpy(v_static_key.get(), out.str().c_str()); v_static_key.set_size(len);
*((char *) memcpy(v_static_key.get(), out.str().c_str(), len) + len) = '\0';
return true; return true;
} }

View file

@ -140,7 +140,7 @@ ostream& operator <<(ostream&s, inv_lists& o)
void inv_lists::insert_to_list(int index, oid_t& id) void inv_lists::insert_to_list(int index, oid_t& id)
{ {
if ( !INRANGE(index, 1, v_sz) ) { if ( !INRANGE(index, 1, (int) v_sz) ) {
throw(boundaryException(1, v_sz, index)); throw(boundaryException(1, v_sz, index));
} }

View file

@ -154,7 +154,6 @@ istream& operator >>(istream& in, mark_t& m)
{ {
char c ; char c ;
char* ptr = m.get(); char* ptr = m.get();
int count = m.size();
Boolean read_marks = false; Boolean read_marks = false;
while ( in && in.get(c) ) { while ( in && in.get(c) ) {

View file

@ -169,7 +169,7 @@ cerr << "\n";
*/ */
if ( len < CLASS_CODE_BYTES || z == 0 ) if ( len < (int) CLASS_CODE_BYTES || z == 0 )
throw(stringException("_peek_obj(): corrupted data")); throw(stringException("_peek_obj(): corrupted data"));
c_code_t class_code; c_code_t class_code;
@ -265,13 +265,13 @@ template_mgr_t::init_obj(abs_storage* store, mmdb_pos_t pos, root*& x)
object_template -> set_cdr_size(cdr_io_buf.content_sz()); object_template -> set_cdr_size(cdr_io_buf.content_sz());
} }
int cdr_sz = object_template -> get_cdr_size();
///////////////// /////////////////
// safety check // safety check
///////////////// /////////////////
#ifdef DEBUG #ifdef DEBUG
int cdr_sz = object_template -> get_cdr_size();
if ( obj_len != cdr_sz ) { if ( obj_len != cdr_sz ) {
debug(cerr, obj_len); debug(cerr, obj_len);
debug(cerr, cdr_sz); debug(cerr, cdr_sz);

View file

@ -54,6 +54,8 @@
#include <sys/time.h> #include <sys/time.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#ifdef SVR4 #ifdef SVR4
#include <sys/systeminfo.h> #include <sys/systeminfo.h>
@ -123,7 +125,6 @@ gethostid()
const char * const char *
unique_id (void) unique_id (void)
{ {
static unsigned int info[4];
static char buf[16]; static char buf[16];
static unsigned int hostid; static unsigned int hostid;
static struct timeval cur_time, old_time; static struct timeval cur_time, old_time;
@ -194,7 +195,7 @@ unique_id (void)
printf ("%2d 0x%02x ", i, ch); printf ("%2d 0x%02x ", i, ch);
PRINT_BITS (ch); PRINT_BITS (ch);
#endif #endif
buf[i] = mapping[buf[i]]; buf[i] = mapping[(int)buf[i]];
} }
} while (!isalnum (buf[0])); } while (!isalnum (buf[0]));

View file

@ -72,7 +72,7 @@ int composite::first() const
void composite::next(int& index) const void composite::next(int& index) const
{ {
if INRANGE( index, 1, v_sz - 1 ) if INRANGE( index, 1, (int) v_sz - 1 )
index ++; index ++;
else else
index = 0; index = 0;

View file

@ -73,10 +73,10 @@ protected:
oid_t compress_agent_id; oid_t compress_agent_id;
unsigned int v_uncompressed_sz;
compress_agent_handler* agent; compress_agent_handler* agent;
unsigned int v_uncompressed_sz;
protected: protected:
void _compress(); void _compress();

View file

@ -100,7 +100,7 @@ handler* cset::get_component(int index)
oid_list_handler* cset::get_locs(handler& query, int index) oid_list_handler* cset::get_locs(handler& query, int index)
{ {
if ( !INRANGE(index, 0, num_indices-1) ) { if ( !INRANGE(index, 0, (int) num_indices-1) ) {
MESSAGE(cerr, "cset::get_locs(): invalid index"); MESSAGE(cerr, "cset::get_locs(): invalid index");
throw(boundaryException(0, num_indices-1, index)); throw(boundaryException(0, num_indices-1, index));
} }
@ -115,7 +115,7 @@ oid_list_handler* cset::get_locs(handler& query, int index)
oid_t cset::get_first_oid(const handler& query, int index) oid_t cset::get_first_oid(const handler& query, int index)
{ {
if ( !INRANGE(index, 0, num_indices-1) ) { if ( !INRANGE(index, 0, (int) num_indices-1) ) {
MESSAGE(cerr, "cset::get_first_oid(): invalid index"); MESSAGE(cerr, "cset::get_first_oid(): invalid index");
throw(boundaryException(0, num_indices-1, index)); throw(boundaryException(0, num_indices-1, index));
} }
@ -130,7 +130,7 @@ oid_t cset::get_first_oid(const handler& query, int index)
c_index_handler* cset::get_index_ptr(int index) c_index_handler* cset::get_index_ptr(int index)
{ {
if ( !INRANGE(index, 0, num_indices-1) ) { if ( !INRANGE(index, 0, (int) num_indices-1) ) {
MESSAGE(cerr, "cset::get_index_ptr(): invalid index"); MESSAGE(cerr, "cset::get_index_ptr(): invalid index");
throw(boundaryException(0, num_indices-1, index)); throw(boundaryException(0, num_indices-1, index));
} }
@ -140,7 +140,7 @@ c_index_handler* cset::get_index_ptr(int index)
void cset::batch_index_begin() void cset::batch_index_begin()
{ {
for ( int i=0; i<num_indices; i++ ) { for ( unsigned int i=0; i<num_indices; i++ ) {
if ( indices[i] != 0 ) { if ( indices[i] != 0 ) {
(*indices[i]) -> batch_index_begin(); (*indices[i]) -> batch_index_begin();
} }
@ -149,7 +149,7 @@ void cset::batch_index_begin()
void cset::batch_index_end() void cset::batch_index_end()
{ {
for ( int i=0; i<num_indices; i++ ) { for ( unsigned int i=0; i<num_indices; i++ ) {
if ( indices[i] != 0 ) { if ( indices[i] != 0 ) {
(*indices[i]) -> batch_index_end(); (*indices[i]) -> batch_index_end();
} }
@ -255,7 +255,7 @@ new_object.its_oid().asciiOut(cerr); cerr << "\n";
#endif #endif
} }
for ( int i = 1; i < num_indices; i++ ) { for ( unsigned int i = 1; i < num_indices; i++ ) {
if ( indices[i] == 0 ) if ( indices[i] == 0 )
continue; continue;
@ -287,7 +287,7 @@ Boolean cset::remove_component(const oid_t& x_oid)
{ {
handler* x = new handler(x_oid, storage_ptr); handler* x = new handler(x_oid, storage_ptr);
for ( int i = 1; i < num_indices; i++ ) { for ( unsigned int i = 1; i < num_indices; i++ ) {
if ( indices[i] == 0 ) if ( indices[i] == 0 )
continue; continue;
@ -324,7 +324,7 @@ cset::update_index(handler* old_comp_obj, handler* new_comp_obj,
oid_t& main_obj_oid) oid_t& main_obj_oid)
{ {
if ( !INRANGE(index, 1, num_indices-1) ) { if ( !INRANGE(index, 1, (int) num_indices-1) ) {
throw(boundaryException(1, num_indices-1, index)); throw(boundaryException(1, num_indices-1, index));
} }
@ -364,7 +364,7 @@ io_status cset::cdrIn(buffer& buf)
void cset::commit() void cset::commit()
{ {
for ( int i = 1; i < num_indices; i++ ) { for ( unsigned int i = 1; i < num_indices; i++ ) {
if ( indices[i] ) if ( indices[i] )
indices[i] -> commit(); indices[i] -> commit();

View file

@ -179,7 +179,7 @@ handler* dl_list::get_component(int index)
oid_list_handler* dl_list::get_locs(handler& query, int index) oid_list_handler* dl_list::get_locs(handler& query, int index)
{ {
if ( !INRANGE(index, 0, v_num_indices-1) ) if ( !INRANGE(index, 0, (int) v_num_indices-1) )
throw(boundaryException(0, v_num_indices-1, index)); throw(boundaryException(0, v_num_indices-1, index));
if ( v_indices[index] == 0 ) if ( v_indices[index] == 0 )
@ -352,7 +352,7 @@ v_dl_list_tail.asciiOut(out); cerr << "\n";
oid_t* cell_ptr = &v_dl_list_head; oid_t* cell_ptr = &v_dl_list_head;
for ( int i=1; i<=v_sz; i++ ) { for ( unsigned int i=1; i<=v_sz; i++ ) {
if ( cell_ptr == 0 ) { if ( cell_ptr == 0 ) {
throw(stringException("broken chain")); throw(stringException("broken chain"));
@ -377,7 +377,7 @@ v_dl_list_tail.asciiOut(out); cerr << "\n";
void dl_list::batch_index_begin() void dl_list::batch_index_begin()
{ {
for ( int i=0; i<v_num_indices; i++ ) { for ( unsigned int i=0; i<v_num_indices; i++ ) {
if ( v_indices[i] != 0 ) { if ( v_indices[i] != 0 ) {
(*v_indices[i]) -> batch_index_begin(); (*v_indices[i]) -> batch_index_begin();
} }
@ -386,7 +386,7 @@ void dl_list::batch_index_begin()
void dl_list::batch_index_end() void dl_list::batch_index_end()
{ {
for ( int i=0; i<v_num_indices; i++ ) { for ( unsigned int i=0; i<v_num_indices; i++ ) {
if ( v_indices[i] != 0 ) { if ( v_indices[i] != 0 ) {
(*v_indices[i]) -> batch_index_end(); (*v_indices[i]) -> batch_index_end();
} }
@ -456,7 +456,7 @@ dl_list::insert_to_indices(const dl_list_cell_handler& new_object)
} }
for ( int i = 1; i < v_num_indices; i++ ) { for ( unsigned int i = 1; i < v_num_indices; i++ ) {
if ( v_indices[i] == 0 ) continue; if ( v_indices[i] == 0 ) continue;
@ -521,7 +521,7 @@ io_status dl_list::cdrIn(buffer& buf)
oid_t dl_list::get_first_oid(const handler& query, int index) oid_t dl_list::get_first_oid(const handler& query, int index)
{ {
if ( !INRANGE(index, 0, v_num_indices-1) ) { if ( !INRANGE(index, 0, (int) v_num_indices-1) ) {
MESSAGE(cerr, "cset::get_first_oid(): invalid index"); MESSAGE(cerr, "cset::get_first_oid(): invalid index");
throw(boundaryException(0, v_num_indices-1, index)); throw(boundaryException(0, v_num_indices-1, index));
} }
@ -535,7 +535,7 @@ oid_t dl_list::get_first_oid(const handler& query, int index)
void dl_list::commit() void dl_list::commit()
{ {
for ( int i = 1; i < v_num_indices; i++ ) for ( unsigned int i = 1; i < v_num_indices; i++ )
{ {
if ( v_indices[i] ) if ( v_indices[i] )
v_indices[i] -> commit() ; v_indices[i] -> commit() ;

View file

@ -92,9 +92,9 @@ protected:
//static memory_pool handler_space_pool; //static memory_pool handler_space_pool;
protected: protected:
rootPtr obj_ptr;
abs_storage* store; abs_storage* store;
oid_t obj_id; oid_t obj_id;
rootPtr obj_ptr;
}; };

View file

@ -85,7 +85,7 @@ long_pstring::extract(int left, int right, char* sink)
//debug(cerr, right); //debug(cerr, right);
//debug(cerr, int(v_str_ptr.loc)); //debug(cerr, int(v_str_ptr.loc));
if ( left > right || right - left > v_sz ) { if ( left > right || right - left > (int) v_sz ) {
throw(boundaryException(left, right, v_sz)); throw(boundaryException(left, right, v_sz));
} }

View file

@ -105,7 +105,7 @@ oid_list::oid_list(oid_list& x) :
list_ptr.loc = 0; list_ptr.loc = 0;
init_data_member(x.v_sz); init_data_member(x.v_sz);
for ( int i=1; i<=v_sz; i++ ) for ( unsigned int i=1; i<=v_sz; i++ )
update_component(i, x(i)); update_component(i, x(i));
} }
@ -240,7 +240,7 @@ debug(cerr, int(this));
debug(cerr, int(list_ptr.p)); debug(cerr, int(list_ptr.p));
*/ */
if ( !INRANGE(ind, 1, v_sz) ) { if ( !INRANGE(ind, 1, (int) v_sz) ) {
MESSAGE(cerr, "oid_list::opeartor(): out of range"); MESSAGE(cerr, "oid_list::opeartor(): out of range");
throw(boundaryException(1, v_sz, ind)); throw(boundaryException(1, v_sz, ind));
} }
@ -330,7 +330,7 @@ oid_list::update_component(int index, const oid_t& new_oid)
{ {
//MESSAGE(cerr, "oid_list::update_component()"); //MESSAGE(cerr, "oid_list::update_component()");
//debug(cerr, my_oid()); //debug(cerr, my_oid());
if ( !INRANGE(index, 1, v_sz) ) { if ( !INRANGE(index, 1, (int) v_sz) ) {
MESSAGE(cerr, "oid_list update(): out of range"); MESSAGE(cerr, "oid_list update(): out of range");
throw(boundaryException(1, v_sz, index)); throw(boundaryException(1, v_sz, index));
} }
@ -379,8 +379,6 @@ io_status oid_list::asciiIn(istream& in)
if ( in.get() != '\n' ) if ( in.get() != '\n' )
throw(formatException("should be a \n")); throw(formatException("should be a \n"));
handler* hd_ptr = 0;
dlist temp_list; dlist temp_list;
dlist_void_ptr_cell* y = 0; dlist_void_ptr_cell* y = 0;

Some files were not shown because too many files have changed in this diff Show more