code cleanup: remove redundant casts. quiet some qualifier warnings.

This commit is contained in:
Campbell Barton 2012-10-14 07:40:16 +00:00
parent 76e2706b30
commit 27e54f4d37
22 changed files with 46 additions and 45 deletions

@ -89,7 +89,7 @@ getNumDisplaySettings(
#else
/* We only have one X11 setting at the moment. */
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings = GHOST_TInt32(1);
numSettings = 1;
#endif
return GHOST_kSuccess;
@ -160,7 +160,7 @@ getCurrentDisplaySetting(
/* According to the xf86vidmodegetallmodelines man page,
* "The first element of the array corresponds to the current video mode."
*/
return getDisplaySetting(display, GHOST_TInt32(0), setting);
return getDisplaySetting(display, 0, setting);
}

@ -1456,7 +1456,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
/* check size and format of the property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
&pty_items, &pty_size, &buffer);
if (pty_format != 8) {
/* property does not contain text, delete it
@ -1484,7 +1484,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
* text, we know the size. */
XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
&pty_items, &pty_size, &buffer);
/* allocate memory to accommodate data in *txt */
if (*len == 0) {
@ -1538,12 +1538,12 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
if (sseln == m_clipboard) {
sel_buf = (unsigned char *)malloc(strlen(txt_cut_buffer) + 1);
strcpy((char *)sel_buf, txt_cut_buffer);
return((GHOST_TUns8 *)sel_buf);
return sel_buf;
}
else {
sel_buf = (unsigned char *)malloc(strlen(txt_select_buffer) + 1);
strcpy((char *)sel_buf, txt_select_buffer);
return((GHOST_TUns8 *)sel_buf);
return sel_buf;
}
}
else if (owner == None)
@ -1594,7 +1594,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
else
free(sel_buf);
return (GHOST_TUns8 *)tmp_data;
return tmp_data;
}
return(NULL);
}

@ -59,34 +59,34 @@ MINLINE float saacos(float fac)
{
if (fac <= -1.0f) return (float)M_PI;
else if (fac >= 1.0f) return 0.0;
else return (float)acos(fac);
else return acosf(fac);
}
MINLINE float saasin(float fac)
{
if (fac <= -1.0f) return (float)-M_PI / 2.0f;
else if (fac >= 1.0f) return (float)M_PI / 2.0f;
else return (float)asin(fac);
else return asinf(fac);
}
MINLINE float sasqrt(float fac)
{
if (fac <= 0.0f) return 0.0f;
return (float)sqrt(fac);
return sqrtf(fac);
}
MINLINE float saacosf(float fac)
{
if (fac <= -1.0f) return (float)M_PI;
else if (fac >= 1.0f) return 0.0f;
else return (float)acosf(fac);
else return acosf(fac);
}
MINLINE float saasinf(float fac)
{
if (fac <= -1.0f) return (float)-M_PI / 2.0f;
else if (fac >= 1.0f) return (float)M_PI / 2.0f;
else return (float)asinf(fac);
else return asinf(fac);
}
MINLINE float sasqrtf(float fac)

@ -50,7 +50,7 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re
this->m_context.setbNodeTree(editingtree);
this->m_context.setFastCalculation(fastcalculation);
bNode *gnode;
for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) {
for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = gnode->next) {
if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) {
this->m_context.setActivegNode(gnode);
break;

@ -51,7 +51,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star
while (node != NULL) {
Node *nnode = addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation());
nnode->setbNodeGroup(groupnode);
node = (bNode *)node->next;
node = node->next;
}
NodeRange node_range(nodes.begin() + nodes_start, nodes.end());
@ -60,7 +60,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star
bNodeLink *nodelink = (bNodeLink *)tree->links.first;
while (nodelink != NULL) {
addNodeLink(node_range, links, nodelink);
nodelink = (bNodeLink *)nodelink->next;
nodelink = nodelink->next;
}
/* Expand group nodes */

@ -51,7 +51,7 @@ Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
input = (bNodeSocket *)input->next;
input = input->next;
}
bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
while (output != NULL) {
@ -60,14 +60,14 @@ Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addOutputSocket(dt, output);
output = (bNodeSocket *)output->next;
output = output->next;
}
}
}
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
SetValueOperation *operation = new SetValueOperation();
bNodeSocketValueFloat *val = (bNodeSocketValueFloat *)bSock->default_value;
operation->setValue(val->value);
@ -114,7 +114,7 @@ SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSock
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
SetColorOperation *operation = new SetColorOperation();
bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)bSock->default_value;
operation->setChannel1(val->value[0]);
@ -127,7 +127,7 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
bNodeSocket *bSock = this->getEditorInputSocket(editorNodeInputSocketIndex);
bNodeSocketValueVector *val = (bNodeSocketValueVector *)bSock->default_value;
SetVectorOperation *operation = new SetVectorOperation();
operation->setX(val->value[0]);

