Convert nil int/float arguments to 0 #227
					 1 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -227,8 +227,12 @@ rb_float_arg(VALUE arg, double *out, int argPos = 0)
 | 
			
		|||
		*out = FIX2INT(arg);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case RUBY_T_NIL :
 | 
			
		||||
		*out = 0;
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
| 
					
	
 Guess I have to configure my editor to not convert tabs ... Guess I have to configure my editor to not convert tabs ... 
			
			
		Also would you happen to know what are the exact tab width etc settings for this project. Also would you happen to know what are the exact tab width etc settings for this project. 
			
			
		 | 
			||||
	default:
 | 
			
		||||
		rb_raise(rb_eTypeError, "Argument %d: Expected float", argPos);
 | 
			
		||||
		rb_raise(rb_eTypeError, "Argument %d: Expected float (got 0x%x)", argPos, rb_type(arg));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -246,8 +250,12 @@ rb_int_arg(VALUE arg, int *out, int argPos = 0)
 | 
			
		|||
		*out = FIX2INT(arg);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
        case RUBY_T_NIL :
 | 
			
		||||
                *out = 0;
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		rb_raise(rb_eTypeError, "Argument %d: Expected fixnum", argPos);
 | 
			
		||||
		rb_raise(rb_eTypeError, "Argument %d: Expected fixnum (got 0x%x)", argPos, rb_type(arg));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	
Wrong indentation (use tabs).