You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2007/06/19 10:46:29 UTC
svn commit: r548654 [2/2] - in
/harmony/enhanced/classlib/branches/java6/modules: awt/
awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/
awt/src/main/native/fontlib/ awt/src/main/native/fontlib/shared/
awt/src/main/native/fontlib/shared/...
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp Tue Jun 19 01:46:27 2007
@@ -20,7 +20,7 @@
*/
#include "T1Glyph.h"
-T1Glyph::T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, unsigned short unicode, unsigned short size, float relativeSize, float* fontBB):Glyph() {
+T1Glyph::T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, ufshort unicode, ufshort size, ffloat relativeSize, ffloat* fontBB):Glyph() {
_charStringMap = charStringMap;
_subrsMap = subrsMap;
_unicode = unicode;
@@ -39,12 +39,12 @@
T1Glyph::~T1Glyph() {
}
-void T1Glyph::parseValueToOutline(EncodedValue *value, std::stack<float> *stack, Outline *out, float *curX, float *curY, float relativeSize){
- float x1, y1, x2, y2, x3, y3;
+void T1Glyph::parseValueToOutline(EncodedValue *value, std::stack<ffloat> *stack, Outline *out, ffloat *curX, ffloat *curY, ffloat relativeSize){
+ ffloat x1, y1, x2, y2, x3, y3;
- unsigned char curChar;
+ ufchar curChar;
- for (unsigned short count = 0; count < value->length; count ++) {
+ for (ufshort count = 0; count < value->length; count ++) {
curChar = value->text[count];
@@ -54,14 +54,14 @@
if (curChar > 31) {
if (curChar > 31 && curChar < 247) { // -107 to 107
- stack->push((float) (curChar - 139));
+ stack->push((ffloat) (curChar - 139));
} else if (curChar > 246 && curChar < 251) { // 108 to 1131
- stack->push((float) ((curChar - 247) * 256 + 108 + (unsigned char)(value->text[++count])));
+ stack->push((ffloat) ((curChar - 247) * 256 + 108 + (ufchar)(value->text[++count])));
} else if (curChar > 250 && curChar < 255) { // -1131 to -108
- stack->push((float) ((curChar - 251) * (-256) - 108 - (unsigned char)(value->text[++count])));
- } else if (curChar == 255) { // int
- stack->push((float) ((curChar << 24) + (unsigned char)((value->text[++count]) << 16) +
- (unsigned char)((value->text[++count]) << 8) + (unsigned char)(value->text[++count])));
+ stack->push((ffloat) ((curChar - 251) * (-256) - 108 - (ufchar)(value->text[++count])));
+ } else if (curChar == 255) { // fint
+ stack->push((ffloat) ((curChar << 24) + (ufchar)((value->text[++count]) << 16) +
+ (ufchar)((value->text[++count]) << 8) + (ufchar)(value->text[++count])));
}
} else {
switch (curChar) {
@@ -76,9 +76,9 @@
break;
}
case CH_STR_RLINETO : {// rlineto
- *curY += (float) stack->top() * relativeSize;
+ *curY += (ffloat) stack->top() * relativeSize;
stack->pop();
- *curX += (float) stack->top() * relativeSize;
+ *curX += (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
@@ -88,7 +88,7 @@
break;
}
case CH_STR_HLINETO : {// hlineto
- *curX += (float) stack->top() * relativeSize;
+ *curX += (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
@@ -98,7 +98,7 @@
break;
}
case CH_STR_VLINETO : {// vlineto
- *curY += (float) stack->top() * relativeSize;
+ *curY += (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
@@ -108,17 +108,17 @@
break;
}
case CH_STR_RRCURVETO : {// rrcurveto equivalent to dx1 dy1 (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) (dy1+dy2+dy3) rcurveto.
- y3 = (float) stack->top() * relativeSize;
+ y3 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x3 = (float) stack->top() * relativeSize;
+ x3 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y2 = (float) stack->top() * relativeSize;
+ y2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x2 = (float) stack->top() * relativeSize;
+ x2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y1 = (float) stack->top() * relativeSize;
+ y1 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x1 = (float) stack->top() * relativeSize;
+ x1 = (ffloat) stack->top() * relativeSize;
stack->pop();
x1 += *curX;
@@ -145,20 +145,20 @@
break;
}
case CH_STR_CALLSUBR : {// callsubr
- x1 = (float) stack->top();
+ x1 = (ffloat) stack->top();
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
printf("call subr = %f, ", x1);
#endif
- parseValueToOutline((*_subrsMap)[(const unsigned short)x1], stack, out, curX, curY, relativeSize);
+ parseValueToOutline((*_subrsMap)[(const ufshort)x1], stack, out, curX, curY, relativeSize);
break;
}
case CH_STR_HSBW : {// hsbw
- y1 = (float) stack->top() * relativeSize;
+ y1 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x1 = (float) stack->top() * relativeSize;
+ x1 = (ffloat) stack->top() * relativeSize;
stack->pop();
_advanceX = y1;
@@ -181,9 +181,9 @@
break;
}
case CH_STR_RMOVETO : {// rmoveto
- *curY += (float) stack->top() * relativeSize;
+ *curY += (ffloat) stack->top() * relativeSize;
stack->pop();
- *curX += (float) stack->top() * relativeSize;
+ *curX += (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
@@ -193,7 +193,7 @@
break;
}
case CH_STR_HMOVETO : {// hmoveto
- *curX += (float) stack->top() * relativeSize;
+ *curX += (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
@@ -204,13 +204,13 @@
}
case CH_STR_VHCURVETO : {// vhcurveto
y3 = 0;
- x3 = (float) stack->top() * relativeSize;
+ x3 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y2 = (float) stack->top() * relativeSize;
+ y2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x2 = (float) stack->top() * relativeSize;
+ x2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y1 = (float) stack->top() * relativeSize;
+ y1 = (ffloat) stack->top() * relativeSize;
stack->pop();
x1 = 0;
@@ -230,15 +230,15 @@
break;
}
case CH_STR_HVCURVETO : {// hvcurveto
- y3 = (float) stack->top() * relativeSize;
+ y3 = (ffloat) stack->top() * relativeSize;
stack->pop();
x3 = 0;
- y2 = (float) stack->top() * relativeSize;
+ y2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x2 = (float) stack->top() * relativeSize;
+ x2 = (ffloat) stack->top() * relativeSize;
stack->pop();
y1 = 0;
- x1 = (float) stack->top() * relativeSize;
+ x1 = (ffloat) stack->top() * relativeSize;
stack->pop();
x1 += *curX;
@@ -262,50 +262,50 @@
printf("escape command = %u, ", curChar);
#endif
if (curChar == CH_STR_ESCAPE_SEAC) {//seak
- x3 = (float) stack->top();
+ x3 = (ffloat) stack->top();
stack->pop();
- y2 = (float) stack->top();
+ y2 = (ffloat) stack->top();
stack->pop();
- x2 = (float) stack->top() * relativeSize;
+ x2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y1 = (float) stack->top() * relativeSize;
+ y1 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x1 = (float) stack->top() * relativeSize;
+ x1 = (ffloat) stack->top() * relativeSize;
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
printf("seak = %f,%f,%f,%f,%f ; ", x1, y1, x2, y2, x3);
#endif
- unsigned short aX = (unsigned short) _advanceX;
- unsigned short aY = (unsigned short) _advanceY;
+ ufshort aX = (ufshort) _advanceX;
+ ufshort aY = (ufshort) _advanceY;
- float tempGlyphBB[4];
+ ffloat tempGlyphBB[4];
- memcpy(tempGlyphBB, _glyphBB, 4 * sizeof(float));
+ memcpy(tempGlyphBB, _glyphBB, 4 * sizeof(ffloat));
- parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(unsigned short)y2]], stack, out, curX, curY, relativeSize);
+ parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(ufshort)y2]], stack, out, curX, curY, relativeSize);
*curY = x2;
*curX = y1;
out->moveTo(*curX, *curY);
- parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(unsigned short)x3]], stack, out, curX, curY, relativeSize);
+ parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(ufshort)x3]], stack, out, curX, curY, relativeSize);
_advanceX = aX;
_advanceY = aY;
- memcpy(_glyphBB, tempGlyphBB, 4 * sizeof(float));
+ memcpy(_glyphBB, tempGlyphBB, 4 * sizeof(ffloat));
break;
} else if (curChar == CH_STR_ESCAPE_SBW) { //sbw
- y2 = (float) stack->top() * relativeSize;
+ y2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x2 = (float) stack->top() * relativeSize;
+ x2 = (ffloat) stack->top() * relativeSize;
stack->pop();
- y1 = (float) stack->top() * relativeSize;
+ y1 = (ffloat) stack->top() * relativeSize;
stack->pop();
- x1 = (float) stack->top() * relativeSize;
+ x1 = (ffloat) stack->top() * relativeSize;
stack->pop();
_advanceX = x1;
@@ -329,9 +329,9 @@
out->moveTo(*curX, *curY);
break;
} else if (curChar == CH_STR_ESCAPE_DIV) {//div
- y1 = (float) stack->top();
+ y1 = (ffloat) stack->top();
stack->pop();
- x1 = (float) stack->top();
+ x1 = (ffloat) stack->top();
stack->pop();
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
printf("div (%f/%f) ", x1, y1);
@@ -346,23 +346,23 @@
}
}
-void T1Glyph::countPoints(std::stack<float> *stack, EncodedValue *value, unsigned short *point, unsigned short *command) {
- unsigned char curChar;
+void T1Glyph::countPoints(std::stack<ffloat> *stack, EncodedValue *value, ufshort *point, ufshort *command) {
+ ufchar curChar;
- for (unsigned short count = 0; count < value->length; count ++) {
+ for (ufshort count = 0; count < value->length; count ++) {
curChar = value->text[count];
if (curChar > 31) {
if (curChar > 31 && curChar < 247) { // -107 to 107
- stack->push((float) (curChar - 139));
+ stack->push((ffloat) (curChar - 139));
} else if (curChar > 246 && curChar < 251) { // 108 to 1131
- stack->push((float) ((curChar - 247) * 256 + 108 + (unsigned char)(value->text[++count])));
+ stack->push((ffloat) ((curChar - 247) * 256 + 108 + (ufchar)(value->text[++count])));
} else if (curChar > 250 && curChar < 255) { // -1131 to -108
- stack->push((float) ((curChar - 251) * (-256) - 108 - (unsigned char)(value->text[++count])));
- } else if (curChar == 255) { // int
- stack->push((float) ((curChar << 24) + (unsigned char)((value->text[++count]) << 16) +
- (unsigned char)((value->text[++count]) << 8) + (unsigned char)(value->text[++count])));
+ stack->push((ffloat) ((curChar - 251) * (-256) - 108 - (ufchar)(value->text[++count])));
+ } else if (curChar == 255) { // fint
+ stack->push((ffloat) ((curChar << 24) + (ufchar)((value->text[++count]) << 16) +
+ (ufchar)((value->text[++count]) << 8) + (ufchar)(value->text[++count])));
}
} else {
switch (curChar) {
@@ -390,7 +390,7 @@
break;
}
case CH_STR_CALLSUBR : {// callsubr
- unsigned short com = (unsigned short) stack->top();
+ ufshort com = (ufshort) stack->top();
stack->pop();
countPoints(stack, (*_subrsMap)[com], point, command);
@@ -401,9 +401,9 @@
if (curChar == CH_STR_ESCAPE_DIV) {//div
break;
} else if (curChar == CH_STR_ESCAPE_SEAC) {//seac
- unsigned short achar = (unsigned short) stack->top();
+ ufshort achar = (ufshort) stack->top();
stack->pop();
- unsigned short bchar = (unsigned short) stack->top();
+ ufshort bchar = (ufshort) stack->top();
stack->pop();
*point += 2;
@@ -425,12 +425,12 @@
}
}
-float* T1Glyph::getGlyphMetrics(void){
+ffloat* T1Glyph::getGlyphMetrics(void){
if ((_advanceX == 0) && (_advanceY == 0)) {
getOutline();
}
- float* gMetrics = new float[6];
+ ffloat* gMetrics = new ffloat[6];
gMetrics[0] = _advanceX;
gMetrics[1] = _advanceY;
@@ -443,12 +443,12 @@
}
Outline* T1Glyph::getOutline(void){
- float curX, curY;
+ ffloat curX, curY;
curX = curY = 0;
- unsigned short point, command;
+ ufshort point, command;
point = command = 0;
- Outline *out;// = new Outline((unsigned short)200,(unsigned short)200);
- std::stack<float> *stack = new std::stack<float>();
+ Outline *out;// = new Outline((ufshort)200,(ufshort)200);
+ std::stack<ffloat> *stack = new std::stack<ffloat>();
EncodedValue *value;
#ifdef GLYPH_OUTLINE_CREATE_DEBUG
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.h Tue Jun 19 01:46:27 2007
@@ -31,17 +31,17 @@
Type1Map *_charStringMap;
Type1Map *_subrsMap;
- float _relativeSize;
- float _glyphBB[4];
+ ffloat _relativeSize;
+ ffloat _glyphBB[4];
- void parseValueToOutline(EncodedValue *value, std::stack<float> *stack, Outline *out, float *curX, float *curY, float relativeSize);
- void countPoints(std::stack<float> *stack, EncodedValue *value, unsigned short *point, unsigned short *command);
+ void parseValueToOutline(EncodedValue *value, std::stack<ffloat> *stack, Outline *out, ffloat *curX, ffloat *curY, ffloat relativeSize);
+ void countPoints(std::stack<ffloat> *stack, EncodedValue *value, ufshort *point, ufshort *command);
public:
- T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, unsigned short unicode, unsigned short size, float relativeSize, float* fontBB);
+ T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, ufshort unicode, ufshort size, ffloat relativeSize, ffloat* fontBB);
~T1Glyph();
Outline* getOutline(void);
- float* getGlyphMetrics(void);
+ ffloat* getGlyphMetrics(void);
};
#endif //__TYPE_1_GLYPH_CLASS_H
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp Tue Jun 19 01:46:27 2007
@@ -35,7 +35,7 @@
delete[] _flags;
}
-int TTCurve::add(float x, float y, unsigned char flag)
+fint TTCurve::add(ffloat x, ffloat y, ufchar flag)
{
_len +=2;
@@ -44,13 +44,13 @@
else if (flag != 0)
_outlineCommandsNumb++;
- float* tmpC = _coords;
- unsigned char* tmpF = _flags;
+ ffloat* tmpC = _coords;
+ ufchar* tmpF = _flags;
- _coords = new float[_len];
- _flags = new unsigned char[(_len+1)/2];
+ _coords = new ffloat[_len];
+ _flags = new ufchar[(_len+1)/2];
- memcpy(_coords,tmpC,(_len-2)*sizeof(float));
+ memcpy(_coords,tmpC,(_len-2)*sizeof(ffloat));
_coords[_len-2] = x;
_coords[_len-1] = y;
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.h Tue Jun 19 01:46:27 2007
@@ -21,6 +21,8 @@
#ifndef __CURVE_H__
#define __CURVE_H__
+#include "TypeDefinition.h"
+
enum{OPEN_FLAG=1, FLAG_ONCURVE=2};
class TTCurve
@@ -30,12 +32,12 @@
TTCurve();
~TTCurve();
- float* _coords;
- unsigned char* _flags;
- unsigned short _len;
- unsigned short _outlineCommandsNumb;
+ ffloat* _coords;
+ ufchar* _flags;
+ ufshort _len;
+ ufshort _outlineCommandsNumb;
- int add(float x, float y, unsigned char flag);
+ fint add(ffloat x, ffloat y, ufchar flag);
};
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.cpp Tue Jun 19 01:46:27 2007
@@ -21,7 +21,7 @@
#include "TTFont.h"
#include "Tables.h"
-TTFont::TTFont(char* pathToFile):Font()
+TTFont::TTFont(fchar* pathToFile):Font()
{
_pathToFile=pathToFile;
_glyphOffsets.offsets = NULL;
@@ -36,14 +36,14 @@
parseCmapTable(_ttfile, &_tableEncode);
parseMaxpTable(_ttfile, &_numGlyphs);
parseHeadTable(_ttfile, _boundingBox, &(_glyphOffsets.format), &_unitsPerEm);
- for (int i=0; i<4; i++)
- _boundingBox[i]/=(float)(_unitsPerEm);
+ for (fint i=0; i<4; i++)
+ _boundingBox[i]/=(ffloat)(_unitsPerEm);
parseLocaTable(_ttfile, &(_glyphOffsets), _numGlyphs);
parseHheaTable(_ttfile, &_numOfHMetrics, &_ascent, &_descent, &_externalLeading);
- _ascent/=(float)(_unitsPerEm);
+ _ascent/=(ffloat)(_unitsPerEm);
_descent = ((_descent>0)?_descent:(-_descent))/_unitsPerEm;
- _externalLeading/=(float)(_unitsPerEm);
+ _externalLeading/=(ffloat)(_unitsPerEm);
parseHmtxTable(_ttfile, _numOfHMetrics, &_hMetrics);
fclose(_ttfile);
@@ -52,45 +52,45 @@
TTFont::~TTFont(void)
{
delete[] _glyphOffsets.offsets;
- delete[] (int*)(_tableEncode.TableEncode);
+ delete[] (fint*)(_tableEncode.TableEncode);
delete[] _psName;
delete[] _hMetrics;
}
-Glyph* TTFont::createGlyph(unsigned short unicode, unsigned short size)
+Glyph* TTFont::createGlyph(ufshort unicode, ufshort size)
{
TTGlyph *gl = new TTGlyph(this, unicode, size);
if (gl->_index < _numOfHMetrics)
- gl->_advanceX = _hMetrics[gl->_index].adwance_width*(float)(size)/(float)(_unitsPerEm);
+ gl->_advanceX = _hMetrics[gl->_index].adwance_width*(ffloat)(size)/(ffloat)(_unitsPerEm);
else
- gl->_advanceX = _hMetrics[_numOfHMetrics-1].adwance_width*(float)(size)/(float)(_unitsPerEm);
+ gl->_advanceX = _hMetrics[_numOfHMetrics-1].adwance_width*(ffloat)(size)/(ffloat)(_unitsPerEm);
gl->_advanceY = 0;
return gl;
}
-unsigned short TTFont::getGlyphIndex(unsigned short symb)
+ufshort TTFont::getGlyphIndex(ufshort symb)
{
- unsigned short index = 0;
+ ufshort index = 0;
if (_tableEncode.format == 0)
{
- unsigned char* te = (unsigned char*)_tableEncode.TableEncode;
+ ufchar* te = (ufchar*)_tableEncode.TableEncode;
index = te[symb];
}else if (_tableEncode.format == 4)
{
- unsigned short segCountX2;
- unsigned short segCount;
-// unsigned short search_range;
-// unsigned short entry_selector;
-// unsigned short range_shift;
- unsigned short* end_count;
- unsigned short* start_count;
- unsigned short* idDelta;
- unsigned short* idRangeOffset;
- unsigned short reservedPad;
- unsigned short* te = (unsigned short*)(_tableEncode.TableEncode);
- int i;
+ ufshort segCountX2;
+ ufshort segCount;
+// ufshort search_range;
+// ufshort entry_selector;
+// ufshort range_shift;
+ ufshort* end_count;
+ ufshort* start_count;
+ ufshort* idDelta;
+ ufshort* idRangeOffset;
+ ufshort reservedPad;
+ ufshort* te = (ufshort*)(_tableEncode.TableEncode);
+ fint i;
segCountX2 = te[0];
segCount = segCountX2/2;
@@ -117,14 +117,14 @@
return index;
}
-unsigned short TTFont::getUnicodeByIndex(unsigned short ind)
+ufshort TTFont::getUnicodeByIndex(ufshort ind)
{
- unsigned short symb = 0;
+ ufshort symb = 0;
if (_tableEncode.format == 0)
{
- unsigned char* te = (unsigned char*)_tableEncode.TableEncode;
- for (unsigned short i = 0; i<=_numGlyphs; i++)
+ ufchar* te = (ufchar*)_tableEncode.TableEncode;
+ for (ufshort i = 0; i<=_numGlyphs; i++)
{
if (ind = te[i])
{
@@ -135,15 +135,15 @@
}else
if (_tableEncode.format == 4)
{
- unsigned short segCountX2;
- unsigned short segCount;
- unsigned short* end_count;
- unsigned short* start_count;
- unsigned short* idDelta;
- unsigned short* idRangeOffset;
- unsigned short reservedPad;
- unsigned short* te = (unsigned short*)(_tableEncode.TableEncode);
- int i;
+ ufshort segCountX2;
+ ufshort segCount;
+ ufshort* end_count;
+ ufshort* start_count;
+ ufshort* idDelta;
+ ufshort* idRangeOffset;
+ ufshort reservedPad;
+ ufshort* te = (ufshort*)(_tableEncode.TableEncode);
+ fint i;
segCountX2 = te[0];
segCount = segCountX2/2;
@@ -156,10 +156,10 @@
for (i=0;i<segCount;i++)
{
if (idRangeOffset[i] != 0)
- for (int j=0; j< _numGlyphs; j++)
+ for (fint j=0; j< _numGlyphs; j++)
{
if (ind - idDelta[i] == idRangeOffset[j] )
- symb = (unsigned short)(&idRangeOffset[j] - idRangeOffset[i]/2 + start_count[i] - &idRangeOffset[i]);
+ symb = (ufshort)(&idRangeOffset[j] - idRangeOffset[i]/2 + start_count[i] - &idRangeOffset[i]);
}
else
symb = (ind - idDelta[i]) % 65536;
@@ -173,27 +173,27 @@
return symb;
}
-wchar_t* TTFont::getPSName()
+fwchar_t* TTFont::getPSName()
{
return _psName;
}
-float* TTFont::getLineMetrics()
+ffloat* TTFont::getLineMetrics()
{
//printf("reading file...\n");
_ttfile = fopen(_pathToFile,"rb");
- float* ret = new float[8];
+ ffloat* ret = new ffloat[8];
ret[0] = _ascent;
ret[1] = _descent;
ret[2] = _externalLeading;
- short uOffset, uThickness;
+ fshort uOffset, uThickness;
//printf("parsing POST table...\n");
parsePostTable(_ttfile, &uOffset, &uThickness);
- ret[3] = (float)uThickness/(float)(_unitsPerEm);
- ret[4] = (float)uOffset/(float)(_unitsPerEm);
+ ret[3] = (ffloat)uThickness/(ffloat)(_unitsPerEm);
+ ret[4] = (ffloat)uOffset/(ffloat)(_unitsPerEm);
//printf("parsing OS2 table...\n");
parseOs2Table(_ttfile, &_strikeOutSize, &_strikeOutOffset);
@@ -201,7 +201,7 @@
ret[5] = _strikeOutSize;
ret[6] = _strikeOutOffset;
- float width = _boundingBox[3]-_boundingBox[1];
+ ffloat width = _boundingBox[3]-_boundingBox[1];
ret[7] = (width>0)?width:(-width);
fclose(_ttfile);
@@ -209,9 +209,9 @@
return ret;
}
-bool TTFont::canDisplay(unsigned short c)
+bool TTFont::canDisplay(ufshort c)
{
- unsigned short index = getGlyphIndex(c);
+ ufshort index = getGlyphIndex(c);
#ifdef WIN32
bool isComposite = isCompositeGlyph(_ttfile, _glyphOffsets, _numGlyphs, index);
if (index == 0 || index >= _numGlyphs || isComposite)
@@ -226,7 +226,7 @@
/* *************** */
/* TTGlyph methods */
/* *************** */
-TTGlyph::TTGlyph(TTFont* font, unsigned short unicode, unsigned short size):Glyph()
+TTGlyph::TTGlyph(TTFont* font, ufshort unicode, ufshort size):Glyph()
{
_ttfont = font;
_unicode = unicode;
@@ -239,7 +239,7 @@
_ttfont->_ttfile = fopen(_ttfont->_pathToFile,"rb");
_index = _ttfont->getGlyphIndex(_unicode);
- parseGlyphData(_ttfont->_ttfile, _ttfont->_glyphOffsets,_ttfont->_numGlyphs,_index, _curve, _boundingRect, (float)_size/(float)(_ttfont->_unitsPerEm));
+ parseGlyphData(_ttfont->_ttfile, _ttfont->_glyphOffsets,_ttfont->_numGlyphs,_index, _curve, _boundingRect, (ffloat)_size/(ffloat)(_ttfont->_unitsPerEm));
fclose(_ttfont->_ttfile);
}
@@ -248,8 +248,8 @@
delete _curve;
}
-float* TTGlyph::getGlyphMetrics(void){
- float* gMetrics = new float[6];
+ffloat* TTGlyph::getGlyphMetrics(void){
+ ffloat* gMetrics = new ffloat[6];
gMetrics[0]=_advanceX;
gMetrics[1]=_advanceY;
@@ -265,7 +265,7 @@
{
Outline* outline = new Outline(_curve->_len,_curve->_outlineCommandsNumb);
- for (int i = 0; i<_curve->_len; i+=2)
+ for (fint i = 0; i<_curve->_len; i+=2)
{
switch(_curve->_flags[i/2])
{
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.h Tue Jun 19 01:46:27 2007
@@ -25,23 +25,24 @@
#include "Glyph.h"
#include "Outline.h"
#include "TTCurve.h"
+#include "TypeDefinition.h"
typedef struct
{
- short format; //format of the 'loca' table
- unsigned long* offsets;
+ fshort format; //format of the 'loca' table
+ uflong* offsets;
} GlyphOffsets;
typedef struct
{
- short format;
+ fshort format;
void* TableEncode;
} TableEncode;
typedef struct
{
- unsigned short adwance_width;
- short lsb;
+ ufshort adwance_width;
+ fshort lsb;
}HMetrics;
class TTGlyph;
@@ -50,48 +51,48 @@
{
friend class TTGlyph;
private:
- char* _pathToFile; // path to font file
- wchar_t *_psName; // postscript name of font
+ fchar* _pathToFile; // path to font file
+ fwchar_t *_psName; // postscript name of font
GlyphOffsets _glyphOffsets; //glyphs offsets in font file
TableEncode _tableEncode; // table with indexes of glyphs
- unsigned short _unitsPerEm; //size of em-square
- unsigned short _numOfHMetrics; // for 'hmtx' table
+ ufshort _unitsPerEm; //size of em-square
+ ufshort _numOfHMetrics; // for 'hmtx' table
HMetrics* _hMetrics; // horizontal metrics for all glyphs
FILE* _ttfile;
- unsigned short getGlyphIndex(unsigned short symb);
- unsigned short getUnicodeByIndex(unsigned short ind);
-// friend unsigned short TTGlyph::getGlyphIndex(unsigned short symb);
-// friend int TTGlyph::initialize();
+ ufshort getGlyphIndex(ufshort symb);
+ ufshort getUnicodeByIndex(ufshort ind);
+// friend ufshort TTGlyph::getGlyphIndex(ufshort symb);
+// friend fint TTGlyph::initialize();
public:
- TTFont(char* pathToFile);
+ TTFont(fchar* pathToFile);
~TTFont(void);
- Glyph* createGlyph(unsigned short unicode, unsigned short size);
- wchar_t* getPSName();
- float* getLineMetrics();
- bool canDisplay(unsigned short c);
+ Glyph* createGlyph(ufshort unicode, ufshort size);
+ fwchar_t* getPSName();
+ ffloat* getLineMetrics();
+ bool canDisplay(ufshort c);
-// float* GetExtraMetrics();
+// ffloat* GetExtraMetrics();
};
class TTGlyph : public Glyph {
private:
TTFont* _ttfont;
- unsigned short _index;
+ ufshort _index;
TTCurve* _curve;
- short _boundingRect[4];
+ fshort _boundingRect[4];
- friend Glyph* TTFont::createGlyph(unsigned short unicode, unsigned short size);
+ friend Glyph* TTFont::createGlyph(ufshort unicode, ufshort size);
public:
- TTGlyph(TTFont *font, unsigned short unicode, unsigned short size);
+ TTGlyph(TTFont *font, ufshort unicode, ufshort size);
~TTGlyph();
Outline* getOutline(void);
- float* getGlyphMetrics(void);
+ ffloat* getGlyphMetrics(void);
};
#endif //__TTFONT_H__
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Tables.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Tables.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Tables.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Tables.h Tue Jun 19 01:46:27 2007
@@ -24,6 +24,7 @@
#include "TTCurve.h"
#include "TTFont.h"
+#include "TypeDefinition.h"
#define CMAP_TABLE "cmap" /* character to glyph mapping */
#define GLYF_TABLE "glyf" /* glyph data */
@@ -51,7 +52,7 @@
#define BIG5_ENCODING 3
#define PRC_ENCODING 4
-typedef long Fixed;
+typedef flong Fixed;
typedef long long LONGDT;
typedef enum
@@ -72,50 +73,50 @@
/* From Win GDI
typedef struct {
- unsigned char bFamilyType;
- unsigned char bSerifStyle;
- unsigned char bWeight;
- unsigned char bProportion;
- unsigned char bContrast;
- unsigned char bStrokeVariation;
- unsigned char bArmStyle;
- unsigned char bLetterform;
- unsigned char bMidline;
- unsigned char bXHeight;
+ ufchar bFamilyType;
+ ufchar bSerifStyle;
+ ufchar bWeight;
+ ufchar bProportion;
+ ufchar bContrast;
+ ufchar bStrokeVariation;
+ ufchar bArmStyle;
+ ufchar bLetterform;
+ ufchar bMidline;
+ ufchar bXHeight;
} PANOSE; */
typedef struct
{
Fixed version;
- unsigned short num_tables;
- unsigned short search_range;
- unsigned short entry_selector;
- unsigned short range_shift;
+ ufshort num_tables;
+ ufshort search_range;
+ ufshort entry_selector;
+ ufshort range_shift;
} Table_Offset;
typedef struct
{
- char tag[4];
- unsigned long checkSum;
- unsigned long offset;
- unsigned long length;
+ fchar tag[4];
+ uflong checkSum;
+ uflong offset;
+ uflong length;
} Table_Directory;
typedef struct
{
- unsigned short platformID;
- unsigned short encodingID;
- unsigned short languageID;
- unsigned short nameID;
- unsigned short string_length;
- unsigned short string_offset;
+ ufshort platformID;
+ ufshort encodingID;
+ ufshort languageID;
+ ufshort nameID;
+ ufshort string_length;
+ ufshort string_offset;
} Name_Entry;
typedef struct
{
- unsigned short format;
- unsigned short num_name_records;
- unsigned short storage_offset;
+ ufshort format;
+ ufshort num_name_records;
+ ufshort storage_offset;
Name_Entry name_record[1];
} Table_name;
@@ -123,20 +124,20 @@
typedef struct
{
Fixed version;
- unsigned short numGlyphs; // number of Glyphs
- unsigned short maxPoints;
- unsigned short maxContours;
- unsigned short maxCompositePoints;
- unsigned short maxCompositeContours;
- unsigned short maxZones;
- unsigned short maxTwilightPoints;
- unsigned short maxStorage;
- unsigned short maxFunctionDefs;
- unsigned short maxInstructionDefs;
- unsigned short maxStackElements;
- unsigned short maxSizeOfInstructions;
- unsigned short maxComponentElements;
- unsigned short maxComponentDepth;
+ ufshort numGlyphs; // number of Glyphs
+ ufshort maxPoints;
+ ufshort maxContours;
+ ufshort maxCompositePoints;
+ ufshort maxCompositeContours;
+ ufshort maxZones;
+ ufshort maxTwilightPoints;
+ ufshort maxStorage;
+ ufshort maxFunctionDefs;
+ ufshort maxInstructionDefs;
+ ufshort maxStackElements;
+ ufshort maxSizeOfInstructions;
+ ufshort maxComponentElements;
+ ufshort maxComponentDepth;
} Table_maxp;
/* TrueType Font Header table */
@@ -144,92 +145,92 @@
{
Fixed table_version;
Fixed font_revision;
- unsigned long checksum_adjust;
- unsigned long magic_number;
- unsigned short flags;
- unsigned short units_per_EM;
+ uflong checksum_adjust;
+ uflong magic_number;
+ ufshort flags;
+ ufshort units_per_EM;
LONGDT created;
LONGDT modified;
- short xMin;
- short yMin;
- short xMax;
- short yMax;
- unsigned short mac_style;
- unsigned short lowest_rec_PPEM;
- short font_direction;
- short index_to_loc_format; // format of 'loca' table
- short glyph_data_format;
+ fshort xMin;
+ fshort yMin;
+ fshort xMax;
+ fshort yMax;
+ ufshort mac_style;
+ ufshort lowest_rec_PPEM;
+ fshort font_direction;
+ fshort index_to_loc_format; // format of 'loca' table
+ fshort glyph_data_format;
} Table_head;
typedef struct
{
Fixed table_version;
- short ascender; /* typographic ascent */
- short descender; /* typographic descent */
- short line_gap; /* typographic line gap */
- unsigned short advance_width_max; /* Maximum advance width value in hmtx table */
- short min_left_sidebearing;
- short min_right_sidebearing; /* Min(aw - lsb - (xMax - xMin)) */
- short xMaxExtent; /* Max(lsb + (xMax - xMin)) */
- short caret_slope_rise;
- short caret_slope_run;
- short first_reserved;
- short second_reserved;
- short third_reserved;
- short fourth_reserved;
- short fifth_reserved;
- short metric_data_format;
- unsigned short number_of_hMetrics;
+ fshort ascender; /* typographic ascent */
+ fshort descender; /* typographic descent */
+ fshort line_gap; /* typographic line gap */
+ ufshort advance_width_max; /* Maximum advance width value in hmtx table */
+ fshort min_left_sidebearing;
+ fshort min_right_sidebearing; /* Min(aw - lsb - (xMax - xMin)) */
+ fshort xMaxExtent; /* Max(lsb + (xMax - xMin)) */
+ fshort caret_slope_rise;
+ fshort caret_slope_run;
+ fshort first_reserved;
+ fshort second_reserved;
+ fshort third_reserved;
+ fshort fourth_reserved;
+ fshort fifth_reserved;
+ fshort metric_data_format;
+ ufshort number_of_hMetrics;
} Table_hhea;
typedef struct
{
- unsigned short table_version;
- short xAvgCharWidth;
- unsigned short usWeightClass;
- unsigned short usWidthClass;
- short fsType;
- short ySubscriptXSize;
- short ySubscriptYSize;
- short ySubscriptXOffset;
- short ySubscriptYOffset;
- short ySuperscriptXSize;
- short ySuperscriptYSize;
- short ySuperscriptXOffset;
- short ySuperscriptYOffset;
- short yStrikeoutSize;
- short yStrikeoutPosition;
- short sFamilyClass;
+ ufshort table_version;
+ fshort xAvgCharWidth;
+ ufshort usWeightClass;
+ ufshort usWidthClass;
+ fshort fsType;
+ fshort ySubscriptXSize;
+ fshort ySubscriptYSize;
+ fshort ySubscriptXOffset;
+ fshort ySubscriptYOffset;
+ fshort ySuperscriptXSize;
+ fshort ySuperscriptYSize;
+ fshort ySuperscriptXOffset;
+ fshort ySuperscriptYOffset;
+ fshort yStrikeoutSize;
+ fshort yStrikeoutPosition;
+ fshort sFamilyClass;
// PANOSE panose;
- unsigned char panose[10];
- unsigned long ulUnicodeRange1;
- unsigned long ulUnicodeRange2;
- unsigned long ulUnicodeRange3;
- unsigned long ulUnicodeRange4;
- unsigned char achVendID[4];
- unsigned short fsSelection;
- unsigned short usFirstCharIndex;
- unsigned short usLastCharIndex;
- unsigned short sTypoAscender;
- unsigned short sTypoDescender;
- unsigned short sTypoLineGap;
- unsigned short sWinAscent;
- unsigned short sWinDescent;
- unsigned long ulCodePageRange1;
- unsigned long ulCodePageRange2;
+ ufchar panose[10];
+ uflong ulUnicodeRange1;
+ uflong ulUnicodeRange2;
+ uflong ulUnicodeRange3;
+ uflong ulUnicodeRange4;
+ ufchar achVendID[4];
+ ufshort fsSelection;
+ ufshort usFirstCharIndex;
+ ufshort usLastCharIndex;
+ ufshort sTypoAscender;
+ ufshort sTypoDescender;
+ ufshort sTypoLineGap;
+ ufshort sWinAscent;
+ ufshort sWinDescent;
+ uflong ulCodePageRange1;
+ uflong ulCodePageRange2;
} Table_os2;
typedef struct
{
- unsigned short platform; //identifier of platform
- unsigned short encodingID; //identifier fo encoding
- unsigned long table_offset; //offset of the encoding table
+ ufshort platform; //identifier of platform
+ ufshort encodingID; //identifier fo encoding
+ uflong table_offset; //offset of the encoding table
} Cmap_Entry;
typedef struct
{
- unsigned short table_version; // =0
- unsigned short numSubTables; //number subtables
+ ufshort table_version; // =0
+ ufshort numSubTables; //number subtables
Cmap_Entry tableHeaders[1]; //headers of subtables
} Table_cmap;
@@ -237,78 +238,78 @@
{
Fixed format; //format type
Fixed italic_angle;
- short underlineOffset;
- short underlineThickness;
- unsigned long isFixedPitch;
- unsigned long minMemType42;
- unsigned long maxMemType42;
- unsigned long minMemType1;
- unsigned long maxMemType1;
+ fshort underlineOffset;
+ fshort underlineThickness;
+ uflong isFixedPitch;
+ uflong minMemType42;
+ uflong maxMemType42;
+ uflong minMemType1;
+ uflong maxMemType1;
} Table_post;
/* first part of the encoding table identical for all format of them */
typedef struct
{
- unsigned short format;
- unsigned short length; //length in bytes
- unsigned short version;
+ ufshort format;
+ ufshort length; //length in bytes
+ ufshort version;
} Table_encode_header;
/*
typedef struct
{
- unsigned short format; // =0,2,4,6
- unsigned short length; // size
- unsigned short version;
- unsigned char map[256];
+ ufshort format; // =0,2,4,6
+ ufshort length; // size
+ ufshort version;
+ ufchar map[256];
} Table_encode_0;
typedef struct
{
-// unsigned short segCountX2; // 2 x segCount
- unsigned short search_range; // 2 x (2**floor(log_2(segCount)))
- unsigned short entry_selector; // log_2(search_range/2)
- unsigned short range_shift; // 2 x segCount - search_range
- unsigned short end_count[1]; // end characterCode for each segment, last =0xFFFF, length = segCount
- unsigned short reservedPad; // = 0
- unsigned short start_count[1]; // Start character code for each segment, length = segCount
- unsigned short idDelta[1]; // Delta for all character codes in segment, length = segCount
- unsigned short idRangeOffset[1]; // Offsets into glyphIdArray or 0, length = segCount
- unsigned short glyphIdArray[]; // Glyph index array (arbitrary length)
+// ufshort segCountX2; // 2 x segCount
+ ufshort search_range; // 2 x (2**floor(log_2(segCount)))
+ ufshort entry_selector; // log_2(search_range/2)
+ ufshort range_shift; // 2 x segCount - search_range
+ ufshort end_count[1]; // end characterCode for each segment, last =0xFFFF, length = segCount
+ ufshort reservedPad; // = 0
+ ufshort start_count[1]; // Start character code for each segment, length = segCount
+ ufshort idDelta[1]; // Delta for all character codes in segment, length = segCount
+ ufshort idRangeOffset[1]; // Offsets into glyphIdArray or 0, length = segCount
+ ufshort glyphIdArray[]; // Glyph index array (arbitrary length)
} Table_encode_4;
*/
typedef struct
{
- short number_of_contours; // <0 for composite glyph
- short xMin;
- short yMin;
- short xMax;
- short yMax;
+ fshort number_of_contours; // <0 for composite glyph
+ fshort xMin;
+ fshort yMin;
+ fshort xMax;
+ fshort yMax;
} Glyph_header;
-template<short n> // n = number_of_contours from Glyph_header
+template<fshort n> // n = number_of_contours from Glyph_header
struct SimpleGlyphDescription
{
- unsigned short endPtsOfContours[n];
- unsigned short instruction_length;
-// unsigned char instructions[instruction_length];
-// unsigned char flags[n];
-// unsigned char(short) xCoordinates[n];
-// unsigned char(short) yCoordinates[n];
+ ufshort endPtsOfContours[n];
+ ufshort instruction_length;
+// ufchar instructions[instruction_length];
+// ufchar flags[n];
+// ufchar(fshort) xCoordinates[n];
+// ufchar(fshort) yCoordinates[n];
};
-int parseCmapTable(FILE* tt_file, TableEncode* te);
-int parseNameTable(FILE* tt_file, wchar_t** familyName, wchar_t** psName, StyleName* fontStyle);
-int parseHeadTable(FILE* tt_file, float* bbox, short* format, unsigned short* unitsPerEm);
-int parseHheaTable(FILE* tt_file, unsigned short* numOfHMetrics, float* ascent, float* descent, float* lineGap);
-int parseMaxpTable(FILE* tt_file, unsigned short *numGlyphs);
-int parseLocaTable(FILE* tt_file, GlyphOffsets* gOffsets, unsigned short numGlyphs);
-int parseOs2Table(FILE* tt_file, float* strikeOutSize, float* strikeOutOffset);
-int parsePostTable(FILE* tt_file, short* uOffset, short* uThickness);
-int parseGlyphData(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex, TTCurve *curve, short* bRect, float transform);
-int parseHmtxTable(FILE* tt_file, unsigned short numOfHMetrics, HMetrics** hm);
-bool isCompositeGlyph(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex);
+fint parseCmapTable(FILE* tt_file, TableEncode* te);
+fint parseNameTable(FILE* tt_file, fwchar_t** familyName, fwchar_t** psName, StyleName* fontStyle);
+fint parseHeadTable(FILE* tt_file, ffloat* bbox, fshort* format, ufshort* unitsPerEm);
+fint parseHheaTable(FILE* tt_file, ufshort* numOfHMetrics, ffloat* ascent, ffloat* descent, ffloat* lineGap);
+fint parseMaxpTable(FILE* tt_file, ufshort *numGlyphs);
+fint parseLocaTable(FILE* tt_file, GlyphOffsets* gOffsets, ufshort numGlyphs);
+fint parseOs2Table(FILE* tt_file, ffloat* strikeOutSize, ffloat* strikeOutOffset);
+fint parsePostTable(FILE* tt_file, fshort* uOffset, fshort* uThickness);
+fint parseGlyphData(FILE* tt_file, const GlyphOffsets gO, ufshort numGlyphs, ufshort glyphIndex, TTCurve *curve, fshort* bRect, ffloat transform);
+fint parseHmtxTable(FILE* tt_file, ufshort numOfHMetrics, HMetrics** hm);
+bool isCompositeGlyph(FILE* tt_file, const GlyphOffsets gO, ufshort numGlyphs, ufshort glyphIndex);
#endif
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Type1Structs.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Type1Structs.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Type1Structs.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Type1Structs.h Tue Jun 19 01:46:27 2007
@@ -25,51 +25,52 @@
#include <map>
#include "EncodedValue.h"
#include "AGL.h"
+#include "TypeDefinition.h"
-typedef std::map<const unsigned short, EncodedValue*> Type1Map;
+typedef std::map<const ufshort, EncodedValue*> Type1Map;
-typedef std::map<unsigned short, unsigned short> Type1GlyphCodeMap;
+typedef std::map<ufshort, ufshort> Type1GlyphCodeMap;
-typedef std::map<unsigned short, char*> Type1AFMMap;
+typedef std::map<ufshort, fchar*> Type1AFMMap;
typedef enum DecodeStateTag {HEADER, PRIVATE_DIR, SUBRS_MASSIVE, CHAR_STRING} DecodeState;
-typedef std::map<const char*, const unsigned short> Type1CharMap;//inner glyph number -- unicode
+typedef std::map<const fchar*, const ufshort> Type1CharMap;//inner glyph number -- unicode
-static const unsigned short MAX_STR_LENGHT = 1024;
-static const unsigned short C1 = 52845;
-static const unsigned short C2 = 22719;
-static const unsigned short DEF_R_EXEC = 55665;
-static const unsigned short DEF_LENIV = 4;
-static const unsigned short DEF_R_CHARSTRING = 4330;
-
-static const unsigned char CH_STR_HSTEM = 1;
-static const unsigned char CH_STR_VSTEM = 3;
-static const unsigned char CH_STR_VMOVETO = 4;
-static const unsigned char CH_STR_RLINETO = 5;
-static const unsigned char CH_STR_HLINETO = 6;
-static const unsigned char CH_STR_VLINETO = 7;
-static const unsigned char CH_STR_RRCURVETO = 8;
-static const unsigned char CH_STR_CLOSEPATH = 9;
-static const unsigned char CH_STR_CALLSUBR = 10;
-static const unsigned char CH_STR_RETURN = 11;
-static const unsigned char CH_STR_ESCAPE = 12;
-static const unsigned char CH_STR_HSBW = 13;
-static const unsigned char CH_STR_ENDCHAR = 14;
-static const unsigned char CH_STR_RMOVETO = 21;
-static const unsigned char CH_STR_HMOVETO = 22;
-static const unsigned char CH_STR_VHCURVETO = 30;
-static const unsigned char CH_STR_HVCURVETO = 31;
-
-static const unsigned char CH_STR_ESCAPE_DOTSECTION = 0;
-static const unsigned char CH_STR_ESCAPE_VSTEM3 = 1;
-static const unsigned char CH_STR_ESCAPE_HSTEM3 = 2;
-static const unsigned char CH_STR_ESCAPE_SEAC = 6;
-static const unsigned char CH_STR_ESCAPE_SBW = 7;
-static const unsigned char CH_STR_ESCAPE_DIV = 12;
-static const unsigned char CH_STR_ESCAPE_CALLOTHERSUBR = 16;
-static const unsigned char CH_STR_ESCAPE_POP = 17;
-static const unsigned char CH_STR_ESCAPE_SETCURRENTPOINT = 33;
+static const ufshort MAX_STR_LENGHT = 1024;
+static const ufshort C1 = 52845;
+static const ufshort C2 = 22719;
+static const ufshort DEF_R_EXEC = 55665;
+static const ufshort DEF_LENIV = 4;
+static const ufshort DEF_R_CHARSTRING = 4330;
+
+static const ufchar CH_STR_HSTEM = 1;
+static const ufchar CH_STR_VSTEM = 3;
+static const ufchar CH_STR_VMOVETO = 4;
+static const ufchar CH_STR_RLINETO = 5;
+static const ufchar CH_STR_HLINETO = 6;
+static const ufchar CH_STR_VLINETO = 7;
+static const ufchar CH_STR_RRCURVETO = 8;
+static const ufchar CH_STR_CLOSEPATH = 9;
+static const ufchar CH_STR_CALLSUBR = 10;
+static const ufchar CH_STR_RETURN = 11;
+static const ufchar CH_STR_ESCAPE = 12;
+static const ufchar CH_STR_HSBW = 13;
+static const ufchar CH_STR_ENDCHAR = 14;
+static const ufchar CH_STR_RMOVETO = 21;
+static const ufchar CH_STR_HMOVETO = 22;
+static const ufchar CH_STR_VHCURVETO = 30;
+static const ufchar CH_STR_HVCURVETO = 31;
+
+static const ufchar CH_STR_ESCAPE_DOTSECTION = 0;
+static const ufchar CH_STR_ESCAPE_VSTEM3 = 1;
+static const ufchar CH_STR_ESCAPE_HSTEM3 = 2;
+static const ufchar CH_STR_ESCAPE_SEAC = 6;
+static const ufchar CH_STR_ESCAPE_SBW = 7;
+static const ufchar CH_STR_ESCAPE_DIV = 12;
+static const ufchar CH_STR_ESCAPE_CALLOTHERSUBR = 16;
+static const ufchar CH_STR_ESCAPE_POP = 17;
+static const ufchar CH_STR_ESCAPE_SETCURRENTPOINT = 33;
//#define GLYPH_OUTLINE_CREATE_DEBUG
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/fljni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/fljni.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/fljni.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/fljni.cpp Tue Jun 19 01:46:27 2007
@@ -31,24 +31,24 @@
JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_initManager
(JNIEnv *env, jobject obj) {
-// jboolean iscopy;
+ //jboolean iscopy;
//printf("getting fonts...\n");
- Environment::getAllFonts();
+ //Environment::getAllFonts();
//printf("fonts added\n");
-#ifdef WIN32
- //char *nativePath = (char *)(env->GetStringUTFChars(path, &iscopy));
+//#ifdef WIN32
+ //fchar *nativePath = (fchar *)(env->GetStringUTFChars(path, &iscopy));
//Environment::addPath(nativePath);
//env->ReleaseStringUTFChars(path, nativePath);
-#endif
+//#endif
fontClass = env->FindClass("java/awt/Font");
outlineClass = env->FindClass("org/apache/harmony/awt/gl/font/fontlib/FLOutline");
fontConstructor = env->GetMethodID(fontClass, "<init>", "(Ljava/lang/String;II)V");
- setOutline = env->GetMethodID(outlineClass, "setOutline", "([B[F)V");
+ setOutline = env->GetMethodID(outlineClass, "setOutline", "([B[F)V");
}
/*
@@ -59,7 +59,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_getAllFontsNative
(JNIEnv *env, jobject obj) {
- Environment::getAllFonts();
+ Environment::getAllFonts();
if (Environment::_length == 0) return NULL;
@@ -69,23 +69,23 @@
FontHeader *fh = Environment::getAllFonts();
- for (unsigned short i = 0; i < Environment::_length; i ++){
-#ifndef WIN32
- unsigned short fName[wcslen((wchar_t *)fh->_familyName)];
- for(unsigned short a = 0; a<wcslen(fh->_familyName); a++){
- fName[a]=(unsigned short)(fh->_familyName[a]);
- }
-#endif
+ for (ufshort i = 0; i < Environment::_length; i ++){
+/*#ifndef WIN32
+ ufshort fName[fwcslen((fwchar_t *)fh->_familyName)];
+ for(ufshort a = 0; a<fwcslen(fh->_familyName); a++){
+ fName[a]=(ufshort)(fh->_familyName[a]);
+ }
+#endif*/
env->SetObjectArrayElement(fonts, i, env->NewObject(
fontClass,
fontConstructor,
-#ifdef WIN32
- env->NewString((jchar *)fh->_familyName, (jsize) wcslen((wchar_t *)fh->_familyName)),
-#else
- env->NewString((jchar*)fName, (jsize) wcslen((wchar_t *)fh->_familyName)),
-#endif
- (jint) (char) fh->_style,
+//#ifdef WIN32
+ env->NewString((jchar *)fh->_familyName, (jsize) fwcslen((fwchar_t *)fh->_familyName)),
+/*#else
+ env->NewString((jchar*)fName, (jsize) fwcslen((fwchar_t *)fh->_familyName)),
+#endif*/
+ (jint) (fchar) fh->_style,
(jint) 1
));
fh = fh->_nextHeader;
@@ -95,24 +95,25 @@
}
JNIEXPORT jobject JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_addFont
-(JNIEnv *env, jobject obj, jstring fontPath, jint type) {
+(JNIEnv *env, jobject obj, jstring fontPath, jint type) {
+
jboolean iscopy;
fontClass = env->FindClass("java/awt/Font");
- char *nativePath = (char *)(env->GetStringUTFChars(fontPath, &iscopy));
+ fchar *nativePath = (fchar *)(env->GetStringUTFChars(fontPath, &iscopy));
FontHeader *fh = Environment::addFile(nativePath, (FontType)type);
- env->ReleaseStringUTFChars(fontPath, nativePath);
+ env->ReleaseStringUTFChars(fontPath, nativePath);
if (fh == NULL) return NULL;
return env->NewObject(
fontClass,
fontConstructor,
- env->NewString((jchar *)fh->_familyName, (jsize) wcslen((wchar_t *)fh->_familyName)),
- (jint) (char) fh->_style,
+ env->NewString((jchar *)fh->_familyName, (jsize) fwcslen((fwchar_t *)fh->_familyName)),
+ (jint) (fchar) fh->_style,
(jint) 1
);
}
@@ -136,9 +137,9 @@
(JNIEnv *env, jobject obj, jstring fontName, jint style) {
jboolean iscopy;
- //char *getenv( const char *name );
+ //fchar *getenv( const fchar *name );
- char *tName = (char *)(env->GetStringUTFChars(fontName, &iscopy));
+ fchar *tName = (fchar *)(env->GetStringUTFChars(fontName, &iscopy));
Font *font = createFont(tName, (StyleName) style);
@@ -151,7 +152,7 @@
#ifdef WIN32
return (jlong) font;
#else
- return (jlong) (long) font;
+ return (jlong) (flong) font;
#endif
}
@@ -165,15 +166,15 @@
#ifdef WIN32
Font *font = (Font *) ptr;
#else
- Font *font = (Font *) (long)ptr;
+ Font *font = (Font *) (flong)ptr;
#endif
jfloatArray metrics = env->NewFloatArray((jsize) FONT_METRICS_QUANTITY);
- float *buffer = (float *)env->GetPrimitiveArrayCritical(metrics, NULL);
+ ffloat *buffer = (ffloat *)env->GetPrimitiveArrayCritical(metrics, NULL);
//printf("getting line metrics...\n");
- float *lineMetrics;
- memcpy(buffer, lineMetrics = font->getLineMetrics(), FONT_METRICS_QUANTITY * sizeof(float));
+ ffloat *lineMetrics;
+ memcpy(buffer, lineMetrics = font->getLineMetrics(), FONT_METRICS_QUANTITY * sizeof(ffloat));
//printf("line metrics gotten");
delete[] lineMetrics;
@@ -193,12 +194,12 @@
#ifdef WIN32
Font *font = (Font *) ptr;
#else
- Font *font = (Font *) (long)ptr;
+ Font *font = (Font *) (flong)ptr;
#endif
- wchar_t *psName = font->getPSName();
+ fwchar_t *psName = font->getPSName();
- return env->NewString((jchar *) psName, (jsize) wcslen(psName));
+ return env->NewString((jchar *) psName, (jsize) fwcslen(psName));
}
/*
@@ -211,7 +212,7 @@
#ifdef WIN32
Font *font = (Font *) ptr;
#else
- Font *font = (Font *) (long)ptr;
+ Font *font = (Font *) (flong)ptr;
#endif
return (jint) font->getMissingGlyphCode();
@@ -222,10 +223,10 @@
#ifdef WIN32
Font *font = (Font *) ptr;
#else
- Font *font = (Font *) (long)ptr;
+ Font *font = (Font *) (flong)ptr;
#endif
- return (jchar) font->getUnicodeByIndex((unsigned short) index);
+ return (jchar) font->getUnicodeByIndex((ufshort) index);
}
/*
@@ -238,7 +239,7 @@
#ifdef WIN32
delete (Font *) ptr;
#else
- delete (Font *) (long) ptr;
+ delete (Font *) (flong) ptr;
#endif
}
@@ -252,10 +253,10 @@
#ifdef WIN32
Font *font = (Font *) ptr;
#else
- Font *font = (Font *) (long)ptr;
+ Font *font = (Font *) (flong)ptr;
#endif
- return font->canDisplay((unsigned short)ch);
+ return font->canDisplay((ufshort)ch);
}
/*
@@ -268,14 +269,14 @@
#ifdef WIN32
Glyph *glyph = (Glyph *) ptr;
#else
- Glyph *glyph = (Glyph *) (long)ptr;
+ Glyph *glyph = (Glyph *) (flong)ptr;
#endif
jfloatArray metrics = env->NewFloatArray((jsize) GLYPH_METRICS_QUANTITY);
- float *buffer = (float *)env->GetPrimitiveArrayCritical(metrics, NULL);
+ ffloat *buffer = (ffloat *)env->GetPrimitiveArrayCritical(metrics, NULL);
- memcpy(buffer, glyph->getGlyphMetrics(), GLYPH_METRICS_QUANTITY * sizeof(float));
+ memcpy(buffer, glyph->getGlyphMetrics(), GLYPH_METRICS_QUANTITY * sizeof(ffloat));
env->ReleasePrimitiveArrayCritical(metrics, buffer, 0);
@@ -291,10 +292,10 @@
(JNIEnv *env, jobject obj, jchar ch, jint size, jlong ptr) {
#ifdef WIN32
Font *font = (Font *) ptr;
- return (jlong) font->getGlyph((unsigned short) ch, (unsigned short) size);
+ return (jlong) font->getGlyph((ufshort) ch, (ufshort) size);
#else
- Font *font = (Font *) (long)ptr;
- return (jlong) (long) font->getGlyph((unsigned short) ch, (unsigned short) size);
+ Font *font = (Font *) (flong)ptr;
+ return (jlong) (flong) font->getGlyph((ufshort) ch, (ufshort) size);
#endif
}
@@ -308,7 +309,7 @@
#ifdef WIN32
Glyph *glyph = (Glyph *) ptr;
#else
- Glyph *glyph = (Glyph *) (long)ptr;
+ Glyph *glyph = (Glyph *) (flong)ptr;
#endif
Outline* out = glyph->getOutline();
@@ -316,7 +317,7 @@
out->trim();
jbyteArray commands = env->NewByteArray((jsize) out->getCommandLength());
- unsigned char *native_buffer = (unsigned char *)env->GetPrimitiveArrayCritical(commands, NULL);
+ ufchar *native_buffer = (ufchar *)env->GetPrimitiveArrayCritical(commands, NULL);
memcpy(native_buffer, out->_commands, out->getCommandLength());
@@ -324,9 +325,9 @@
jfloatArray points = env->NewFloatArray((jsize) out->getPointsLength());
- float *buffer = (float *)env->GetPrimitiveArrayCritical(points, NULL);
+ ffloat *buffer = (ffloat *)env->GetPrimitiveArrayCritical(points, NULL);
- memcpy(buffer, out->_points, out->getPointsLength() * sizeof(float));
+ memcpy(buffer, out->_points, out->getPointsLength() * sizeof(ffloat));
env->ReleasePrimitiveArrayCritical(points, buffer, 0);
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/include/fljni.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/include/fljni.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/include/fljni.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/include/fljni.h Tue Jun 19 01:46:27 2007
@@ -24,6 +24,7 @@
#include "org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h"
#include "Environment.h"
+#include "TypeDefinition.h"
#include "Font.h"
//#include <stdlib.h>
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jun 19 01:46:27 2007
@@ -0,0 +1 @@
+libFL.exp
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile Tue Jun 19 01:46:27 2007
@@ -16,7 +16,7 @@
include $(HY_HDK)/build/make/defines.mk
CFLAGS += -fpic
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include -I$(PNG_DIR)
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
BUILDFILES = \
$(SHAREDSUB)fljni.o \
@@ -29,10 +29,14 @@
$(SHAREDSUB)T1Font.o \
$(SHAREDSUB)T1Glyph.o \
$(SHAREDSUB)TTCurve.o \
- $(SHAREDSUB)TTFont.o
+ $(SHAREDSUB)TTFont.o \
+ $(SHAREDSUB)TypeDefinition.o
+
+ifneq ($(HY_ZIP_API),true)
+MDLLIBFILES += $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX)
+endif
MDLLIBFILES += \
- $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib.so \
$(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(LIBPATH)libvmi.so
OSLIBS += $(STDCLIBS)
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile Tue Jun 19 01:46:27 2007
@@ -34,7 +34,8 @@
$(SHAREDSUB)T1Font.obj \
$(SHAREDSUB)T1Glyph.obj \
$(SHAREDSUB)TTCurve.obj \
- $(SHAREDSUB)TTFont.obj
+ $(SHAREDSUB)TTFont.obj \
+ $(SHAREDSUB)TypeDefinition.obj
VIRTFILES = $(LIBBASE).res
SYSLIBFILES = ws2_32.lib Iphlpapi.lib
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java Tue Jun 19 01:46:27 2007
@@ -93,9 +93,11 @@
private static final long serialVersionUID = 5142939176006310877L;
- private SortResult sr;
+ private int resultCode;
- private boolean sorted = false;
+ private String badAttrId;
+
+ private transient boolean sorted = false;
/**
* @ar.org.fitc.spec_ref
@@ -107,7 +109,10 @@
*/
public SortResponseControl(String id, boolean criticality, byte[] value) throws IOException {
super(OID,criticality,value);
- this.sr = (SortResult) ASN1_SORTRESPONSE.decode(value);
+ SortResult sr;
+ sr = (SortResult) ASN1_SORTRESPONSE.decode(value);
+ resultCode = sr.getSortresult();
+ badAttrId = sr.getAttributeType();
if (getResultCode() == 0) {
sorted = true;
} else {
@@ -119,14 +124,14 @@
* @ar.org.fitc.spec_ref
*/
public String getAttributeID () {
- return sr.getAttributeType();
+ return badAttrId;
}
/**
* @ar.org.fitc.spec_ref
*/
public int getResultCode () {
- return sr.getSortresult();
+ return resultCode;
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java Tue Jun 19 01:46:27 2007
@@ -106,7 +106,7 @@
static InitialContextFactoryBuilder icfb;
static ObjectFactoryBuilder ofb;
-
+
NamingManager() {
super();
// package private to prevent it being instanced but make it can be
@@ -129,22 +129,21 @@
* @throws NamingException
* for other errors encountered.
*/
- public static synchronized void setInitialContextFactoryBuilder(
+ public static void setInitialContextFactoryBuilder(
InitialContextFactoryBuilder icfb) throws IllegalStateException,
SecurityException, NamingException {
-
- if (null != NamingManager.icfb) {
- // jndi.1E=InitialContextFactoryBuilder cannot be reset
- throw new IllegalStateException(Messages.getString("jndi.1E")); //$NON-NLS-1$
- }
-
// check security access
SecurityManager sm = System.getSecurityManager();
if (null != sm) {
sm.checkSetFactory();
}
-
- NamingManager.icfb = icfb;
+ synchronized (NamingManager.class) {
+ if (null != NamingManager.icfb) {
+ // jndi.1E=InitialContextFactoryBuilder cannot be reset
+ throw new IllegalStateException(Messages.getString("jndi.1E")); //$NON-NLS-1$
+ }
+ NamingManager.icfb = icfb;
+ }
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java Tue Jun 19 01:46:27 2007
@@ -25,6 +25,7 @@
import java.net.InetAddress;
import java.net.SocketTimeoutException;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
@@ -33,7 +34,6 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
-//import java.util.logging.Level;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
@@ -99,9 +99,9 @@
private int threadNumberLimit;
// vector with currently running Resolver threads
- private final Vector<ThreadListEntry> resolverThreads = new Vector<ThreadListEntry>();
+ private final ArrayList<ThreadListEntry> resolverThreads = new ArrayList<ThreadListEntry>();
// the list of host names that should be resolved
- private final Vector<ThreadListEntry> hostnamesToResolve = new Vector<ThreadListEntry>();
+ private final ArrayList<ThreadListEntry> hostnamesToResolve = new ArrayList<ThreadListEntry>();
// semaphore that controls access to both lists above
private class ThreadListSemaphore {}
private final Object threadListSemaphore = new ThreadListSemaphore();
@@ -1428,7 +1428,7 @@
synchronized (threadListSemaphore) {
// check that no currently running thread looks for this hostname
for (int i = 0; i < resolverThreads.size(); i++) {
- Resolver.ThreadListEntry entry = resolverThreads.elementAt(i);
+ Resolver.ThreadListEntry entry = resolverThreads.get(i);
if (ProviderMgr.namesAreEqual(hostname,
entry.serverNameToResolve) &&
entry.dnsClass == dnsClass)
@@ -1440,7 +1440,7 @@
}
// check if the hostname is already scheduled for resolving
for (int i = 0; i < hostnamesToResolve.size(); i++) {
- Resolver.ThreadListEntry entry = hostnamesToResolve.elementAt(i);
+ Resolver.ThreadListEntry entry = hostnamesToResolve.get(i);
if (ProviderMgr.namesAreEqual(hostname,
entry.serverNameToResolve) &&
entry.dnsClass == dnsClass)
@@ -1459,7 +1459,7 @@
newEntry = new Resolver.ThreadListEntry();
newEntry.serverNameToResolve = hostname;
newEntry.dnsClass = dnsClass;
- hostnamesToResolve.addElement(newEntry);
+ hostnamesToResolve.add(newEntry);
// starting new thread that should make further updates by itself
newThread = new Thread(this);
//if (LogConst.DEBUG) {
@@ -1483,10 +1483,10 @@
// update lists
synchronized (threadListSemaphore) {
if (hostnamesToResolve.size() > 0) {
- entryToProcess = hostnamesToResolve.elementAt(0);
+ entryToProcess = hostnamesToResolve.get(0);
hostnamesToResolve.remove(0);
entryToProcess.thread = Thread.currentThread();
- resolverThreads.addElement(entryToProcess);
+ resolverThreads.add(entryToProcess);
} else {
//ProviderMgr.logger.warning(
// "Resolver thread: no host name to resolve");
@@ -1515,7 +1515,7 @@
// update resolver threads list, remove info about current thread
synchronized (threadListSemaphore) {
for (int i = 0; i < resolverThreads.size(); i++) {
- Resolver.ThreadListEntry entry = resolverThreads.elementAt(i);
+ Resolver.ThreadListEntry entry = resolverThreads.get(i);
if (ProviderMgr.namesAreEqual(
entryToProcess.serverNameToResolve,
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java Tue Jun 19 01:46:27 2007
@@ -24,7 +24,7 @@
package org.apache.harmony.jndi.provider.dns;
import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Vector;
/**
@@ -37,14 +37,14 @@
class ResolverCache {
/** keys - zone & host names; values - vectors with RRs */
- Hashtable<String, Vector<CacheEntry>> names = new Hashtable<String, Vector<CacheEntry>>();
+ HashMap<String, Vector<CacheEntry>> names = new HashMap<String, Vector<CacheEntry>>();
/**
* Since <code>ResolverCache</code> is singleton class its constructor
* should be hidden.
*/
private ResolverCache() {
- names = new Hashtable<String, Vector<CacheEntry>>();
+ names = new HashMap<String, Vector<CacheEntry>>();
}
private static ResolverCache instance = null;
@@ -146,7 +146,7 @@
* Removes all cached entries.
*/
synchronized void clear() {
- names = new Hashtable<String, Vector<CacheEntry>>();
+ names = new HashMap<String, Vector<CacheEntry>>();
}
// additional class
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java Tue Jun 19 01:46:27 2007
@@ -23,9 +23,9 @@
package org.apache.harmony.jndi.provider.dns;
-import java.util.Vector;
-import java.util.Hashtable;
import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
import org.apache.harmony.jndi.internal.nls.Messages;
@@ -60,16 +60,13 @@
servers = new Vector<Server>();
}
- private static SList instance = null;
+ private static SList instance = new SList();
/**
* <code>SList</code> is a singleton class.
* @return instance of <code>SList</code>
*/
static SList getInstance() {
- if (instance == null) {
- instance = new SList();
- }
return instance;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java Tue Jun 19 01:46:27 2007
@@ -23,6 +23,8 @@
package org.apache.harmony.jndi.tests.javax.naming.ldap;
import java.io.IOException;
+import java.io.Serializable;
+
import javax.naming.AuthenticationNotSupportedException;
import javax.naming.LimitExceededException;
import javax.naming.NamingException;
@@ -33,8 +35,12 @@
import javax.naming.directory.InvalidSearchFilterException;
import javax.naming.directory.NoSuchAttributeException;
import javax.naming.ldap.SortResponseControl;
+
import junit.framework.TestCase;
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
/**
* <p>This Test class is testing the SortControl class.</p>
* <p>In the next tables we are gonna see the methods that we test in this class:</p>
@@ -805,4 +811,32 @@
}
+ public void testSerializationCompatibility() throws Exception{
+ String Id = "test";
+ boolean crit = true;
+ SortResponseControl object;
+ byte[] ber = { 48, 3, 10, 1, 0 };
+ object = new SortResponseControl(Id, crit, ber);
+ SerializationTest.verifyGolden(this, object, SORTRESPONSECONTROL_COMPARATOR);
+ }
+
+ // comparator for SortResponseControl
+ private static final SerializableAssert SORTRESPONSECONTROL_COMPARATOR = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SortResponseControl initThr = (SortResponseControl) initial;
+ SortResponseControl dserThr = (SortResponseControl) deserialized;
+
+ // verify ResultCode
+ int initResultCode = initThr.getResultCode();
+ int dserResultCode = dserThr.getResultCode();
+ assertTrue(initResultCode == dserResultCode);
+
+ // verify BadAttrId
+ String initBadAttrId = initThr.getAttributeID();
+ String dserBadAttrId = dserThr.getAttributeID();
+ assertEquals(initBadAttrId, dserBadAttrId);
+ }
+ };
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java Tue Jun 19 01:46:27 2007
@@ -84,10 +84,7 @@
*/
@Override
public synchronized void flush() throws IOException {
- if (count > 0) {
- out.write(buf, 0, count);
- }
- count = 0;
+ flushInternal();
out.flush();
}
@@ -122,7 +119,8 @@
throw new NullPointerException(Msg.getString("K0047")); //$NON-NLS-1$
}
- if (count == 0 && length >= buf.length) {
+ if (length >= buf.length) {
+ flushInternal();
out.write(buffer, offset, length);
return;
}
@@ -131,29 +129,15 @@
// K002f=Arguments out of bounds
throw new ArrayIndexOutOfBoundsException(Msg.getString("K002f")); //$NON-NLS-1$
}
-
- int available = buf.length - count;
- if (length < available) {
- available = length;
- }
- if (available > 0) {
- System.arraycopy(buffer, offset, buf, count, available);
- count += available;
- }
- if (count == buf.length) {
- out.write(buf, 0, buf.length);
- count = 0;
- if (length > available) {
- offset += available;
- available = length - available;
- if (available >= buf.length) {
- out.write(buffer, offset, available);
- } else {
- System.arraycopy(buffer, offset, buf, count, available);
- count += available;
- }
- }
+
+ // flush the internal buffer first if we have not enough space left
+ if (length >= (buf.length - count)) {
+ flushInternal();
}
+
+ // the length is always less than (buf.length - count) here so arraycopy is safe
+ System.arraycopy(buffer, offset, buf, count, length);
+ count += length;
}
/**
@@ -178,5 +162,15 @@
count = 0;
}
buf[count++] = (byte) oneByte;
+ }
+
+ /**
+ * Flushes only internal buffer.
+ */
+ private void flushInternal() throws IOException {
+ if (count > 0) {
+ out.write(buf, 0, count);
+ }
+ count = 0;
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedWriter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedWriter.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedWriter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedWriter.java Tue Jun 19 01:46:27 2007
@@ -85,7 +85,7 @@
public void close() throws IOException {
synchronized (lock) {
if (!isClosed()) {
- flush();
+ flushInternal();
out.close();
buf = null;
out = null;
@@ -106,12 +106,19 @@
if (isClosed()) {
throw new IOException(Msg.getString("K005d")); //$NON-NLS-1$
}
- if (pos > 0) {
- out.write(buf, 0, pos);
- }
- pos = 0;
+ flushInternal();
out.flush();
}
+ }
+
+ /**
+ * Flushes the internal buffer.
+ */
+ private void flushInternal() throws IOException {
+ if (pos > 0) {
+ out.write(buf, 0, pos);
+ }
+ pos = 0;
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java Tue Jun 19 01:46:27 2007
@@ -906,16 +906,24 @@
Comparable<K> object = null;
if (comparator == null) {
object = toComparable(key);
+ Entry<K, V> x = root;
+ while (x != null) {
+ result = object.compareTo(x.key);
+ if (result == 0) {
+ return x;
+ }
+ x = result < 0 ? x.left : x.right;
+ }
+ } else {
+ Entry<K, V> x = root;
+ while (x != null) {
+ result = comparator.compare(key, x.key);
+ if (result == 0) {
+ return x;
+ }
+ x = result < 0 ? x.left : x.right;
+ }
}
- Entry<K, V> x = root;
- while (x != null) {
- result = object != null ? object.compareTo(x.key) : comparator
- .compare(key, x.key);
- if (result == 0) {
- return x;
- }
- x = result < 0 ? x.left : x.right;
- }
return null;
}
@@ -1264,28 +1272,39 @@
fixup(x);
}
}
+ y.left = y.right = y.parent = null;
size--;
}
private Entry<K, V> rbInsert(K object) {
int result = 0;
Entry<K, V> y = null;
- if (size != 0) {
- Comparable<K> key = null;
- if (comparator == null) {
- key = toComparable(object);
- }
- Entry<K, V> x = root;
- while (x != null) {
- y = x;
- result = key != null ? key.compareTo(x.key) : comparator
- .compare(object, x.key);
- if (result == 0) {
- return x;
- }
- x = result < 0 ? x.left : x.right;
- }
- }
+ if (size != 0) {
+ Comparable<K> key = null;
+ if (comparator == null) {
+ key = toComparable(object);
+ Entry<K, V> x = root;
+ while (x != null) {
+ y = x;
+ result = key.compareTo(x.key);
+ if (result == 0) {
+ return x;
+ }
+ x = result < 0 ? x.left : x.right;
+ }
+ } else {
+ Entry<K, V> x = root;
+ while (x != null) {
+ y = x;
+ result = comparator.compare(object, x.key);
+ if (result == 0) {
+ return x;
+ }
+ x = result < 0 ? x.left : x.right;
+ }
+ }
+
+ }
size++;
modCount++;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java Tue Jun 19 01:46:27 2007
@@ -82,6 +82,24 @@
}
}
+ private static class MockOutputStream extends OutputStream {
+ byte[] written;
+ int count;
+
+ public MockOutputStream(int size) {
+ written = new byte[size];
+ count = 0;
+ }
+
+ public void write(int b) {
+ written[count++] = (byte)b;
+ }
+
+ public String getWritten() {
+ return new String(written, 0, count);
+ }
+ }
+
/**
* @tests java.io.BufferedOutputStream#write(byte[], int, int)
*/
@@ -105,8 +123,20 @@
bais.read(wbytes, 0, 1013);
assertTrue("Incorrect bytes written", fileString.substring(0, 1013)
.equals(new String(wbytes, 0, wbytes.length)));
+
+ // regression test for HARMONY-4177
+ MockOutputStream mos = new MockOutputStream(5);
+ BufferedOutputStream bos = new BufferedOutputStream(mos, 3);
+ bos.write("a".getBytes());
+ bos.write("bcde".getBytes());
+ assertEquals("Large data should be written directly", "abcde", mos.getWritten());
+ mos = new MockOutputStream(4);
+ bos = new BufferedOutputStream(mos, 3);
+ bos.write("ab".getBytes());
+ bos.write("cd".getBytes());
+ assertEquals("Should flush before write", "ab", mos.getWritten());
} catch (java.io.IOException e) {
- fail("Flush test failed");
+ fail("write$BII test failed: " + e);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java Tue Jun 19 01:46:27 2007
@@ -19,6 +19,7 @@
import java.io.BufferedWriter;
import java.io.IOException;
+import java.io.Writer;
import tests.support.Support_StringWriter;
@@ -51,6 +52,33 @@
assertTrue("Used in tests", true);
}
+ private static class MockWriter extends Writer {
+ StringBuffer sb = new StringBuffer();
+ boolean flushCalled = false;
+
+ public void write(char[] buf, int off, int len) throws IOException {
+ for (int i = off; i < off + len; i++) {
+ sb.append(buf[i]);
+ }
+ }
+
+ public void close() throws IOException {
+ System.out.println("close");
+ }
+
+ public void flush() throws IOException {
+ flushCalled = true;
+ }
+
+ public String getWritten() {
+ return sb.toString();
+ }
+
+ public boolean isFlushCalled() {
+ return flushCalled;
+ }
+ }
+
/**
* @tests java.io.BufferedWriter#close()
*/
@@ -62,6 +90,22 @@
} catch (IOException e) {
}
assertTrue("Write after close", !sw.toString().equals(testString));
+
+ // Regression test for HARMONY-4178
+ try {
+ MockWriter mw = new MockWriter();
+ BufferedWriter bw = new BufferedWriter(mw);
+ bw.write('a');
+ bw.close();
+
+ // flush should not be called on underlying stream
+ assertFalse("Flush was called in the underlying stream", mw.isFlushCalled());
+
+ // on the other hand the BufferedWriter itself should flush the buffer
+ assertEquals("BufferdWriter do not flush itself before close", "a", mw.getWritten());
+ } catch (IOException ioe) {
+ fail("Exception during close test: " + ioe);
+ }
}
/**
Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 19 01:46:27 2007
@@ -2,3 +2,4 @@
*.map
*.pdb
*.manifest
+libhycharset.so
Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jun 19 01:46:27 2007
@@ -0,0 +1 @@
+libhycharset.exp
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java Tue Jun 19 01:46:27 2007
@@ -98,13 +98,18 @@
}
public String getSubString(long pos, int length) throws SerialException {
+ checkValidation();
if (pos < 1 || pos > len) {
throw new SerialException(Messages.getString("sql.21")); // $NON-NLS-1$
}
- if (length < 0 || length > len) {
+ if (length < 0 || pos + length > len + 1) {
throw new SerialException(Messages.getString("sql.22")); // $NON-NLS-1$
}
- return new String(buf, (int) (pos - 1), length);
+ try {
+ return new String(buf, (int) (pos - 1), length);
+ } catch (StringIndexOutOfBoundsException e) {
+ throw new SerialException();
+ }
}
public long position(Clob searchClob, long start) throws SerialException,
@@ -184,5 +189,11 @@
System.arraycopy(buf, 0, truncatedBuffer, 0, (int)length);
buf = truncatedBuffer;
len = length;
+ }
+
+ private void checkValidation() throws SerialException {
+ if(len == -1){
+ throw new SerialException(Messages.getString("sql.38")); //$NON-NLS-1$
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java Tue Jun 19 01:46:27 2007
@@ -33,6 +33,8 @@
import javax.sql.rowset.serial.SerialClob;
import javax.sql.rowset.serial.SerialException;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockClob;
+
import junit.framework.TestCase;
public class SerialClobTest extends TestCase {
@@ -177,6 +179,22 @@
} catch (SerialException e) {
// expected
}
+ try {
+ sub = serialClob.getSubString(3, 4);
+ fail("should throw SerialException");
+ } catch (SerialException e) {
+ // expected
+ }
+
+ LongLengthClob longClob = new LongLengthClob();
+ serialClob = new SerialClob(longClob);
+
+ try {
+ serialClob.getSubString(1, 3);
+ fail("should throw SerialException");
+ } catch (SerialException e) {
+ // expected
+ }
}
@@ -390,6 +408,12 @@
fail("should throw SerialException");
} catch (SerialException e) {
// expected
+ }
+ }
+ private static class LongLengthClob extends MockClob {
+ @Override
+ public long length() throws SQLException {
+ return (long)Integer.MAX_VALUE * (long)2 + 4;
}
}