Commit Graph

80 Commits

Author SHA1 Message Date
marco
135467a029 --- Merging r49478 into '.':
U    rtl/objpas/classes/streams.inc
--- Recording mergeinfo for merge of r49478 into '.':
 U   .

# revisions: 49478
r49478 | marco | 2021-06-05 17:42:34 +0200 (Sat, 05 Jun 2021) | 2 lines
Changed paths:
   M /trunk/rtl/objpas/classes/streams.inc

 * fix from Sebastian Hellwig for writeunicodestring bytes number, mantis   0038963

git-svn-id: branches/fixes_3_2@49610 -
2021-07-15 15:36:48 +00:00
michael
dbcd3d0b64 * Merging revisions 47061 from trunk:
------------------------------------------------------------------------
    r47061 | michael | 2020-10-07 12:15:13 +0200 (Wed, 07 Oct 2020) | 1 line
    
    * Fix bug where position is not advanced when calling ReadAnsiString/ReadString
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@47062 -
2020-10-07 10:23:29 +00:00
michael
0a2f57724b * Merging revisions r45444 from trunk:
------------------------------------------------------------------------
    r45444 | michael | 2020-05-20 09:32:09 +0200 (Wed, 20 May 2020) | 1 line
    
    * Fix bug ID #37118
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@46587 -
2020-08-23 09:20:22 +00:00
marco
6d1a81ffde --- Recording mergeinfo for merge of r44225 into '.':
G   .

# revisions: 44225

git-svn-id: branches/fixes_3_2@44307 -
2020-03-17 09:36:47 +00:00
ondrej
9e9c7e1409 Merging revisions r43838, r43839, r43840, r43841, r43842, r43844, r43845, r43846, r43848, r43942, r43945, r43946, r43947, r43948 from trunk
(TStrings&TEncoding encoding fixes)

r43838
classes: fix TMBCSEncoding.IsSingleByte. Issue #36504
---------------------
r43839
classes: fix TStrings.SaveToStream overloads (Delphi-compatibility + introduce IgnoreEncoding-overload for legacy FPC code like for LoadFromStream)
---------------------
r43840
sysutils: fix TMBCSEncoding.GetPreamble
---------------------
r43841
classes: add TStrings.Options (Delphi-compatibility)
---------------------
r43842
sysutils: change TEncoding.Default from ANSI to SystemEncoding. (It is Delphi-compatible indeed because default SystemEncoding is ANSI.)
---------------------
r43844
fpmkunit: fix compilation after r43841
---------------------
r43845
classes: introduce TRawByteStringStream
---------------------
r43846
sysutils: TEncoding.IsStandardEncoding: FSystemEncodings are standard encodings (they must not be destroyed in user code)
---------------------
r43848
classes: add TStringsOption.soPreserveBOM
---------------------
r43942
TStrings: old SaveToFile(string) and SaveToStream(TStream) should ignore Encoding and stay backwards compatible within FPC. Use the other overloads for Encoding-aware SaveTo* methods
---------------------
r43945
TStrings: add missing SaveToFile overload with IgnoreEncoding parameter
---------------------
r43946
Revert r43942: TStrings: old SaveToFile(string) and SaveToStream(TStream) should ignore Encoding and stay backwards compatible within FPC. Use the other overloads for Encoding-aware SaveTo* methods
---------------------
r43947
TStrings: default options:  * remove soWriteBOM for FPC backwards compatibility * add soPreserveBOM so that a loaded file is correctly resaved
---------------------
r43948
TStrings.SaveToStream(TStream): use FEncoding as the default for IgnoreEncoding=False so that loaded files are correctly resaved
---------------------

