public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: ncunningham@users.sourceforge.net
Cc: Andries Brouwer <aebr@win.tue.nl>,
	root@chaos.analogic.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@digeo.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: PATCH 1/2: Make gotoxy & siblings use unsigned variables
Date: Sat, 10 Jan 2004 04:34:16 +0100	[thread overview]
Message-ID: <3FFF72B8.52E6E601@gmx.de> (raw)
In-Reply-To: 1073683594.4582.36.camel@laptop-linux

Nigel Cunningham wrote:
>
> Andries Brouwer wrote:
>
> > When did you last see a console in text mode with a line length
> > of more than 2^31 ?
> >
> > If you go for a minimal patch then you should replace "char"
> > in one or two places by "unsigned char" and that is all.
>
> Of course you're right about 2^31 columns, but the rest of the code used
> unsigned ints as well, not because it expects 2^31 columns, but because
> (if I understand the code right), the numbers can be part of escape
> sequences... I'm looking at csi_m in vt.c.

Yes, they may be part of escape sequences and that's why your patch is
wrong.  See the comment above gotoxy:

    /*
     * gotoxy() must verify all boundaries, because the arguments
     * might also be negative. If the given position is out of
     * bounds, the cursor is placed at the nearest margin.
    */

If you make the arguments unsigned it will choose the wrong
margin for negative values.  That will i.e. happen if you send
the sequence to move the cursor 10 spaces left when it is only
in column 5.

Afaics, the only thing that needs fixing is putconsxy:

 void putconsxy(int currcons, char *p)
 {
-        gotoxy(currcons, p[0], p[1]);
+        gotoxy(currcons, (unsigned char)p[0], (unsigned char)p[1]);
         set_cursor(currcons);
 }

Ciao, ET.

  reply	other threads:[~2004-01-10  3:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-09 18:33 PATCH 1/2: Make gotoxy & siblings use unsigned variables Nigel Cunningham
2004-01-09 19:22 ` Richard B. Johnson
2004-01-09 19:43   ` Nigel Cunningham
2004-01-09 20:33     ` Andries Brouwer
2004-01-09 21:26       ` Nigel Cunningham
2004-01-10  3:34         ` Edgar Toernig [this message]
2004-01-13 21:57     ` Pavel Machek
2004-01-09 21:32 ` Andrew Morton
2004-01-09 21:38 ` Andrew Morton
     [not found] <1c9S3-75-23@gated-at.bofh.it>
     [not found] ` <1cauN-131-17@gated-at.bofh.it>
     [not found]   ` <1cb7n-1Z6-17@gated-at.bofh.it>
     [not found]     ` <1cbAw-2BB-27@gated-at.bofh.it>
2004-01-16 18:41       ` Bill Davidsen
2004-01-16 18:54         ` Nigel Cunningham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FFF72B8.52E6E601@gmx.de \
    --to=froese@gmx.de \
    --cc=aebr@win.tue.nl \
    --cc=akpm@digeo.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@users.sourceforge.net \
    --cc=root@chaos.analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox