@@ -222,30 +222,30 @@ void rename_function(Program program, TaskMonitor monitor, long func_addr_value,
222222 void modify_function (Program program , long func_addr_value , int args_num ) {
223223 Address func_addr =program .getAddressFactory ().getDefaultAddressSpace ().getAddress (func_addr_value );
224224 Function func =program .getFunctionManager ().getFunctionAt (func_addr );
225+ int pointer_size =get_pointer_size (program );
225226 if (func ==null ) {
226227 return ;
227228 }
228- if (func .getParameterCount ()==args_num /get_pointer_size ( program ) ) {
229+ if (func .getParameterCount ()==args_num /pointer_size ) {
229230 return ;
230231 }
231232
232233 try {
233234 List <Parameter > new_params =new ArrayList <>();
234- for (int i =0 ;i <args_num /get_pointer_size (program );i ++) {
235+ for (int i =0 ;i <args_num /pointer_size ;i ++) {
236+ DataType data_type =null ;
235237 if (i <func .getParameterCount ()) {
236- new_params .add (func .getParameter (i ));
238+ data_type =func .getParameter (i ).getDataType ();
239+ }else if (pointer_size ==8 ) {
240+ data_type =new Undefined8DataType ();
237241 }else {
238- Parameter param =null ;
239- if (get_pointer_size (program )==8 ) {
240- param =new ParameterImpl (String .format ("param_%d" , i +1 ), new Undefined8DataType (), func .getProgram ());
241- }else {
242- param =new ParameterImpl (String .format ("param_%d" , i +1 ), new Undefined4DataType (), func .getProgram ());
243- }
244- new_params .add (param );
242+ data_type =new Undefined4DataType ();
245243 }
244+ Parameter param =new ParameterImpl (String .format ("param_%d" , i +1 ), data_type , (i +1 )*pointer_size , func .getProgram (), SourceType .USER_DEFINED );
245+ new_params .add (param );
246246 }
247247
248- func .updateFunction (null , null , new_params , FunctionUpdateType .DYNAMIC_STORAGE_ALL_PARAMS , true , SourceType .ANALYSIS );
248+ func .updateFunction (null , null , new_params , FunctionUpdateType .CUSTOM_STORAGE , true , SourceType .USER_DEFINED );
249249 }catch (Exception e ) {
250250 }
251251 }
0 commit comments