HylaFAX The world's most advanced open source fax server

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

Re: faxmail error



"D Hugh Redelmeier" writes:

> Here is an old message from the mailing list.  I've added top-of-my
> head (i.e. untested) comments just now.  I don't know if this message
> is the best one on the topic, it is just the first (latest) that I
> found in my personal collection of saved mailing list articles.

First I'd like to state that this changes works for me. That's why I
posted them.

> | From zorzella@dcc.unicamp.br Wed Jan  8 17:13:25 1997
> | Date: 	Wed, 8 Jan 1997 13:52:30 -0500
> | Message-Id: <199701081852.QAA01964@xingu>
> | From: Luiz Otavio Lautenschlaeger Zorzella <zorzella@dcc.unicamp.br>
> | To: flexfax@sgi.com
> | Subject: bug fixes in hylafax. How to post?
> |
> | I have 3 bug fixes related to accents & hylafax. I'll post them here,
> | and if I have to do something else, please tell me.
> |
> | The first one is Matthias Apitz's reply to my correction on
> | textfmt. I'm posting again...
> |
> | At line 849 of util/TextFmt.c++ , change:
> |
> | 	int c = *cp++;
> |
> | to:
> |
> | 	int c = *cp++ & 0xff;
> |
> | This fix actually doesn't work for me, probably due to a gcc bug, that
> | I'm trying to find now. So maybe it doesn't work for you too, but the
> | statement is correct.

> I don't know why the fix doesn't work, but I think it would be cleaner
> to write:
> 	int c = (unsigned char) *cp++;

As I told, it didn't work because of a optimization bug in gcc
2.7.0. This is already fixed.

And I didn't choose the style of wrinting. A cast was my first proposed
solution to Matthias Apitz, but he prefers "& 0xff" to cut the high
order part of the integer. And if you take a look you'll see that he
(or whoelse wrote the code) uses a lot this trick. So let's stick to it.

> | The second & third fixes are in faxmail/MIMEState.c++
> |
> |
> | At line 311, change:
> |
> |  	    c &= 0x7f;
> | to:
> |  	    c &= 0xff;

> I don't really understand the context of this code, BUT it is in a
> case label "ENC_7BIT".  How does it happen that we are in this case
> (rather than, say, the parallel case "ENC_8BIT") when we have 8-bit
> characters?

I don't know. But I think thine line is needed... Try for yourself.

> IFF this change is right, it can be more simply accomplished by
> deleting the line.  The value of c is the result returned by getc.  I
> assume that this getc is the one from the ANSI and ISO C standards.
> The standard specifies that fgetc (and hence getc) "...obtains the
> next charactrer (if present) as an unsigned char converted to an
> int...".

The change works for me! If is there any conceptual problem, that's
why I posted it.

> If it is needed for some non-standard system, I'd prefer:
>  	    c = (unsigned char) c;

Already commented above.

> This comment applies to the parallel statement in the ENC8_BIT case.
> The original code has this redundant masking.

> | And at line 401, change:
> |
> | 	buf.put(line, cc-1);		// everything up to ``="''
> |
> | to:
> |
> |  	copyQP (buf, line, cc-1);

> I have not looked at this, so I don't know what it is about.

This code made a break whenever a mime character was reached. My fix
simply does what the rest of the code does: put the converted char in
the buffer.

> | If you have anything to comment on this changes, or ask about them,
> | please tell me.
> |
> | Thanks.
> |
> | Z  .:.   .:.     Luiz Ot'avio Lautenschl"ager Zorzella    .:.   .:.  
> |   :   : :   :                                            :   : :   : 
> |   : .:: : .::    zorzella@dcc.unicamp.br                 ::. : ::. : 
> |   : ::: : :::    http://www.dcc.unicamp.br/~zorzella     ::: : ::: : 
> |   `.::' `.::'                                            `::.' `::.'

> Hugh Redelmeier
> hugh@mimosa.com  voice: +1 416 482-8253

I think it's better if you TRY the fixes (and alternatives) so that
you _can_ say: "simply delete this code" or whatever - as I did.

Best wishes from

> -- 
Z  .:.   .:.     Luiz Otavio Lautenschlaeger Zorzella     .:.   .:.  
  :   : :   :                                            :   : :   : 
  : .:: : .::    mailto:zorzella@dcc.unicamp.br          ::. : ::. : 
  : ::: : :::    http://www.dcc.unicamp.br/~zorzella     ::: : ::: : 
  `.::' `.::'    PGP at my home page                     `::.' `::.'




Project hosted by iFAX Solutions