more unicode fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24438 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-01-31 12:04:46 +00:00
parent 38f4377214
commit 26792908cf
3 changed files with 21 additions and 21 deletions

View file

@ -34,10 +34,12 @@
- (NSMutableString *) dumpQue:(int)acount
{
NSMutableString * output=[NSMutableString stringWithCString:"Dumping "];
NSMutableString * output;
int i=0;
int c=[event_queue count];
output = [NSMutableString stringWithCapacity: 1024];
[output appendString: @"Dumping "];
if (acount >=c || acount==0)
acount=c;
else

View file

@ -1199,12 +1199,13 @@ printf("\n\n##############################################################\n");
- (NSString *) getNativeClassName: (HWND)hwnd
{
char * windowType[80];
UINT wsize =80;
UINT wsize = 80;
unichar windowType[wsize + 1];
if (RealGetWindowClass(hwnd,(LPTSTR)windowType,wsize)>0)
if (RealGetWindowClassW(hwnd, windowType, wsize) > 0)
{
return [NSString stringWithCString: (char *)windowType length: wsize+1];
return [NSString stringWithCharacters: windowType
length: wcslen(windowType)];
}
return nil;
@ -1212,11 +1213,14 @@ printf("\n\n##############################################################\n");
- (NSString *) getWindowtext: (HWND)hwnd
{
char * windowText[80];
int wsize = 80;
unichar windowText[wsize + 1];
if (GetWindowText(hwnd,(LPTSTR)windowText,wsize) > 0)
return [NSString stringWithCString: (char *)windowText length: wsize + 1];
if (GetWindowTextW(hwnd, windowText, wsize) > 0)
{
return [NSString stringWithCharacters: windowText
length: wcslen(windowText)];
}
return nil;
}

View file

@ -122,16 +122,14 @@ void add_font(NSMutableArray *fontDefs, NSString *fontName,
else
traits |= NSUnitalicFontMask;
fontStyle = [[NSString alloc] initWithBytes: lpelfe->elfStyle
length: wcslen(lpelfe->elfStyle)
encoding: NSUnicodeStringEncoding];
fontStyle = [NSString stringWithCharacters: lpelfe->elfStyle
length: wcslen(lpelfe->elfStyle)];
fontDef = [NSArray arrayWithObjects:
fontName,
fontStyle,
[NSNumber numberWithInt: weight],
[NSNumber numberWithUnsignedInt: traits],
nil];
RELEASE(fontStyle);
[fontDefs addObject: fontDef];
}
@ -140,12 +138,10 @@ int CALLBACK fontenum(ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEX *lpntme,
{
NSString *fontName;
fontName = [[NSString alloc] initWithBytes: lpelfe->elfFullName
length: wcslen(lpelfe->elfFullName)
encoding: NSUnicodeStringEncoding];
fontName = [NSString stringWithCharacters: lpelfe->elfFullName
length: wcslen(lpelfe->elfFullName)];
NSLog(@"Found font %@", fontName);
add_font((NSMutableArray *)lParam, fontName, lpelfe, lpntme);
RELEASE(fontName);
return 1;
}
@ -178,10 +174,8 @@ int CALLBACK fontfamilyenum(ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEX *lpntme,
NSMutableArray *fontDefs;
WIN32FontEnumerator *enumer = (WIN32FontEnumerator*)lParam;
fontName = AUTORELEASE([[NSString alloc]
initWithBytes: lpelfe->elfFullName
length: wcslen(lpelfe->elfFullName)
encoding: NSUnicodeStringEncoding]);
fontName = [NSString stringWithCharacters: lpelfe->elfFullName
length: wcslen(lpelfe->elfFullName)];
familyName = win32_font_family(fontName);
fontDefs = [enumer->allFontFamilies objectForKey: familyName];