Changeset b5c2d452c919c7ae398969e5a8875858b35f2fa3

Show
Ignore:
Timestamp:
06/08/04 19:28:36 (4 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1091813316 +0000
git-parent:

[7e6650a16c7cc9ddbca73d9f0338a2fa21fc4182]

git-author:
Sam Hocevar <sam@videolan.org> 1091813316 +0000
Message:
  • Really fixed strict aliasing breakage here and there.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/audio_filter/converter/float32tos16.c

    rd1c0b83 rb5c2d45  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: float32tos16.c,v 1.14 2003/12/04 16:02:54 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    9393#else 
    9494        /* This is walken's trick based on IEEE float format. */ 
    95         float f_in = *p_in + 384.0; 
    96         int32_t i_in; 
    97         i_in = *(int32_t *)(intptr_t)&f_in; 
    98         if ( i_in > 0x43c07fff ) *p_out = 32767; 
    99         else if ( i_in < 0x43bf8000 ) *p_out = -32768; 
    100         else *p_out = i_in - 0x43c00000; 
     95        union { float f; int32_t i; } u; 
     96        u.f = *p_in + 384.0; 
     97        if ( u.i > 0x43c07fff ) *p_out = 32767; 
     98        else if ( u.i < 0x43bf8000 ) *p_out = -32768; 
     99        else *p_out = u.i - 0x43c00000; 
    101100#endif 
    102101        p_in++; p_out++; 
  • modules/audio_filter/converter/s16tofloat32.c

    rd1c0b83 rb5c2d45  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: s16tofloat32.c,v 1.7 2003/12/04 16:02:54 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    9696         * this takes 16 seconds to perform one billion conversions, instead 
    9797         * of 19 seconds for the above division. */ 
    98         int32_t i_out = *p_in + 0x43c00000
    99         float f_out = *(float *)(intptr_t)&i_out
    100         *p_out = f_out - 384.0; 
     98        union { float f; int32_t i; } u
     99        u.i = *p_in + 0x43c00000
     100        *p_out = u.f - 384.0; 
    101101#endif 
    102102 
  • modules/gui/skins2/x11/x11_window.cpp

    r394b2dc rb5c2d45  
    177177    int i_ret, i_format; 
    178178    unsigned long i, i_items, i_bytesafter; 
    179     Atom net_wm_supported, net_wm_state, net_wm_state_on_top, *p_args = NULL; 
     179    Atom net_wm_supported, net_wm_state, net_wm_state_on_top; 
     180    union { Atom *p_atom; unsigned char *p_char; } p_args; 
     181 
     182    p_args.p_atom = NULL; 
    180183 
    181184    net_wm_supported = XInternAtom( XDISPLAY, "_NET_SUPPORTED", False ); 
     
    186189                                &net_wm_supported, 
    187190                                &i_format, &i_items, &i_bytesafter, 
    188                                 (unsigned char **)(intptr_t)&p_args ); 
     191                                (unsigned char **)&p_args ); 
    189192 
    190193    if( i_ret != Success || i_items == 0 ) return; /* Not supported */ 
     
    196199    for( i = 0; i < i_items; i++ ) 
    197200    { 
    198         if( p_args[i] == net_wm_state_on_top ) break; 
    199     } 
    200  
    201     XFree( p_args ); 
     201        if( p_args.p_atom[i] == net_wm_state_on_top ) break; 
     202    } 
     203 
     204    XFree( p_args.p_atom ); 
    202205    if( i == i_items ) return; /* Not supported */ 
    203206 
  • modules/video_output/x11/xcommon.c

    r5833047 rb5c2d45  
    21882188    int i_ret, i_format; 
    21892189    unsigned long i, i_items, i_bytesafter; 
    2190     Atom net_wm_supported, *p_args = NULL; 
     2190    Atom net_wm_supported; 
     2191    union { Atom *p_atom; unsigned char *p_char; } p_args; 
     2192 
     2193    p_args.p_atom = NULL; 
    21912194 
    21922195    p_vout->p_sys->b_net_wm_state_fullscreen = VLC_FALSE; 
     
    22042207                                &net_wm_supported, 
    22052208                                &i_format, &i_items, &i_bytesafter, 
    2206                                 (unsigned char **)(intptr_t)&p_args ); 
     2209                                (unsigned char **)&p_args ); 
    22072210 
    22082211    if( i_ret != Success || i_items == 0 ) return; 
     
    22252228    for( i = 0; i < i_items; i++ ) 
    22262229    { 
    2227         if( p_args[i] == p_vout->p_sys->net_wm_state_fullscreen ) 
     2230        if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_fullscreen ) 
    22282231        { 
    22292232            msg_Dbg( p_vout, 
     
    22312234            p_vout->p_sys->b_net_wm_state_fullscreen = VLC_TRUE; 
    22322235        } 
    2233         else if( p_args[i] == p_vout->p_sys->net_wm_state_above ) 
     2236        else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_above ) 
    22342237        { 
    22352238            msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_ABOVE" ); 
    22362239            p_vout->p_sys->b_net_wm_state_above = VLC_TRUE; 
    22372240        } 
    2238         else if( p_args[i] == p_vout->p_sys->net_wm_state_below ) 
     2241        else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_below ) 
    22392242        { 
    22402243            msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_BELOW" ); 
    22412244            p_vout->p_sys->b_net_wm_state_below = VLC_TRUE; 
    22422245        } 
    2243         else if( p_args[i] == p_vout->p_sys->net_wm_state_stays_on_top ) 
     2246        else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_stays_on_top ) 
    22442247        { 
    22452248            msg_Dbg( p_vout, 
     
    22492252    } 
    22502253 
    2251     XFree( p_args ); 
     2254    XFree( p_args.p_atom ); 
    22522255} 
    22532256 
  • modules/visualization/visual/effects.c

    rd1c0b83 rb5c2d45  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: effects.c,v 1.10 2003/12/04 16:02:54 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@via.ecp.fr> 
     
    147147    for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; ) 
    148148    { 
    149         float f_in = *p_buffl + 384.0; 
    150         int32_t i_in; 
    151         i_in = *(int32_t *)(intptr_t)&f_in; 
    152         if(i_in >  0x43c07fff ) * p_buffs = 32767; 
    153         else if ( i_in < 0x43bf8000 ) *p_buffs = -32768; 
    154         else *p_buffs = i_in - 0x43c00000; 
     149        union { float f; int32_t i; } u; 
     150        u.f = *p_buffl + 384.0; 
     151        if(u.i >  0x43c07fff ) * p_buffs = 32767; 
     152        else if ( u.i < 0x43bf8000 ) *p_buffs = -32768; 
     153        else *p_buffs = u.i - 0x43c00000; 
    155154 
    156155        p_buffl++ ; p_buffs++ ;