Skip to content

Commit 8df8098

Browse files
committed
Merge pull request #44 from chrisws/0_11_20
0 12 6
2 parents e42228b + c2120b3 commit 8df8098

File tree

8 files changed

+55
-17
lines changed

8 files changed

+55
-17
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
SUBDIRS = @BUILD_SUBDIRS@
99

1010
deb:
11-
fakeroot dpkg-buildpackage -b
11+
fakeroot dpkg-buildpackage -b -uc -us
1212

1313
test:
1414
(cd @TEST_DIR@ && make test)

samples/distro-examples/tests/output/trycatch.out

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,20 @@ open failed FS(2): NO SUCH FILE OR DIRECTORY
44
after try
55
catch by error name
66
outer after try
7+
8+
9+
* RTE-ERROR AT ../../../samples/distro-examples/tests/trycatch.bas:200 *
10+
Description:
11+
Division by zero
12+
13+
Stack:
14+
TRY: 199
15+
TRY: 198
16+
TRY: 197
17+
TRY: 196
18+
TRY: 195
19+
IF: 194
20+
IF: 193
21+
IF: 192
22+
SUB: 216
23+

samples/distro-examples/tests/trycatch.bas

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,29 @@ if (Found != 5) then
188188
throw "Failed: " + Found
189189
endif
190190
191+
sub stack_test
192+
if 1 == 1 then
193+
if 2 == 2 then
194+
if 3 == 3 then
195+
try
196+
try
197+
try
198+
try
199+
try
200+
a = 1 / 0
201+
catch
202+
end try
203+
catch
204+
end try
205+
catch
206+
end try
207+
catch
208+
end try
209+
catch
210+
end try
211+
fi
212+
fi
213+
fi
214+
end
191215
192-
216+
stack_test

src/common/device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ void log_printf(const char *format, ...) {
387387

388388
if (size) {
389389
char *buf = malloc(size + 3);
390+
buf[0] = '\0';
390391
va_start(args, format);
391392
vsnprintf(buf, size + 1, format, args);
392393
va_end(args);

src/common/sberr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ void rt_raise(const char *fmt, ...) {
6565

6666
// log the stack trace
6767
for (i_stack = prog_stack_count; i_stack > 0; i_stack--) {
68-
stknode_t node = prog_stack[i_stack];
68+
stknode_t node = prog_stack[i_stack - 1];
6969
switch (node.type) {
70-
case 0xFF:
71-
case kwBYREF:
72-
case kwTYPE_CRVAR:
70+
case 0xFF:
71+
case kwBYREF:
72+
case kwTYPE_CRVAR:
7373
// ignore these types
7474
break;
7575

76-
default:
76+
default:
7777
for (i_kw = 0; keyword_table[i_kw].name[0] != '\0'; i_kw++) {
7878
if (node.type == keyword_table[i_kw].code) {
7979
log_printf(" %s: %d", keyword_table[i_kw].name, node.line);

src/common/scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ void comp_get_unary(const char *p, int *ladd, int *linc, int *ldec, int *leqop)
18181818
*ladd = (strncmp(p, "<<", 2) == 0);
18191819
*linc = (strncmp(p, "++", 2) == 0);
18201820
*ldec = (strncmp(p, "--", 2) == 0);
1821-
if (p[1] == '=' && strchr("-+/\\*^%&|", p[0])) {
1821+
if (p[0] != '\0' && p[1] == '=' && strchr("-+/\\*^%&|", p[0])) {
18221822
*leqop = p[0];
18231823
} else {
18241824
*leqop = 0;

src/ui/inputs.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,9 @@ void FormInput::construct(var_p_t form, var_p_t field, int id) {
138138
}
139139

140140
const char *caption = getText();
141-
int textW = 0;
142-
int textH = 0;
143-
144-
if (caption) {
145-
MAExtent extent = maGetTextSize(caption);
146-
textW = EXTENT_X(extent);
147-
textH = EXTENT_Y(extent);
148-
}
141+
MAExtent extent = maGetTextSize(caption != NULL && caption[0] ? caption : "Z");
142+
int textW = EXTENT_X(extent);
143+
int textH = EXTENT_Y(extent);
149144

150145
if (_width <= 0 && caption != NULL) {
151146
_width = textW + padding(false);
@@ -572,7 +567,7 @@ void FormLineInput::draw(int x, int y, int w, int h, int chw) {
572567
maFillRect(px, y, width, _height);
573568
maSetColor(_bg);
574569
maDrawText(px, y, _buffer + _scroll + start, chars);
575-
} else {
570+
} else if (hasFocus()) {
576571
int px = x + (_point * chw);
577572
maFillRect(px, y, chw, _height);
578573
if (_point < len) {

src/ui/system.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@ void System::systemPrint(const char *format, ...) {
10501050

10511051
if (size) {
10521052
char *buf = (char *)malloc(size + 1);
1053+
buf[0] = '\0';
10531054
va_start(args, format);
10541055
vsnprintf(buf, size + 1, format, args);
10551056
va_end(args);

0 commit comments

Comments
 (0)