Commit graph

284 commits

Author SHA1 Message Date
rfm
6667842dd5 Update FSF address as requested by Gregory 2024-11-07 13:37:59 +00:00
rfm
d988153800 Fix for #361 2024-02-16 14:26:41 +00:00
rfm
05c1ba2e6e ifindentation fixes 2023-12-05 14:12:07 +00:00
Frederik Seiffert
0aaa5307c8 Fix NSData initWithContentsOfURL: caching data of file URLs 2023-08-01 13:27:54 +02:00
Frederik Carlier
081f890be8 [NSData initWithBase64EncodedString]: Fix decoding of an empty string
Don't call `NSZoneRealloc` with a length of 0, but free the zone and return an empty `NSData` buffer instead.
2023-04-06 21:54:46 +00:00
Richard Frith-Macdonald
0b1a2d4d66 Tidy positioning of semicolon to be inside IF_NO_ARC() macros so it won't appear in the source when compiled with ARC 2022-02-17 10:21:36 +00:00
Richard Frith-Macdonald
c76ebf2962 Replaced IF_NO_GC() macro calls with the more descriptive IF_NO_ARC()
and deprecate it.  Searched for and removed obsolete references to
garbage collection in comments and documentation.
2022-02-17 10:08:18 +00:00
Frederik Seiffert
6657796e15 Use GSNativeChar where applicable 2022-01-26 10:33:33 +01:00
Levin Li
5b151c5fa0 Do not call handler blocks if they are nil 2021-11-23 18:34:34 +08:00
Mads Marquart
d439847ba6
Fix NSData initWithBytesNoCopy:length:deallocator:
The previous implementation simply swizzled `NSData` into `NSDataWithDeallocatorBlock`, and forgot to actually assign `bytes` and `length`.
2021-10-29 09:17:56 +02:00
Frederik Seiffert
40f88bc622 Enable _C_BOOL on non GNU C compilers 2021-08-08 17:27:40 +02:00
Richard Frith-Macdonald
fe7d9b6435 Use NSZoneMalloc and NSZoneRealloc for memory used by data, so it is in the correct zone for the instance (and to avoid complaints from static analyser). 2021-01-18 11:47:39 +00:00
Richard Frith-Macdonald
679272b50c Use memcpy rather than strncpy/strncat to avoid compiler warnings 2020-12-03 12:07:33 -05:00
Richard Frith-Macdonald
f18594ff3e tweaks to avoid compiler warnings 2020-12-03 11:56:14 -05:00
Richard Frith-Macdonald
23d431234c Fix bug in offset 2020-11-13 05:41:42 +00:00
Adam Fox
0b69d88ee2 Implementation of [NSData rangeOfData:options:range], adapted from [NSString rangeOfString:options:range]. 2020-10-12 12:22:00 -06:00
Richard Frith-Macdonald
47b6defc26 We only need to set the ownership of a newly created file on unix-like systems where the effective user ID may be different from the real user ID. 2020-07-07 07:42:40 +01:00
Richard Frith-Macdonald
31ea5db30b When overwriting a file with data, do not attempt to set creation date.
When creaqting a new file, try to use the real uid when effective uid is root
2020-06-25 09:19:44 +01:00
Richard Frith-Macdonald
41ab84eaba So not attempt to alter creation date of newly created file. 2020-06-09 11:43:56 +01:00
Gregory John Casamento
753c907938 Fix address for FSF and License name in all headers in base 2019-12-09 18:36:00 -05:00
Richard Frith-Macdonald
dd36855923 Improved memory usage reporting mechanisms 2019-08-08 17:20:25 +01:00
Richard Frith-Macdonald
dce6a5a86a implement [NSMutableData+dataWithBytesNoCopy:length:freeWhenDone:] 2019-08-06 16:05:19 +01:00
Richard Frith-Macdonald
3f7d54a33f improve reportingn of memory usage 2019-06-11 14:07:10 +01:00
Richard Frith-Macdonald
2425c42ace Cosmetic tweaks to match coding style 2019-06-06 14:16:30 +01:00
Frederik Seiffert
9f01876102 Added option to specify Android asset reading mode. 2019-05-24 09:29:24 +02:00
Frederik Seiffert
ba4948fd97 Moved Android asset reading code path in NSData.
No reason to get path file system representation first.
2019-05-24 09:28:10 +02:00
Frederik Seiffert
3b60b1a8be Added support for asset loading on Android.
Requires passing the activity's AssetManager object from Java to GNUstep by calling +[NSBundle setJavaAssetManager:withJNIEnv:], which then enables the following features:

