Changeset 17
- Timestamp:
- 02/17/08 20:47:58 (6 months ago)
- Files:
-
- trunk/win32/dfl/control.d (modified) (1 diff)
- trunk/win32/dfl/internal/com.d (modified) (6 diffs)
- trunk/win32/dfl/internal/dlib.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/control.d
r16 r17 800 800 if(!i) 801 801 children = children[1 .. children.length]; 802 if(i == children.length - 1)802 else if(i == children.length - 1) 803 803 children = children[0 .. i]; 804 804 else trunk/win32/dfl/internal/com.d
r14 r17 6 6 7 7 private import dfl.internal.winapi, dfl.internal.wincom, dfl.internal.dlib; 8 9 10 version(DFL_TANGO_SEEK_COMPAT) 11 { 12 } 13 else 14 { 15 version = DFL_TANGO_NO_SEEK_COMPAT; 16 } 8 17 9 18 … … 20 29 package class DflComObject: ComObject 21 30 { 22 extern (Windows):31 extern(Windows): 23 32 24 33 override ULONG AddRef() … … 112 121 version(Tango) 113 122 { 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]); 115 127 } 116 128 else 117 129 { 130 if(!stm.writeable) 131 return E_NOTIMPL; 118 132 written = stm.writeBlock(pv, cb); 119 133 } … … 132 146 133 147 148 version(DFL_TANGO_NO_SEEK_COMPAT) 149 { 150 } 151 else 152 { 153 long _fakepos = 0; 154 } 155 156 134 157 HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 135 158 { 136 version(Tango)137 {138 auto stmseek = cast(DStream.Seek)stm;139 if(!stmseek)140 return S_FALSE; // ?141 }142 else143 {144 if(!stm.seekable)145 return S_FALSE; // ?146 }147 148 159 HRESULT result = S_OK; 149 160 161 //printf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 162 150 163 try 151 164 { … … 153 166 { 154 167 long pos; 155 switch(dwOrigin) 168 auto stmseek = cast(DSeekStream)stm; 169 if(!stmseek) 156 170 { 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 } 177 212 } 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 } 178 239 } 179 240 else 180 241 { 242 if(!stm.seekable) 243 //return S_FALSE; // ? 244 return E_NOTIMPL; // ? 245 181 246 ulong pos; 182 247 switch(dwOrigin) … … 230 295 { 231 296 // 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 } 233 309 return S_OK; // ? 234 310 } trunk/win32/dfl/internal/dlib.d
r15 r17 45 45 } 46 46 else version(DFL_TANGO0992) 47 { 48 version = DFL_TANGObefore0994; 49 } 50 else version(DFL_TANGO0993) 47 51 { 48 52 version = DFL_TANGObefore0994; … … 339 343 private import tango.io.model.IConduit; 340 344 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; 342 357 343 358 alias tango.core.Exception.IOException DStreamException; // Note: from tango.core.Exception. … … 450 465 451 466 alias std.stream.Stream DStream; 467 468 alias std.stream.OutputStream DOutputStream; 452 469 453 470 alias std.stream.StreamException DStreamException;
