Bug 525255 - Enable indirect static usage warnings

Cover cocoa.

Change-Id: Ibf01d0735cc001978dcd27d1af4d2dba8b277327
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TableDragSourceEffect.java
index 4969cf8..b96a26b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TableDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TableDragSourceEffect.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 import org.eclipse.swt.widgets.*;
 
@@ -81,13 +82,13 @@
 		if (dragSourceImage != null) dragSourceImage.dispose();
 		dragSourceImage = null;
 		NSPoint point = new NSPoint();
-		long /*int*/ ptr = OS.malloc(NSPoint.sizeof);
+		long /*int*/ ptr = C.malloc(NSPoint.sizeof);
 		OS.memmove(ptr, point, NSPoint.sizeof);
 		NSEvent nsEvent = NSApplication.sharedApplication().currentEvent();
 		NSTableView widget = (NSTableView)control.view;
 		NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr);
 		OS.memmove(point, ptr, NSPoint.sizeof);
-		OS.free(ptr);
+		C.free(ptr);
 		if (nsImage == null) return null;
 		//TODO: Image representation wrong???
 		Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TreeDragSourceEffect.java
index a358cf8..318b512 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TreeDragSourceEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/TreeDragSourceEffect.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 import org.eclipse.swt.widgets.*;
 
@@ -80,13 +81,13 @@
 		if (dragSourceImage != null) dragSourceImage.dispose();
 		dragSourceImage = null;
 		NSPoint point = new NSPoint();
-		long /*int*/ ptr = OS.malloc(NSPoint.sizeof);
+		long /*int*/ ptr = C.malloc(NSPoint.sizeof);
 		OS.memmove(ptr, point, NSPoint.sizeof);
 		NSEvent nsEvent = NSApplication.sharedApplication().currentEvent();
 		NSTableView widget = (NSTableView)control.view;
 		NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr);
 		OS.memmove(point, ptr, NSPoint.sizeof);
-		OS.free(ptr);
+		C.free(ptr);
 		//TODO: Image representation wrong???
 		Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage);
 		dragSourceImage = image;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
index 8e0a994..583151b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,10 +11,9 @@
 package org.eclipse.swt.printing;
 
 import org.eclipse.swt.*;
-import org.eclipse.swt.printing.PrinterData;
-import org.eclipse.swt.widgets.*;
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
+import org.eclipse.swt.widgets.*;
 
 /**
  * Instances of this class allow the user to select
@@ -244,7 +243,7 @@
 				: PrinterData.DUPLEX_NONE;
 		NSData nsData = NSKeyedArchiver.archivedDataWithRootObject(printInfo);
 		data.otherData = new byte[(int)/*64*/nsData.length()];
-		OS.memmove(data.otherData, nsData.bytes(), data.otherData.length);
+		C.memmove(data.otherData, nsData.bytes(), data.otherData.length);
 		printerData = data;
 	}
 	printInfo.release();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/cocoa/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/cocoa/org/eclipse/swt/program/Program.java
index 8e3c6db..dafb27b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/cocoa/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/cocoa/org/eclipse/swt/program/Program.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,14 +11,14 @@
 package org.eclipse.swt.program;
 
 
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.internal.cocoa.*;
-import org.eclipse.swt.widgets.*;
+import java.io.*;
+import java.util.*;
+
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
-
-import java.io.IOException;
-import java.util.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cocoa.*;
+import org.eclipse.swt.widgets.*;
 
 /**
  * Instances of this class represent programs and
@@ -230,13 +230,13 @@
 }
 
 static boolean isExecutable (String fileName) {
-	long /*int*/ ptr = OS.malloc(1);
+	long /*int*/ ptr = C.malloc(1);
 	NSString path = NSString.stringWith(fileName);
 	boolean result = false;
 	NSFileManager manager = NSFileManager.defaultManager();
 	if (manager.fileExistsAtPath(path, ptr)) {
 		byte[] isDirectory = new byte[1];
-		OS.memmove(isDirectory, ptr, 1);
+		C.memmove(isDirectory, ptr, 1);
 		if (isDirectory[0] == 0 && manager.isExecutableFileAtPath(path)) {
 			NSWorkspace ws = NSWorkspace.sharedWorkspace();
 			NSString type = ws.typeOfFile(path, 0);
@@ -244,7 +244,7 @@
 					OS.UTTypeEqual(type.id, NSString.stringWith("public.shell-script").id)); //$NON-NLS-1$
 		}
 	}
