Apply patch: ncpfs-hg-commit-431.patch

This commit is contained in:
Mario Fetka
2026-04-28 20:56:03 +02:00
parent b417a518c5
commit 4d94ea705a
96 changed files with 3398 additions and 431 deletions

View File

@@ -410,7 +410,7 @@ ncp_open_file(struct ncp_conn *conn,
}
long
ncp_close_file(struct ncp_conn *conn, const char *file_id)
ncp_close_file(struct ncp_conn *conn, const unsigned char *file_id)
{
long result;
@@ -630,7 +630,7 @@ ncp_get_trustee(struct ncp_conn *conn, u_int32_t object_id,
}
*contin = ncp_reply_word_hl(conn, 0);
*trustee = ncp_reply_byte(conn, 6);
strncpy(path, ncp_reply_data(conn, 8), len);
memcpy(path, ncp_reply_data(conn, 8), len);
path[len] = 0;
ncp_unlock_conn(conn);
return 0;
@@ -799,7 +799,7 @@ ncp_add_handle_path2(struct ncp_conn *conn,
ncp_add_byte(conn, dir_style); /* 1 = dir_base, 0xFF = no handle, 0 = handle */
if (encpath) {
if (pathlen == NCP_PATH_STD) {
int p = ncp_path_to_NW_format2(encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point);
int p = ncp_path_to_NW_format2((const char*)encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point);
if (p < 0) {
return p;
}
@@ -823,7 +823,7 @@ ncp_extract_file_info(void *structure, struct nw_info_struct *target)
memcpy(target, structure, info_struct_size);
name_len = (u_int8_t*)structure + info_struct_size;
target->nameLen = *name_len;
strncpy(target->entryName, name_len + 1, *name_len);
memcpy(target->entryName, name_len + 1, *name_len);
target->entryName[*name_len] = '\0';
}
return;
@@ -1215,9 +1215,9 @@ ncp_ren_or_mov_file_or_subdir(struct ncp_conn *conn,
}
static int
ncp_do_read(struct ncp_conn *conn, const char *file_id,
ncp_do_read(struct ncp_conn *conn, const unsigned char *file_id,
u_int32_t offset, u_int16_t to_read,
char *target, int *bytes_read)
void *target, int *bytes_read)
{
long result;
unsigned int off;
@@ -1252,11 +1252,12 @@ ncp_do_read(struct ncp_conn *conn, const char *file_id,
}
long
ncp_read(struct ncp_conn *conn, const char *file_id,
off_t offset, size_t count, char *target)
ncp_read(struct ncp_conn *conn, const unsigned char *file_id,
off_t offset, size_t count, void *itarget)
{
int bufsize = conn->i.buffer_size;
size_t already_read = 0;
u_int8_t* target = itarget;
if (!file_id || !target) {
return ERR_NULL_POINTER;
@@ -1290,7 +1291,7 @@ ncp_read(struct ncp_conn *conn, const char *file_id,
static NWCCODE
ncp_do_read_64(struct ncp_conn *conn, u_int32_t fh,
ncp_off64_t offset, size_t to_read,
void *target, size_t *bytes_read)
char *target, size_t *bytes_read)
{
long result;
unsigned int off;
@@ -1367,7 +1368,7 @@ ncp_read_64(struct ncp_conn *conn, u_int32_t fh, ncp_off64_t offset,
return 0;
}
NWCCODE ncp_read64(struct ncp_conn *conn, const char file_handle[6],
NWCCODE ncp_read64(struct ncp_conn *conn, const unsigned char file_handle[6],
ncp_off64_t offset, size_t count, void *target, size_t *readbytes) {
NWCCODE result;
@@ -1400,9 +1401,9 @@ NWCCODE ncp_read64(struct ncp_conn *conn, const char file_handle[6],
}
static int
ncp_do_write(struct ncp_conn *conn, const char *file_id,
ncp_do_write(struct ncp_conn *conn, const unsigned char *file_id,
u_int32_t offset, u_int16_t to_write,
const char *source, int *bytes_written)
const void *source, int *bytes_written)
{
long result;
@@ -1425,11 +1426,12 @@ ncp_do_write(struct ncp_conn *conn, const char *file_id,
}
long
ncp_write(struct ncp_conn *conn, const char *file_id,
off_t offset, size_t count, const char *source)
ncp_write(struct ncp_conn *conn, const unsigned char *file_id,
off_t offset, size_t count, const void *isource)
{
int bufsize = conn->i.buffer_size;
size_t already_written = 0;
const u_int8_t* source = isource;
if (!file_id || !source) {
return ERR_NULL_POINTER;
@@ -1520,7 +1522,7 @@ static NWCCODE ncp_write_64(struct ncp_conn *conn, u_int32_t fh,
return 0;
}
NWCCODE ncp_write64(struct ncp_conn *conn, const char file_handle[6],
NWCCODE ncp_write64(struct ncp_conn *conn, const unsigned char file_handle[6],
ncp_off64_t offset, size_t count, const void *target, size_t *bytes) {
NWCCODE result;
@@ -1554,8 +1556,8 @@ NWCCODE ncp_write64(struct ncp_conn *conn, const char file_handle[6],
long
ncp_copy_file(struct ncp_conn *conn,
const char source_file[6],
const char target_file[6],
const unsigned char source_file[6],
const unsigned char target_file[6],
u_int32_t source_offset,
u_int32_t target_offset,
u_int32_t count,
@@ -2940,7 +2942,7 @@ ncp_ns_open_create_entry(struct ncp_conn *conn,
/* struct nw_info_struct2 */ void* target, size_t sizeoftarget,
u_int8_t* oc_action,
u_int8_t* oc_callback,
char file_handle[6])
unsigned char file_handle[6])
{
NWCCODE result;
u_int32_t fhandle;
@@ -3484,10 +3486,10 @@ ncp_get_mount_volume_list_compat(struct ncp_conn *conn,
unsigned int *itemcnt,
void* b, size_t* blen) {
unsigned int vol;
unsigned char* buffer = b;
char* buffer = b;
unsigned int items = 0;
size_t needSize;
unsigned char* bend = buffer + *blen;
char* bend = buffer + *blen;
if (flags & 1) {
needSize = 4 + 1 + 17;
@@ -3527,7 +3529,7 @@ ncp_get_mount_volume_list_compat(struct ncp_conn *conn,
return NWE_SERVER_FAILURE;
}
*itemcnt = items;
*blen = buffer - (unsigned char*)b;
*blen = buffer - (char*)b;
return 0;
}
@@ -3667,7 +3669,7 @@ ncp_volume_list_next(NWVOL_HANDLE h,
unsigned int itemcnt;
unsigned char buffer[1024];
size_t blen = sizeof(buffer);
char* b;
unsigned char* b;
if (h->err) {
result = h->err;
@@ -3696,7 +3698,7 @@ ncp_volume_list_next(NWVOL_HANDLE h,
}
/* let's build buffer */
b = (char*)malloc(blen);
b = malloc(blen);
if (!b) {
result = ENOMEM;
goto quit;
@@ -4018,7 +4020,7 @@ ncp_ns_search_end(NWDIRLIST_HANDLE h) {
static NWCCODE ncp_get_file_size_32(
NWCONN_HANDLE conn,
const char fileHandle[6],
const unsigned char fileHandle[6],
ncp_off64_t* fileSize) {
NWCCODE result;
@@ -4069,7 +4071,7 @@ static NWCCODE ncp_get_file_size_64(
NWCCODE
ncp_get_file_size(
NWCONN_HANDLE conn,
const char fileHandle[6],
const unsigned char fileHandle[6],
ncp_off64_t* fileSize) {
NWCCODE result;