Author: mlytwyn
Date: Fri Sep 23 22:37:19 2016
New Revision: 40105
URL: http://svn.gna.org/viewcvs/gnustep?rev=40105&view=rev
Log:
Merge with base trunk revision 40072
Modified:
libs/base/branches/gnustep_testplant_branch/Source/NSSocketPortNameServer.m
libs/base/branches/gnustep_testplant_branch/Source/NSThread.m
libs/base/branches/gnustep_testplant_branch/Source/NSTimer.m
libs/base/branches/gnustep_testplant_branch/Source/NSURL.m
libs/base/branches/gnustep_testplant_branch/Source/NSURLConnection.m
libs/base/branches/gnustep_testplant_branch/Source/NSUnarchiver.m
libs/base/branches/gnustep_testplant_branch/Source/NSUndoManager.m
Modified:
libs/base/branches/gnustep_testplant_branch/Source/NSSocketPortNameServer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSSocketPortNameServer.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSSocketPortNameServer.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSSocketPortNameServer.m
Fri Sep 23 22:37:19 2016
@@ -24,9 +24,11 @@
$Date$ $Revision$
*/
-/* define to get system-v functions including inet_aton()
+/* defines to get system-v functions including inet_aton()
+ * The first define is for old versions of glibc, the second for newer ones
*/
#define _SVID_SOURCE 1
+#define _DEFAULT_SOURCE 1
#import "common.h"
#define EXPOSE_NSSocketPortNameServer_IVARS 1
@@ -53,7 +55,7 @@
#import "GSPortPrivate.h"
-#ifdef __MINGW__
+#ifdef _WIN32
#include <winsock2.h>
#include <wininet.h>
#else
@@ -183,15 +185,17 @@
if (e != nil)
{
NSDebugMLLog(@"NSSocketPortNameServer",
- @"failed connect to gdomap on %@ - %@",
- [[notification object] socketAddress], e);
+ @"failed connect to gdomap on %@:%@ - %@",
+ [[notification object] socketAddress],
+ [[notification object] socketService],
+ e);
/*
* Remove our file handle, then either retry or fail.
*/
[self close];
if (launchCmd == nil)
{
- launchCmd = [NSTask launchPathForTool: @"gdomap"];
+ launchCmd = RETAIN([NSTask launchPathForTool: @"gdomap"]);
}
if (state == GSPC_LOPEN && launchCmd != nil)
{
@@ -251,8 +255,9 @@
if (d == nil || [d length] == 0)
{
[self fail];
- NSLog(@"NSSocketPortNameServer lost connection to gdomap on %@",
- [[notification object] socketAddress]);
+ NSLog(@"NSSocketPortNameServer lost connection to gdomap on %@:%@",
+ [[notification object] socketAddress],
+ [[notification object] socketService]);
}
else
{
@@ -321,8 +326,10 @@
if (e != nil)
{
[self fail];
- NSLog(@"NSSocketPortNameServer failed write to gdomap on %@ - %@",
- [[notification object] socketAddress], e);
+ NSLog(@"NSSocketPortNameServer failed write to gdomap on %@:%@ - %@",
+ [[notification object] socketAddress],
+ [[notification object] socketService],
+ e);
}
else
{
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSThread.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSThread.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSThread.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSThread.m Fri Sep
23 22:37:19 2016
@@ -73,18 +73,10 @@
#import "Foundation/NSConnection.h"
#import "Foundation/NSInvocation.h"
#import "Foundation/NSUserDefaults.h"
-#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSValue.h"
#import "GSPrivate.h"
#import "GSRunLoopCtxt.h"
-
-#if GS_WITH_GC
-#include <gc/gc.h>
-#endif
-#if __OBJC_GC__
-#include <objc/objc-auto.h>
-#endif
#if defined(HAVE_PTHREAD_NP_H)
# include <pthread_np.h>
@@ -115,7 +107,7 @@
NSUInteger
GSPrivateThreadID()
{
-#if defined(__MINGW__)
+#if defined(_WIN32)
return (NSUInteger)GetCurrentThreadId();
#elif defined(HAVE_GETTID)
return (NSUInteger)syscall(SYS_gettid);
@@ -132,7 +124,7 @@
* FIXME ... This is code for the microsoft compiler;
* how do we make it work for gcc/clang?
*/
-#if defined(__MINGW__) && defined(HAVE_WINDOWS_H)
+#if defined(_WIN32) && defined(HAVE_WINDOWS_H)
// Usage: SetThreadName (-1, "MainThread");
#include <windows.h>
const DWORD MS_VC_EXCEPTION=0x406D1388;
@@ -263,7 +255,7 @@
return;
}
-#if defined(__MINGW__)
+#if defined(_WIN32)
/*
* Avoid integer overflow by breaking up long sleeps.
*/
@@ -299,7 +291,7 @@
delay = when - GSPrivateTimeNow();
}
-#else /* __MINGW__ */
+#else /* _WIN32 */
/*
* Avoid integer overflow by breaking up long sleeps.
@@ -352,7 +344,7 @@
delay = when - GSPrivateTimeNow();
}
#endif /* !HAVE_NANOSLEEP */
-#endif /* !__MINGW__ */
+#endif /* !_WIN32 */
}
static NSArray *
@@ -411,6 +403,7 @@
* Conversely, we need to be able to retrieve the pthread_t
* from an NSValue.
*/
+// Testplant-MAL-09232016: Keeping testplant branch code...
static inline void
_getPthreadFromNSValue(NSValue* value, pthread_t *thread_ptr)
{
@@ -576,6 +569,17 @@
{
NSValue *ref;
+ if (0 == thread)
+ {
+ /* On some systems this is called with a null thread pointer,
+ * so try to ger the NSThread object for the current thread.
+ */
+ thread = pthread_getspecific(thread_object_key);
+ if (0 == thread)
+ {
+ return; // no thread info
+ }
+ }
RETAIN((NSThread*)thread);
ref = NSValueCreateFromPthread(pthread_self());
_willLateUnregisterThread(ref, (NSThread*)thread);
@@ -664,7 +668,7 @@
}
/*
- * Callback function so send notifications on becoming multi-threaded.
+ * Callback function to send notifications on becoming multi-threaded.
*/
static void
gnustep_base_thread_callback(void)
@@ -687,13 +691,6 @@
* threaded BEFORE sending the notifications.
*/
entered_multi_threaded_state = YES;
-#if GS_WITH_GC && defined(HAVE_GC_ALLOW_REGISTER_THREADS)
- /* This function needs to be called before going multi-threaded
- * so that the garbage collection library knows to support
- * registration of new threads.
- */
- GS_allow_register_threads();
-#endif
NS_DURING
{
[GSPerformHolder class]; // Force initialization
@@ -737,7 +734,6 @@
static void
setThreadForCurrentThread(NSThread *t)
{
- [[NSGarbageCollector defaultCollector] disableCollectorForPointer: t];
pthread_setspecific(thread_object_key, t);
gnustep_base_thread_callback();
}
@@ -767,7 +763,6 @@
[(GSRunLoopThreadInfo*)thread->_runLoopInfo invalidate];
RELEASE(thread);
- [[NSGarbageCollector defaultCollector] enableCollectorForPointer:
thread];
pthread_setspecific(thread_object_key, nil);
}
}
@@ -787,9 +782,12 @@
{
t = [self new];
t->_active = YES;
- [[NSGarbageCollector defaultCollector] disableCollectorForPointer: t];
pthread_setspecific(thread_object_key, t);
GS_CONSUMED(t);
+ if (defaultThread != nil && t != defaultThread)
+ {
+ gnustep_base_thread_callback();
+ }
return YES;
}
return NO;
@@ -1066,25 +1064,65 @@
- (void) _setName: (NSString *)aName
{
- int result = -1;
-
- while (result != 0 && [aName length] > 0)
- {
- result =
- PTHREAD_SETNAME([aName cStringUsingEncoding: NSUTF8StringEncoding]);
- if (result != 0)
+ if ([aName isKindOfClass: [NSString class]])
+ {
+ int i;
+ char buf[200];
+
+ if (YES == [aName getCString: buf
+ maxLength: sizeof(buf)
+ encoding: NSUTF8StringEncoding])
+ {
+ i = strlen(buf);
+ }
+ else
{
+ /* Too much for buffer ... truncate on a character boundary.
+ */
+ i = sizeof(buf) - 1;
+ if (buf[i] & 0x80)
+ {
+ while (i > 0 && (buf[i] & 0x80))
+ {
+ buf[i--] = '\0';
+ }
+ }
+ else
+ {
+ buf[i--] = '\0';
+ }
+ }
+ while (i > 0)
+ {
+ if (PTHREAD_SETNAME(buf) == 0)
+ {
+ break; // Success
+ }
+
if (ERANGE == errno)
{
/* Name must be too long ... gnu/linux uses 15 characters
*/
- if ([aName length] > 15)
+ if (i > 15)
{
- aName = [aName substringToIndex: 15];
+ i = 15;
}
else
{
- aName = [aName substringToIndex: [aName length] - 1];
+ i--;
+ }
+ /* too long a name ... truncate on a character boundary.
+ */
+ if (buf[i] & 0x80)
+ {
+ while (i > 0 && (buf[i] & 0x80))
+ {
+ buf[i--] = '\0';
+ }
+ }
+ else
+ {
+ buf[i--] = '\0';
}
}
else
@@ -1122,33 +1160,12 @@
/**
* Trampoline function called to launch the thread
*/
-static void *nsthreadLauncher(void* thread)
+static void *
+nsthreadLauncher(void *thread)
{
NSThread *t = (NSThread*)thread;
+
setThreadForCurrentThread(t);
-#if __OBJC_GC__
- objc_registerThreadWithCollector();
-#endif
-#if GS_WITH_GC && defined(HAVE_GC_REGISTER_MY_THREAD)
- {
- struct GC_stack_base base;
-
- if (GC_get_stack_base(&base) == GC_SUCCESS)
- {
- int result;
-
- result = GC_register_my_thread(&base);
- if (result != GC_SUCCESS && result != GC_DUPLICATE)
- {
- fprintf(stderr, "Argh ... no thread support in garbage collection
library\n");
- }
- }
- else
- {
- fprintf(stderr, "Unable to determine stack base to register new thread
for garbage collection\n");
- }
- }
-#endif
/*
* Let observers know a new thread is starting.
@@ -1257,7 +1274,7 @@
BOOL signalled = NO;
[lock lock];
-#if defined(__MINGW__)
+#if defined(_WIN32)
if (INVALID_HANDLE_VALUE != event)
{
if (SetEvent(event) == 0)
@@ -1307,7 +1324,7 @@
- (id) init
{
-#ifdef __MINGW__
+#ifdef _WIN32
if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE)
{
DESTROY(self);
@@ -1371,7 +1388,7 @@
[lock lock];
p = AUTORELEASE(performers);
performers = nil;
-#ifdef __MINGW__
+#ifdef _WIN32
if (event != INVALID_HANDLE_VALUE)
{
CloseHandle(event);
@@ -1400,7 +1417,7 @@
unsigned int c;
[lock lock];
-#if defined(__MINGW__)
+#if defined(_WIN32)
if (event != INVALID_HANDLE_VALUE)
{
if (ResetEvent(event) == 0)
@@ -1575,11 +1592,6 @@
- (NSArray*) modes
{
return modes;
-}
-
-- (NSString *) description
-{
- return [NSString stringWithFormat:@"%@ on %@",
NSStringFromSelector(selector), receiver];
}
@end
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSTimer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSTimer.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSTimer.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSTimer.m Fri Sep
23 22:37:19 2016
@@ -244,9 +244,11 @@
NS_HANDLER
{
NSLog(@"*** NSTimer ignoring exception '%@' (reason '%@') "
- @"raised during posting of timer with target %p "
+ @"raised during posting of timer with target %s(%s) "
@"and selector '%@'",
- [localException name], [localException reason], target,
+ [localException name], [localException reason],
+ GSClassNameFromObject(target),
+ GSObjCIsInstance(target) ? "instance" : "class",
NSStringFromSelector([target selector]));
}
NS_ENDHANDLER
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSURL.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSURL.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSURL.m (original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSURL.m Fri Sep 23
22:37:19 2016
@@ -260,11 +260,7 @@
len += strlen(rel->fragment) + 1; // #fragment
}
-#if GS_WITH_GC
- ptr = buf = (char*)NSAllocateCollectable(len, 0);
-#else
ptr = buf = (char*)NSZoneMalloc(NSDefaultMallocZone(), len);
-#endif
if (rel->scheme != 0)
{
@@ -849,11 +845,7 @@
BOOL canBeGeneric = YES;
size += sizeof(parsedURL) + urlAlign + 1;
-#if GS_WITH_GC
- buf = _data = (parsedURL*)NSAllocateCollectable(size, 0);
-#else
buf = _data = (parsedURL*)NSZoneMalloc(NSDefaultMallocZone(), size);
-#endif
memset(buf, '\0', size);
start = end = ptr = (char*)&buf[1];
[_urlString getCString: start
@@ -1428,6 +1420,7 @@
return nil == errorStr ? YES : NO;
}
+// Testplant-MAL-09232016: Keeping testplant branch code...
- (BOOL) getResourceValue:(id*)value forKey:(NSString *)key
error:(NSError**)error
{
if ([self isFileURL])
@@ -1538,7 +1531,7 @@
unescape(buf, buf);
}
-#if defined(__MINGW__)
+#if defined(_WIN32)
/* On windows a file URL path may be of the form C:\xxx (ie we should
* not insert the leading slash).
* Also the vertical bar symbol may have been used instead of the
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSURLConnection.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSURLConnection.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSURLConnection.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSURLConnection.m
Fri Sep 23 22:37:19 2016
@@ -110,7 +110,6 @@
_done = YES;
}
-
- (void) connection: (NSURLConnection *)connection
didReceiveData: (NSData *)data
{
@@ -138,13 +137,8 @@
if (o != nil)
{
-#if GS_WITH_GC
- o->_NSURLConnectionInternal
- = NSAllocateCollectable(sizeof(Internal), NSScannedOption);
-#else
o->_NSURLConnectionInternal = NSZoneCalloc([self zone],
1, sizeof(Internal));
-#endif
}
return o;
}
@@ -264,8 +258,15 @@
- (void) connection: (NSURLConnection *)connection
didReceiveAuthenticationChallenge: (NSURLAuthenticationChallenge *)challenge
{
+ if ([challenge proposedCredential] == nil
+ || [challenge previousFailureCount] > 0)
+ {
+ /* continue without a credential if there is no proposed credential
+ * at all or if an authentication failure has already happened.
+ */
[[challenge sender]
continueWithoutCredentialForAuthenticationChallenge: challenge];
+}
}
- (void) connection: (NSURLConnection *)connection
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSUnarchiver.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSUnarchiver.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSUnarchiver.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSUnarchiver.m Fri Sep
23 22:37:19 2016
@@ -78,6 +78,9 @@
case _C_ULNG_LNG: return "unsigned long long";
case _C_FLT: return "float";
case _C_DBL: return "double";
+#if __GNUC__ > 2 && defined(_C_BOOL)
+ case _C_BOOL: return "_Bool";
+#endif
case _C_PTR: return "pointer";
case _C_CHARPTR: return "cstring";
case _C_ARY_B: return "array";
@@ -123,6 +126,7 @@
case _GSC_ULNG_LNG: return "unsigned long long";
case _GSC_FLT: return "float";
case _GSC_DBL: return "double";
+ case _GSC_BOOL: return "_Bool";
case _GSC_PTR: return "pointer";
case _GSC_CHARPTR: return "cstring";
case _GSC_ARY_B: return "array";
@@ -166,7 +170,11 @@
_C_ULNG_LNG,
_C_FLT,
_C_DBL,
+#if __GNUC__ > 2 && defined(_C_BOOL)
+ _C_BOOL,
+#else
0,
+#endif
0,
0,
_C_ID,
@@ -608,6 +616,9 @@
case _C_ULNG_LNG: info = _GSC_ULNG_LNG; break;
case _C_FLT: info = _GSC_FLT; break;
case _C_DBL: info = _GSC_DBL; break;
+#if __GNUC__ > 2 && defined(_C_BOOL)
+ case _C_BOOL: info = _GSC_BOOL; break;
+#endif
default: info = _GSC_NONE; break;
}
@@ -1255,6 +1266,16 @@
(*desImp)(src, desSel, &val, @encode(double), &cursor, nil);
*(float*)address = (float)val;
}
+ return;
+
+ case _GSC_BOOL:
+ if (*type != type_map[_GSC_BOOL])
+ {
+ [NSException raise: NSInternalInconsistencyException
+ format: @"expected %s and got %s",
+ typeToName1(*type), typeToName2(info)];
+ }
+ (*desImp)(src, desSel, address, type, &cursor, nil);
return;
default:
@@ -1460,11 +1481,7 @@
void *b;
NSData *d;
-#if GS_WITH_GC
- b = NSAllocateCollectable(l, 0);
-#else
b = NSZoneMalloc(zone, l);
-#endif
[self decodeArrayOfObjCType: @encode(unsigned char)
count: l
at: b];
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSUndoManager.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSUndoManager.m?rev=40105&r1=40104&r2=40105&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/NSUndoManager.m
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/NSUndoManager.m Fri Sep
23 22:37:19 2016
@@ -1026,6 +1026,8 @@
return;
}
+ // Testplant-MAL-09232016: Paul moved this up in testplant branch code so
+ // local changes...
_isUndoing = YES;
[[NSNotificationCenter defaultCenter]
@@ -1105,6 +1107,7 @@
@end
+// Testplant-MAL-09232016: Paul added to testplant branch - keeping changes...
@implementation NSCellUndoManager
- (void)dealloc
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs