File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,11 @@ impl<O: ArrowNativeType> OffsetBufferBuilder<O> {
70
70
///
71
71
/// Panics if offsets overflow `O`
72
72
pub fn finish_cloned ( & self ) -> OffsetBuffer < O > {
73
- O :: from_usize ( self . last_offset ) . expect ( "overflow" ) ;
74
- unsafe { OffsetBuffer :: new_unchecked ( self . offsets . clone ( ) . into ( ) ) }
73
+ let cloned = Self {
74
+ offsets : self . offsets . clone ( ) ,
75
+ last_offset : self . last_offset ,
76
+ } ;
77
+ cloned. finish ( )
75
78
}
76
79
}
77
80
Original file line number Diff line number Diff line change @@ -127,16 +127,16 @@ unsafe fn set_upto_64bits(
127
127
}
128
128
129
129
/// # Safety
130
- /// The caller must ensure all arguments are within the valid range.
130
+ /// The caller must ensure `data` has `offset..(offset + 8)` range, and `count <= 8` .
131
131
#[ inline]
132
132
unsafe fn read_bytes_to_u64 ( data : & [ u8 ] , offset : usize , count : usize ) -> u64 {
133
133
debug_assert ! ( count <= 8 ) ;
134
- let mut tmp = std :: mem :: MaybeUninit :: < u64 > :: new ( 0 ) ;
134
+ let mut tmp: u64 = 0 ;
135
135
let src = data. as_ptr ( ) . add ( offset) ;
136
136
unsafe {
137
- std:: ptr:: copy_nonoverlapping ( src, tmp. as_mut_ptr ( ) as * mut u8 , count) ;
138
- tmp. assume_init ( )
137
+ std:: ptr:: copy_nonoverlapping ( src, & mut tmp as * mut _ as * mut u8 , count) ;
139
138
}
139
+ tmp
140
140
}
141
141
142
142
/// # Safety
You can’t perform that action at this time.
0 commit comments