Skip to content

Commit 2a29316

Browse files
authored
Replace offset with increment for pointer arithmetic
1 parent 334098a commit 2a29316

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libcc2rs/src/io.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn fread_refcount(a0: AnyPtr, a1: u64, a2: u64, a3: Ptr<::std::fs::File>) ->
112112

113113
for &byte in &buffer[..n] {
114114
dst.write(byte);
115-
dst = dst.offset(1);
115+
dst += 1;
116116
}
117117

118118
read_bytes += n;
@@ -142,7 +142,7 @@ pub fn fwrite_refcount(a0: AnyPtr, a1: u64, a2: u64, a3: Ptr<::std::fs::File>) -
142142

143143
for b in buffer.iter_mut().take(to_fill) {
144144
*b = src.read();
145-
src = src.offset(1);
145+
src += 1;
146146
}
147147

148148
let mut off = 0;
@@ -193,7 +193,7 @@ pub unsafe fn fwrite_unsafe(
193193
for b in buffer.iter_mut().take(to_fill) {
194194
unsafe {
195195
*b = *src;
196-
src = src.offset(1);
196+
src += 1;
197197
}
198198
}
199199

@@ -252,7 +252,7 @@ pub unsafe fn fread_unsafe(
252252
for &byte in &buffer[..n] {
253253
unsafe {
254254
*dst = byte;
255-
dst = dst.offset(1);
255+
dst += 1;
256256
}
257257
}
258258

0 commit comments

Comments
 (0)