From 5310ca898f75b2181473f5d3565ed21fd996bc9d Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Fri, 26 Feb 1999 17:59:16 +0000 Subject: [PATCH] fix uninitialize variable and fix various signed/unsigned warnings --- js/src/xpconnect/xpcconvert.cpp | 12 ++++++------ js/src/xpconnect/xpcnsid.cpp | 8 ++++---- js/src/xpconnect/xpcprivate.h | 2 +- js/src/xpconnect/xpcwrappedjsclass.cpp | 4 ++-- js/src/xpconnect/xpcwrappednativeclass.cpp | 2 +- js/src/xpconnect/xpt_cpp.cpp | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/js/src/xpconnect/xpcconvert.cpp b/js/src/xpconnect/xpcconvert.cpp index 7155667f0cb..9ec97b52114 100644 --- a/js/src/xpconnect/xpcconvert.cpp +++ b/js/src/xpconnect/xpcconvert.cpp @@ -299,7 +299,7 @@ XPCConvert::NativeData2JS(JSContext* cx, jsval* d, const void* s, else { // we need to build a wrapper - nsXPCWrappedNative* wrapper; + nsXPCWrappedNative* wrapper=NULL; XPCContext* xpcc; if(!iid || !(xpcc = nsXPConnect::GetContext(cx)) || !(wrapper = nsXPCWrappedNative::GetNewOrUsedWrapper(xpcc, @@ -397,7 +397,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, break; case nsXPTType::T_CHAR : { - char* bytes; + char* bytes=NULL; JSString* str; if(!(str = JS_ValueToString(cx, s))|| @@ -411,7 +411,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, } case nsXPTType::T_WCHAR : { - jschar* chars; + jschar* chars=NULL; JSString* str; if(!(str = JS_ValueToString(cx, s))|| !(chars = JS_GetStringChars(str))) @@ -439,7 +439,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, case nsXPTType::T_IID: { JSObject* obj; - const nsID* pid; + const nsID* pid=NULL; if(!JSVAL_IS_OBJECT(s) || (!(obj = JSVAL_TO_OBJECT(s))) || (!(pid = xpc_JSObjectToID(cx, obj)))) @@ -469,7 +469,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, case nsXPTType::T_CHAR_STR: { - char* bytes; + char* bytes=NULL; JSString* str; if(!(str = JS_ValueToString(cx, s))|| @@ -496,7 +496,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, case nsXPTType::T_WCHAR_STR: { - jschar* chars; + jschar* chars=NULL; JSString* str; if(!(str = JS_ValueToString(cx, s))|| diff --git a/js/src/xpconnect/xpcnsid.cpp b/js/src/xpconnect/xpcnsid.cpp index a5f122070ae..f6c8f287d53 100644 --- a/js/src/xpconnect/xpcnsid.cpp +++ b/js/src/xpconnect/xpcnsid.cpp @@ -107,7 +107,7 @@ static JSClass nsID_class = { JS_STATIC_DLL_CALLBACK(JSBool) nsID_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - IDData* data; + IDData* data=NULL; if(!JS_InstanceOf(cx, obj, &nsID_class, NULL) || !(data = (IDData*) JS_GetPrivate(cx, obj))) @@ -120,8 +120,8 @@ JS_STATIC_DLL_CALLBACK(JSBool) nsID_equals(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSObject *obj2; - IDData* data1; - IDData* data2; + IDData* data1=NULL; + IDData* data2=NULL; if(!JS_InstanceOf(cx, obj, &nsID_class, NULL) || !argc || !JSVAL_IS_OBJECT(argv[0]) || @@ -207,7 +207,7 @@ xpc_NewIDObject(JSContext *cx, const nsID& aID) const nsID* xpc_JSObjectToID(JSContext *cx, JSObject* obj) { - IDData* data; + IDData* data=NULL; if(!cx || !obj || !JS_InstanceOf(cx, obj, &nsID_class, NULL) || diff --git a/js/src/xpconnect/xpcprivate.h b/js/src/xpconnect/xpcprivate.h index 03a6aff387b..d9ac7135098 100644 --- a/js/src/xpconnect/xpcprivate.h +++ b/js/src/xpconnect/xpcprivate.h @@ -122,7 +122,7 @@ public: JSBool Init(JSObject* aGlobalObj = NULL); void DebugDump(int depth); - ~XPCContext(); + virtual ~XPCContext(); private: XPCContext(); // no implementation XPCContext(JSContext* aJSContext, diff --git a/js/src/xpconnect/xpcwrappedjsclass.cpp b/js/src/xpconnect/xpcwrappedjsclass.cpp index 948f7274222..41f45435b79 100644 --- a/js/src/xpconnect/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/xpcwrappedjsclass.cpp @@ -266,9 +266,9 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, jsval argsBuffer[ARGS_BUFFER_COUNT]; jsval* argv = NULL; uint8 i; - uint8 argc; + uint8 argc=0; jsval result; - uint8 paramCount; + uint8 paramCount=0; nsresult retval = NS_ERROR_FAILURE; JSErrorReporter older; JSBool success; diff --git a/js/src/xpconnect/xpcwrappednativeclass.cpp b/js/src/xpconnect/xpcwrappednativeclass.cpp index 140e3011b61..79881f57da1 100644 --- a/js/src/xpconnect/xpcwrappednativeclass.cpp +++ b/js/src/xpconnect/xpcwrappednativeclass.cpp @@ -275,7 +275,7 @@ static JSBool isConstructorID(JSContext *cx, jsid id) { jsval idval; - const char *property_name; + const char *property_name=NULL; // XXX this could be improved by cacheing the hashed id for "constructor" if (JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) && (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL) { diff --git a/js/src/xpconnect/xpt_cpp.cpp b/js/src/xpconnect/xpt_cpp.cpp index 61d08d1eb24..43d6b4b7027 100644 --- a/js/src/xpconnect/xpt_cpp.cpp +++ b/js/src/xpconnect/xpt_cpp.cpp @@ -77,7 +77,7 @@ class InterfaceInfoManagerImpl : public nsIInterfaceInfoManager public: InterfaceInfoManagerImpl(); - ~InterfaceInfoManagerImpl(); + virtual ~InterfaceInfoManagerImpl(); static InterfaceInfoManagerImpl* GetInterfaceInfoManager(); static nsIAllocator* GetAllocator(InterfaceInfoManagerImpl* iim = NULL); @@ -371,7 +371,7 @@ InterfaceInfoManagerImpl::BuildInterfaceForEntry(uint16 i) NS_IMETHODIMP InterfaceInfoManagerImpl::GetInfoForIID(const nsIID* iid, nsIInterfaceInfo** info) { - for(int i = 0; i < ENTRY_COUNT;i++) + for(unsigned int i = 0; i < ENTRY_COUNT;i++) { XPTInterfaceDirectoryEntry* entry = &InterfaceDirectoryEntryTable[i]; if(iid->Equals(entry->iid)) @@ -390,7 +390,7 @@ InterfaceInfoManagerImpl::GetInfoForIID(const nsIID* iid, nsIInterfaceInfo** inf NS_IMETHODIMP InterfaceInfoManagerImpl::GetInfoForName(const char* name, nsIInterfaceInfo** info) { - for(int i = 0; i < ENTRY_COUNT;i++) + for(unsigned int i = 0; i < ENTRY_COUNT;i++) { XPTInterfaceDirectoryEntry* entry = &InterfaceDirectoryEntryTable[i]; if(!strcmp(name, entry->name)) @@ -409,7 +409,7 @@ InterfaceInfoManagerImpl::GetInfoForName(const char* name, nsIInterfaceInfo** in NS_IMETHODIMP InterfaceInfoManagerImpl::GetIIDForName(const char* name, nsIID** iid) { - for(int i = 0; i < ENTRY_COUNT;i++) + for(unsigned int i = 0; i < ENTRY_COUNT;i++) { XPTInterfaceDirectoryEntry* entry = &InterfaceDirectoryEntryTable[i]; if(!strcmp(name, entry->name)) @@ -429,7 +429,7 @@ InterfaceInfoManagerImpl::GetIIDForName(const char* name, nsIID** iid) NS_IMETHODIMP InterfaceInfoManagerImpl::GetNameForIID(const nsIID* iid, char** name) { - for(int i = 0; i < ENTRY_COUNT;i++) + for(unsigned int i = 0; i < ENTRY_COUNT;i++) { XPTInterfaceDirectoryEntry* entry = &InterfaceDirectoryEntryTable[i]; if(iid->Equals(entry->iid))