1 |
|
/* |
2 |
|
* extfs_amiga.cpp - MacOS file system for access native file system access, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
84 |
|
uint32 type; |
85 |
|
uint32 creator; |
86 |
|
uint16 flags; |
87 |
< |
uint16 pad0; |
87 |
> |
uint8 pad0[22]; // total size: 32 bytes to match the size of FInfo+FXInfo |
88 |
|
}; |
89 |
|
|
90 |
|
static void make_helper_path(const char *src, char *dest, const char *add, bool only_dir = false) |
221 |
|
|
222 |
|
// Read file |
223 |
|
finf_struct finf; |
224 |
< |
if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) { |
224 |
> |
if (read(fd, &finf, sizeof(finf_struct)) >= 8) { |
225 |
|
|
226 |
|
// Type/creator are in Finder info file, return them |
227 |
|
type = ntohl(finf.type); |
254 |
|
return; |
255 |
|
|
256 |
|
// Read file |
257 |
< |
finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; |
257 |
> |
finf_struct finf; |
258 |
> |
finf.flags = DEFAULT_FINDER_FLAGS; |
259 |
> |
memset(&finf, 0, sizeof(finf_struct)); |
260 |
|
read(fd, &finf, sizeof(finf_struct)); |
261 |
|
|
262 |
|
// Set Finder flags |
285 |
|
|
286 |
|
// Read Finder flags |
287 |
|
finf_struct finf; |
288 |
< |
if (read(fd, &finf, sizeof(finf_struct)) == sizeof(finf_struct)) |
288 |
> |
if (read(fd, &finf, sizeof(finf_struct)) >= 10) |
289 |
|
flags = ntohs(finf.flags); |
290 |
|
|
291 |
|
// Close file |
300 |
|
return; |
301 |
|
|
302 |
|
// Read file |
303 |
< |
finf_struct finf = {0, 0, DEFAULT_FINDER_FLAGS, 0}; |
303 |
> |
finf_struct finf; |
304 |
> |
memset(&finf, 0, sizeof(finf_struct)); |
305 |
> |
finf.flags = DEFAULT_FINDER_FLAGS; |
306 |
|
read(fd, &finf, sizeof(finf_struct)); |
307 |
|
|
308 |
|
// Set Finder flags |
347 |
|
|
348 |
|
/* |
349 |
|
* Read "length" bytes from file to "buffer", |
350 |
< |
* returns number of bytes read (or 0) |
350 |
> |
* returns number of bytes read (or -1 on error) |
351 |
|
*/ |
352 |
|
|
353 |
< |
size_t extfs_read(int fd, void *buffer, size_t length) |
353 |
> |
ssize_t extfs_read(int fd, void *buffer, size_t length) |
354 |
|
{ |
351 |
– |
errno = 0; |
355 |
|
return read(fd, buffer, length); |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
/* |
360 |
|
* Write "length" bytes from "buffer" to file, |
361 |
< |
* returns number of bytes written (or 0) |
361 |
> |
* returns number of bytes written (or -1 on error) |
362 |
|
*/ |
363 |
|
|
364 |
< |
size_t extfs_write(int fd, void *buffer, size_t length) |
364 |
> |
ssize_t extfs_write(int fd, void *buffer, size_t length) |
365 |
|
{ |
363 |
– |
errno = 0; |
366 |
|
return write(fd, buffer, length); |
367 |
|
} |
368 |
|
|