git-svn-id: branches/fixes_3_2@44067 -
2020-01-30 06:21:12 +00:00
michael
0e58449360 * Merging revisions r43357 from trunk:
------------------------------------------------------------------------
    r43357 | michael | 2019-11-02 12:51:28 +0100 (Sat, 02 Nov 2019) | 1 line
    
    * Fix bug ID #36234: unicodedatastering must be of type unicodestring
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@43735 -
2019-12-23 13:33:47 +00:00
michael
807a917a5f * Undo 42424
git-svn-id: branches/fixes_3_2@42441 -
2019-07-14 08:54:20 +00:00
michael
1c0ef960b0 * Undo 42425
git-svn-id: branches/fixes_3_2@42440 -
2019-07-14 08:53:12 +00:00
michael
d65408db6c * Merging revisions r42048,r42049,r42056,r42057 from trunk:
------------------------------------------------------------------------
    r42048 | michael | 2019-05-12 17:33:26 +0200 (Sun, 12 May 2019) | 1 line
    
    * FIx compilation for platforms that do not have extended
    ------------------------------------------------------------------------
    r42049 | michael | 2019-05-12 17:36:04 +0200 (Sun, 12 May 2019) | 1 line
    
    * FIx compilation with 3.0.4
    ------------------------------------------------------------------------
    r42056 | michael | 2019-05-13 13:47:46 +0200 (Mon, 13 May 2019) | 1 line
    
    * Make explicit that Integer is 32-bit
    ------------------------------------------------------------------------
    r42057 | michael | 2019-05-13 22:15:00 +0200 (Mon, 13 May 2019) | 1 line
    
    * Fix bug ID #35576
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@42425 -
2019-07-13 13:29:23 +00:00
michael
8c43258e68 * Merging revisions 42021,42040,42041,42042 from trunk:
------------------------------------------------------------------------
    r42021 | michael | 2019-05-07 17:40:00 +0200 (Tue, 07 May 2019) | 1 line
    
    * GetPrimaryIndexFields is now a public class method, needed in designer
    ------------------------------------------------------------------------
    r42040 | michael | 2019-05-12 09:51:38 +0200 (Sun, 12 May 2019) | 1 line
    
    * Patch from Ondrej Pokorny to fix bug ID #35544 (accept short timezones)
    ------------------------------------------------------------------------
    r42041 | michael | 2019-05-12 09:54:02 +0200 (Sun, 12 May 2019) | 1 line
    
    * Add largeint (int64) parameter supportby Silvio Clecio (bug ID 35554)
    ------------------------------------------------------------------------
    r42042 | michael | 2019-05-12 12:09:16 +0200 (Sun, 12 May 2019) | 1 line
    
    * Add Read/Write(Buffer) TBytes, ReadData/WriteData, ReadBufferData/WriteBufferData to be Delphi compatible
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@42424 -
2019-07-13 13:28:03 +00:00
michael
844a9b0ca6 * Actually observe TStringStream.OwnsEncoding in destructor
git-svn-id: trunk@39379 -
2018-07-04 11:03:21 +00:00
michael
ab0c29e54f * Rename RawByteString version of TstringStream constructor, compiler cannot decide for empty string
git-svn-id: trunk@36759 -
2017-07-21 18:02:26 +00:00
michael
2b1bb6a5f5 * TStringStream now observes encoding, bug ID #30508
git-svn-id: trunk@36758 -
2017-07-21 17:02:37 +00:00
marco
6166215174 * make istream signedness equal to MSDN and modern delphi. Denis Kozlov,
mantis #31473

git-svn-id: trunk@35542 -
2017-03-08 15:05:11 +00:00
michael
bc6819aa91 * Attempt to avoid overflow when reallocating stream
git-svn-id: trunk@34518 -
2016-09-12 08:41:42 +00:00
michael
6b3b3d5c0c * Fix bug ID #29155, wrong declaration of ISTream.
git-svn-id: trunk@32820 -
2016-01-01 16:35:38 +00:00
michael
e6b86d9b5b * Made string in stringstream constructor optional
git-svn-id: trunk@32326 -
2015-11-15 11:05:19 +00:00
michael
61969710c3 * Writebuffer too (Fix bug 28796streams.inc
git-svn-id: trunk@31986 -
2015-10-09 06:57:05 +00:00
michael
2c24153736 * Fix bug #28796
git-svn-id: trunk@31982 -
2015-10-08 19:06:04 +00:00
yury
e1a0b1204a * Removed unused vars in RTL.
git-svn-id: trunk@31750 -
2015-09-17 16:48:53 +00:00
michael
5f5883695d * Fix bug #26954
git-svn-id: trunk@30292 -
2015-03-23 16:50:31 +00:00
michael
71a1628303 * Fix bug #24645
git-svn-id: trunk@28661 -
2014-09-14 16:17:25 +00:00
nickysn
9418fa9b8b * fixed compilation of unit classes with integer=smallint
git-svn-id: trunk@27045 -
2014-03-09 14:21:32 +00:00
michael
f163a35238 * UniqueString called on initial string for stringstream (bug ID 24130)
git-svn-id: trunk@26715 -
2014-02-08 09:55:31 +00:00
michael
b023e30164 * Only resize TStringStream.Datastring in case the string will grow because of the write operation
git-svn-id: trunk@26599 -
2014-01-28 08:37:49 +00:00
nickysn
730f7c82b7 * some fixes, intended to get units fgl and classes to compile on 16-bit cpus
git-svn-id: trunk@24649 -
2013-05-30 18:58:25 +00:00
svenbarth
930b76e8fb Fix compilation of WinCE. Change the fixed UNICODE define of WinCE to FPC_OS_UNICODE, so that it won't be undefined when changing the mode/string type and that the usage of a UNICODE API is independant of the mode.
Also adjusted all Windows (Win32/64/CE) units to define a "UNICODE" if "FPC_OS_UNICODE" is defined (except the Jedi units).
Also the common RTL units that checked for UNICODE now check for FPC_OS_UNICODE.

git-svn-id: trunk@24420 -
2013-05-04 11:06:32 +00:00
michael
a3f7a7fdb4 * Avoid overflow when reading from streams > 2gb
git-svn-id: trunk@22945 -
2012-11-06 23:41:49 +00:00
florian
39aef35bdc * pass not only exception address but also frame to raise:
if an address is passed the compiler cannot know a good 
  value for the frame so it passed nil and no stack trace is printed, resolves #12528

git-svn-id: trunk@22932 -
2012-11-04 20:40:21 +00:00
Jonas Maebe
404e1a34a4 * changed resource handle parameters from THandle to TFPResourceHMODULE so
they don't truncate the handle data on 64 bit platforms (patch by
    Anton Kavalenka, mantis #21721)

git-svn-id: trunk@22392 -
2012-09-14 15:05:08 +00:00
michael
9fc66414b5 * Avoid code duplication in TFileStream.Create
git-svn-id: trunk@19628 -
2011-11-11 17:32:17 +00:00
florian
cd2488d177 * fix compilation on 64 Bit targets
git-svn-id: trunk@19393 -
2011-10-06 17:54:44 +00:00
paul
7817f5017d rtl: add TBytesStream class for compatibility with delphi (TStringStream is a descendant of TBytesStream) + test
git-svn-id: trunk@19389 -
2011-10-06 04:41:10 +00:00
michael
96e5333dc2 * Added fakeSeekForward for benefit of descendant streams.
* Override GetSize/Position for memory/stringstream for efficiency
* Added InvalidSeek exception throwing. Should be overridden to throw custom exceptions.

git-svn-id: trunk@18190 -
2011-08-13 18:45:48 +00:00
michael
fd491e8647 * Fixed permissions on file create
git-svn-id: trunk@17560 -
2011-05-26 07:02:42 +00:00
michael
a201f07420 * Added share mode argument to FileCreate call
git-svn-id: trunk@17548 -
2011-05-23 21:11:07 +00:00
paul
812a665cbe rtl: don't crash if resource is not found in TResourceStream and was passed by ID instead of Name (in this case exception tried to get a string from ID)
git-svn-id: trunk@17173 -
2011-03-24 03:44:26 +00:00
marco
32a7502f38 * Change TProxyStream.seek to 64-bit variant.
git-svn-id: trunk@17093 -
2011-03-08 15:13:53 +00:00
sergei
41aeb9a22b * Rework TStream.CopyFrom (see Mantis #17980):
a) Use significantly larger buffer (128k instead of 1k)
b) When Count=0, do not try to determine the source size. Just copy until the source can be read. This should improve performance with limited seek capability sources (e.g. a decompression stream will be decompressed once rather than twice).
c) Use ReadBuffer/WriteBuffer, so an exception is raised when something goes wrong. This conforms to Delphi behavior.

