Commit graph

265 commits

Author SHA1 Message Date
David Chisnall
3847c54f3f Add NSConstantString implementation for v2 ABI.
This is largely the version from the newabi branch, but with a few
cleanups made possible by other bug fixes in the GSString
implementations.
2018-12-27 13:44:45 +00:00
fredkiefer
5a72e1cfa8 * Source/GSString.m: Remove GSString copyWithZone:.
* Source/NSString.m: Raise exception when no is provided for the
string. This brings our implementation closer to the Cocoa one.
* Source/GSString.m: Add similar exceptions.
2018-07-06 23:53:32 +02:00
Richard Frith-Macdonald
1066ec7015 Ensure we are testing the internal 16bit unicode representation class. 2018-07-02 14:20:58 +01:00
fredkiefer
ab60bab84a * Source/GSString.m: Move the method _unicodeString from here...
* Tests/base/NSString/test00.m: ...to here.
2018-07-01 23:50:05 +02:00
fredkiefer
760d6ad990 * Source/GSString.m: Remove code that was identical to super class. 2018-07-01 23:27:09 +02:00
David Chisnall
970c8cbd05 Revert "Fix memory corruption in NSException."
Accidentally included unrelated changes.

This reverts commit 3b1e94ec5d.
2018-04-07 20:03:33 +01:00
David Chisnall
3b1e94ec5d Fix memory corruption in NSException.
If compiling without backtrace or BFD support, we initialise the
location to store return addresses incorrectly, leaving a dangling
pointer which we then right over.

Most consumers never read this, so it seemed to work most of the time by
just overwriting a random bit of memory.

This probably has security implications, because throwing an exception
can clobber random bits of memory, though not with attacker-controlled
data.
2018-04-07 11:02:04 +01:00
David Chisnall
0ebb50f984 Fix logic error in GSPrivateRangeOfString.
We were checking if the receiver was a specific class, then directly
accessing an ivar of target.  We were then checking if target is a
specific class and, if so, accessing the ivar or target.

