libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libredwg] Re: bug loading text


From: nei
Subject: [libredwg] Re: bug loading text
Date: Tue, 05 Apr 2011 14:31:52 -0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

Hi, i discover a bug in dwgspec.
follow the bug and solution:

bug:
bit_read_TV(Bit_Chain * dat)
{
  unsigned int i;
  unsigned int length;
  unsigned char *chain;

  length = bit_read_BS(dat);
  chain = (unsigned char *) malloc(length + 1);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RC(dat);
      if (chain[i] == 0)
chain[i] = '*';//<-----------end of strings are switched by *, so text are not displayed correctly
      else if (!isprint (chain[i]))
chain[i] = '~';//<-----------characters like é,ç,etc.... are switched by ~, so text are not displayed correctly
    }
  chain[i] = '\0';

  return (chain);
}



possible solution:

 bit_read_TV(Bit_Chain * dat)
{
  unsigned int i;
  unsigned int length;
  unsigned char *chain;

  length = bit_read_BS(dat);
  chain = (unsigned char *) malloc(length + 1);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RC(dat);
    }
  chain[i] = '\0';

  return (chain);
}


regards
Nei








reply via email to

[Prev in Thread] Current Thread [Next in Thread]