Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 12th, 2006, 01:52 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default RLE Uncompession

I need make sure that the following code will uncompress the RLE BMP file correctly:



DWORD RLEUncompress(unsigned char *output,unsigned char *input,int length)
{
   int count;
   DWORD counter=0;

   while (length > 0) {
      count = *input++;
      counter++;
      if (count > 0x80) {
         memset(output,*input++,count);
         counter+= count;
         length -= 2;
      } else if (count < 0x80) {
         memcpy(output,input,count);
         input += count;
         length -= count;

      }
      output += count;

   }
   return counter;
}

Reply With Quote









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.