size_t-ize Onyx2D as appropriate

See darlinghq/darling#418
This commit is contained in:
Sergey Bugaev 2018-09-09 23:02:11 +03:00
parent 655c781ccf
commit 33528b917b
10 changed files with 50 additions and 50 deletions

View File

@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation O2Color
-initWithColorSpace:(O2ColorSpaceRef)colorSpace pattern:(O2Pattern *)pattern components:(const O2Float *)components {
int i;
size_t i;
_colorSpace=[colorSpace retain];
_pattern=[pattern retain];
@ -25,7 +25,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
O2ColorRef O2ColorInitWithColorSpace(O2ColorRef self,O2ColorSpaceRef colorSpace,const O2Float *components) {
int i;
size_t i;
self->_colorSpace=[colorSpace retain];
self->_pattern=nil;
@ -102,7 +102,7 @@ O2ColorRef O2ColorCreateCopy(O2ColorRef self) {
}
O2ColorRef O2ColorCreateCopyWithAlpha(O2ColorRef self,O2Float alpha) {
int i;
size_t i;
O2Float components[self->_numberOfComponents];
for(i=0;i<self->_numberOfComponents-1;i++)
@ -145,7 +145,7 @@ BOOL O2ColorEqualToColor(O2ColorRef self,O2ColorRef other) {
if(![self->_colorSpace isEqualToColorSpace:other->_colorSpace])
return NO;
int i;
size_t i;
for(i=0;i<self->_numberOfComponents;i++)
if(self->_components[i]!=other->_components[i])
return NO;

View File

@ -131,8 +131,8 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self) {
@implementation O2ColorSpace_indexed
-initWithColorSpace:(O2ColorSpaceRef)baseColorSpace hival:(unsigned)hival bytes:(const unsigned char *)bytes {
int i,max=O2ColorSpaceGetNumberOfComponents(baseColorSpace)*(hival+1);
-initWithColorSpace:(O2ColorSpaceRef)baseColorSpace hival:(size_t)hival bytes:(const unsigned char *)bytes {
size_t i,max=O2ColorSpaceGetNumberOfComponents(baseColorSpace)*(hival+1);
_type=kO2ColorSpaceModelIndexed;
_base=[baseColorSpace retain];
@ -159,7 +159,7 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self) {
if(self->_hival!=other->_hival)
return NO;
int i,max=O2ColorSpaceGetNumberOfComponents(self->_base)*(self->_hival+1);
size_t i,max=O2ColorSpaceGetNumberOfComponents(self->_base)*(self->_hival+1);
for(i=0;i<max;i++)
if(self->_bytes[i]!=other->_bytes[i])
return NO;
@ -171,7 +171,7 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self) {
return _base;
}
-(unsigned)hival {
-(size_t)hival {
return _hival;
}
@ -206,7 +206,7 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self) {
}
-(void)dealloc {
int i;
size_t i;
for(i=0;i<_numberOfComponents;i++)
free(_names[i]);

View File

@ -364,7 +364,7 @@ void O2GStateSetMiterLimit(O2GState *self,O2Float limit) {
self->_miterLimit=limit;
}
void O2GStateSetLineDash(O2GState *self,O2Float phase,const O2Float *lengths,unsigned count){
void O2GStateSetLineDash(O2GState *self,O2Float phase,const O2Float *lengths,size_t count){
self->_dashPhase=phase;
self->_dashLengthsCount=count;

View File

@ -1058,7 +1058,7 @@ O2argb8u *O2ImageRead_CMYK8888_to_argb8u(O2Image *self,int x,int y,O2argb8u *spa
O2argb8u *O2ImageRead_I8_to_argb8u(O2Image *self,int x,int y,O2argb8u *span,int length) {
O2ColorSpace_indexed *indexed=(O2ColorSpace_indexed *)self->_colorSpace;
unsigned hival=[indexed hival];
size_t hival=[indexed hival];
const unsigned char *palette=[indexed paletteBytes];
const uint8_t *scanline = scanlineAtY(self,y);

View File

@ -16,7 +16,7 @@ void O2MutablePathEllipseToBezier(O2Point *cp,O2Float x,O2Float y,O2Float xrad,O
O2Float magic=0.551784;
O2Float xmag=xrad*magic;
O2Float ymag=yrad*magic;
int i=0;
size_t i=0;
cp[i++]=O2PointMake(-xrad,0);
@ -84,7 +84,7 @@ O2MutablePathRef O2PathCreateMutable(void) {
return [[O2MutablePath allocWithZone:NULL] initWithOperators:NULL numberOfElements:0 points:NULL numberOfPoints:0];
}
-initWithOperators:(unsigned char *)elements numberOfElements:(unsigned)numberOfElements points:(O2Point *)points numberOfPoints:(unsigned)numberOfPoints {
-initWithOperators:(unsigned char *)elements numberOfElements:(size_t)numberOfElements points:(O2Point *)points numberOfPoints:(size_t)numberOfPoints {
O2PathInitWithOperators(self,elements,numberOfElements,points,numberOfPoints);
_capacityOfElements=numberOfElements;
_capacityOfPoints=numberOfPoints;
@ -100,7 +100,7 @@ void O2PathReset(O2MutablePathRef self) {
self->_numberOfPoints=0;
}
static inline void expandOperatorCapacity(O2MutablePath *self,unsigned delta){
static inline void expandOperatorCapacity(O2MutablePath *self,size_t delta){
if(self->_numberOfElements+delta>self->_capacityOfElements){
self->_capacityOfElements=MAX(1,self->_capacityOfElements);
@ -111,7 +111,7 @@ static inline void expandOperatorCapacity(O2MutablePath *self,unsigned delta){
}
}
static inline void expandPointCapacity(O2MutablePath *self,unsigned delta){
static inline void expandPointCapacity(O2MutablePath *self,size_t delta){
if(self->_numberOfPoints+delta>self->_capacityOfPoints){
self->_capacityOfPoints=MAX(1,self->_capacityOfPoints);
@ -187,7 +187,7 @@ void O2PathCloseSubpath(O2MutablePathRef self) {
}
void O2PathAddLines(O2MutablePathRef self,const O2AffineTransform *matrix,const O2Point *points,size_t count) {
int i;
size_t i;
if(count==0)
return;
@ -207,7 +207,7 @@ void O2PathAddRect(O2MutablePathRef self,const O2AffineTransform *matrix,O2Rect
}
void O2PathAddRects(O2MutablePathRef self,const O2AffineTransform *matrix,const O2Rect *rects,size_t count) {
int i;
size_t i;
for(i=0;i<count;i++)
O2PathAddRect(self,matrix,rects[i]);
@ -230,9 +230,9 @@ void O2PathAddArc(O2MutablePathRef self,const O2AffineTransform *matrix,O2Float
O2Float radiusx=radius,radiusy=radius;
double remainder=ABS(endRadian-startRadian);
double delta=M_PI_2; // 90 degrees
int i;
size_t i;
O2Point points[4*((int)ceil(remainder/delta)+1)];
int pointsIndex=0;
size_t pointsIndex=0;
for(;remainder>0;startRadian+=delta,remainder-=delta){
double sweepangle=(remainder>delta)?delta:remainder;
@ -380,7 +380,7 @@ void O2PathAddEllipseInRect(O2MutablePathRef self,const O2AffineTransform *matri
O2Float x=rect.origin.x+xradius;
O2Float y=rect.origin.y+yradius;
O2Point cp[13];
int i;
size_t i;
O2MutablePathEllipseToBezier(cp,x,y,xradius,yradius);
@ -391,11 +391,11 @@ void O2PathAddEllipseInRect(O2MutablePathRef self,const O2AffineTransform *matri
}
void O2PathAddPath(O2MutablePathRef self,const O2AffineTransform *matrix,O2PathRef path) {
unsigned opsCount=O2PathNumberOfElements(path);
size_t opsCount=O2PathNumberOfElements(path);
const unsigned char *ops=O2PathElements(path);
unsigned pointCount=O2PathNumberOfPoints(path);
size_t pointCount=O2PathNumberOfPoints(path);
const O2Point *points=O2PathPoints(path);
unsigned i;
size_t i;
expandOperatorCapacity(self,opsCount);
expandPointCapacity(self,pointCount);
@ -414,7 +414,7 @@ void O2PathAddPath(O2MutablePathRef self,const O2AffineTransform *matrix,O2PathR
}
void O2PathApplyTransform(O2MutablePathRef self,const O2AffineTransform matrix) {
int i;
size_t i;
for(i=0;i<self->_numberOfPoints;i++)
self->_points[i]=O2PointApplyAffineTransform(self->_points[i],matrix);

View File

@ -12,12 +12,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation O2Path
-initWithOperators:(unsigned char *)elements numberOfElements:(unsigned)numberOfElements points:(O2Point *)points numberOfPoints:(unsigned)numberOfPoints {
-initWithOperators:(unsigned char *)elements numberOfElements:(size_t)numberOfElements points:(O2Point *)points numberOfPoints:(size_t)numberOfPoints {
return O2PathInitWithOperators(self,elements,numberOfElements,points,numberOfPoints);
}
id O2PathInitWithOperators(O2Path *self,unsigned char *elements,unsigned numberOfElements,O2Point *points,unsigned numberOfPoints) {
int i;
id O2PathInitWithOperators(O2Path *self,unsigned char *elements,size_t numberOfElements,O2Point *points,size_t numberOfPoints) {
size_t i;
self->_numberOfElements=numberOfElements;
self->_elements=NSZoneMalloc(NULL,(self->_numberOfElements==0)?1:self->_numberOfElements);
@ -65,7 +65,7 @@ O2MutablePathRef O2PathCreateMutableCopy(O2PathRef self) {
return [[O2MutablePath allocWithZone:NULL] initWithOperators:self->_elements numberOfElements:self->_numberOfElements points:self->_points numberOfPoints:self->_numberOfPoints];
}
unsigned O2PathNumberOfElements(O2PathRef self) {
size_t O2PathNumberOfElements(O2PathRef self) {
return self->_numberOfElements;
}
@ -73,7 +73,7 @@ const unsigned char *O2PathElements(O2PathRef self) {
return self->_elements;
}
unsigned O2PathNumberOfPoints(O2PathRef self) {
size_t O2PathNumberOfPoints(O2PathRef self) {
return self->_numberOfPoints;
}
@ -87,15 +87,15 @@ O2Point O2PathGetCurrentPoint(O2PathRef self) {
}
BOOL O2PathEqualToPath(O2PathRef self,O2PathRef other){
unsigned otherNumberOfOperators=O2PathNumberOfElements(other);
size_t otherNumberOfOperators=O2PathNumberOfElements(other);
if(self->_numberOfElements==otherNumberOfOperators){
unsigned otherNumberOfPoints=O2PathNumberOfPoints(other);
size_t otherNumberOfPoints=O2PathNumberOfPoints(other);
if(self->_numberOfPoints==otherNumberOfPoints){
const unsigned char *otherOperators=O2PathElements(other);
const O2Point *otherPoints;
int i;
size_t i;
for(i=0;i<self->_numberOfElements;i++)
if(self->_elements[i]!=otherOperators[i])
@ -263,8 +263,8 @@ BOOL O2PathContainsPoint(O2PathRef self,const O2AffineTransform *xform,O2Point p
int cn = 0; // the crossing number counter
int count = O2PathNumberOfElements(self);
int i = 0;
size_t count = O2PathNumberOfElements(self);
size_t i = 0;
O2Point startPoint = O2PointZero, currentPoint = O2PointZero, toPoint = O2PointZero;
O2Point *points = self->_points;
uint8_t *element = self->_elements;
@ -332,7 +332,7 @@ BOOL O2PathContainsPoint(O2PathRef self,const O2AffineTransform *xform,O2Point p
O2Rect O2PathGetBoundingBox(O2PathRef self) {
O2Rect result;
int i;
size_t i;
if(self->_numberOfPoints==0)
return O2RectZero;
@ -361,7 +361,7 @@ O2Rect O2PathGetBoundingBox(O2PathRef self) {
}
void O2PathApply(O2PathRef self,void *info,O2PathApplierFunction function) {
int i,pointIndex=0;
size_t i,pointIndex=0;
O2PathElement element;
for(i=0;i<self->_numberOfElements;i++){

View File

@ -63,20 +63,20 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self);
@interface O2ColorSpace_indexed : O2ColorSpace {
O2ColorSpace *_base;
unsigned _hival;
size_t _hival;
unsigned char *_bytes;
}
- initWithColorSpace:(O2ColorSpaceRef)baseColorSpace hival:(unsigned)hival bytes:(const unsigned char *)bytes;
- initWithColorSpace:(O2ColorSpaceRef)baseColorSpace hival:(size_t)hival bytes:(const unsigned char *)bytes;
- (O2ColorSpaceRef)baseColorSpace;
- (unsigned)hival;
- (size_t)hival;
- (const unsigned char *)paletteBytes;
@end
@interface O2ColorSpace_DeviceN : O2ColorSpace {
@public
unsigned _numberOfComponents;
size_t _numberOfComponents;
@protected
char **_names;
O2ColorSpaceRef _alternateSpace;

View File

@ -46,7 +46,7 @@ extern "C" {
O2LineJoin _lineJoin;
O2Float _miterLimit;
O2Float _dashPhase;
int _dashLengthsCount;
size_t _dashLengthsCount;
O2Float *_dashLengths;
O2ColorRenderingIntent _renderingIntent;
O2BlendMode _blendMode;
@ -139,7 +139,7 @@ void O2GStateSetLineWidth(O2GState *self, O2Float width);
void O2GStateSetLineCap(O2GState *self, int lineCap);
void O2GStateSetLineJoin(O2GState *self, int lineJoin);
void O2GStateSetMiterLimit(O2GState *self, O2Float limit);
void O2GStateSetLineDash(O2GState *self, O2Float phase, const O2Float *lengths, unsigned count);
void O2GStateSetLineDash(O2GState *self, O2Float phase, const O2Float *lengths, size_t count);
- (void)setRenderingIntent:(O2ColorRenderingIntent)intent;
O2BlendMode O2GStateBlendMode(O2GState *self);

View File

@ -14,8 +14,8 @@ extern "C" {
#endif
@interface O2MutablePath : O2Path <NSCopying> {
unsigned _capacityOfElements;
unsigned _capacityOfPoints;
size_t _capacityOfElements;
size_t _capacityOfPoints;
}
void O2PathReset(O2MutablePathRef self);

View File

@ -35,19 +35,19 @@ typedef struct {
typedef void (*O2PathApplierFunction)(void *info, const O2PathElement *element);
@interface O2Path : NSObject <NSCopying> {
unsigned _numberOfElements;
size_t _numberOfElements;
unsigned char *_elements;
unsigned _numberOfPoints;
size_t _numberOfPoints;
O2Point *_points;
}
- initWithOperators:(unsigned char *)elements numberOfElements:(unsigned)numberOfElements points:(O2Point *)points numberOfPoints:(unsigned)numberOfPoints;
- initWithOperators:(unsigned char *)elements numberOfElements:(size_t)numberOfElements points:(O2Point *)points numberOfPoints:(size_t)numberOfPoints;
// internal
id O2PathInitWithOperators(O2Path *self, unsigned char *elements, unsigned numberOfElements, O2Point *points, unsigned numberOfPoints);
unsigned O2PathNumberOfElements(O2PathRef self);
id O2PathInitWithOperators(O2Path *self, unsigned char *elements, size_t numberOfElements, O2Point *points, size_t numberOfPoints);
size_t O2PathNumberOfElements(O2PathRef self);
const unsigned char *O2PathElements(O2PathRef self);
unsigned O2PathNumberOfPoints(O2PathRef self);
size_t O2PathNumberOfPoints(O2PathRef self);
const O2Point *O2PathPoints(O2PathRef self);
// O2 public