-	OS.free(ptr);
+	C.free(ptr);
 	return result;
 }
 
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
index 617e2ac..75ae13f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011, 2016 IBM Corporation and others.
+ * Copyright (c) 2011, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -1703,7 +1703,7 @@
 		NSNumber number = new NSNumber (value);
 		long /*int*/ ptr = number.objCType ();
 		byte[] type = new byte[1];
-		OS.memmove (type, ptr, 1);
+		C.memmove (type, ptr, 1);
 		if (type[0] == 'c' || type[0] == 'B') {
 			return new Boolean (number.boolValue ());
 		}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java
index 949f076..6e117c7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
 
 
 import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 
 /**
@@ -214,9 +215,9 @@
 					OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width*4, 32);
 			NSPoint point = new NSPoint();
 			if (style == SWT.CURSOR_WAIT) {
-				OS.memmove(nsImageRep.bitmapData(), WAIT_SOURCE, WAIT_SOURCE.length);
+				C.memmove(nsImageRep.bitmapData(), WAIT_SOURCE, WAIT_SOURCE.length);
 			} else { //style == SWT.CURSOR_IBEAM
-				OS.memmove(nsImageRep.bitmapData(), SHADOWED_IBEAM_SOURCE, SHADOWED_IBEAM_SOURCE.length);
+				C.memmove(nsImageRep.bitmapData(), SHADOWED_IBEAM_SOURCE, SHADOWED_IBEAM_SOURCE.length);
 				point.x = 4; point.y = 8;			// values from NSCursor.IBeamCursor().hotSpot();
 			}
 			nsImage.addRepresentation(nsImageRep);
@@ -330,7 +331,7 @@
 	nsImageRep = nsImageRep.initWithBitmapDataPlanes(0, width, height,
 			8, 4, true, false, OS.NSDeviceRGBColorSpace,
 			OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width * 4, 32);
-	OS.memmove(nsImageRep.bitmapData(), buffer, buffer.length);
+	C.memmove(nsImageRep.bitmapData(), buffer, buffer.length);
 	nsImage.addRepresentation(nsImageRep);
 	NSPoint point = new NSPoint();
 	point.x = hotspotX;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
index b61b83e..d4f84a7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -226,7 +226,7 @@
 	if (types != null) {
 		types[typeCount] = (byte)type;
 		if (length > 0) {
-			OS.memmove(point, element.points, length * CGPoint.sizeof);
+			C.memmove(point, element.points, length * CGPoint.sizeof);
 			System.arraycopy(point, 0, points, count, length * 2);
 		}
 	}
@@ -480,12 +480,12 @@
 			rect.size.width = size.width;
 			rect.size.height = size.height;
 			int displayCount = 16;
-			long /*int*/ displays = OS.malloc(4 * displayCount), countPtr = OS.malloc(4);
+			long /*int*/ displays = C.malloc(4 * displayCount), countPtr = C.malloc(4);
 			if (OS.CGGetDisplaysWithRect(rect, displayCount, displays, countPtr) != 0) return;
 			int[] count = new int[1], display = new int[1];
-			OS.memmove(count, countPtr, OS.PTR_SIZEOF);
+			C.memmove(count, countPtr, C.PTR_SIZEOF);
 			for (int i = 0; i < count[0]; i++) {
-				OS.memmove(display, displays + (i * 4), 4);
+				C.memmove(display, displays + (i * 4), 4);
 				OS.CGDisplayBounds(display[0], rect);
 				double /*float*/ scaling = 1;
 				for (int j = 0; j < screens.count(); j++) {
@@ -503,7 +503,7 @@
 					int height = (int) (size.height * scaling);
 					NSBitmapImageRep rep = (NSBitmapImageRep)new NSBitmapImageRep().alloc();
 					rep = rep.initWithBitmapDataPlanes(0, width, height, 8, 3, false, false, OS.NSDeviceRGBColorSpace, OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width * 4, 32);
-					OS.memset(rep.bitmapData(), 0xFF, width * height * 4);
+					C.memset(rep.bitmapData(), 0xFF, width * height * 4);
 					imageHandle.addRepresentation(rep);
 					rep.release();
 				}
@@ -514,8 +514,8 @@
 					OS.CGImageRelease(srcImage);
 				}
 			}
