Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2009, 4:03:59 PM (15 years ago)
Author:
rgrieder
Message:

Found even more casts. They sure aren't all of them, but I hope to have caught every pointer C-style cast because they can be very dangerous.
Note: I didn't do the pointer casts in the network library because that would have taken way too long.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/tools/Shader.cc

    r3196 r3301  
    165165            if (pointer->first)
    166166            {
    167                 if ((*((float*)pointer->second)) != value)
    168                 {
    169                     (*((float*)pointer->second)) = value;
     167                if ((*static_cast<float*>(pointer->second)) != value)
     168                {
     169                    (*static_cast<float*>(pointer->second)) = value;
    170170                    return true;
    171171                }
     
    173173            else
    174174            {
    175                 if ((*((int*)pointer->second)) != (int)value)
    176                 {
    177                     (*((int*)pointer->second)) = (int)value;
     175                if ((*static_cast<int*>(pointer->second)) != static_cast<int>(value))
     176                {
     177                    (*static_cast<int*>(pointer->second)) = static_cast<int>(value);
    178178                    return true;
    179179                }
     
    190190            if (pointer->first)
    191191            {
    192                 if ((*((float*)pointer->second)) != (float)value)
    193                 {
    194                     (*((float*)pointer->second)) = (float)value;
     192                if ((*static_cast<float*>(pointer->second)) != static_cast<float>(value))
     193                {
     194                    (*static_cast<float*>(pointer->second)) = static_cast<float>(value);
    195195                    return true;
    196196                }
     
    198198            else
    199199            {
    200                 if ((*((int*)pointer->second)) != value)
    201                 {
    202                     (*((int*)pointer->second)) = value;
     200                if ((*static_cast<int*>(pointer->second)) != value)
     201                {
     202                    (*static_cast<int*>(pointer->second)) = value;
    203203                    return true;
    204204                }
     
    214214        {
    215215            if (pointer->first)
    216                 return (*((float*)pointer->second));
     216                return (*static_cast<float*>(pointer->second));
    217217            else
    218                 return static_cast<float>(*((int*)pointer->second));
     218                return static_cast<float>(*static_cast<int*>(pointer->second));
    219219        }
    220220        else
     
    309309                        {
    310310                            void* temp = (definition_iterator->second.isFloat())
    311                                             ? (void*)parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex)
    312                                             : (void*)parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex);
     311                                            ? static_cast<void*>(parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex))
     312                                            : static_cast<void*>(parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex));
    313313                            ParameterPointer parameter_pointer = ParameterPointer(definition_iterator->second.isFloat(), temp);
    314314
Note: See TracChangeset for help on using the changeset viewer.