Sigrid Solveig Haflínudóttirfix warnings on NetBSD buildbb423b81 year agoHistory
53 lines · 985 B · C
RawDownload
#include "platform.h"#include "brieflz.h" intmain(int argc, char **argv){	unsigned long sz;	int n, level; 	level = 9;	if(argc == 2 && argv[1][0] == '-' && isdigit((unsigned)argv[1][1])){		level = atoi(argv[1]+1);		argc--;	}	if(argc != 1)		abort(); 	u8int *in = nil;	unsigned long max = 32768;	for(sz = 0;; sz += n){		if(max < sz+65536){			max *= 2;			if((in = realloc(in, max)) == nil)				abort();		}		if((n = read(0, in+sz, max-sz)) < 0)			abort();		if(n == 0)			break;	}	if(sz == sizeof(in))		abort();	u8int *out = malloc(1+4+blz_max_packed_size(sz));	if(out == nil)		abort();	u8int *w = malloc(blz_workmem_size_level(sz, level));	if(w == nil)		abort();	unsigned long osz = blz_pack_level(in, out+1+4, sz, w, level);	if(osz == BLZ_ERROR)		abort();	out[0] = 0;	out[1] = sz >> 0;	out[2] = sz >> 8;	out[3] = sz >> 16;	out[4] = sz >> 24;	osz += 1+4;	if((unsigned long)write(1, out, osz) != osz)		abort();	free(w);	free(out);	exits(nil);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t