-			OS.free(displays);
-			OS.free(countPtr);
+			C.free(displays);
+			C.free(countPtr);
 		}
 	} finally {
 		uncheckGC(pool);
@@ -712,22 +712,22 @@
 	if (count > 0) {
 		long /*int*/ cgPath = OS.CGPathCreateMutable();
 		if (cgPath == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-		long /*int*/ points = OS.malloc(NSPoint.sizeof * 3);
+		long /*int*/ points = C.malloc(NSPoint.sizeof * 3);
 		if (points == 0) SWT.error(SWT.ERROR_NO_HANDLES);
 		double /*float*/ [] pt = new double /*float*/ [6];
 		for (int i = 0; i < count; i++) {
 			int element = (int)/*64*/nsPath.elementAtIndex(i, points);
 			switch (element) {
 				case OS.NSMoveToBezierPathElement:
-					OS.memmove(pt, points, NSPoint.sizeof);
+					C.memmove(pt, points, NSPoint.sizeof);
 					OS.CGPathMoveToPoint(cgPath, 0, pt[0], pt[1]);
 					break;
 				case OS.NSLineToBezierPathElement:
-                	OS.memmove(pt, points, NSPoint.sizeof);
+                	C.memmove(pt, points, NSPoint.sizeof);
                     OS.CGPathAddLineToPoint(cgPath, 0, pt[0], pt[1]);
 					break;
 				 case OS.NSCurveToBezierPathElement:
-					 OS.memmove(pt, points, NSPoint.sizeof * 3);
+					 C.memmove(pt, points, NSPoint.sizeof * 3);
 					 OS.CGPathAddCurveToPoint(cgPath, 0, pt[0], pt[1], pt[2], pt[3], pt[4], pt[5]);
 					 break;
                 case OS.NSClosePathBezierPathElement:
@@ -735,7 +735,7 @@
 					 break;
 			}
 		}
-		OS.free(points);
+		C.free(points);
 		return cgPath;
 	}
 	return 0;
@@ -2473,7 +2473,7 @@
 			int pointCount = 0;
 			Region clipRgn = new Region(device);
 			int[] pointArray = new int[count * 2];
-			long /*int*/ points = OS.malloc(NSPoint.sizeof);
+			long /*int*/ points = C.malloc(NSPoint.sizeof);
 			if (points == 0) SWT.error(SWT.ERROR_NO_HANDLES);
 			NSPoint pt = new NSPoint();
 			for (int i = 0; i < count; i++) {
@@ -2498,7 +2498,7 @@
 				}
 			}
 			if (pointCount != 0) clipRgn.add(pointArray, pointCount);
-			OS.free(points);
+			C.free(points);
 			region.intersect(clipRgn);
 			clipRgn.dispose();
 		}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
index 935503c..6d9f756 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
@@ -179,20 +179,20 @@
 				/* Compute the alpha values */
 				long /*int*/ bitmapBytesPerRow = width;
 				long /*int*/ bitmapByteCount = bitmapBytesPerRow * height;
-				long /*int*/ alphaBitmapData = OS.malloc(bitmapByteCount);
+				long /*int*/ alphaBitmapData = C.malloc(bitmapByteCount);
 				long /*int*/ alphaBitmapCtx = OS.CGBitmapContextCreate(alphaBitmapData, width, height, 8, bitmapBytesPerRow, 0, OS.kCGImageAlphaOnly);
 				NSGraphicsContext.static_saveGraphicsState();
 				NSGraphicsContext.setCurrentContext(NSGraphicsContext.graphicsContextWithGraphicsPort(alphaBitmapCtx, false));
 				nativeRep.drawInRect(rect);
 				NSGraphicsContext.static_restoreGraphicsState();
 				byte[] alphaData = new byte[(int)/*64*/bitmapByteCount];
-				OS.memmove(alphaData, alphaBitmapData, bitmapByteCount);
-				OS.free(alphaBitmapData);
+				C.memmove(alphaData, alphaBitmapData, bitmapByteCount);
+				C.free(alphaBitmapData);
 				OS.CGContextRelease(alphaBitmapCtx);
 
 				/* Merge the alpha values with the pixels */
 				byte[] srcData = new byte[height * bpr];
