From 135e9d40138b8137a2a3282a3e5e274eee851787 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 3 Jul 2013 15:23:05 -0700 Subject: [PATCH] Bug 888280 - Give several things in CTypes.cpp internal name linkage. r=evilpies --- js/src/ctypes/CTypes.cpp | 20 ++++++++++---------- js/src/ctypes/CTypes.h | 15 --------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 4c5504365d5..c00399c781f 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -787,14 +787,14 @@ GetABICode(JSObject* obj) return ABICode(JSVAL_TO_INT(result)); } -JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = { +static JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = { #define MSG_DEF(name, number, count, exception, format) \ { format, count, exception } , #include "ctypes/ctypes.msg" #undef MSG_DEF }; -const JSErrorFormatString* +static const JSErrorFormatString* GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber) { if (0 < errorNumber && errorNumber < CTYPESERR_LIMIT) @@ -802,7 +802,7 @@ GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber) return NULL; } -JSBool +static JSBool TypeError(JSContext* cx, const char* expected, jsval actual) { JSString* str = JS_ValueToSource(cx, actual); @@ -1009,7 +1009,7 @@ InitTypeConstructor(JSContext* cx, return true; } -JSObject* +static JSObject* InitInt64Class(JSContext* cx, HandleObject parent, JSClass* clasp, @@ -1057,7 +1057,7 @@ AttachProtos(JSObject* proto, const AutoObjectVector& protos) JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i])); } -JSBool +static JSBool InitTypeClasses(JSContext* cx, HandleObject parent) { // Initialize the ctypes.CType class. This acts as an abstract base class for @@ -1253,8 +1253,8 @@ GetCallbacks(JSObject* obj) // Utility function to access a property of an object as an object // returns false and sets the error if the property does not exist // or is not an object -bool GetObjectProperty(JSContext *cx, HandleObject obj, - const char *property, MutableHandleObject result) +static bool GetObjectProperty(JSContext *cx, HandleObject obj, + const char *property, MutableHandleObject result) { RootedValue val(cx); if (!JS_GetProperty(cx, obj, property, val.address())) { @@ -2032,7 +2032,7 @@ strnlen(const CharType* begin, size_t max) // parent's buffer. // * If 'parentObj' is null, the new CData object may or may not own its // resulting buffer depending on the 'ownResult' argument. -JSBool +static JSBool ConvertToJS(JSContext* cx, HandleObject typeObj, HandleObject parentObj, @@ -2187,7 +2187,7 @@ bool CanConvertTypedArrayItemTo(JSObject *baseType, JSObject *valObj, JSContext // we can autoconvert a JS string primitive to a pointer-to-character type. // In this case, ownership of the allocated string is handed off to the // caller; 'freePointer' will be set to indicate this. -JSBool +static JSBool ImplicitConvert(JSContext* cx, HandleValue val, JSObject* targetType_, @@ -2578,7 +2578,7 @@ ImplicitConvert(JSContext* cx, // Convert jsval 'val' to a C binary representation of CType 'targetType', // storing the result in 'buffer'. This function is more forceful than // ImplicitConvert. -JSBool +static JSBool ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* buffer) { // If ImplicitConvert succeeds, use that result. diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 9f92e0b5146..dfc650ea06c 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -183,10 +183,6 @@ enum ErrorNum { CTYPESERR_LIMIT }; -const JSErrorFormatString* -GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber); -JSBool TypeError(JSContext* cx, const char* expected, jsval actual); - /** * ABI constants that specify the calling convention to use. * ctypes.default_abi corresponds to the cdecl convention, and in almost all @@ -311,17 +307,6 @@ bool IsCTypesGlobal(JSObject* obj); JSCTypesCallbacks* GetCallbacks(JSObject* obj); -JSBool InitTypeClasses(JSContext* cx, HandleObject parent); - -JSBool ConvertToJS(JSContext* cx, HandleObject typeObj, HandleObject dataObj, - void* data, bool wantPrimitive, bool ownResult, jsval* result); - -JSBool ImplicitConvert(JSContext* cx, HandleValue val, JSObject* targetType, - void* buffer, bool isArgument, bool* freePointer); - -JSBool ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, - void* buffer); - /******************************************************************************* ** JSClass reserved slot definitions *******************************************************************************/