aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/PlatCocoa.mm33
-rw-r--r--cocoa/QuartzTextStyleAttribute.h2
-rw-r--r--cocoa/ScintillaCocoa.mm25
-rw-r--r--cocoa/ScintillaView.mm24
4 files changed, 42 insertions, 42 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index b1de20902..985539396 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -951,7 +951,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
if (unicodeMode) {
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
- int fit = textLayout->getStringLength();
+ CFIndex fit = textLayout->getStringLength();
int ui=0;
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
int i=0;
@@ -960,7 +960,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
size_t codeUnits = (lenChar < 4) ? 1 : 2;
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL);
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
- positions[i++] = lround(xPosition);
+ positions[i++] = static_cast<int>(lround(xPosition));
}
ui += codeUnits;
}
@@ -976,14 +976,14 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
size_t lenChar = Platform::IsDBCSLeadByte(codePage, s[i]) ? 2 : 1;
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL);
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
- positions[i++] = lround(xPosition);
+ positions[i++] = static_cast<int>(lround(xPosition));
}
ui++;
}
} else { // Single byte encoding
for (int i=0;i<len;i++) {
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, i+1, NULL);
- positions[i] = lround(xPosition);
+ positions[i] = static_cast<int>(lround(xPosition));
}
}
@@ -1420,7 +1420,7 @@ public:
}
int Length() const
{
- return lines.size();
+ return static_cast<int>(lines.size());
}
void Clear()
{
@@ -1430,7 +1430,7 @@ public:
{
lines.push_back(RowData(type, str));
}
- int GetType(int index) const
+ int GetType(size_t index) const
{
if (index < lines.size())
{
@@ -1441,7 +1441,7 @@ public:
return 0;
}
}
- const char* GetString(int index) const
+ const char* GetString(size_t index) const
{
if (index < lines.size())
{
@@ -1467,7 +1467,7 @@ NSObject <NSTableViewDataSource>
//----------------- ListBoxImpl --------------------------------------------------------------------
// Map from icon type to an NSImage*
-typedef std::map<int, NSImage*> ImageMap;
+typedef std::map<NSInteger, NSImage*> ImageMap;
class ListBoxImpl : public ListBox
{
@@ -1527,8 +1527,8 @@ public:
// For access from AutoCompletionDataSource
int Rows();
- NSImage* ImageForRow(int row);
- NSString* TextForRow(int row);
+ NSImage* ImageForRow(NSInteger row);
+ NSString* TextForRow(NSInteger row);
void DoubleClick();
};
@@ -1707,7 +1707,7 @@ void ListBoxImpl::Append(char* s, int type)
ld.Add(count, type, s);
Scintilla::SurfaceImpl surface;
- unsigned int width = surface.WidthText(font, s, strlen(s));
+ unsigned int width = surface.WidthText(font, s, static_cast<int>(strlen(s)));
if (width > maxItemWidth)
{
maxItemWidth = width;
@@ -1733,7 +1733,7 @@ void ListBoxImpl::Append(char* s, int type)
void ListBoxImpl::SetList(const char* list, char separator, char typesep)
{
Clear();
- int count = strlen(list) + 1;
+ size_t count = strlen(list) + 1;
char* words = new char[count];
if (words)
{
@@ -1781,7 +1781,7 @@ void ListBoxImpl::Select(int n)
int ListBoxImpl::GetSelection()
{
- return [table selectedRow];
+ return static_cast<int>([table selectedRow]);
}
int ListBoxImpl::Find(const char* prefix)
@@ -1864,7 +1864,7 @@ int ListBoxImpl::Rows()
return ld.Length();
}
-NSImage* ListBoxImpl::ImageForRow(int row)
+NSImage* ListBoxImpl::ImageForRow(NSInteger row)
{
ImageMap::iterator it = images.find(ld.GetType(row));
if (it != images.end())
@@ -1879,7 +1879,7 @@ NSImage* ListBoxImpl::ImageForRow(int row)
}
}
-NSString* ListBoxImpl::TextForRow(int row)
+NSString* ListBoxImpl::TextForRow(NSInteger row)
{
const char* textString = ld.GetString(row);
NSString* sTitle;
@@ -2013,7 +2013,8 @@ const char *Platform::DefaultFont()
*/
int Platform::DefaultFontSize()
{
- return [[NSUserDefaults standardUserDefaults] integerForKey: @"NSFixedPitchFontSize"];
+ return static_cast<int>([[NSUserDefaults standardUserDefaults]
+ integerForKey: @"NSFixedPitchFontSize"]);
}
//--------------------------------------------------------------------------------------------------
diff --git a/cocoa/QuartzTextStyleAttribute.h b/cocoa/QuartzTextStyleAttribute.h
index 3171ca446..ecea73b91 100644
--- a/cocoa/QuartzTextStyleAttribute.h
+++ b/cocoa/QuartzTextStyleAttribute.h
@@ -16,7 +16,7 @@ class QuartzFont
{
public:
/** Create a font style from a name. */
- QuartzFont( const char* name, int length, float size, bool bold, bool italic )
+ QuartzFont( const char* name, size_t length, float size, bool bold, bool italic )
{
assert( name != NULL && length > 0 && name[length] == '\0' );
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index 196ae28e4..6348d3f78 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -542,7 +542,7 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar
{
NSString* input = [[NSString stringWithCharacters: (const unichar*) &wParam length: 1] autorelease];
const char* utf8 = [input UTF8String];
- AddCharUTF((char*) utf8, strlen(utf8), false);
+ AddCharUTF((char*) utf8, static_cast<unsigned int>(strlen(utf8)), false);
return 1;
}
return 0;
@@ -902,7 +902,7 @@ void ScintillaCocoa::StartDrag()
int startLine = pdoc->LineFromPosition(selStart);
int endLine = pdoc->LineFromPosition(selEnd);
Point pt;
- int startPos, endPos, ep;
+ long startPos, endPos, ep;
Rect rcSel;
if (startLine==endLine && WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE) {
@@ -917,8 +917,8 @@ void ScintillaCocoa::StartDrag()
// step back a position if we're counting the newline
ep = WndProc(SCI_GETLINEENDPOSITION, startLine, 0);
if (endPos > ep) endPos = ep;
- ptStart = LocationFromPosition(startPos);
- ptEnd = LocationFromPosition(endPos);
+ ptStart = LocationFromPosition(static_cast<int>(startPos));
+ ptEnd = LocationFromPosition(static_cast<int>(endPos));
if (ptStart.y == ptEnd.y) {
// We're just selecting part of one visible line
rcSel.left = ptStart.x;
@@ -926,7 +926,7 @@ void ScintillaCocoa::StartDrag()
} else {
// Find the bounding box.
startPos = WndProc(SCI_POSITIONFROMLINE, startLine, 0);
- rcSel.left = LocationFromPosition(startPos).x;
+ rcSel.left = LocationFromPosition(static_cast<int>(startPos)).x;
rcSel.right = client.right;
}
rcSel.top = ptStart.y;
@@ -943,10 +943,10 @@ void ScintillaCocoa::StartDrag()
// step back a position if we're counting the newline
ep = WndProc(SCI_GETLINEENDPOSITION, l, 0);
if (endPos > ep) endPos = ep;
- pt = LocationFromPosition(startPos); // top left of line selection
+ pt = LocationFromPosition(static_cast<int>(startPos)); // top left of line selection
if (pt.x < rcSel.left || rcSel.left < 0) rcSel.left = pt.x;
if (pt.y < rcSel.top || rcSel.top < 0) rcSel.top = pt.y;
- pt = LocationFromPosition(endPos); // top right of line selection
+ pt = LocationFromPosition(static_cast<int>(endPos)); // top right of line selection
pt.y += vs.lineHeight; // get to the bottom of the line
if (pt.x > rcSel.right || rcSel.right < 0) {
if (pt.x > client.right)
@@ -984,7 +984,6 @@ void ScintillaCocoa::StartDrag()
pixmap = new SurfaceImpl();
if (pixmap)
{
- PRectangle client = GetClientRectangle();
PRectangle imageRect = NSRectToPRectangle(selectionRectangle);
paintState = painting;
sw->InitPixMap(client.Width(), client.Height(), NULL, NULL);
@@ -1199,7 +1198,7 @@ bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selec
bool rectangular = bestType == ScintillaRecPboardType;
- int len = usedLen;
+ int len = static_cast<int>(usedLen);
char *dest = Document::TransformLineEnds(&len, (char *)buffer, len, pdoc->eolMode);
selectedText->Set(dest, len+1, pdoc->dbcsCodePage,
@@ -1351,7 +1350,7 @@ void ScintillaCocoa::SetHorizontalScrollPos()
bool ScintillaCocoa::ModifyScrollBars(int nMax, int nPage)
{
// Input values are given in lines, not pixels, so we have to convert.
- int lineHeight = WndProc(SCI_TEXTHEIGHT, 0, 0);
+ int lineHeight = static_cast<int>(WndProc(SCI_TEXTHEIGHT, 0, 0));
PRectangle bounds = GetTextRectangle();
ScintillaView* topContainer = TopContainer();
@@ -1670,9 +1669,9 @@ int ScintillaCocoa::InsertText(NSString* input)
CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?',
false, buffer,usedLen, NULL);
- AddCharUTF((char*) buffer, usedLen, false);
+ AddCharUTF((char*) buffer, static_cast<unsigned int>(usedLen), false);
delete []buffer;
- return usedLen;
+ return static_cast<int>(usedLen);
}
//--------------------------------------------------------------------------------------------------
@@ -1814,7 +1813,7 @@ NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* event)
*/
void ScintillaCocoa::HandleCommand(NSInteger command)
{
- Command(command);
+ Command(static_cast<int>(command));
}
//--------------------------------------------------------------------------------------------------
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 174c5c256..64b5008c6 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -260,8 +260,8 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
- (NSRange) selectedRange
{
- int begin = [mOwner getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0];
- int end = [mOwner getGeneralProperty: SCI_GETSELECTIONEND parameter: 0];
+ long begin = [mOwner getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0];
+ long end = [mOwner getGeneralProperty: SCI_GETSELECTIONEND parameter: 0];
return NSMakeRange(begin, end - begin);
}
@@ -285,7 +285,7 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
else if ([aString isKindOfClass:[NSAttributedString class]])
newText = (NSString*) [aString string];
- int currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0];
+ long currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0];
// Replace marked text if there is one.
if (mMarkedTextRange.length > 0)
@@ -655,7 +655,7 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
case IBNZoomChanged:
{
// Compute point increase/decrease based on default font size.
- int fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT];
+ long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT];
int zoom = (int) (fontSize * (value - 1));
[self setGeneralProperty: SCI_SETZOOM value: zoom];
break;
@@ -712,7 +712,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
if (scn->margin == 2)
{
// Click on the folder margin. Toggle the current line if possible.
- int line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position];
+ long line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position];
[editor setGeneralProperty: SCI_TOGGLEFOLD value: line];
}
break;
@@ -729,7 +729,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
{
// A zoom change happend. Notify info bar if there is one.
float zoom = [editor getGeneralProperty: SCI_GETZOOM parameter: 0];
- int fontSize = [editor getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT];
+ long fontSize = [editor getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT];
float factor = (zoom / fontSize) + 1;
[editor->mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor];
break;
@@ -1088,7 +1088,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
NSString *result = @"";
char *buffer(0);
- const int length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0);
+ const long length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0);
if (length > 0)
{
buffer = new char[length + 1];
@@ -1121,7 +1121,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
NSString *result = @"";
char *buffer(0);
- const int length = mBackend->WndProc(SCI_GETLENGTH, 0, 0);
+ const long length = mBackend->WndProc(SCI_GETLENGTH, 0, 0);
if (length > 0)
{
buffer = new char[length + 1];
@@ -1338,7 +1338,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
*/
- (NSColor*) getColorProperty: (int) property parameter: (long) parameter
{
- int color = mBackend->WndProc(property, parameter, 0);
+ long color = mBackend->WndProc(property, parameter, 0);
float red = (color & 0xFF) / 255.0;
float green = ((color >> 8) & 0xFF) / 255.0;
float blue = ((color >> 16) & 0xFF) / 255.0;
@@ -1493,8 +1493,8 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
{
// The current position is where we start searching. That is either the end of the current
// (main) selection or the caret position. That ensures we do proper "search next" too.
- int currentPosition = [self getGeneralProperty: SCI_GETCURRENTPOS parameter: 0];
- int length = [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0];
+ long currentPosition = [self getGeneralProperty: SCI_GETCURRENTPOS parameter: 0];
+ long length = [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0];
int searchFlags= 0;
if (matchCase)
@@ -1506,7 +1506,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
ttf.chrg.cpMin = currentPosition;
ttf.chrg.cpMax = length;
ttf.lpstrText = (char*) [searchText UTF8String];
- int position = mBackend->WndProc(SCI_FINDTEXT, searchFlags, (sptr_t) &ttf);
+ long position = mBackend->WndProc(SCI_FINDTEXT, searchFlags, (sptr_t) &ttf);
if (position < 0 && wrap)
{