-				OS.memmove(srcData, rep.bitmapData(), srcData.length);
+				C.memmove(srcData, rep.bitmapData(), srcData.length);
 				for (int a = 0, p = 0; a < alphaData.length; a++, p += 4) {
 					srcData[p] = alphaData[a];
 					float alpha = alphaData[a] & 0xFF;
@@ -202,7 +202,7 @@
 						srcData[p+3] = (byte)(((srcData[p+3] & 0xFF) / alpha) * 0xFF);
 					}
 				}
-				OS.memmove(rep.bitmapData(), srcData, srcData.length);
+				C.memmove(rep.bitmapData(), srcData, srcData.length);
 
 				// If the alpha has only 0 or 255 (-1) for alpha values, compute the transparent pixel color instead
 				// of a continuous alpha range.
@@ -405,7 +405,7 @@
 	rep.release();
 
 	long /*int*/ data = rep.bitmapData();
-	OS.memmove(data, srcData, srcWidth * srcHeight * 4);
+	C.memmove(data, srcData, srcWidth * srcHeight * 4);
 	if (flag != SWT.IMAGE_COPY) {
 		final int redOffset, greenOffset, blueOffset;
 		if (srcBpp == 32 && (srcBitmapFormat & OS.NSAlphaFirstBitmapFormat) == 0) {
@@ -432,7 +432,7 @@
 			byte oneBlue = (byte)oneRGB.blue;
 			byte[] line = new byte[(int)/*64*/srcBpr];
 			for (int y=0; y<srcHeight; y++) {
-				OS.memmove(line, data + (y * srcBpr), srcBpr);
+				C.memmove(line, data + (y * srcBpr), srcBpr);
 				int offset = 0;
 				for (int x=0; x<srcWidth; x++) {
 					int red = line[offset+redOffset] & 0xFF;
@@ -450,14 +450,14 @@
 					}
 					offset += 4;
 				}
-				OS.memmove(data + (y * srcBpr), line, srcBpr);
+				C.memmove(data + (y * srcBpr), line, srcBpr);
 			}
 			break;
 		}
 		case SWT.IMAGE_GRAY: {
 			byte[] line = new byte[(int)/*64*/srcBpr];
 			for (int y=0; y<srcHeight; y++) {
-				OS.memmove(line, data + (y * srcBpr), srcBpr);
+				C.memmove(line, data + (y * srcBpr), srcBpr);
 				int offset = 0;
 				for (int x=0; x<srcWidth; x++) {
 					int red = line[offset+redOffset] & 0xFF;
@@ -467,7 +467,7 @@
 					line[offset+redOffset] = line[offset+greenOffset] = line[offset+blueOffset] = intensity;
 					offset += 4;
 				}
-				OS.memmove(data + (y * srcBpr), line, srcBpr);
+				C.memmove(data + (y * srcBpr), line, srcBpr);
 			}
 			break;
 		}
@@ -844,7 +844,7 @@
 	long /*int*/ bitmapFormat = imageRep.bitmapFormat();
 	long /*int*/ dataSize = height * bpr;
 	byte[] srcData = new byte[(int)/*64*/dataSize];
-	OS.memmove(srcData, bitmapData, dataSize);
+	C.memmove(srcData, bitmapData, dataSize);
 
 	PaletteData palette;
 	if (bpp == 32 && (bitmapFormat & OS.NSAlphaFirstBitmapFormat) == 0) {
@@ -935,7 +935,7 @@
 		long /*int*/ format = imageRep.bitmapFormat();
 		long /*int*/ dataSize = height * bpr;
 		byte[] srcData = new byte[(int)/*64*/dataSize];
-		OS.memmove(srcData, bitmapData, dataSize);
+		C.memmove(srcData, bitmapData, dataSize);
 		if (info.transparentPixel != -1) {
 			if ((format & OS.NSAlphaFirstBitmapFormat) != 0) {
 				for (int i=0; i<dataSize; i+=4) {
@@ -968,7 +968,7 @@
 		// Since we just calculated alpha for the image rep, tell it that it now has an alpha component.
 		imageRep.setAlpha(true);
 
-		OS.memmove(bitmapData, srcData, dataSize);
+		C.memmove(bitmapData, srcData, dataSize);
 	} finally {
 		if (pool != null) pool.release();
 	}
@@ -1073,7 +1073,7 @@
 	}
 
 	rep = rep.initWithBitmapDataPlanes(0, imageData.width, imageData.height, 8, hasAlpha ? 4 : 3, hasAlpha, false, OS.NSDeviceRGBColorSpace, OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, bpr, 32);
-	OS.memmove(rep.bitmapData(), buffer, dataSize);
+	C.memmove(rep.bitmapData(), buffer, dataSize);
 	return rep;
 }
 
@@ -1400,7 +1400,7 @@
 	handle = handle.initWithSize(size);
 	NSBitmapImageRep rep = (NSBitmapImageRep)new NSBitmapImageRep().alloc();
 	rep = rep.initWithBitmapDataPlanes(0, width, height, 8, 3, false, false, OS.NSDeviceRGBColorSpace, OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width * 4, 32);
-	OS.memset(rep.bitmapData(), 0xFF, width * height * 4);
+	C.memset(rep.bitmapData(), 0xFF, width * height * 4);
 	handle.addRepresentation(rep);
 	rep.release();
 	handle.setCacheMode(OS.NSImageCacheNever);
@@ -1681,7 +1681,7 @@
 		}
 		byte[] line = new byte[(int)bpr];
 		for (int i = 0, offset = 0; i < height; i++, offset += bpr) {
-			OS.memmove(line, data + offset, bpr);
+			C.memmove(line, data + offset, bpr);
 			for (int j = 0; j  < line.length; j += 4) {
 				if (line[j + redOffset] == red && line[j + greenOffset] == green && line[j + blueOffset] == blue) {
 					line[j + redOffset] = newRed;
@@ -1689,7 +1689,7 @@
 					line[j + blueOffset] = newBlue;
 				}
 			}
-			OS.memmove(data + offset, line, bpr);
+			C.memmove(data + offset, line, bpr);
 		}
 		alphaInfo.transparentPixel = (newRed & 0xFF) << 16 | (newGreen & 0xFF) << 8 | (newBlue & 0xFF);
 	} finally {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Path.java
index 824e597..b275507 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Path.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
 package org.eclipse.swt.graphics;
 
 import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 
 /**
@@ -245,7 +246,7 @@
 
 void appendBezierPath (NSBezierPath path) {
 	int count = (int)/*64*/path.elementCount();
-	long /*int*/ points = OS.malloc(3 * NSPoint.sizeof);
+	long /*int*/ points = C.malloc(3 * NSPoint.sizeof);
 	if (points == 0) SWT.error(SWT.ERROR_NO_HANDLES);
 	NSPoint pt1 = new NSPoint();
 	NSPoint pt2 = new NSPoint();
@@ -279,7 +280,7 @@
 				break;
 		}
 	}
-	OS.free(points);
+	C.free(points);
 }
 
 /**
@@ -392,7 +393,7 @@
 		attrStr.release();
 		range = layoutManager.glyphRangeForTextContainer(textContainer);
 		if (range.length != 0) {
-			long /*int*/ glyphs = OS.malloc((range.length + 1) * 4);
+			long /*int*/ glyphs = C.malloc((range.length + 1) * 4);
 			long /*int*/ count = layoutManager.getGlyphs(glyphs, range);
 			NSBezierPath path = NSBezierPath.bezierPath();
 			for (int i = 0; i < count; i++) {
@@ -404,7 +405,7 @@
 				path.moveToPoint(pt);
 				path.appendBezierPathWithGlyphs(glyphs + (i * 4), 1, actualFont);
 			}
-			OS.free(glyphs);
+			C.free(glyphs);
 			NSAffineTransform transform = NSAffineTransform.transform();
 			transform.scaleXBy(1, -1);
 			path.transformUsingAffineTransform(transform);
