All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@users.sourceforge.net>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@digeo.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: PATCH 1/2: Make gotoxy & siblings use unsigned variables
Date: Sat, 10 Jan 2004 07:33:05 +1300	[thread overview]
Message-ID: <1073672901.2069.15.camel@laptop-linux> (raw)

[-- Attachment #1: Type: text/plain, Size: 2859 bytes --]

This patch makes console X and Y coordinates unsigned, rather than
signed. Issues with wide (> 128 char?) consoles, seen when developing
Software Suspend's 'nice display' are thus fixed. A brief examination of
related code showed that this use of signed variables was the exception
rather than the rule.

Regards,

Nigel

diff -ruN linux-2.6.1-rc3/drivers/char/vt.c console-patch-1/drivers/char/vt.c
--- linux-2.6.1-rc3/drivers/char/vt.c	2004-01-09 14:24:45.000000000 +1300
+++ console-patch-1/drivers/char/vt.c	2004-01-10 07:17:08.000000000 +1300
@@ -149,7 +149,7 @@
 static void vc_init(unsigned int console, unsigned int rows,
 		    unsigned int cols, int do_clear);
 static void blank_screen(unsigned long dummy);
-static void gotoxy(int currcons, int new_x, int new_y);
+static void gotoxy(int currcons, unsigned int new_x, unsigned int new_y);
 static void save_cur(int currcons);
 static void reset_terminal(int currcons, int do_clear);
 static void con_flush_chars(struct tty_struct *tty);
@@ -859,9 +859,9 @@
  * might also be negative. If the given position is out of
  * bounds, the cursor is placed at the nearest margin.
  */
-static void gotoxy(int currcons, int new_x, int new_y)
+static void gotoxy(int currcons, unsigned int new_x, unsigned int new_y)
 {
-	int min_y, max_y;
+	unsigned int min_y, max_y;
 
 	if (new_x < 0)
 		x = 0;
@@ -888,7 +888,7 @@
 }
 
 /* for absolute user moves, when decom is set */
-static void gotoxay(int currcons, int new_x, int new_y)
+static void gotoxay(int currcons, unsigned int new_x, unsigned int new_y)
 {
 	gotoxy(currcons, new_x, decom ? (top+new_y) : new_y);
 }
@@ -2996,13 +2996,13 @@
 	return screenpos(currcons, 2 * w_offset, viewed);
 }
 
-void getconsxy(int currcons, char *p)
+void getconsxy(int currcons, unsigned char *p)
 {
 	p[0] = x;
 	p[1] = y;
 }
 
-void putconsxy(int currcons, char *p)
+void putconsxy(int currcons, unsigned char *p)
 {
 	gotoxy(currcons, p[0], p[1]);
 	set_cursor(currcons);
diff -ruN linux-2.6.1-rc3/include/linux/selection.h console-patch-1/include/linux/selection.h
--- linux-2.6.1-rc3/include/linux/selection.h	2004-01-09 14:22:25.000000000 +1300
+++ console-patch-1/include/linux/selection.h	2004-01-10 07:17:08.000000000 +1300
@@ -36,8 +36,8 @@
 extern void complement_pos(int currcons, int offset);
 extern void invert_screen(int currcons, int offset, int count, int shift);
 
-extern void getconsxy(int currcons, char *p);
-extern void putconsxy(int currcons, char *p);
+extern void getconsxy(int currcons, unsigned char *p);
+extern void putconsxy(int currcons, unsigned char *p);
 
 extern u16 vcs_scr_readw(int currcons, const u16 *org);
 extern void vcs_scr_writew(int currcons, u16 val, u16 *org);

-- 
My work on Software Suspend is graciously brought to you by
LinuxFund.org.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-01-09 18:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-09 18:33 Nigel Cunningham [this message]
2004-01-09 19:22 ` PATCH 1/2: Make gotoxy & siblings use unsigned variables 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
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=1073672901.2069.15.camel@laptop-linux \
    --to=ncunningham@users.sourceforge.net \
    --cc=akpm@digeo.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.