@@ -145,56 +145,20 @@ extern "C" void MCByteStoreByteOf(MCDataRef p_value, index_t p_index, MCDataRef&
145145 MCByteStoreByteRangeOf (p_value, p_index, p_index, x_target);
146146}
147147
148- extern " C" void MCByteStoreAfterByteOf (MCDataRef p_value, index_t p_index , MCDataRef& x_target )
148+ extern " C" bool MCByteRepeatForEachByte ( void *& x_iterator, MCDataRef& r_iterand , MCDataRef p_data )
149149{
150- uindex_t t_start, t_count;
151- MCChunkGetExtentsOfByteChunkByExpression (x_target, p_index, t_start, t_count);
152-
153- if (t_count == 0 )
154- return ;
155-
156- if (t_start + t_count > MCDataGetLength (x_target))
157- return ;
158-
159- t_start += t_count;
160-
161- MCAutoDataRef t_data;
162- if (!MCDataMutableCopy (x_target, &t_data))
163- return ;
164-
165- if (!MCDataInsert (*t_data, t_start, p_value))
166- return ;
167-
168- MCAutoDataRef t_new_data;
169- if (!MCDataCopy (*t_data, &t_new_data))
170- return ;
171-
172- MCValueAssign (x_target, *t_new_data);
173- }
174-
175- extern " C" void MCByteStoreBeforeByteOf (MCDataRef p_value, index_t p_index, MCDataRef& x_target)
176- {
177- uindex_t t_start, t_count;
178- MCChunkGetExtentsOfByteChunkByRange (x_target, p_index, p_index, t_start, t_count);
179-
180- if (t_count == 0 )
181- return ;
182-
183- if (t_start + t_count > MCDataGetLength (x_target))
184- return ;
150+ uindex_t t_offset;
151+ t_offset = (uindex_t )x_iterator;
185152
186- MCAutoDataRef t_data;
187- if (!MCDataMutableCopy (x_target, &t_data))
188- return ;
153+ if (t_offset == MCDataGetLength (p_data))
154+ return false ;
189155
190- if (!MCDataInsert (*t_data, t_start, p_value ))
191- return ;
156+ if (!MCDataCopyRange (p_data, MCRangeMake (t_offset, 1 ), r_iterand ))
157+ return false ;
192158
193- MCAutoDataRef t_new_data;
194- if (!MCDataCopy (*t_data, &t_new_data))
195- return ;
159+ x_iterator = (void *)(t_offset + 1 );
196160
197- MCValueAssign (x_target, *t_new_data) ;
161+ return true ;
198162}
199163
200164// //////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments