mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Fix clang compiler and static analyzer warnings
This commit is contained in:
@@ -1205,7 +1205,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
kCFPreferencesCurrentApplication);
|
||||
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
|
||||
|
||||
ASLogInfo(@"Use renderer=%d", renderer);
|
||||
ASLogInfo(@"Use renderer=%ld", renderer);
|
||||
|
||||
// This action is called when the user clicks the "use ATSUI renderer"
|
||||
// button in the advanced preferences pane.
|
||||
@@ -1807,8 +1807,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
[dict setObject:NSStringFromRange(range) forKey:@"selectionRange"];
|
||||
} else {
|
||||
ASLogErr(@"Xcode selection range size mismatch! got=%d expected=%d",
|
||||
length, sizeof(MMXcodeSelectionRange));
|
||||
ASLogErr(@"Xcode selection range size mismatch! got=%ld "
|
||||
"expected=%ld", length, sizeof(MMXcodeSelectionRange));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2393,11 +2393,11 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
if (r.length > 0) {
|
||||
// Select given range of characters.
|
||||
// TODO: This only works for encodings where 1 byte == 1 character
|
||||
[a addObject:[NSString stringWithFormat:@"norm %dgov%dgo",
|
||||
[a addObject:[NSString stringWithFormat:@"norm %ldgov%ldgo",
|
||||
r.location, NSMaxRange(r)-1]];
|
||||
} else {
|
||||
// Position cursor on line at start of range.
|
||||
[a addObject:[NSString stringWithFormat:@"norm %dGz.0",
|
||||
[a addObject:[NSString stringWithFormat:@"norm %ldGz.0",
|
||||
r.location]];
|
||||
}
|
||||
|
||||
|
||||
@@ -1544,7 +1544,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
NSNumber *key = [NSNumber numberWithInt:port];
|
||||
NSMutableArray *replies = [serverReplyDict objectForKey:key];
|
||||
if (replies && [replies count]) {
|
||||
ASLogDebug(@" %d replies, topmost is: %@", [replies count],
|
||||
ASLogDebug(@" %ld replies, topmost is: %@", [replies count],
|
||||
[replies objectAtIndex:0]);
|
||||
return [replies objectAtIndex:0];
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ static void netbeansReadCallback(CFSocketRef s,
|
||||
keyCode:(unsigned)code
|
||||
modifiers:(int)mods
|
||||
{
|
||||
ASLogDebug(@"key='%@' code=%#x mods=%#x length=%d", key, code, mods,
|
||||
ASLogDebug(@"key='%@' code=%#x mods=%#x length=%ld", key, code, mods,
|
||||
[key length]);
|
||||
if (!key) return;
|
||||
|
||||
@@ -2829,10 +2829,10 @@ static void netbeansReadCallback(CFSocketRef s,
|
||||
NSString *cmd;
|
||||
if (range.length > 0) {
|
||||
// TODO: This only works for encodings where 1 byte == 1 character
|
||||
cmd = [NSString stringWithFormat:@"<C-\\><C-N>%dgov%dgo",
|
||||
cmd = [NSString stringWithFormat:@"<C-\\><C-N>%ldgov%ldgo",
|
||||
range.location, NSMaxRange(range)-1];
|
||||
} else {
|
||||
cmd = [NSString stringWithFormat:@"<C-\\><C-N>%dGz.0",
|
||||
cmd = [NSString stringWithFormat:@"<C-\\><C-N>%ldGz.0",
|
||||
range.location];
|
||||
}
|
||||
|
||||
|
||||
@@ -1033,12 +1033,11 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
|
||||
CFStringRef strRef = CFStringCreateWithCharactersNoCopy(
|
||||
NULL, chars, count, kCFAllocatorNull);
|
||||
CTFontRef newFontRef = CTFontCreateForString(fontRef, strRef, r);
|
||||
CFRelease(strRef);
|
||||
if (!newFontRef) {
|
||||
ASLogNotice(@"Cannot find font to draw chars: %@", strRef);
|
||||
CGFontRelease(cgFontRef);
|
||||
return;
|
||||
}
|
||||
CFRelease(strRef);
|
||||
|
||||
recurseDraw(chars, glyphs, advances, count, context, newFontRef,
|
||||
x0, y);
|
||||
|
||||
@@ -123,7 +123,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
withString:(NSString *)string
|
||||
{
|
||||
#if MM_TS_PARANOIA_LOG
|
||||
ASLogWarn(@"Calling %s on MMTextStorage is unsupported", _cmd);
|
||||
ASLogWarn(@"Calling %@ on MMTextStorage is unsupported",
|
||||
NSStringFromSelector(_cmd));
|
||||
#endif
|
||||
//[attribString replaceCharactersInRange:range withString:string];
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
// system. Releasing the text storage will in turn release the layout
|
||||
// manager, the text container, and finally the text view (self). This
|
||||
// complicates deallocation somewhat, see -[MMVimView dealloc].
|
||||
if (![super initWithFrame:frame textContainer:tc]) {
|
||||
if (!(self = [super initWithFrame:frame textContainer:tc])) {
|
||||
[textStorage release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -281,11 +281,11 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex
|
||||
{
|
||||
filename = normalizeFilename(filename);
|
||||
ASLogInfo(@"filename=%@ index=%d", filename, tabIndex);
|
||||
ASLogInfo(@"filename=%@ index=%ld", filename, tabIndex);
|
||||
|
||||
NSString *fnEsc = [filename stringByEscapingSpecialFilenameCharacters];
|
||||
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>:silent "
|
||||
"tabnext %d |"
|
||||
"tabnext %ld |"
|
||||
"edit! %@<CR>", tabIndex + 1, fnEsc];
|
||||
[self addVimInput:input];
|
||||
}
|
||||
@@ -540,7 +540,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
}
|
||||
|
||||
if (delayQueue) {
|
||||
ASLogDebug(@" Flushing delay queue (%d items)",
|
||||
ASLogDebug(@" Flushing delay queue (%ld items)",
|
||||
[delayQueue count]/2);
|
||||
[self performSelector:@selector(processInputQueue:)
|
||||
withObject:delayQueue
|
||||
@@ -579,7 +579,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
SetTextDimensionsReplyMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int rows = *((int*)bytes); bytes += sizeof(int);
|
||||
int cols = *((int*)bytes); bytes += sizeof(int);
|
||||
int cols = *((int*)bytes);
|
||||
|
||||
// NOTE: When a resize message originated in the frontend, Vim
|
||||
// acknowledges it with a reply message. When this happens the window
|
||||
@@ -642,7 +642,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
} else if (ShowToolbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int enable = *((int*)bytes); bytes += sizeof(int);
|
||||
int flags = *((int*)bytes); bytes += sizeof(int);
|
||||
int flags = *((int*)bytes);
|
||||
|
||||
int mode = NSToolbarDisplayModeDefault;
|
||||
if (flags & ToolbarLabelFlag) {
|
||||
@@ -659,25 +659,25 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
} else if (CreateScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int type = *((int*)bytes); bytes += sizeof(int);
|
||||
int type = *((int*)bytes);
|
||||
|
||||
[windowController createScrollbarWithIdentifier:ident type:type];
|
||||
} else if (DestroyScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int32_t ident = *((int32_t*)bytes);
|
||||
|
||||
[windowController destroyScrollbarWithIdentifier:ident];
|
||||
} else if (ShowScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int visible = *((int*)bytes); bytes += sizeof(int);
|
||||
int visible = *((int*)bytes);
|
||||
|
||||
[windowController showScrollbarWithIdentifier:ident state:visible];
|
||||
} else if (SetScrollbarPositionMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int pos = *((int*)bytes); bytes += sizeof(int);
|
||||
int len = *((int*)bytes); bytes += sizeof(int);
|
||||
int len = *((int*)bytes);
|
||||
|
||||
[windowController setScrollbarPosition:pos length:len
|
||||
identifier:ident];
|
||||
@@ -685,7 +685,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
const void *bytes = [data bytes];
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
float val = *((float*)bytes); bytes += sizeof(float);
|
||||
float prop = *((float*)bytes); bytes += sizeof(float);
|
||||
float prop = *((float*)bytes);
|
||||
|
||||
[windowController setScrollbarThumbValue:val proportion:prop
|
||||
identifier:ident];
|
||||
@@ -724,7 +724,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
} else if (SetDefaultColorsMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
unsigned bg = *((unsigned*)bytes); bytes += sizeof(unsigned);
|
||||
unsigned fg = *((unsigned*)bytes); bytes += sizeof(unsigned);
|
||||
unsigned fg = *((unsigned*)bytes);
|
||||
NSColor *back = [NSColor colorWithArgbInt:bg];
|
||||
NSColor *fore = [NSColor colorWithRgbInt:fg];
|
||||
|
||||
@@ -750,12 +750,12 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
afterDelay:0];
|
||||
} else if (SetMouseShapeMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int shape = *((int*)bytes); bytes += sizeof(int);
|
||||
int shape = *((int*)bytes);
|
||||
|
||||
[windowController setMouseShape:shape];
|
||||
} else if (AdjustLinespaceMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int linespace = *((int*)bytes); bytes += sizeof(int);
|
||||
int linespace = *((int*)bytes);
|
||||
|
||||
[windowController adjustLinespace:linespace];
|
||||
} else if (ActivateMsgID == msgid) {
|
||||
@@ -779,7 +779,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
const void *bytes = [data bytes];
|
||||
// state < 0 <-> some buffer modified
|
||||
// state > 0 <-> current buffer modified
|
||||
int state = *((int*)bytes); bytes += sizeof(int);
|
||||
int state = *((int*)bytes);
|
||||
|
||||
// NOTE: The window controller tracks whether current buffer is
|
||||
// modified or not (and greys out the proxy icon as well as putting a
|
||||
@@ -842,7 +842,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
const void *bytes = [data bytes];
|
||||
int rows = *((int*)bytes); bytes += sizeof(int);
|
||||
int cols = *((int*)bytes); bytes += sizeof(int);
|
||||
int state = *((int*)bytes); bytes += sizeof(int);
|
||||
int state = *((int*)bytes);
|
||||
|
||||
[windowController zoomWithRows:rows
|
||||
columns:cols
|
||||
@@ -850,7 +850,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
} else if (SetWindowPositionMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
int x = *((int*)bytes); bytes += sizeof(int);
|
||||
int y = *((int*)bytes); bytes += sizeof(int);
|
||||
int y = *((int*)bytes);
|
||||
|
||||
// NOTE: Vim measures Y-coordinates from top of screen.
|
||||
NSRect frame = [[[windowController window] screen] frame];
|
||||
|
||||
@@ -83,7 +83,7 @@ enum {
|
||||
- (MMVimView *)initWithFrame:(NSRect)frame
|
||||
vimController:(MMVimController *)controller
|
||||
{
|
||||
if (![super initWithFrame:frame])
|
||||
if (!(self = [super initWithFrame:frame]))
|
||||
return nil;
|
||||
|
||||
vimController = controller;
|
||||
@@ -95,7 +95,7 @@ enum {
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSInteger renderer = [ud integerForKey:MMRendererKey];
|
||||
ASLogInfo(@"Use renderer=%d", renderer);
|
||||
ASLogInfo(@"Use renderer=%ld", renderer);
|
||||
|
||||
#if MM_ENABLE_ATSUI
|
||||
if (MMRendererATSUI == renderer) {
|
||||
@@ -107,7 +107,7 @@ enum {
|
||||
if (MMRendererCoreText == renderer) {
|
||||
// HACK! 'textView' has type MMTextView, but MMCoreTextView is not
|
||||
// derived from MMTextView.
|
||||
textView = [[MMCoreTextView alloc] initWithFrame:frame];
|
||||
textView = (MMTextView *)[[MMCoreTextView alloc] initWithFrame:frame];
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
|
||||
@@ -177,7 +177,7 @@ gui_macvim_after_fork_init()
|
||||
kCFPreferencesCurrentApplication,
|
||||
&keyValid);
|
||||
if (keyValid) {
|
||||
ASLogInfo(@"Use renderer=%d", val);
|
||||
ASLogInfo(@"Use renderer=%ld", val);
|
||||
use_gui_macvim_draw_string = (val != MMRendererCoreText);
|
||||
|
||||
// For now only the Core Text renderer knows how to render graphical
|
||||
@@ -593,7 +593,7 @@ gui_mch_new_colors(void)
|
||||
gui.def_back_pixel = gui.back_pixel;
|
||||
gui.def_norm_pixel = gui.norm_pixel;
|
||||
|
||||
ASLogDebug(@"back=%x norm=%x", gui.def_back_pixel, gui.def_norm_pixel);
|
||||
ASLogDebug(@"back=%ld norm=%ld", gui.def_back_pixel, gui.def_norm_pixel);
|
||||
|
||||
[[MMBackend sharedInstance]
|
||||
setDefaultColorsBackground:gui.def_back_pixel
|
||||
@@ -748,7 +748,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
? menu->strings[MENU_INDEX_TIP] : menu->actext;
|
||||
NSArray *desc = descriptor_for_menu(menu);
|
||||
NSString *keyEquivalent = menu->mac_key
|
||||
? [NSString stringWithFormat:@"%C", specialKeyToNSKey(menu->mac_key)]
|
||||
? [NSString stringWithFormat:@"%C",
|
||||
(unsigned short)specialKeyToNSKey(menu->mac_key)]
|
||||
: [NSString string];
|
||||
int modifierMask = vimModMaskToEventModifierFlags(menu->mac_mods);
|
||||
char_u *icon = NULL;
|
||||
@@ -917,7 +918,7 @@ gui_mch_free_font(font)
|
||||
GuiFont font;
|
||||
{
|
||||
if (font != NOFONT) {
|
||||
ASLogDebug(@"font=0x%x", font);
|
||||
ASLogDebug(@"font=%p", font);
|
||||
[(id)font release];
|
||||
}
|
||||
}
|
||||
@@ -1559,7 +1560,7 @@ gui_mch_get_rgb(guicolor_T pixel)
|
||||
void
|
||||
gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
|
||||
{
|
||||
ASLogDebug(@"Columns=%d Rows=%d", Columns, Rows);
|
||||
ASLogDebug(@"Columns=%ld Rows=%ld", Columns, Rows);
|
||||
*screen_w = Columns;
|
||||
*screen_h = Rows;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user