- NSBundle main bundle resource paths support for Android assets, e.g. for pathForResource:ofType:, URLForResource:ofType: and related methods.
- NSBundle main bundle info dictionary support if Info.plist exists in Android assets.
- -initWithContentsOfFile: and related methods support for reading Android assets from main bundle in various classes (e.g. NSData, NSDictionary, NSArray, etc.).
- NSFileManager fileExistsAtPath:(isDirectory:) and isReadableFileAtPath: return YES for main bundle asset / asset directory paths.
- NSFileHandle support for reading Android assets from main bundle.
- NSDirectoryEnumerator support for enumerating Android assets from main bundle. Note that recursion into subdirectories is currently not supported by the native Android asset manager API (see https://issuetracker.google.com/issues/37002833).

Also adds support for automatic NSProcessInfo initialization on Android with a fake executable path "/data/data/<app identifier>/exe" (as Android apps don't have a real executable path), and tweaks main bundle initialization to allow that path. Main bundle resource paths are prefixed by "/data/data/<app identifier>/Resources".
2019-05-23 15:44:07 +02:00
Richard Frith-Macdonald
92f961dbb6 remove redundant close 2018-01-30 14:40:12 +00:00
Richard Frith-Macdonald
ba7c5086d1 gix handle leak on write failure 2018-01-30 07:26:05 +00:00
Richard Frith-Macdonald
4ce7a25541 Changes to avoid possible hang in connection reply mode due to race condition. 2017-12-21 13:51:01 +00:00
Richard Frith-MacDonald
5c3acb5693 Fail quietly when asked to read non-existent file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40188 72102866-910b-0410-8b05-ffd578937521
2016-11-01 21:02:31 +00:00
Richard Frith-MacDonald
1ab80b3f58 Fixes for problems spotted by Wolfgang
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40171 72102866-910b-0410-8b05-ffd578937521
2016-10-24 10:22:43 +00:00
Niels Grewe
3e654a6b09 Fix warnings for compilers without blocks support.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40039 72102866-910b-0410-8b05-ffd578937521
2016-07-27 12:39:59 +00:00
Niels Grewe
2e18a14485 Avoid reallocating objects post-hoc based on the initializer used.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40038 72102866-910b-0410-8b05-ffd578937521
2016-07-27 07:02:42 +00:00
Niels Grewe
1b82abd967 Don't leak the deallocator block
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40037 72102866-910b-0410-8b05-ffd578937521
2016-07-26 23:52:53 +00:00
Niels Grewe
c2be055c3e Add [NSData initWithBytesNoCopy:length:deallocator:]
This new initializer allows customising the deallocation behaviour
through user-supplied blocks. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40035 72102866-910b-0410-8b05-ffd578937521
2016-07-26 23:01:11 +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
62d2bcbabc changes for use of _WIN32 define on windows
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39492 72102866-910b-0410-8b05-ffd578937521
2016-03-09 13:16:16 +00:00
Niels Grewe
28c824a78a Modify the interfaces of all collection classes to be compatible with the
new lightweight generics implemenation. (Newer MacOS X/iOS code assuming 
the presence of the generics annotations can otherwise not be compiled with
GNUstep). This should be well-behaved under clang and gcc both. 

Fix NSCache which was copying the cache keys when it really shouldn't
have. Added a few test cases for eviction behaviour.

Few smaller tweaks to avoid compiler warnings.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39406 72102866-910b-0410-8b05-ffd578937521
2016-02-22 21:04:18 +00:00
Richard Frith-MacDonald
8eb1eb2a3e Fix for obscure decoding error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39338 72102866-910b-0410-8b05-ffd578937521
2016-02-04 22:33:19 +00:00
Richard Frith-MacDonald
bf5038e2ac protect from both old runtime and old compiler
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39042 72102866-910b-0410-8b05-ffd578937521
2015-10-08 09:13:32 +00:00
Richard Frith-MacDonald
f6271e8e48 fixup for old runtime
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39041 72102866-910b-0410-8b05-ffd578937521
2015-10-08 09:04:48 +00:00
Richard Frith-MacDonald
0c5d96eebd changes intended to allow use of _Bool throughout
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39010 72102866-910b-0410-8b05-ffd578937521
2015-09-22 09:46:10 +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
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
8c07ae4a05 Tidy to match conding conventions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38721 72102866-910b-0410-8b05-ffd578937521
2015-06-30 08:41:38 +00:00
Riccardo Mottola
c5dc2d494d base64EncodedDataWithOptions, base64EncodedStringWithOptions: first implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38634 72102866-910b-0410-8b05-ffd578937521
2015-06-14 16:17:17 +00:00
Richard Frith-MacDonald
37352097e3 Reproduce OSX padding behavior
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38604 72102866-910b-0410-8b05-ffd578937521
2015-06-08 07:46:02 +00:00
Richard Frith-MacDonald
d187e70974 stricter base64 decoding
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38602 72102866-910b-0410-8b05-ffd578937521
2015-06-08 07:14:38 +00:00
Richard Frith-MacDonald
4bce4d2978 Various updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38599 72102866-910b-0410-8b05-ffd578937521
2015-06-04 09:18:52 +00:00