From 3adc04030590b61e935727d66a886d28dac1745b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 19:16:18 +0000 Subject: [PATCH] Add change protype of ntfs_attr_pwrite: make @b const. --- include/ntfs/attrib.h | 2 +- libntfs/attrib.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index d11b1217..57980249 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -267,7 +267,7 @@ extern void ntfs_attr_close(ntfs_attr *na); extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b); extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, - void *b); + const void *b); extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, const u32 bk_size, void *dst); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 20aad66b..75867e35 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -878,7 +878,7 @@ rl_err_out: * appropriately to the return code of ntfs_pwrite(), or to EINVAL in case of * invalid arguments. */ -s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) +s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) { s64 written, to_write, ofs, total, old_initialized_size, old_data_size; ntfs_volume *vol; @@ -1073,7 +1073,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) written = to_write / sizeof(unsigned long); eo = 0; for (t = 0; t < written; t++) { - if (((unsigned long*)b)[t]) { + if (((const unsigned long*)b)[t]) { eo = 1; break; } @@ -1081,9 +1081,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) cnt = to_write & (sizeof(unsigned long) - 1); if (cnt && !eo) { int i; - u8 *b2; + const u8 *b2; - b2 = (u8*)b + (to_write & + b2 = (const u8*)b + (to_write & ~(sizeof(unsigned long) - 1)); for (i = 0; i < cnt; i++) { if (b2[i]) { @@ -1099,7 +1099,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ total += to_write; count -= to_write; - b = (u8*)b + to_write; + b = (const u8*)b + to_write; continue; } /* The buffer is non zero, instantiate the hole. */ @@ -1250,7 +1250,7 @@ retry: if (written > 0) { total += written; count -= written; - b = (u8*)b + written; + b = (const u8*)b + written; continue; } /* If the syscall was interrupted, try again. */