Russ Cox
da3ed55e4e
devdraw: fix x11 input
...
R=rsc
https://codereview.appspot.com/10458043
2013-06-21 15:28:02 -04:00
Xi Wang
1bfec89b99
rc: avoid undefined C
...
There are two bugs in pdec() on INT_MIN:
* wrong output.
`n = 1-n' should be `n = -1-n' when n is INT_MIN.
* infinite loop.
gcc optimizes `if(n>=0)' into `if(true)' because `-INT_MIN' (signed integer overflow) is undefined behavior in C, and gcc assumes the negation of a negative number must be positive. The resulting binary keeps printing '-' forever given INT_MIN.
Try the simplified pdec.c below.
$ gcc pdec.c
$ ./a.out -2147483648
--214748364*
$ gcc pdec.c -O2
$ ./a.out -2147483648
<infinite loop>
$ gcc pdec.c -O2 -D__PATCH__
$ ./a.out -2147483648
-2147483648
=== pdec.c ===
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define io void
void pchr(io *f, int c)
{
putchar(c);
}
void pdec(io *f, int n)
{
if(n<0){
#ifndef __PATCH__
n=-n;
if(n>=0){
pchr(f, '-');
pdec(f, n);
return;
}
/* n is two's complement minimum integer */
n = 1-n;
#else
if(n!=INT_MIN){
pchr(f, '-');
pdec(f, -n);
return;
}
/* n is two's complement minimum integer */
n = -(INT_MIN+1);
#endif
pchr(f, '-');
pdec(f, n/10);
pchr(f, n%10+'1');
return;
}
if(n>9)
pdec(f, n/10);
pchr(f, n%10+'0');
}
int main(int argc, char **argv)
{
int n = atoi(argv[1]);
pdec(NULL, n);
putchar('\n');
}
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/7241055
2013-03-19 14:36:50 -04:00
Xi Wang
8a2a5b8f25
libsec: avoid undefined C
...
gcc compiles `p + length < p' into 'length < 0' since pointer overflow is undefined behavior in C. This breaks the check against a large `length'.
Use `length > pend - p' instead.
There's no need to check `length < 0' since `length' is from length_decode() and should be non-negative.
===
Try the simplified code.
void bar(void);
void foo(unsigned char *p, int length)
{
if (p + length < p)
bar();
}
$ gcc -S -o - t.c -O2
...
foo:
.LFB0:
.cfi_startproc
testl %esi, %esi
js .L4
rep
ret
.L4:
jmp bar
.cfi_endproc
Clearly `p' is not used at all.
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/7231069
2013-03-19 14:35:16 -04:00
Russ Cox
01e3847b7e
xd: accept -S for 8-byte swap
...
R=rsc
https://codereview.appspot.com/7565045
2013-03-11 17:26:11 -04:00
Russ Cox
36bb28dc63
devdraw: control+click = button 2, alt/shift+click = button 3
...
For single-button mouse users.
R=rsc
https://codereview.appspot.com/7620043
2013-03-07 22:40:47 -05:00
Russ Cox
17934beda0
devdraw: silence unused variable warnings
...
R=rsc
https://codereview.appspot.com/7304064
2013-02-08 12:46:59 -05:00
Russ Cox
5154e54d8b
devdraw: disable XCopyArea optimization
...
Ubuntu Precise seems to have a buggy X server
that sometimes fails at XCopyArea. Let devdraw
do it itself.
This will slow down remote X a little bit,
but slow and correct is better than fast and broken.
R=rsc
https://codereview.appspot.com/7310069
2013-02-08 12:44:56 -05:00
Alessandro Arzilli
cac1425c4a
fontsrv: fix on X11 when X11H is not defined
...
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/7228044
2013-01-30 17:46:16 -08:00
Xi Wang
0dc3aa4b1d
libmach: fix crash in dwarfpc (misuse of realloc)
...
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/7225059
2013-01-30 17:46:12 -08:00
David du Colombier
d5baaf984f
jpegdump: fix build and warnings
...
R=rsc
https://codereview.appspot.com/7070070
2013-01-19 10:05:12 +01:00
David du Colombier
23efb34d47
freq: fix crash with utf > 0xffff (thanks Andrey Mirtchovski)
...
R=rsc
https://codereview.appspot.com/7029054
2013-01-04 20:06:08 +01:00
David du Colombier
0798d6b741
venti/wrarena: fix arenapart breakage
...
R=rsc
https://codereview.appspot.com/7027044
2013-01-03 06:48:36 +01:00
Russ Cox
cb71c0bdc4
fontsrv: only build when the pieces are there
2012-12-18 07:22:19 -08:00
Christian Kellermann
1a512ec048
fontsrv: fix build on OpenBSD 5.2
...
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/6850108
2012-12-11 12:45:45 -05:00
David du Colombier
0b4fd92105
auth/factotum: fix password prompt hang with secstore
...
R=rsc
http://codereview.appspot.com/6906057
2012-12-09 11:24:30 +01:00
Russ Cox
09adcb0901
fontsrv: make single quotes look like quotes
...
R=rsc
https://codereview.appspot.com/6864051
2012-12-03 15:55:13 -05:00
Russ Cox
1785490baa
fontsrv: scaled pjw
...
R=rsc
https://codereview.appspot.com/6854130
2012-12-01 00:35:06 -05:00
Russ Cox
c96d832508
acme: retina scaling for scroll bars, button
...
R=rsc
http://codereview.appspot.com/6854094
2012-11-26 00:33:05 -05:00
Russ Cox
c28224992a
samterm: retina scaling for scroll bars, borders
...
R=rsc
http://codereview.appspot.com/6844083
2012-11-26 00:23:06 -05:00
Russ Cox
a8a0a6422c
9term: adjust to dpi changes
...
R=rsc
http://codereview.appspot.com/6847105
2012-11-26 00:13:18 -05:00
Russ Cox
58b1904e3e
devdraw: fake dpi calculation on Mac
...
R=rsc
http://codereview.appspot.com/6782115
2012-11-25 23:55:27 -05:00
Russ Cox
cc9547960e
libframe: auto scale tick for retina
...
R=rsc
http://codereview.appspot.com/6850102
2012-11-25 23:48:19 -05:00
Russ Cox
ffaaaf9dae
devdraw: use %R not Fn-F3 for retina toggle
...
R=rsc
http://codereview.appspot.com/6854093
2012-11-25 23:47:54 -05:00
Russ Cox
55905845f3
devdraw: add forcedpi toggled by Fn+F3 on Mac
...
R=rsc
http://codereview.appspot.com/6846104
2012-11-25 23:38:14 -05:00
Marius Eriksen
2589c5c6ee
acme: set $samfile (same as $%) during execution
...
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6854092
2012-11-25 22:56:08 -05:00
Russ Cox
e19fde3584
fontsrv: work around a few crashes
...
Probably not the right fix, but gets us going.
R=rsc
http://codereview.appspot.com/6782113
2012-11-25 22:45:32 -05:00
Russ Cox
c6d1f20537
devdraw: fix retina mode
...
R=rsc
http://codereview.appspot.com/6847104
2012-11-25 22:43:57 -05:00
Russ Cox
9f3851871e
libdraw: add scalesize
...
R=rsc
http://codereview.appspot.com/6855092
2012-11-25 22:15:57 -05:00
Russ Cox
d0e0701913
devdraw, libdraw: add display->dpi
...
Fixed at 100 right now, but the plan is to make it accurate
and then use it.
R=rsc
http://codereview.appspot.com/6856091
2012-11-25 21:41:52 -05:00
Shenghou Ma
7b9ef735a8
devdraw: restore compilation on OS X 10.6
...
Also add some ignored files to .hgignore
R=rsc
http://codereview.appspot.com/6842089
2012-11-25 21:20:18 -05:00
Russ Cox
9ca6e21f3d
acme: use threadspawnd to avoid changing "." of current process
...
R=rsc
http://codereview.appspot.com/6736060
2012-10-22 12:32:31 -04:00
Russ Cox
9e4b56e764
libthread: add threadspawnd
...
R=rsc
http://codereview.appspot.com/6742064
2012-10-22 12:32:09 -04:00
Marius Eriksen
81c2c5e775
acme: add $acmeshell to control execution shell
...
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6614056
2012-10-21 16:52:08 -04:00
Yuval Pavel Zholkover
9c61127928
fontsrv: x11 support
...
R=rsc, 0intro
CC=plan9port.codebot
http://codereview.appspot.com/6739047
2012-10-21 16:49:13 -04:00
Rob Kroeger
e13727e3c4
plumb.app: accept plumb:foo as alias for foo
...
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/5495046
2012-10-21 12:53:33 -04:00
Caio Oliveira
e4122a42b9
devdraw: map X11 dead_diaresis to double quote
...
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6690049
2012-10-21 12:12:00 -04:00
Erik Quanstrom
33cdf63251
libmemdraw: fix int size bug
...
R=rsc, quanstro
CC=plan9port.codebot
http://codereview.appspot.com/6657043
2012-10-21 12:08:49 -04:00
Russ Cox
c5bfba483f
silence more warnings
...
R=rsc
http://codereview.appspot.com/6744056
2012-10-21 12:04:56 -04:00
Russ Cox
0cfb376070
fix clang warnings reported by Tuncer Ayaz
...
R=rsc
http://codereview.appspot.com/6744054
2012-10-21 11:25:08 -04:00
Russ Cox
caade78487
lib9: fix Mac warning
...
R=rsc
http://codereview.appspot.com/6749053
2012-10-20 13:42:39 -04:00
Russ Cox
220c15d2b7
fix gcc 4.7 warnings (thanks Tuncer Ayaz)
...
R=rsc
http://codereview.appspot.com/6744053
2012-10-20 13:36:52 -04:00
Rob Kroeger
c3feb5c5c1
libframe: use correct text color when painting
...
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6625065
2012-10-16 13:57:43 -04:00
Rob Kroeger
ef99c9f1ae
devdraw: MacBook retina support
...
Enable with export devdrawretina=1 (everything will be smaller).
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6592072
2012-10-16 13:55:44 -04:00
Russ Cox
60a47420a8
devdraw: prefer 24-bit over 15-bit or 16-bit.
...
Fixes remote X11 use via XQuartz 2.7.4.
R=rsc
http://codereview.appspot.com/6624058
2012-10-07 09:48:47 -04:00
Erik Quanstrom
5b6028903d
acme: correct writes of runes on auspicious byte boundaries
...
R=rsc, r
CC=plan9port.codebot
http://codereview.appspot.com/6586067
2012-10-05 16:42:25 -04:00
Akshat Kumar
ac3ba726f9
src/cmd: Add a repurposed import(4), called `9import', to the ports.
...
The code is adapted from Plan 9's import(4); this allows us to speak
that protocol. We don't currently support AAN (in the works) or
TLS/SSL.
Thanks to David for help with the man page, testing, and development.
R=0intro, rsc
CC=plan9port.codebot
http://codereview.appspot.com/6458100
2012-09-24 10:35:01 -04:00
Russ Cox
37f8ed2410
acme: mouse movement for Del
...
If the mouse was in the tag of the old window,
it was most likely pointing at Del. If bringing up a
new window from below and not moving the mouse
somewhere else, adjust it so that it ends up pointing
at Del in the replacement window's tag too.
This makes it easy to Del a sequence of windows in
a column, from top to bottom.
http://www.youtube.com/watch?v=ET8w6RT6u5M
R=r
http://codereview.appspot.com/6558047
2012-09-23 22:01:56 -04:00
Russ Cox
9dbe4a0df9
snarfer: disable during build
...
Don't want to require X11 during OS X build anymore.
R=rsc
http://codereview.appspot.com/6531045
2012-09-18 11:39:24 -04:00
Russ Cox
85504cda14
sam: add $% as an alias for $samfile
...
R=r
http://codereview.appspot.com/6488137
2012-09-17 14:53:11 -04:00
Russ Cox
54bebe6a69
libdraw: add visibleclicks mode
...
R=rsc
http://codereview.appspot.com/6501137
2012-09-17 12:39:49 -04:00