Skip to content

Commit 9ad78e6

Browse files
committed
fix build
1 parent c2d7f74 commit 9ad78e6

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

libcc2rs/src/inc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<T> UnsafePostfixInc for *const T {
8787
#[inline]
8888
unsafe fn postfix_inc(&mut self) -> Self {
8989
let copy = *self;
90-
*self += 1;
90+
*self = self.offset(1);
9191
copy
9292
}
9393
}
@@ -96,7 +96,7 @@ impl<T> UnsafePostfixInc for *mut T {
9696
#[inline]
9797
unsafe fn postfix_inc(&mut self) -> Self {
9898
let copy = *self;
99-
*self += 1;
99+
*self = self.offset(1);
100100
copy
101101
}
102102
}
@@ -111,15 +111,15 @@ pub trait UnsafePrefixInc {
111111
impl<T> UnsafePrefixInc for *const T {
112112
#[inline]
113113
unsafe fn prefix_inc(&mut self) -> Self {
114-
*self += 1;
114+
*self = self.offset(1);
115115
*self
116116
}
117117
}
118118

119119
impl<T> UnsafePrefixInc for *mut T {
120120
#[inline]
121121
unsafe fn prefix_inc(&mut self) -> Self {
122-
*self += 1;
122+
*self = self.offset(1);
123123
*self
124124
}
125125
}

libcc2rs/src/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub unsafe fn fread_unsafe(
154154
for &byte in &buffer[..n] {
155155
unsafe {
156156
*dst = byte;
157-
dst += 1;
157+
dst = dst.offset(1);
158158
}
159159
}
160160

rules/algorithm/tgt_unsafe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ unsafe fn f2<T1: Clone, T2: From<T1>>(a0: *const T1, a1: *const T1, a2: *mut T2)
1313
let mut curr = a0.clone();
1414
while curr < a1 {
1515
*outptr = (*curr).clone().into();
16-
curr += 1;
17-
outptr += 1;
16+
curr = curr.offset(1);
17+
outptr = outptr.offset(1);
1818
}
1919
outptr
2020
}

rules/stdio/tgt_refcount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn f6(a0: AnyPtr, a1: u64, a2: u64, a3: Ptr<::std::fs::File>) -> u64 {
8080

8181
for i in 0..to_fill {
8282
buffer[i] = src.read();
83-
src += 1;
83+
src = src.offset(1);
8484
}
8585

8686
let mut off = 0;

rules/stdio/tgt_unsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ unsafe fn f6(a0: *const ::libc::c_void, a1: u64, a2: u64, a3: *mut ::std::fs::Fi
8585

8686
for i in 0..to_fill {
8787
buffer[i] = *src;
88-
src += 1;
88+
src = src.offset(1);
8989
}
9090

9191
let mut off = 0;

0 commit comments

Comments
 (0)