This mostly worked because most GNUstep strings have the same
underlying implementation and so the check was passing and by
coincidence giving the correct value.  This breaks when GSTinyStrings
are used more often and was picked up by teaching the compiler to
generate GSTinyStrings for small string literals.
2018-04-06 10:43:10 +01:00
Richard Frith-Macdonald
c6e4220409 Add _unicodeString method to return GSUnicodeString subclass instance for tests 2018-02-27 15:00:52 +00:00
Richard Frith-Macdonald
73f3fb78ab raise on character conversion failure 2018-02-07 10:49:02 +00:00
Richard Frith-Macdonald
ad87ff5462 raise exception on character conversion failure 2018-02-07 10:38:57 +00:00
Richard Frith-Macdonald
ab670fd27a improive handling of failed character conversion 2018-02-04 11:10:07 +00:00
fredkiefer
e69450400a * Source/GSFormat.m: Call va_end with the correct parameter.
* Source/NSObject+NSComparisonMethods.m: Add missing return.
* Source/GSString.m (-replaceCharactersInRange:withString:,
-initWithBytesNoCopy:...freeWhenDone:): Remove dead code.
* Source/NSDistantObject.m (-initWithCoder:): Remove dead code.
* Source/NSPredicate.m (_eval_avg:): Don't devide by zero.
Fix issues found by Coverity.
2018-02-01 22:31:15 +01:00
Richard Frith-Macdonald
9d21ee5671 check for null pointer 2018-01-31 14:24:46 +00:00
Richard Frith-Macdonald
c31c6a87b8 fix uninitialised variable 2018-01-30 15:01:01 +00:00
Wolfgang Lux
bc285396da Characters outside the BMP cannot be converted to Latin 1 string encoding 2017-07-10 10:16:27 +02:00
Richard Frith-MacDonald
0fe344d12a Partial fix/update for noncharacter codepoints,
also check for task exit more consistently


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40125 72102866-910b-0410-8b05-ffd578937521
2016-10-05 17:44:00 +00:00
Richard Frith-MacDonald
5d272a49e5 Fixup error in return value when buffer too small
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39920 72102866-910b-0410-8b05-ffd578937521
2016-06-25 18:27:33 +00:00
Richard Frith-MacDonald
c4b05fa213 Optimise fetching ascii or utf8 from literal string
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39915 72102866-910b-0410-8b05-ffd578937521
2016-06-23 18:27:22 +00:00
Richard Frith-MacDonald
71941dd24d cleanup changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39762 72102866-910b-0410-8b05-ffd578937521
2016-05-14 09:34:01 +00:00
Richard Frith-MacDonald
d53b94baba If we are doing a numeric search, use the superclass method (with ICU numeric collation).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39662 72102866-910b-0410-8b05-ffd578937521
2016-04-13 12:45:03 +00:00
Richard Frith-MacDonald
d40d219015 removal of garbage collection
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39608 72102866-910b-0410-8b05-ffd578937521
2016-03-25 11:15:28 +00:00
Richard Frith-MacDonald
a0c97c1ddd deprecate confusing extension in favour of simpler ARC-complient method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39520 72102866-910b-0410-8b05-ffd578937521
2016-03-10 16:50:41 +00:00
Richard Frith-MacDonald
ce29f2223d Further correction to latin1 conversion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39299 72102866-910b-0410-8b05-ffd578937521
2016-01-21 12:42:43 +00:00
Richard Frith-MacDonald
912fbca179 Fix error copnverting utf8 constant string to latin1 data
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39298 72102866-910b-0410-8b05-ffd578937521
2016-01-21 12:27:25 +00:00
Niels Grewe
17d379a59a Optimise appending UTF-16 strings for formatting
If the string being appended to already uses unichar as the underlying 
character type, append the new characters using memcpy() instead of
looping over them individually. Also includes test cases to verify that
nothing breaks.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38969 72102866-910b-0410-8b05-ffd578937521
2015-09-04 09:48:07 +00:00
Richard Frith-MacDonald
78c05bfc01 Avoid compiler warnrings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38888 72102866-910b-0410-8b05-ffd578937521
2015-08-16 10:42:48 +00:00
Richard Frith-MacDonald
3b02814665 more updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38803 72102866-910b-0410-8b05-ffd578937521
2015-07-16 08:44:15 +00:00
Richard Frith-MacDonald
8e93dc85d3 More experimental code changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38801 72102866-910b-0410-8b05-ffd578937521
2015-07-15 15:26:29 +00:00
Richard Frith-MacDonald
841ddf78e0 memory usage interrogation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38799 72102866-910b-0410-8b05-ffd578937521
2015-07-15 14:14:21 +00:00
Richard Frith-MacDonald
9d6729f4a7 remove a little unused code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38556 72102866-910b-0410-8b05-ffd578937521
2015-05-26 12:19:02 +00:00
Richard Frith-MacDonald
a43250585a fix sign extension error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38549 72102866-910b-0410-8b05-ffd578937521
2015-05-26 09:56:55 +00:00
Richard Frith-MacDonald
5ab0c3a6c7 Implement -mutableCopyWithZone: for tiny strings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38543 72102866-910b-0410-8b05-ffd578937521
2015-05-25 18:13:10 +00:00
Richard Frith-MacDonald
293606cda5 more utf8 optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38542 72102866-910b-0410-8b05-ffd578937521
2015-05-25 17:55:51 +00:00
Richard Frith-MacDonald
83dda5160c some optionisation of string equality test ... don't compute hash of string
unless the string is large enough to make it worthwhile.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38541 72102866-910b-0410-8b05-ffd578937521
2015-05-25 14:51:02 +00:00
Richard Frith-MacDonald
493a170d6a Another small optimisation for string creation ...
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38540 72102866-910b-0410-8b05-ffd578937521
2015-05-25 11:47:13 +00:00
Richard Frith-MacDonald
1fbfe0cdf6 Small optimisation for creating NSString from UTF8 C string
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38539 72102866-910b-0410-8b05-ffd578937521
2015-05-25 11:11:24 +00:00
Richard Frith-MacDonald
ca40ca54c2 minor performance tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38530 72102866-910b-0410-8b05-ffd578937521
2015-05-24 14:12:42 +00:00
Richard Frith-MacDonald
696c4dd7a3 check to see if we should free memory
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38529 72102866-910b-0410-8b05-ffd578937521
2015-05-23 21:35:03 +00:00
Richard Frith-MacDonald
19ba70e988 Another tiny string optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38525 72102866-910b-0410-8b05-ffd578937521
2015-05-22 16:24:27 +00:00
Richard Frith-MacDonald
d8e9f81945 Some string optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38518 72102866-910b-0410-8b05-ffd578937521
2015-05-22 14:28:08 +00:00
Richard Frith-MacDonald
dee7d0fae5 Fixups to get acceptable performance from TinyString objects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38476 72102866-910b-0410-8b05-ffd578937521
2015-05-05 11:54:14 +00:00
Richard Frith-MacDonald
245e957635 fix for bug #42483
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37934 72102866-910b-0410-8b05-ffd578937521
2014-06-01 18:08:44 +00:00
Richard Frith-MacDonald
ed09c55959 leak detection improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37003 72102866-910b-0410-8b05-ffd578937521
2013-08-22 15:44:54 +00:00
Richard Frith-MacDonald
da4f7056ca printf style format tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36799 72102866-910b-0410-8b05-ffd578937521
2013-07-02 15:46:26 +00:00
Richard Frith-MacDonald
97cecc058e tweaks to keep static analyzer happy
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36527 72102866-910b-0410-8b05-ffd578937521
2013-04-14 16:25:27 +00:00
Richard Frith-MacDonald
d314f0f843 experiment with slower but better hashes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36344 72102866-910b-0410-8b05-ffd578937521
2013-03-12 16:11:10 +00:00
Richard Frith-MacDonald
a8559c5c18 avoid a couple of warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36280 72102866-910b-0410-8b05-ffd578937521
2013-03-05 16:20:10 +00:00
Richard Frith-MacDonald
75661de25e fix for overrun when searching backwards (spotted by Fred using valgrind)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36204 72102866-910b-0410-8b05-ffd578937521
2013-02-28 12:51:27 +00:00
David Chisnall
6f84df52c2 Add missing retainCount methods for small objects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36034 72102866-910b-0410-8b05-ffd578937521
2013-01-29 18:42:23 +00:00