 |
Changeset 3762
- Timestamp:
- 07/19/08 16:34:08
(5 months ago)
- Author:
- larsivi
- Message:
Merged [3758]-[3761] into 0.99.7
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3635 |
r3762 |
|
| 1146 | 1146 | break; |
|---|
| 1147 | 1147 | |
|---|
| 1148 | | version (Win32) |
|---|
| 1149 | | { |
|---|
| 1150 | | case '\\': |
|---|
| 1151 | | fp[i] = '/'; |
|---|
| 1152 | | } |
|---|
| 1153 | 1148 | case FileConst.PathSeparatorChar: |
|---|
| 1154 | 1149 | if (name_ < 0) |
|---|
| 1155 | 1150 | name_ = i + 1; |
|---|
| 1156 | 1151 | break; |
|---|
| | 1152 | |
|---|
| | 1153 | case '\\': |
|---|
| | 1154 | throw new IOException ("unexpected '\\' character in path: "~path); |
|---|
| 1157 | 1155 | |
|---|
| 1158 | 1156 | version (Win32) |
|---|
| r3742 |
r3762 |
|
| 188 | 188 | double toReal () |
|---|
| 189 | 189 | { |
|---|
| 190 | | return (toInt() * M_RAN_INVM32 + (0.5 + M_RAN_INVM32 / 2)); |
|---|
| | 190 | return ((cast(int) toInt) * M_RAN_INVM32 + (0.5 + M_RAN_INVM32 / 2)); |
|---|
| 191 | 191 | } |
|---|
| 192 | 192 | |
|---|
| … | … | |
| 200 | 200 | double toRealEx () |
|---|
| 201 | 201 | { |
|---|
| 202 | | return (toInt() * M_RAN_INVM32 + (0.5 + M_RAN_INVM52 / 2) + |
|---|
| 203 | | (toInt() & 0x000FFFFF) * M_RAN_INVM52); |
|---|
| | 202 | return ((cast(int) toInt) * M_RAN_INVM32 + (0.5 + M_RAN_INVM52 / 2) + |
|---|
| | 203 | ((cast(int) toInt) & 0x000FFFFF) * M_RAN_INVM52); |
|---|
| 204 | 204 | } |
|---|
| 205 | 205 | } |
|---|
| r3680 |
r3762 |
|
| 416 | 416 | if (socket is null) |
|---|
| 417 | 417 | { |
|---|
| 418 | | socket = new SocketConduit; |
|---|
| | 418 | socket = createSocket; |
|---|
| 419 | 419 | socket.setTimeout (timeout); |
|---|
| 420 | 420 | socket.connect (address); |
|---|
| … | … | |
| 559 | 559 | // return the input buffer |
|---|
| 560 | 560 | return input; |
|---|
| 561 | | } |
|---|
| 562 | | /*********************************************************************** |
|---|
| 563 | | |
|---|
| 564 | | Make a request for the resource specified via the constructor |
|---|
| 565 | | using the specified timeout period (in micro-seconds), and a |
|---|
| 566 | | user-defined callback for pumping additional data to the host. |
|---|
| 567 | | The callback would be used when uploading data during a 'put' |
|---|
| 568 | | operation (or equivalent). The return value represents the |
|---|
| 569 | | input buffer, from which all returned headers and content may |
|---|
| 570 | | be accessed. |
|---|
| 571 | | |
|---|
| 572 | | Note that certain request-headers may generated automatically |
|---|
| 573 | | if they are not present. These include a Host header and, in |
|---|
| 574 | | the case of Post, both ContentType & ContentLength for a query |
|---|
| 575 | | type of request. The latter two are *not* produced for Post |
|---|
| 576 | | requests with 'pump' specified ~ when using 'pump' to output |
|---|
| 577 | | additional content, you must explicitly set your own headers. |
|---|
| 578 | | |
|---|
| 579 | | Note also that IOException instances may be thrown. These |
|---|
| 580 | | should be caught by the client to ensure a close() operation |
|---|
| 581 | | is always performed |
|---|
| 582 | | |
|---|
| 583 | | ***********************************************************************/ |
|---|
| 584 | | |
|---|
| 585 | | private IBuffer open (RequestMethod method, Pump pump, IBuffer input) |
|---|
| 586 | | { |
|---|
| 587 | | try { |
|---|
| 588 | | this.method = method; |
|---|
| 589 | | openStart(pump, input); |
|---|
| 590 | | // user has additional data to send? |
|---|
| 591 | | |
|---|
| 592 | | return openFinish(pump); |
|---|
| 593 | | } finally {redirections = 0;} |
|---|
| 594 | 561 | } |
|---|
| 595 | 562 | |
|---|
| … | … | |
| 676 | 643 | return false; |
|---|
| 677 | 644 | } |
|---|
| | 645 | |
|---|
| | 646 | /*********************************************************************** |
|---|
| | 647 | |
|---|
| | 648 | Overridable socket factory, for use with HTTPS and so on |
|---|
| | 649 | |
|---|
| | 650 | ***********************************************************************/ |
|---|
| | 651 | |
|---|
| | 652 | protected SocketConduit createSocket () |
|---|
| | 653 | { |
|---|
| | 654 | return new SocketConduit; |
|---|
| | 655 | } |
|---|
| | 656 | |
|---|
| | 657 | /*********************************************************************** |
|---|
| | 658 | |
|---|
| | 659 | Make a request for the resource specified via the constructor |
|---|
| | 660 | using the specified timeout period (in micro-seconds), and a |
|---|
| | 661 | user-defined callback for pumping additional data to the host. |
|---|
| | 662 | The callback would be used when uploading data during a 'put' |
|---|
| | 663 | operation (or equivalent). The return value represents the |
|---|
| | 664 | input buffer, from which all returned headers and content may |
|---|
| | 665 | be accessed. |
|---|
| | 666 | |
|---|
| | 667 | Note that certain request-headers may generated automatically |
|---|
| | 668 | if they are not present. These include a Host header and, in |
|---|
| | 669 | the case of Post, both ContentType & ContentLength for a query |
|---|
| | 670 | type of request. The latter two are *not* produced for Post |
|---|
| | 671 | requests with 'pump' specified ~ when using 'pump' to output |
|---|
| | 672 | additional content, you must explicitly set your own headers. |
|---|
| | 673 | |
|---|
| | 674 | Note also that IOException instances may be thrown. These |
|---|
| | 675 | should be caught by the client to ensure a close() operation |
|---|
| | 676 | is always performed |
|---|
| | 677 | |
|---|
| | 678 | ***********************************************************************/ |
|---|
| | 679 | |
|---|
| | 680 | private IBuffer open (RequestMethod method, Pump pump, IBuffer input) |
|---|
| | 681 | { |
|---|
| | 682 | try { |
|---|
| | 683 | this.method = method; |
|---|
| | 684 | openStart(pump, input); |
|---|
| | 685 | // user has additional data to send? |
|---|
| | 686 | |
|---|
| | 687 | return openFinish(pump); |
|---|
| | 688 | } finally {redirections = 0;} |
|---|
| | 689 | } |
|---|
| 678 | 690 | } |
|---|
| 679 | 691 | |
|---|
| r3694 |
r3762 |
|
| 393 | 393 | { |
|---|
| 394 | 394 | auto tmp = s; |
|---|
| 395 | | auto i = tmp.length; |
|---|
| 396 | | foreach (idx, c; tmp) |
|---|
| | 395 | int i = tmp.length; |
|---|
| | 396 | foreach (int idx, T c; tmp) |
|---|
| 397 | 397 | if (c is '.') |
|---|
| 398 | 398 | while (--i >= idx) |
|---|
| … | … | |
| 511 | 511 | Cout.newline; |
|---|
| 512 | 512 | |
|---|
| | 513 | Cout (truncate(format(tmp, 1.0, 6))).newline; |
|---|
| 513 | 514 | Cout (truncate(format(tmp, 30, 6))).newline; |
|---|
| 514 | 515 | Cout (truncate(format(tmp, 3.14159, 6, 0))).newline; |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic