rem: if(!sb)
add: if(!bar || !info) return B_BAD_VALUE;  if(bar->privatedata->sbinfo.double_arrows != info->double_arrows) { bar->privatedata->sbinfo.double_arrows = info->double_arrows;  int8 multiplier=(info->double_arrows)?1:-1;  if(bar->fOrientation==B_VERTICAL) bar->privatedata->thumbframe.OffsetBy(0,multiplier*B_H_SCROLL_BAR_HEIGHT); else bar->privatedata->thumbframe.OffsetBy(multiplier*B_V_SCROLL_BAR_WIDTH,0); }  bar->privatedata->sbinfo.proportional = info->proportional;      if(info->knob >= 0 && info->knob <= 2) bar->privatedata->sbinfo.knob = info->knob; else
context: status_t control_scrollbar(int8 command, void *data, BScrollBar *sb){	if(!sb)		return B_BAD_VALUE;		switch(command)	{		case 0: 	// Scroll By Value		{			if(!data)				return B_BAD_VALUE;						float datavalue=*((float *)data);			if(datavalue==0)				return B_ERROR;						if(sb->fOrientation==B_VERTICAL)			{				if(datavalue<0)				{					if(sb->fValue + datavalue >= sb->fMin)					{						sb->fValue += datavalue;						if(sb->fTarget)							sb->fTarget->ScrollBy(0,datavalue);						sb->privatedata->thumbframe.OffsetBy(0,datavalue);						sb->fValue--;						return B_OK;					}					// fall through to return B_ERROR				}				else				{					if(sb->fValue + datavalue <= sb->fMax)					{						sb->fValue += datavalue;						if(sb->fTarget)							sb->fTarget->ScrollBy(0,datavalue);						sb->privatedata->thumbframe.OffsetBy(0,datavalue);						sb->fValue++;						return B_OK;					}					// fall through to return B_ERROR				}			}			else			{				if(datavalue<0)				{					if(sb->fValue + datavalue >= sb->fMin)					{						sb->fValue += datavalue;						if(sb->fTarget)							sb->fTarget->ScrollBy(datavalue,0);						sb->privatedata->thumbframe.OffsetBy(datavalue,0);						sb->fValue--;						return B_OK;					}					// fall through to return B_ERROR				}				else				{					if(sb->fValue + datavalue <= sb->fMax)					{						sb->fValue += datavalue;						if(sb->fTarget)							sb->fTarget->ScrollBy(datavalue,0);						sb->privatedata->thumbframe.OffsetBy(datavalue,0);						sb->fValue++;						return B_OK;					}					// fall through to return B_ERROR				}			}			return B_ERROR;		}// end case 0 (Scroll By Value)				case 1:		// Set Double		{			if(!data)				return B_BAD_VALUE;			bool datavalue=*((bool *)data);			if(sb->privatedata->sbinfo.double_arrows==datavalue)				return B_OK;			sb->privatedata->sbinfo.double_arrows=datavalue;						int8 multiplier=(datavalue)?1:-1;						if(sb->fOrientation==B_VERTICAL)				sb->privatedata->thumbframe.OffsetBy(0,multiplier*B_H_SCROLL_BAR_HEIGHT);			else				sb->privatedata->thumbframe.OffsetBy(multiplier*B_V_SCROLL_BAR_WIDTH,0);			return B_OK;		}				case 2:		// Set Proportional		{			// TODO: Figure out how proportional relates to the size of the thumb						if(!data)				return B_BAD_VALUE;						bool datavalue=*((bool *)data);			sb->privatedata->sbinfo.proportional=datavalue;			return B_OK;		}				case 3:		// Set Style		{			// TODO: Add redraw code to reflect the changes			if(!data)				return B_BAD_VALUE;						int8 datavalue=*((int8 *)data);						if(datavalue!=0 && datavalue!=1 && datavalue!=2)				return B_BAD_VALUE;						sb->privatedata->sbinfo.knob=datavalue;			return B_OK;		}				default:		{			printf("Unknown command value %d in control_scrollbar\n",command);			break;		}	} // end command switch			// We should never get here unless I've done something dumb in calling the function	return B_BAD_VALUE;}