Changeset 17

Show
Ignore:
Timestamp:
02/17/08 20:47:58 (6 months ago)
Author:
Chris Miller
Message:

Minor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/win32/dfl/control.d

    r16 r17  
    800800            if(!i) 
    801801                children = children[1 .. children.length]; 
    802             if(i == children.length - 1) 
     802            else if(i == children.length - 1) 
    803803                children = children[0 .. i]; 
    804804            else 
  • trunk/win32/dfl/internal/com.d

    r14 r17  
    66 
    77private import dfl.internal.winapi, dfl.internal.wincom, dfl.internal.dlib; 
     8 
     9 
     10version(DFL_TANGO_SEEK_COMPAT) 
     11{ 
     12} 
     13else 
     14{ 
     15    version = DFL_TANGO_NO_SEEK_COMPAT; 
     16} 
    817 
    918 
     
    2029package class DflComObject: ComObject 
    2130{ 
    22     extern (Windows): 
     31    extern(Windows): 
    2332     
    2433    override ULONG AddRef() 
     
    112121            version(Tango) 
    113122            { 
    114                 written = stm.write(pv[0 .. cb]); 
     123                auto outstm = cast(DOutputStream)stm; 
     124                if(!outstm) 
     125                    return E_NOTIMPL; 
     126                written = outstm.write(pv[0 .. cb]); 
    115127            } 
    116128            else 
    117129            { 
     130                if(!stm.writeable) 
     131                    return E_NOTIMPL; 
    118132                written = stm.writeBlock(pv, cb); 
    119133            } 
     
    132146     
    133147     
     148    version(DFL_TANGO_NO_SEEK_COMPAT) 
     149    { 
     150    } 
     151    else 
     152    { 
     153        long _fakepos = 0; 
     154    } 
     155     
     156     
    134157    HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 
    135158    { 
    136         version(Tango) 
    137         { 
    138             auto stmseek = cast(DStream.Seek)stm; 
    139             if(!stmseek) 
    140                 return S_FALSE; // ? 
    141         } 
    142         else 
    143         { 
    144             if(!stm.seekable) 
    145                 return S_FALSE; // ? 
    146         } 
    147          
    148159        HRESULT result = S_OK; 
    149160         
     161        //printf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 
     162         
    150163        try 
    151164        { 
     
    153166            { 
    154167                long pos; 
    155                 switch(dwOrigin) 
     168                auto stmseek = cast(DSeekStream)stm; 
     169                if(!stmseek) 
    156170                { 
    157                     case STREAM_SEEK_SET: 
    158                         pos = stmseek.seek(dlibMove.QuadPart, DStream.Seek.Anchor.Begin); 
    159                         if(plibNewPosition) 
    160                             plibNewPosition.QuadPart = pos; 
    161                         break; 
    162                      
    163                     case STREAM_SEEK_CUR: 
    164                         pos = stmseek.seek(dlibMove.QuadPart, DStream.Seek.Anchor.Current); 
    165                         if(plibNewPosition) 
    166                             plibNewPosition.QuadPart = pos; 
    167                         break; 
    168                      
    169                     case STREAM_SEEK_END: 
    170                         pos = stmseek.seek(dlibMove.QuadPart, DStream.Seek.Anchor.End); 
    171                         if(plibNewPosition) 
    172                             plibNewPosition.QuadPart = pos; 
    173                         break; 
    174                      
    175                     default: 
    176                         result = STG_E_INVALIDFUNCTION; 
     171                    //return S_FALSE; // ? 
     172                    //return E_NOTIMPL; // ? 
     173                    version(DFL_TANGO_NO_SEEK_COMPAT) 
     174                    { 
     175                        //return S_FALSE; // ? 
     176                        return E_NOTIMPL; // ? 
     177                    } 
     178                    else 
     179                    { 
     180                        switch(dwOrigin) 
     181                        { 
     182                            case STREAM_SEEK_SET: 
     183                                //return S_FALSE; // ? 
     184                                return E_NOTIMPL; // ? 
     185                             
     186                            case STREAM_SEEK_CUR: 
     187                                pos = cast(long)dlibMove.QuadPart; 
     188                                if(pos < 0) 
     189                                    return E_NOTIMPL; // ? 
     190                                if(pos) 
     191                                { 
     192                                    byte[1] b1; 
     193                                    for(; pos; pos--) 
     194                                    { 
     195                                        if(1 != stm.read(b1)) 
     196                                            break; 
     197                                        _fakepos++; 
     198                                    } 
     199                                } 
     200                                if(plibNewPosition) 
     201                                    plibNewPosition.QuadPart = _fakepos; 
     202                                break; 
     203                             
     204                            case STREAM_SEEK_END: 
     205                                //return S_FALSE; // ? 
     206                                return E_NOTIMPL; // ? 
     207                             
     208                            default: 
     209                                result = STG_E_INVALIDFUNCTION; 
     210                        } 
     211                    } 
    177212                } 
     213                else 
     214                { 
     215                    switch(dwOrigin) 
     216                    { 
     217                        case STREAM_SEEK_SET: 
     218                            pos = stmseek.seek(dlibMove.QuadPart, DSeekStream.Anchor.Begin); 
     219                            if(plibNewPosition) 
     220                                plibNewPosition.QuadPart = pos; 
     221                            break; 
     222                         
     223                        case STREAM_SEEK_CUR: 
     224                            pos = stmseek.seek(dlibMove.QuadPart, DSeekStream.Anchor.Current); 
     225                            if(plibNewPosition) 
     226                                plibNewPosition.QuadPart = pos; 
     227                            break; 
     228                         
     229                        case STREAM_SEEK_END: 
     230                            pos = stmseek.seek(dlibMove.QuadPart, DSeekStream.Anchor.End); 
     231                            if(plibNewPosition) 
     232                                plibNewPosition.QuadPart = pos; 
     233                            break; 
     234                         
     235                        default: 
     236                            result = STG_E_INVALIDFUNCTION; 
     237                    } 
     238                } 
    178239            } 
    179240            else 
    180241            { 
     242                if(!stm.seekable) 
     243                    //return S_FALSE; // ? 
     244                    return E_NOTIMPL; // ? 
     245                 
    181246                ulong pos; 
    182247                switch(dwOrigin) 
     
    230295    { 
    231296        // Ignore -grfCommitFlags- and just flush the stream.. 
    232         stm.flush(); 
     297        //stm.flush(); 
     298        version(Tango) 
     299        { 
     300            auto outstm = cast(DOutputStream)stm; 
     301            if(!outstm) 
     302                return E_NOTIMPL; 
     303            outstm.flush(); 
     304        } 
     305        else 
     306        { 
     307            stm.flush(); 
     308        } 
    233309        return S_OK; // ? 
    234310    } 
  • trunk/win32/dfl/internal/dlib.d

    r15 r17  
    4545    } 
    4646    else version(DFL_TANGO0992) 
     47    { 
     48        version = DFL_TANGObefore0994; 
     49    } 
     50    else version(DFL_TANGO0993) 
    4751    { 
    4852        version = DFL_TANGObefore0994; 
     
    339343    private import tango.io.model.IConduit; 
    340344     
    341     alias tango.io.model.IConduit.IConduit DStream; 
     345    version(DFL_DSTREAM_ICONDUIT) // Disabled by default. 
     346    { 
     347        alias tango.io.model.IConduit.IConduit DStream; // Requires writability. 
     348    } 
     349    else 
     350    { 
     351        alias tango.io.model.IConduit.InputStream DStream; 
     352    } 
     353     
     354    alias tango.io.model.IConduit.OutputStream DOutputStream; 
     355     
     356    alias tango.io.model.IConduit.IConduit.Seek DSeekStream; 
    342357     
    343358    alias tango.core.Exception.IOException DStreamException; // Note: from tango.core.Exception. 
     
    450465     
    451466    alias std.stream.Stream DStream; 
     467     
     468    alias std.stream.OutputStream DOutputStream; 
    452469     
    453470    alias std.stream.StreamException DStreamException;