ObjFW  Check-in [51d335dbac]

Overview
Comment:-[tryReadTillDelimiter:]: Save data on exception
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 51d335dbacd3f2f8ae87438f86347ae71b37e7875c0a6ddadad4357d06606a7a
User & Date: js on 2018-06-24 23:31:29
Other Links: manifest | tags
Context
2018-06-27
03:32
Update config.guess and config.sub check-in: 19e5df0ca4 user: js tags: trunk
2018-06-24
23:31
-[tryReadTillDelimiter:]: Save data on exception check-in: 51d335dbac user: js tags: trunk
22:29
Fix missing static check-in: 455e09469e user: js tags: trunk
Changes

Modified src/OFStream.m from [1e88e98956] to [33902d6225].

740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
					    stringWithCString: rcs
						     encoding: encoding
						       length: rl];
				} @catch (id e) {
					if (bufferLength > 0) {
						/*
						 * Append data to _readBuffer
						 * to prevent loss of data due
						 * to wrong encoding.
						 */
						readBuffer = [self
						    allocMemoryWithSize:
						    _readBufferLength +
						    bufferLength];

						memcpy(readBuffer, _readBuffer,







|
<







740
741
742
743
744
745
746
747

748
749
750
751
752
753
754
					    stringWithCString: rcs
						     encoding: encoding
						       length: rl];
				} @catch (id e) {
					if (bufferLength > 0) {
						/*
						 * Append data to _readBuffer
						 * to prevent loss of data.

						 */
						readBuffer = [self
						    allocMemoryWithSize:
						    _readBufferLength +
						    bufferLength];

						memcpy(readBuffer, _readBuffer,
968
969
970
971
972
973
974


























975
976
977
978
979
980
981
					char *rcs = retCString;
					size_t rl = retLength;

					ret = [OFString
					    stringWithCString: rcs
						     encoding: encoding
						       length: rl];


























				} @finally {
					[self freeMemory: retCString];
				}

				readBuffer = [self allocMemoryWithSize:
				    bufferLength - i - 1];
				if (readBuffer != NULL)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
					char *rcs = retCString;
					size_t rl = retLength;

					ret = [OFString
					    stringWithCString: rcs
						     encoding: encoding
						       length: rl];
				} @catch (id e) {
					if (bufferLength > 0) {
						/*
						 * Append data to _readBuffer
						 * to prevent loss of data.
						 */
						readBuffer = [self
						    allocMemoryWithSize:
						    _readBufferLength +
						    bufferLength];

						memcpy(readBuffer, _readBuffer,
						    _readBufferLength);
						memcpy(readBuffer +
						    _readBufferLength,
						    buffer, bufferLength);

						[self freeMemory:
						    _readBufferMemory];
						_readBuffer = readBuffer;
						_readBufferMemory = readBuffer;
						_readBufferLength +=
						    bufferLength;
					}

					@throw e;
				} @finally {
					[self freeMemory: retCString];
				}

				readBuffer = [self allocMemoryWithSize:
				    bufferLength - i - 1];
				if (readBuffer != NULL)