Regenerate README, improve protability of a few string formats,

implement method for marshalling the contents of a notification's
user info dictionary for use as in-arguments of a D-Bus signal.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@37543 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2014-01-06 14:55:35 +00:00
parent bcf52f728e
commit 6c8389fee3
6 changed files with 65 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2014-01-06 Niels Grewe <niels.grewe@halbordnung.de>
* README: Regenerate
* Source/DKEndpointManager.m
* Source/DKInterface.m:
Format string safety improvements.
* Source/DKSignal.h
* Source/DKSignal.m:
Add method to marshall the contents of a notification's
user info dictionary into D-Bus wire format.
2014-01-05 Niels Grewe <niels.grewe@halbordnung.de>
* Bundles/DBusMenu/DKMenuRegistry.m:

6
README
View File

@ -35,8 +35,8 @@ improvements you have made freely available. You should read the
COPYING file in the root directory of the framework distribution for
more information. The file `Source/type_encoding_cases.h' is originally
part of the GNUstep Objective-C runtime and licensed under the MIT
license. All other files in the `Source', `Headers', and `Tests'
directories are covered under the LGPL.
license. All other files in the `Bundles', `Source', `Headers', and
`Tests' directories are covered under the LGPL.
The associated tools and examples are covered under the GNU Public
License. This means if you make changes to these programs, you cannot
@ -48,7 +48,7 @@ GPL.
The documentation is, unless noted otherwise, licensed under the GNU
Free Documentation License (with no Invariant Sections or Cover Texts).
Copyright (C) 2010 Free Software Foundation
Copyright (C) 2010-2014 Free Software Foundation
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -142,7 +142,7 @@ if (NO == DKRingEmpty)\
__sync_fetch_and_add(&producerCounter, 1);\
[producerLock unlock];\
NSDebugMLog(@"Inserting into ringbuffer (remaining capacity: %lu).",\
DKRingSpace);\
(unsigned long)DKRingSpace);\
} while (0)
@ -152,14 +152,14 @@ if (NO == DKRingEmpty)\
#define DKRingRemove(x) do {\
if (NO == DKRingEmpty)\
{\
NSDebugMLog(@"Removing element at %lu from ring buffer", DKMaskIndex(consumerCounter));\
NSDebugMLog(@"Removing element at %lu from ring buffer", (unsigned long)DKMaskIndex(consumerCounter));\
x = ringBuffer[DKMaskIndex(consumerCounter)];\
ringBuffer[DKMaskIndex(consumerCounter)] = (DKRingBufferElement){nil, NULL, nil, NULL};\
[x.target autorelease];\
__sync_fetch_and_add(&consumerCounter, 1);\
}\
NSDebugMLog(@"(new capacity: %lu).",\
DKRingSpace);\
(unsigned long)DKRingSpace);\
} while (0)
@implementation DKEndpointManager

View File

@ -307,7 +307,7 @@
if (NULL == selectorString)
{
NSWarnMLog(@"Cannot register selector with empty name for method %@");
NSWarnMLog(@"Cannot register selector with empty name for method %@", aMethod);
return;
}

View File

@ -68,6 +68,24 @@
*/
- (NSDictionary*)userInfoFromIterator: (DBusMessageIter*)iter;
/**
* Marshalls the arguments from an NSNotification's userInfo dictionary into
* a libdbus iterator. The algorithm for resolving the values is as follows:
*
* 1. If an argument has an attached org.gnustep.openstep.notification.key
* annotation, get the value for that key.
* 2. If the value is nil, try the argN key of the dictionary, where argN
* is the position of the argument in the introspection graph
* 3. Marshall the value into the iterator.
*
* As a consequence, named arguments take precedence over positional ones,
* and absence is interpreted as a null value, which may cause an exception
* for some data types (e.g. object paths)
*/
- (void)marshallUserInfo: (NSDictionary*)userInfo
intoIterator: (DBusMessageIter*)iter;
/**
* Returns YES if the signal is a stub signal created by the notification
* center.

View File

@ -168,6 +168,35 @@
return userInfo;
}
- (void)marshallUserInfo: (NSDictionary*)userInfo
intoIterator: (DBusMessageIter*)iter
{
NSUInteger numArgs = [args count];
NSUInteger index = 0;
while (index < (numArgs))
{
NSString *key = [NSString stringWithFormat: @"arg%lu", index];
DKArgument *arg = (DKArgument*)[args objectAtIndex: index];
NSString *annotatedKey = [arg annotationValueForKey: @"org.gnustep.openstep.notification.key"];
id value = nil;
if (nil != annotatedKey)
{
value = [userInfo objectForKey: annotatedKey];
}
if (nil == value)
{
// second try, with the argN key
value = [userInfo objectForKey: key];
}
[arg marshallObject: value
intoIterator: iter];
index++;
}
}
- (NSXMLNode*)XMLNode
{
NSXMLNode *nameAttribute = [NSXMLNode attributeWithName: @"name"