@@ -471,15 +472,15 @@
 	try {
 		//TODO - see windows
 		if (outline) {
-			long /*int*/ pixel = OS.malloc(4);
+			long /*int*/ pixel = C.malloc(4);
 			if (pixel == 0) SWT.error(SWT.ERROR_NO_HANDLES);
 			int[] buffer = new int[]{0xFFFFFFFF};
-			OS.memmove(pixel, buffer, 4);
+			C.memmove(pixel, buffer, 4);
 			long /*int*/ colorspace = OS.CGColorSpaceCreateDeviceRGB();
 			long /*int*/ context = OS.CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorspace, OS.kCGImageAlphaNoneSkipFirst);
 			OS.CGColorSpaceRelease(colorspace);
 			if (context == 0) {
-				OS.free(pixel);
+				C.free(pixel);
 				SWT.error(SWT.ERROR_NO_HANDLES);
 			}
 			GCData data = gc.data;
@@ -504,8 +505,8 @@
 			OS.CGPathRelease(path);
 			OS.CGContextStrokePath(context);
 			OS.CGContextRelease(context);
-			OS.memmove(buffer, pixel, 4);
-			OS.free(pixel);
+			C.memmove(buffer, pixel, 4);
+			C.free(pixel);
 			return buffer[0] != 0xFFFFFFFF;
 		} else {
 			NSPoint point = new NSPoint();
@@ -640,7 +641,7 @@
 		int pointCount = 0, typeCount = 0;
 		byte[] types = new byte[count];
 		float[] pointArray = new float[count * 6];
-		long /*int*/ points = OS.malloc(3 * NSPoint.sizeof);
+		long /*int*/ points = C.malloc(3 * NSPoint.sizeof);
 		if (points == 0) SWT.error(SWT.ERROR_NO_HANDLES);
 		NSPoint pt = new NSPoint();
 		for (int i = 0; i < count; i++) {
@@ -675,7 +676,7 @@
 					break;
 			}
 		}
