code cleanup: remove redundant casts. quiet some qualifier warnings.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 14 Oct 2012 07:40:16 +0000 (07:40 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 14 Oct 2012 07:40:16 +0000 (07:40 +0000)
22 files changed:
intern/ghost/intern/GHOST_DisplayManagerX11.cpp
intern/ghost/intern/GHOST_SystemX11.cpp
source/blender/blenlib/intern/math_base_inline.c
source/blender/compositor/intern/COM_ExecutionSystem.cpp
source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
source/blender/compositor/intern/COM_Node.cpp
source/blender/compositor/intern/COM_OpenCLDevice.cpp
source/blender/compositor/nodes/COM_DilateErodeNode.cpp
source/blender/compositor/nodes/COM_KeyingNode.cpp
source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
source/blender/compositor/operations/COM_GlareGhostOperation.cpp
source/blender/compositor/operations/COM_MaskOperation.cpp
source/blender/compositor/operations/COM_MovieDistortionOperation.h
source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
source/blender/editors/mask/mask_select.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/tracking_select.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/uvedit/uvedit_ops.c

index 0bd90854a310b6da8117a0ea9dacbfe2d1600bad..3d702c02b0fd2bd81e4fb477efc5058dd6658c49 100644 (file)
@@ -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);
 }
 
 
index 232bea6749b5e97b1ed11c43a4dfbbfcbd8a516d..3ba84e157ed4eedf6872136b73e8adbb0ecfbc8d 100644 (file)
@@ -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);
 }
index 97fc431d8fad50b8d0c04c78b5e76cfb9facc2c4..21ecfccf9d9195173b64db0b9952c653e6797629 100644 (file)
@@ -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)
index a13717c9d86a1885286bda2a3101737e53936998..0018cbbae9f0773b9b03667a57f3d60d486739aa 100644 (file)
@@ -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;
index 33a5cafebbe9b9861598b96662ffea0ec7b081c9..506bd42ace3694e8458f1fa9bb9b9d260d7c4140 100644 (file)
@@ -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 */
index 5922b0e6b0884d3dc09392904741278740c61f01..300d7ef1952eb37e896db371a546a8dd0ea5a664 100644 (file)
@@ -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]);
index d23ed245844c8683b62109e7752e197662584908..d5da079c9fd28c008bb81d0c75c2eeb5b29a016f 100644 (file)
@@ -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,
index 5cfc29ecce2f4a7bbaed97bb6dd09ee5de582a40..0fb7ea7d2646ad37b8f5c258e90bb3d2cdfeb802 100644 (file)
@@ -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;
 
index 6bc9afba32ce03eb1cd4fc8ebd352ec1b2cc6035..51ea2913e65d07ce950d581c4cc68e964e54718b 100644 (file)
@@ -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;
 
index 88289f12ebbf8a602187cd9054a13e99cfe60fa5..f6b23f6afd26336532e8466b11a82457baee15c1 100644 (file)
@@ -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));
index 2b2928c98dbe924bd91720c0d9d64f964969d789..262252f7d8ce7b648e6aca63a4244f17397e0435 100644 (file)
@@ -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
index ace04237b2993034b3c4b7dcc49bdcb8a4d8ad75..c4f8b3a0ddbe3ba6d9bd61e57535c1d48c3fca78 100644 (file)
@@ -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;
index 36b3f2023ae564325c4e68ac5d3cd7be4ef25cb1..ba1059c4eb5104aaca8ad856500d8b1689476965 100644 (file)
@@ -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);
index f3eeb2f48bac80c034ca38222c476a45c629a5be..93cc555fdbc3cac5f54fc7204db996b02f540072 100644 (file)
@@ -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];
 
index 193ab669f4097306e9093cd0490b577ff57fedf4..fd9cc1fddcb3a90343b2ab13c0b140b6485f1491 100644 (file)
@@ -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;
index 7ccc91072bcd9da8b73219de99b043309b3300ff..b8e15934c305f3ca087a251e30fce77704b5bbf1 100644 (file)
@@ -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;
index 69cfdf4e51baad2de2dece34b76168c372a1e2f5..dc204909577c30c6d1c0306eca0b87609572db05 100644 (file)
@@ -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;
        }
index 167353e7cb794bfc4af878b6607bf6e43e26a58a..b495ca3281387e9930bdb6fc276f98255c95fabe 100644 (file)
@@ -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,
index 7e3fabd1f664ae8278b66217c892f50e394aa869..feb523237baf40d943bb724c261ced734b946d59 100644 (file)
@@ -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;
        }
index b0916a50c37a13bd1c524555f6f2461087577f94..a3efa15c54a0e397bf9162828600684665c511dd 100644 (file)
@@ -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;
        }
index a111799a27cfdfd446ca9d985338bfcf6a556702..9fd7cfafae0340f6593b58a44ab8325c3d597c14 100644 (file)
@@ -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;
        }
index e3d52fcaa9b263286eefb3e5e86bcf8c41204496..e582643519780d8ced74969253d9da7208b69e96 100644 (file)
@@ -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;
        }