mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Small clang compatibility patch by Niels Grewe
<niels.grewe@halbordnung.de>. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29421 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b04fdf46b9
commit
0f16fdb914
2 changed files with 10 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-01-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSColor.m: (-hash): Don't use a dynamic union, as clang
|
||||
doesn't support this.
|
||||
Patch by Niels Grewe <niels.grewe@halbordnung.de>.
|
||||
|
||||
2010-01-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSAttributedString.m (-rangeOfTextTable:atIndex:): Add
|
||||
|
|
|
@ -1265,17 +1265,14 @@ systemColorWithName(NSString *name)
|
|||
- (NSUInteger) hash
|
||||
{
|
||||
int nums = [self numberOfComponents];
|
||||
union {
|
||||
uint8_t bytes[sizeof(float) * nums];
|
||||
float floats[nums];
|
||||
} u;
|
||||
float floats[nums];
|
||||
NSUInteger h = 0;
|
||||
unsigned i;
|
||||
|
||||
[self getComponents: u.floats];
|
||||
for (i = 0; i < sizeof(u); i++)
|
||||
[self getComponents: &floats[0]];
|
||||
for (i = 0; i < sizeof(floats); i++)
|
||||
{
|
||||
h = (h << 5) + h + u.bytes[i];
|
||||
h = (h << 5) + h + *(uint8_t*)(((uintptr_t)&floats[0])+(i*sizeof(uint8_t)));
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue