Bug 888280 - Give several things in CTypes.cpp internal name linkage. r=evilpies

This commit is contained in:
Dan Gohman 2013-07-03 15:23:05 -07:00
Родитель 0049df5d64
Коммит ae00e3dd0e
2 изменённых файлов: 10 добавлений и 25 удалений

Просмотреть файл

@ -787,14 +787,14 @@ GetABICode(JSObject* obj)
return ABICode(JSVAL_TO_INT(result)); return ABICode(JSVAL_TO_INT(result));
} }
JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = { static JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = {
#define MSG_DEF(name, number, count, exception, format) \ #define MSG_DEF(name, number, count, exception, format) \
{ format, count, exception } , { format, count, exception } ,
#include "ctypes/ctypes.msg" #include "ctypes/ctypes.msg"
#undef MSG_DEF #undef MSG_DEF
}; };
const JSErrorFormatString* static const JSErrorFormatString*
GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber) GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber)
{ {
if (0 < errorNumber && errorNumber < CTYPESERR_LIMIT) if (0 < errorNumber && errorNumber < CTYPESERR_LIMIT)
@ -802,7 +802,7 @@ GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber)
return NULL; return NULL;
} }
JSBool static JSBool
TypeError(JSContext* cx, const char* expected, jsval actual) TypeError(JSContext* cx, const char* expected, jsval actual)
{ {
JSString* str = JS_ValueToSource(cx, actual); JSString* str = JS_ValueToSource(cx, actual);
@ -1009,7 +1009,7 @@ InitTypeConstructor(JSContext* cx,
return true; return true;
} }
JSObject* static JSObject*
InitInt64Class(JSContext* cx, InitInt64Class(JSContext* cx,
HandleObject parent, HandleObject parent,
JSClass* clasp, JSClass* clasp,
@ -1057,7 +1057,7 @@ AttachProtos(JSObject* proto, const AutoObjectVector& protos)
JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i])); JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i]));
} }
JSBool static JSBool
InitTypeClasses(JSContext* cx, HandleObject parent) InitTypeClasses(JSContext* cx, HandleObject parent)
{ {
// Initialize the ctypes.CType class. This acts as an abstract base class for // 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 // Utility function to access a property of an object as an object
// returns false and sets the error if the property does not exist // returns false and sets the error if the property does not exist
// or is not an object // or is not an object
bool GetObjectProperty(JSContext *cx, HandleObject obj, static bool GetObjectProperty(JSContext *cx, HandleObject obj,
const char *property, MutableHandleObject result) const char *property, MutableHandleObject result)
{ {
RootedValue val(cx); RootedValue val(cx);
if (!JS_GetProperty(cx, obj, property, val.address())) { if (!JS_GetProperty(cx, obj, property, val.address())) {
@ -2032,7 +2032,7 @@ strnlen(const CharType* begin, size_t max)
// parent's buffer. // parent's buffer.
// * If 'parentObj' is null, the new CData object may or may not own its // * If 'parentObj' is null, the new CData object may or may not own its
// resulting buffer depending on the 'ownResult' argument. // resulting buffer depending on the 'ownResult' argument.
JSBool static JSBool
ConvertToJS(JSContext* cx, ConvertToJS(JSContext* cx,
HandleObject typeObj, HandleObject typeObj,
HandleObject parentObj, 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. // 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 // In this case, ownership of the allocated string is handed off to the
// caller; 'freePointer' will be set to indicate this. // caller; 'freePointer' will be set to indicate this.
JSBool static JSBool
ImplicitConvert(JSContext* cx, ImplicitConvert(JSContext* cx,
HandleValue val, HandleValue val,
JSObject* targetType_, JSObject* targetType_,
@ -2578,7 +2578,7 @@ ImplicitConvert(JSContext* cx,
// Convert jsval 'val' to a C binary representation of CType 'targetType', // Convert jsval 'val' to a C binary representation of CType 'targetType',
// storing the result in 'buffer'. This function is more forceful than // storing the result in 'buffer'. This function is more forceful than
// ImplicitConvert. // ImplicitConvert.
JSBool static JSBool
ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* buffer) ExplicitConvert(JSContext* cx, HandleValue val, HandleObject targetType, void* buffer)
{ {
// If ImplicitConvert succeeds, use that result. // If ImplicitConvert succeeds, use that result.

Просмотреть файл

@ -183,10 +183,6 @@ enum ErrorNum {
CTYPESERR_LIMIT 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. * ABI constants that specify the calling convention to use.
* ctypes.default_abi corresponds to the cdecl convention, and in almost all * ctypes.default_abi corresponds to the cdecl convention, and in almost all
@ -311,17 +307,6 @@ bool IsCTypesGlobal(JSObject* obj);
JSCTypesCallbacks* GetCallbacks(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 ** JSClass reserved slot definitions
*******************************************************************************/ *******************************************************************************/