git-svn-id: trunk@16992 -
2011-02-24 03:25:40 +00:00
sergei
907e7a32d5 * GetFileHandle(), THandleStream: changed type that is used to store file handle from Integer to THandle, so it can be redefined to 64 bits on certain platforms, see http://lists.freepascal.org/lists/fpc-devel/2010-November/023019.html
git-svn-id: trunk@16383 -
2010-11-20 12:58:53 +00:00
paul
a1d94c6829 rtl: implement TStreamAdapter.CopyTo, .SetSize, return proper error value for Clone instead of raising exception (#0016161) + test
git-svn-id: trunk@15138 -
2010-04-11 12:52:31 +00:00
paul
17687d90ce rtl: minor changes for TStreamAdapter:
- return STG_E_INVALIDPOINTER instead of E_INVLIDARG for Read,Write as msdn requires
  - return STG_E_INVALIDFUNCTION instead of E_INVLIDARG for Seek as msdn requires

git-svn-id: trunk@15127 -
2010-04-10 17:50:29 +00:00
florian
42ae8bf971 * fixed memory stream compilation on 64 bit targets
git-svn-id: trunk@14523 -
2010-01-02 16:05:57 +00:00
florian
b5167560c3 * T*MemoryStream now uses PtrInt for sizes and positions so it can be bigger than 2 GB on 64 Bit systems, resolves #15313
git-svn-id: trunk@14513 -
2010-01-01 21:05:18 +00:00
marco
27114853b4 * TStream.Read/writeqword. Mantis 15023
git-svn-id: trunk@14111 -
2009-11-08 11:47:50 +00:00
marco
6ed7d33569 * patch from 15003 from M spiller, reverting now implemented.
git-svn-id: trunk@14078 -
2009-11-06 10:52:23 +00:00
marco
09b22de964 * TStreamAdapter + relevant constants. From 10608
git-svn-id: trunk@13988 -
2009-10-31 20:13:41 +00:00
marco
b5e361a4cb * TOleStream + TProxystream (Mantis 8376)
git-svn-id: trunk@13984 -
2009-10-30 18:27:26 +00:00
marco
1e7ee7aef4 * Patch from Paul Ishenin, load stringlists with fmdenywrite. (improves sharing behaviour)
git-svn-id: trunk@13803 -
2009-10-04 13:36:43 +00:00
Jonas Maebe
6f4637b32a * do not do anything when writing to a t(custom)memorystream if the current
position is negative (patch by Collin Western, mantis #13318)

git-svn-id: trunk@12955 -
2009-03-22 15:53:16 +00:00