-		OS.free(points);
+		C.free(points);
 		if (pointCount != pointArray.length) {
 			float[] temp = new float[pointCount];
 			System.arraycopy(pointArray, 0, temp, 0, pointCount);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java
index bc0aa81..103035a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,9 +11,9 @@
 package org.eclipse.swt.graphics;
 
 
+import org.eclipse.swt.*;
 import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
-import org.eclipse.swt.*;
 
 /**
  * Instances of this class represent areas of an x-y coordinate
@@ -378,7 +378,7 @@
 long /*int*/ convertRgn(long /*int*/ message, long /*int*/ rgn, long /*int*/ r, long /*int*/ newRgn) {
 	if (message == OS.kQDRegionToRectsMsgParse) {
 		short[] rect = new short[4];
-		OS.memmove(rect, r, rect.length * 2);
+		C.memmove(rect, r, rect.length * 2);
 		int i = 0;
 		NSPoint point = new NSPoint();
 		int[] points = new int[10];
@@ -479,7 +479,7 @@
 short[] rect = new short[4];
 long /*int*/ regionToRects(long /*int*/ message, long /*int*/ rgn, long /*int*/ r, long /*int*/ path) {
 	if (message == OS.kQDRegionToRectsMsgParse) {
-		OS.memmove(rect, r, rect.length * 2);
+		C.memmove(rect, r, rect.length * 2);
 		pt.x = rect[1];
 		pt.y = rect[0];
 		OS.objc_msgSend(path, OS.sel_moveToPoint_, pt);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
index 715eef6..ef7d797 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -316,7 +316,7 @@
 	int numberOfLines;
 	layoutManager.glyphRangeForTextContainer(textContainer);
 	long /*int*/ numberOfGlyphs = layoutManager.numberOfGlyphs(), index;
-	long /*int*/ rangePtr = OS.malloc(NSRange.sizeof);
+	long /*int*/ rangePtr = C.malloc(NSRange.sizeof);
 	NSRange lineRange = new NSRange();
 	for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++){
 	    layoutManager.lineFragmentUsedRectForGlyphAtIndex(index, rangePtr, true);
@@ -339,7 +339,7 @@
 		bounds[0] = new NSRect();
 		bounds[0].height = Math.max(layoutManager.defaultLineHeightForFont(nsFont), ascent + descent);
 	}
-	OS.free(rangePtr);
+	C.free(rangePtr);
 	offsets[numberOfLines] = (int)/*64*/textStorage.length();
 	this.lineOffsets = offsets;
 	this.lineBounds = bounds;
@@ -2216,14 +2216,14 @@
 		size.width = metrics.width;
 		size.height = metrics.ascent + metrics.descent;
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc(NSSize.sizeof);
+		long /*int*/ result = C.malloc(NSSize.sizeof);
 		OS.memmove(result, size, NSSize.sizeof);
 		return result;
 	} else if (sel == OS.sel_cellBaselineOffset) {
 		NSPoint point = new NSPoint();
 		point.y = -metrics.descent;
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc(NSPoint.sizeof);
+		long /*int*/ result = C.malloc(NSPoint.sizeof);
 		OS.memmove(result, point, NSPoint.sizeof);
 		return result;
 	}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index 80b8ce6..ceea364 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -875,7 +875,7 @@
 				OS.SetFrontProcess (psn);
 			}
 		}
-		ptr = OS.getenv (ascii ("APP_ICON_" + pid));
+		ptr = C.getenv (ascii ("APP_ICON_" + pid));
 		if (ptr != 0) {
 			NSString path = NSString.stringWithUTF8String (ptr);
 			NSImage image = (NSImage) new NSImage().alloc();
@@ -4329,7 +4329,7 @@
 static NSString getApplicationName() {
 	NSString name = null;
 	int pid = OS.getpid ();
-	long /*int*/ ptr = OS.getenv (ascii ("APP_NAME_" + pid));
+	long /*int*/ ptr = C.getenv (ascii ("APP_NAME_" + pid));
 	if (ptr != 0) name = NSString.stringWithUTF8String(ptr);
 	if (name == null && APP_NAME != null) name = NSString.stringWith(APP_NAME);
 	if (name == null) {
@@ -5682,19 +5682,19 @@
 	} else if (sel == OS.sel_markedRange) {
 		NSRange range = widget.markedRange (id, sel);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRange.sizeof);
+		long /*int*/ result = C.malloc (NSRange.sizeof);
 		OS.memmove (result, range, NSRange.sizeof);
 		return result;
 	} else if (sel == OS.sel_selectedRange) {
 		NSRange range = widget.selectedRange (id, sel);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRange.sizeof);
+		long /*int*/ result = C.malloc (NSRange.sizeof);
 		OS.memmove (result, range, NSRange.sizeof);
 		return result;
 	} else if (sel == OS.sel_cellSize) {
 		NSSize size = widget.cellSize (id, sel);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSSize.sizeof);
+		long /*int*/ result = C.malloc (NSSize.sizeof);
 		OS.memmove (result, size, NSSize.sizeof);
 		return result;
 	} else if (sel == OS.sel_hasMarkedText) {
@@ -5896,7 +5896,7 @@
 	} else if (sel == OS.sel_firstRectForCharacterRange_) {
 		NSRect rect = widget.firstRectForCharacterRange (id, sel, arg0);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_insertText_) {
@@ -5938,7 +5938,7 @@
 	} else if (sel == OS.sel_headerRectOfColumn_) {
 		NSRect rect = widget.headerRectOfColumn(id, sel, arg0);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_imageRectForBounds_) {
@@ -5946,7 +5946,7 @@
 		OS.memmove(rect, arg0, NSRect.sizeof);
 		rect = widget.imageRectForBounds(id, sel, rect);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_titleRectForBounds_) {
@@ -5954,7 +5954,7 @@
 		OS.memmove(rect, arg0, NSRect.sizeof);
 		rect = widget.titleRectForBounds(id, sel, rect);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_cellSizeForBounds_) {
@@ -5962,7 +5962,7 @@
 		OS.memmove(rect, arg0, NSRect.sizeof);
 		NSSize size = widget.cellSizeForBounds(id, sel, rect);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSSize.sizeof);
+		long /*int*/ result = C.malloc (NSSize.sizeof);
 		OS.memmove (result, size, NSSize.sizeof);
 		return result;
 	} else if (sel == OS.sel_setObjectValue_) {
@@ -5972,7 +5972,7 @@
 	} else if (sel == OS.sel_sizeOfLabel_) {
 		NSSize size = widget.sizeOfLabel(id, sel, arg0 != 0);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc(NSSize.sizeof);
+		long /*int*/ result = C.malloc(NSSize.sizeof);
 		OS.memmove(result, size, NSSize.sizeof);
 		return result;
 	} else if (sel == OS.sel_comboBoxSelectionDidChange_) {
@@ -6089,7 +6089,7 @@
 		OS.memmove(rect, arg0, NSRect.sizeof);
 		rect = widget.expansionFrameWithFrame_inView(id, sel, rect, arg1);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_focusRingMaskBoundsForFrame_inView_) {
@@ -6097,7 +6097,7 @@
 		OS.memmove(rect, arg0, NSRect.sizeof);
 		rect = widget.focusRingMaskBoundsForFrame(id, sel, rect, arg1);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_drawLabel_inRect_) {
@@ -6144,7 +6144,7 @@
 	} else if (sel == OS.sel_textView_willChangeSelectionFromCharacterRange_toCharacterRange_) {
 		NSRange range = widget.textView_willChangeSelectionFromCharacterRange_toCharacterRange(id, sel, arg0, arg1, arg2);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRange.sizeof);
