ZRLE question

Jared McIntyre jmcintyre@dfsoftware.com
Sun Nov 23 06:49:05 2003


Chicken of the VNC lately has had issues talking to RealVNC servers. 
I think the problem is in the COTVNC ZRLE decoder for subencoding 
greater than or equal to 130.  When it completes running through this 
subencoding for 16 and 24 bit color the variable "data" is pointing 
at a location that is not correct.  I've read through the 
documentation for the protocol, and can't see where its going wrong. 
Has something changed in the protocol in the last year or so as it 
seemed to work correctly at one point.

Here is a slightly modified verion of their code for subencoding >= 
130.  If someone with more knowledge than me about ZRLE would look at 
it and see if they can see the problem, I'd appreciate it.  (For 
those who don't know the language, the funny [] is the object message 
call in Objective-C, but that shouldn't be the problem)

if(subEncoding >= 130) {
	for(i=0; i<(subEncoding - 128); i++) {
		[frameBuffer fillColor:palette + i fromTightPixel:data];
		data += cPixelSize;
	}
	y = 0;
	while(y < (tile.size.width * tile.size.height)) {
		unsigned char index = *data++;
		if(index & 0x80) {
			index &= 0x7f;
			i = 1;
			do {
				b = *data++;
				i += b;
			} while(b == 0xff);
			[frameBuffer putRun:palette + index 
ofLength:i at:tile pixelOffset:y];
			y += i;
		}
		else
		{
			[frameBuffer putRun:palette + index 
ofLength:1 at:tile pixelOffset:y];
			y++;
		}
	}

Thanks for the help,
-- 

Jared McIntyre
Deep Fried Software
Deep Fried LLC
Owner/Engineer
http://www.dfsoftware.com
jmcintyre@dfsoftware.com