@ -74,7 +74,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
{
cl_int error;
MemoryBuffer *result = (MemoryBuffer *)reader->getInputMemoryBuffer(inputMemoryBuffers);
MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers);
const cl_image_format imageFormat = {
CL_RGBA,

@ -79,7 +79,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
CompositorQuality quality = context->getQuality();
/* initialize node data */
NodeBlurData *data = (NodeBlurData *)&this->m_alpha_blur;
NodeBlurData *data = &this->m_alpha_blur;
memset(data, 0, sizeof(*data));
data->filtertype = R_FILTER_GAUSS;

@ -151,7 +151,7 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext
CompositorQuality quality = context->getQuality();
/* initialize node data */
NodeBlurData *data = (NodeBlurData *)&this->m_alpha_blur;
NodeBlurData *data = &this->m_alpha_blur;
memset(data, 0, sizeof(*data));
data->filtertype = R_FILTER_GAUSS;

@ -64,8 +64,8 @@ void ConvertDepthToRadiusOperation::initExecution()
this->m_inverseFocalDistance = 1.0f / focalDistance;
this->m_aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
float minsz = min(getWidth(), getHeight());
this->m_dof_sp = (float)minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
const float minsz = min(getWidth(), getHeight());
this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
if (this->m_blurPostOperation) {
m_blurPostOperation->setSigma(min(m_aperture * 128.0f, this->m_maxRadius));

@ -128,8 +128,8 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign
// XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
// so just skiping blur along faulty direction if src's def is below that limit!
if (src_width < 3) xy &= ~(int) 1;
if (src_height < 3) xy &= ~(int) 2;
if (src_width < 3) xy &= ~1;
if (src_height < 3) xy &= ~2;
if (xy < 1) return;
// see "Recursive Gabor Filtering" by Young/VanVliet

@ -79,9 +79,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
sc = 2.13;
isc = -0.97;
for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
v = (float)(y + 0.5f) / (float)gbuf->getHeight();
v = ((float)y + 0.5f) / (float)gbuf->getHeight();
for (x = 0; x < gbuf->getWidth(); x++) {
u = (float)(x + 0.5f) / (float)gbuf->getWidth();
u = ((float)x + 0.5f) / (float)gbuf->getWidth();
s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f;
tbuf1->readCubic(c, s * gbuf->getWidth(), t * gbuf->getHeight());
sm = smoothMask(s, t);
@ -100,9 +100,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
memset(tbuf1->getBuffer(), 0, tbuf1->getWidth() * tbuf1->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float));
for (n = 1; n < settings->iter && (!breaked); n++) {
for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
v = (float)(y + 0.5f) / (float)gbuf->getHeight();
v = ((float)y + 0.5f) / (float)gbuf->getHeight();
for (x = 0; x < gbuf->getWidth(); x++) {
u = (float)(x + 0.5f) / (float)gbuf->getWidth();
u = ((float)x + 0.5f) / (float)gbuf->getWidth();
tc[0] = tc[1] = tc[2] = 0.f;
for (p = 0; p < 4; p++) {
np = (n << 2) + p;

@ -73,7 +73,7 @@ void MaskOperation::initExecution()
for (masklay = (MaskLayer *)mask_temp->masklayers.first;
masklay;
masklay = (MaskLayer *)masklay->next)
masklay = masklay->next)
{
masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, this->m_frame_number);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);

@ -115,10 +115,10 @@ public:
if (!this->m_bufferCalculated[offset]) {
//float overscan = 0.0f;
float w = (float)this->m_width /* / (1 + overscan) */;
float h = (float)this->m_height /* / (1 + overscan) */;
float aspx = (float)w / this->m_calibration_width;
float aspy = (float)h / this->m_calibration_height;
const float w = (float)this->m_width /* / (1 + overscan) */;
const float h = (float)this->m_height /* / (1 + overscan) */;
const float aspx = w / (float)this->m_calibration_width;
const float aspy = h / (float)this->m_calibration_height;
float in[2];
float out[2];

@ -98,7 +98,7 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
const float sd = 1.0f / (float)ds;
for (z = 0; z < ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
const float tz = (z + (jit ? BLI_frand() : 0.5f)) * sd;
t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot;
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;
@ -116,7 +116,7 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
const float sd = 1.0f / (float)ds;
for (z = 0; z < ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
const float tz = (z + (jit ? BLI_frand() : 0.5f)) * sd;
t = 1.0f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;

@ -192,7 +192,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
cl_int maxBlur;
cl_float threshold = this->m_threshold;
MemoryBuffer *sizeMemoryBuffer = (MemoryBuffer *)this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers);
MemoryBuffer *sizeMemoryBuffer = this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers);
const float max_dim = max(m_width, m_height);
cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;

@ -557,7 +557,7 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
select = !RNA_boolean_get(op->ptr, "deselect");
do_lasso_select_mask(C, mcords, mcords_tot, select);
MEM_freeN(mcords);
MEM_freeN((void *)mcords);
return OPERATOR_FINISHED;
}

@ -44,6 +44,7 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_rect.h"
#include "GPU_extensions.h"
@ -692,7 +693,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf, const unsign
context->start_frame = clip->start_frame;
context->frame_offset = clip->frame_offset;
strcpy(context->colorspace, clip->colorspace_settings.name);
BLI_strncpy(context->colorspace, clip->colorspace_settings.name, sizeof(context->colorspace));
}
else {
/* displaying exactly the same image which was loaded t oa texture,

@ -476,7 +476,7 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
select = !RNA_boolean_get(op->ptr, "deselect");
do_lasso_select_marker(C, mcords, mcords_tot, select);
MEM_freeN(mcords);
MEM_freeN((void *)mcords);
return OPERATOR_FINISHED;
}

@ -593,7 +593,7 @@ static int node_lasso_select_exec(bContext *C, wmOperator *op)
select = !RNA_boolean_get(op->ptr, "deselect");
do_lasso_select_node(C, mcords, mcords_tot, select);
MEM_freeN(mcords);
MEM_freeN((void *)mcords);
return OPERATOR_FINISHED;
}

@ -943,7 +943,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
select = !RNA_boolean_get(op->ptr, "deselect");
view3d_lasso_select(C, &vc, mcords, mcords_tot, extend, select);
MEM_freeN(mcords);
MEM_freeN((void *)mcords);
return OPERATOR_FINISHED;
}

@ -2829,7 +2829,7 @@ static int uv_lasso_select_exec(bContext *C, wmOperator *op)
select = !RNA_boolean_get(op->ptr, "deselect");
change = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select);
MEM_freeN(mcords);
MEM_freeN((void *)mcords);
return change ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}