+		long /*int*/ result = C.malloc (NSRange.sizeof);
 		OS.memmove (result, range, NSRange.sizeof);
 		return result;
 	} else if (sel == OS.sel_dragSelectionWithEvent_offset_slideBack_) {
@@ -6160,7 +6160,7 @@
 		OS.memmove (rect, arg1, NSRect.sizeof);
 		rect = widget.drawTitleWithFrameInView (id, sel, arg0, rect, arg2);
 		/* NOTE that this is freed in C */
-		long /*int*/ result = OS.malloc (NSRect.sizeof);
+		long /*int*/ result = C.malloc (NSRect.sizeof);
 		OS.memmove (result, rect, NSRect.sizeof);
 		return result;
 	} else if (sel == OS.sel_hitTestForEvent_inRect_ofView_) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
index 01399ed..ceb40d5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -353,11 +353,11 @@
 	NSString path = new NSString(arg1);
 	if (filterExtensions != null && filterExtensions.length != 0) {
 		NSFileManager manager = NSFileManager.defaultManager();
-		long /*int*/ ptr = OS.malloc(1);
+		long /*int*/ ptr = C.malloc(1);
 		boolean found = manager.fileExistsAtPath(path, ptr);
 		byte[] isDirectory = new byte[1];
-		OS.memmove(isDirectory, ptr, 1);
-		OS.free(ptr);
+		C.memmove(isDirectory, ptr, 1);
+		C.free(ptr);
 		if (found) {
 			if (isDirectory[0] != 0) {
 				return 1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java
index 5113a3e..a93a43a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/IME.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 
 /**
@@ -462,7 +463,7 @@
 		NSRange rangeLimit = new NSRange (), effectiveRange = new NSRange ();
 		rangeLimit.length = length;
 		int rangeCount = 0;
-		long /*int*/ ptr = OS.malloc (NSRange.sizeof);
+		long /*int*/ ptr = C.malloc (NSRange.sizeof);
 		for (int i = 0; i < length;) {
 			NSDictionary attribs = attribStr.attributesAtIndex(i, ptr, rangeLimit);
 			OS.memmove (effectiveRange, ptr, NSRange.sizeof);
@@ -471,7 +472,7 @@
 			ranges [rangeCount * 2 + 1] = (int)/*64*/(effectiveRange.location + effectiveRange.length - 1);
 			styles [rangeCount++] = getStyle (attribs);
 		}
-		OS.free (ptr);
+		C.free (ptr);
 		if (rangeCount != styles.length) {
 			TextStyle [] newStyles = new TextStyle [rangeCount];
 			System.arraycopy (styles, 0, newStyles, 0, newStyles.length);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
index 663ed14..3e98df4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
 import org.eclipse.swt.*;
 import org.eclipse.swt.events.*;
 import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
 import org.eclipse.swt.internal.cocoa.*;
 
 /**
@@ -305,7 +306,7 @@
 	range.length = offsets[linkIndex].y - offsets[linkIndex].x + 1;
 	NSRange glyphRange = layoutManager.glyphRangeForCharacterRange(range, 0);
 
-	long /*int*/ rangePtr = OS.malloc(NSRange.sizeof);
+	long /*int*/ rangePtr = C.malloc(NSRange.sizeof);
 	NSRange lineRange = new NSRange();
 
 	/* compute number of lines in the link */
@@ -336,7 +337,7 @@
 		result[i] = new NSRect();
 		OS.NSIntersectionRect(result[i], usedRect, boundsRect);
 	}
-	OS.free(rangePtr);
+	C.free(rangePtr);
 	return result;
 }