ulong l;
Memimage *i;
- if(Dx(r) <= 0 || Dy(r) <= 0){
- werrstr("bad rectangle %R", r);
- return nil;
- }
if((d = chantodepth(chan)) == 0) {
werrstr("bad channel descriptor %.8lux", chan);
return nil;
}
+ if(badrect(r)){
+ werrstr("bad rectangle %R", r);
+ return nil;
+ }
l = wordsperline(r, d);
werrstr("bad channel descriptor %.8lux", chan);
return nil;
}
+ if(badrect(r)){
+ werrstr("bad rectangle %R", r);
+ return nil;
+ }
l = wordsperline(r, d);
+
nw = l*Dy(r);
md = malloc(sizeof(Memdata));
if(md == nil)
{
if(i == nil)
return;
- if(i->data->ref-- == 1 && i->data->allocd){
+ if(--i->data->ref == 0 && i->data->allocd){
if(i->data->base)
poolfree(imagmem, i->data->base);
free(i->data);
{
uchar *a;
- a = i->data->bdata+i->zero+sizeof(ulong)*p.y*i->width;
-
+ a = i->data->bdata+i->zero+(int)(sizeof(ulong)*p.y*i->width);
if(i->depth < 8){
/*
* We need to always round down,