Browse code

Fixes from Sigrid for plan9

neauoire authored on 16/03/2021 16:01:47
Showing 3 changed files
... ...
@@ -448,12 +448,18 @@ int
448 448
 main(int argc, char *argv[])
449 449
 {
450 450
 	FILE *f;
451
-	if(argc < 3)
452
-		return error("Input", "Missing");
453
-	if(!(f = fopen(argv[1], "r")))
454
-		return error("Open", "Failed");
455
-	if(!pass1(f) || !pass2(f))
456
-		return error("Assembly", "Failed");
451
+	if(argc < 3) {
452
+		error("Input", "Missing");
453
+		return 1;
454
+	}
455
+	if(!(f = fopen(argv[1], "r"))) {
456
+		error("Open", "Failed");
457
+		return 1;
458
+	}
459
+	if(!pass1(f) || !pass2(f)) {
460
+		error("Assembly", "Failed");
461
+		return 1;
462
+	}
457 463
 	fwrite(p.data, sizeof(p.data), 1, fopen(argv[2], "wb"));
458 464
 	fclose(f);
459 465
 	cleanup(argv[2]);
... ...
@@ -58,13 +58,13 @@ Uint8 icons[][8] = {
58 58
 	{0x00, 0x7e, 0x40, 0x7c, 0x40, 0x40, 0x7e, 0x00},
59 59
 	{0x00, 0x7e, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x00}};
60 60
 
61
-SDL_Window *gWindow;
62
-SDL_Renderer *gRenderer;
63
-SDL_Texture *gTexture;
64
-Uint32 *pixels;
61
+static SDL_Window *gWindow;
62
+static SDL_Renderer *gRenderer;
63
+static SDL_Texture *gTexture;
64
+static Uint32 *pixels;
65 65
 
66
-Screen screen;
67
-Device *devscreen, *devmouse, *devkey, *devctrl;
66
+static Screen screen;
67
+static Device *devscreen, *devmouse, *devkey, *devctrl;
68 68
 
69 69
 #pragma mark - Helpers
70 70
 
... ...
@@ -252,6 +252,7 @@ init(void)
252 252
 	if(!(pixels = (Uint32 *)malloc(WIDTH * HEIGHT * sizeof(Uint32))))
253 253
 		return error("Pixels", "Failed to allocate memory");
254 254
 	clear(pixels);
255
+	SDL_StartTextInput();
255 256
 	SDL_ShowCursor(SDL_DISABLE);
256 257
 	screen.bounds.x1 = PAD * 8;
257 258
 	screen.bounds.x2 = WIDTH - PAD * 8 - 1;
... ...
@@ -385,7 +386,7 @@ sprite_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
385 386
 Uint8
386 387
 file_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
387 388
 {
388
-	char *name = &m[(m[ptr + 8] << 8) + m[ptr + 8 + 1]];
389
+	char *name = (char *)&m[(m[ptr + 8] << 8) + m[ptr + 8 + 1]];
389 390
 	Uint16 length = (m[ptr + 8 + 2] << 8) + m[ptr + 8 + 3];
390 391
 	if(b0 == 0x0d) {
391 392
 		Uint16 addr = (m[ptr + 8 + 4] << 8) + b1;
... ...
@@ -196,8 +196,8 @@ int
196 196
 bootuxn(Uxn *u)
197 197
 {
198 198
 	size_t i;
199
-	char *cptr = (char *)&u;
200
-	for(i = 0; i < sizeof u; i++)
199
+	char *cptr = (char *)u;
200
+	for(i = 0; i < sizeof(*u); i++)
201 201
 		cptr[i] = 0;
202 202
 	return 1;
203 203
 }