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;
int count;
const char* f_QuaddingString;
const Element* f_element;
const FeatureSet* f_local;
const FeatureSet* f_complete;
const FeatureSet* f_parent;
const char* f_QuaddingString;
};
#endif

View File

@@ -34,16 +34,20 @@ char* loutFeatureProcessor::empty_string()
char*
loutFeatureProcessor::prepend(const char* header, const char* body)
{
char* x = new char[strlen(header)+strlen(body)+1];
strcpy(x, header);
strcat(x, body);
int hlen = strlen(header);
int blen = strlen(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;
}
void
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];
}
@@ -135,15 +139,13 @@ loutFeatureProcessor::dimensionToCharPtr(const FeatureValue* f,
if ( dimensionToFloat(y, unitOfY, f, u) ) {
FeatureValueDimension::Unit unit;
if ( u != FeatureValueDimension::NONE ) {
unitOfY = u;
}
switch ( unitOfY ) {
case FeatureValueDimension::INCH:
sprintf(dBuf, "%.2fi", y);
snprintf(dBuf, sizeof(dBuf), "%.2fi", y);
break;
case FeatureValueDimension::PICA:
@@ -151,11 +153,11 @@ loutFeatureProcessor::dimensionToCharPtr(const FeatureValue* f,
break;
case FeatureValueDimension::POINT:
sprintf(dBuf, "%.2fp", y);
snprintf(dBuf, sizeof(dBuf), "%.2fp", y);
break;
case FeatureValueDimension::CM:
sprintf(dBuf, "%.2fc", y);
snprintf(dBuf, sizeof(dBuf), "%.2fc", y);
break;
case FeatureValueDimension::PIXEL:

View File

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

View File

@@ -139,9 +139,11 @@ const char*
autoNumberNumeric::getValue()
{
char* ptr = f_buf.get_base();
int ptrlen = f_buf.buf_sz();
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
*ptr = 0;
@@ -154,7 +156,7 @@ autoNumberNumeric::getValue()
autoNumberCased::autoNumberCased(const char* nm, autoNumberType an_t,
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 i;
int offset;
int offset = 0;
switch ( a_case ) {
case UPPER:
@@ -321,9 +323,10 @@ void autoNumberAlphabetic::setNextValue()
const char* autoNumberAlphabetic::getValue()
{
char* ptr = f_buf.get_base();
int ptrlen = f_buf.buf_sz();
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));
else
*ptr = 0;
@@ -472,6 +475,8 @@ const char* romanCardinals[4][9] =
const char*
autoNumberRoman::ArabicToRoman(int x)
{
unsigned int len, slen;
RomanNumberBuf[0] = 0;
if ( x > 3999 ) {
MESSAGE(cerr, "Value too large.");
@@ -481,7 +486,7 @@ autoNumberRoman::ArabicToRoman(int x)
char* buf = form("%d", x);
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' )
{
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] = 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--;
}

View File

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

View File

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