Compare commits
No commits in common. "98b469c21d7810ba17dc72c56c444a7b79668197" and "c478b339e0e353dee3c9fc432980c04d1b702d21" have entirely different histories.
98b469c21d
...
c478b339e0
28
tl-parser.c
28
tl-parser.c
@ -2823,21 +2823,11 @@ int num = 0;
|
||||
void wint (int a) {
|
||||
// printf ("%d ", a);
|
||||
a = htole32 (a);
|
||||
int r = write(__f, &a, 4);
|
||||
if (r != 4)
|
||||
{
|
||||
fprintf(stderr, "Cannot write int %d, file might be corrupted", a);
|
||||
assert(0);
|
||||
}
|
||||
assert (write (__f, &a, 4) == 4);
|
||||
}
|
||||
|
||||
void wdata (const void *x, int len) {
|
||||
int r = write(__f, x, len);
|
||||
if (r != len)
|
||||
{
|
||||
fprintf(stderr, "Cannot write data len %d, file might be corrupted", len);
|
||||
assert(0);
|
||||
}
|
||||
assert (write (__f, x, len) == len);
|
||||
}
|
||||
|
||||
void wstr (const char *s) {
|
||||
@ -2846,12 +2836,7 @@ void wstr (const char *s) {
|
||||
int x = strlen (s);
|
||||
if (x <= 254) {
|
||||
unsigned char x_c = (unsigned char)x;
|
||||
int r = write(__f, &x_c, 1);
|
||||
if (r != 1)
|
||||
{
|
||||
fprintf(stderr, "Cannot write string %s, file might be corrupted", s);
|
||||
assert(0);
|
||||
}
|
||||
assert (write (__f, &x_c, 1) == 1);
|
||||
} else {
|
||||
fprintf (stderr, "String is too big...\n");
|
||||
assert (0);
|
||||
@ -2872,12 +2857,7 @@ void wstr (const char *s) {
|
||||
void wll (long long a) {
|
||||
// printf ("%lld ", a);
|
||||
a = htole64 (a);
|
||||
int r = write(__f, &a, 8);
|
||||
if (r != 8)
|
||||
{
|
||||
fprintf(stderr, "Cannot write long long %lld, file might be corrupted", a);
|
||||
assert(0);
|
||||
}
|
||||
assert (write (__f, &a, 8) == 8);
|
||||
}
|
||||
|
||||
int count_list_size (struct tl_combinator_tree *T) {
|
||||
|
12
tlc.c
12
tlc.c
@ -61,12 +61,7 @@ void usage (void) {
|
||||
int vkext_write (const char *filename) {
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
int f = 0;
|
||||
int r = _sopen_s(&f, filename, _O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
if (r != 0)
|
||||
{
|
||||
fprintf(stderr, "Cannot write file %s\n", filename);
|
||||
return -1;
|
||||
}
|
||||
assert(_sopen_s(&f, filename, _O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE) == 0);
|
||||
#elif defined(WIN32) || defined(_WIN32)
|
||||
int f = open(filename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0640);
|
||||
assert(f >= 0);
|
||||
@ -74,11 +69,6 @@ int vkext_write (const char *filename) {
|
||||
int f = open (filename, O_CREAT | O_WRONLY | O_TRUNC, 0640);
|
||||
assert (f >= 0);
|
||||
#endif
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr, "Cannot write file %s\n", filename);
|
||||
return -1;
|
||||
}
|
||||
write_types (f);
|
||||
close (f);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user