From e33e65a165bbde482efb07a195f4ac418603f2a5 Mon Sep 17 00:00:00 2001 From: "slamm%netscape.com" Date: Fri, 16 Jul 1999 20:06:37 +0000 Subject: [PATCH] Fix build warnings. --- dom/src/base/nsJSSecurityManager.cpp | 3 +- lib/xp/xp_file.c | 10 ++-- modules/plugin/base/src/nsPluginsDirUNIX.cpp | 40 ++++--------- modules/plugin/nglsrc/nsPluginsDirUNIX.cpp | 40 ++++--------- widget/tests/widget/nsWidgetTest.cpp | 62 ++++++++++---------- xpcom/tests/TestBuffers.cpp | 6 +- xpcom/typelib/xpidl/xpidl_java.c | 1 - xpfe/bootstrap/nsAppRunner.cpp | 15 ++--- 8 files changed, 65 insertions(+), 112 deletions(-) diff --git a/dom/src/base/nsJSSecurityManager.cpp b/dom/src/base/nsJSSecurityManager.cpp index 4293242e7a28..0cf1c64963d0 100644 --- a/dom/src/base/nsJSSecurityManager.cpp +++ b/dom/src/base/nsJSSecurityManager.cpp @@ -2248,7 +2248,6 @@ PRInt32 nsJSSecurityManager::CheckForPrivilege(JSContext *cx, char *prop_name, int priv_code) { char *tmp_prop_name; - JSBool priv = JS_TRUE; if(prop_name == NULL) { return SCRIPT_SECURITY_NO_ACCESS; @@ -3017,4 +3016,4 @@ nsJSSecurityManager::CanSetProperty(JSContext * aJSContext, const jsid aName) { return NS_OK; -} \ No newline at end of file +} diff --git a/lib/xp/xp_file.c b/lib/xp/xp_file.c index 34aa83e6e9f6..d5f9d6b05a11 100644 --- a/lib/xp/xp_file.c +++ b/lib/xp/xp_file.c @@ -224,6 +224,8 @@ extern XP_Bool XP_FileNameContainsBadChars (const char *name) #if defined(XP_UNIX) || defined(XP_BEOS) +#include /* for fsync & getpid */ + /* This is just like fclose(), except that it does fflush() and fsync() first, to ensure that the bits have made it to the disk before we return. */ @@ -264,8 +266,6 @@ XP_END_PROTOS #if defined(XP_UNIX) || defined(XP_BEOS) -#include /* for getpid */ - #ifdef TRACE #define Debug 1 #define DO_TRACE(x) if (xp_file_debug) XP_TRACE(x) @@ -482,12 +482,12 @@ int XP_FileTruncate(const char* name, XP_FileType type, int32 length) */ int XP_FileWrite (const void* source, int32 count, XP_File file) { - int32 realCount; + uint32 realCount; if ( count < 0 ) realCount = XP_STRLEN( source ); else - realCount = count; + realCount = (uint32)count; return( fwrite( source, 1, realCount, file ) ); } @@ -1146,7 +1146,6 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) sprintf(buf, "%.900s/%s", conf_dir, policyFN); break; } -#endif /* MOZ_SECURITY */ case xpSecurityModule: { @@ -1163,6 +1162,7 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) HG06196 break; } +#endif /* MOZ_SECURITY */ case xpPKCS12File: /* Convert /a/b/c/foo to /a/b/c/foo.p12 (note leading dot) */ diff --git a/modules/plugin/base/src/nsPluginsDirUNIX.cpp b/modules/plugin/base/src/nsPluginsDirUNIX.cpp index f2ba97d8a155..63690377a9a9 100644 --- a/modules/plugin/base/src/nsPluginsDirUNIX.cpp +++ b/modules/plugin/base/src/nsPluginsDirUNIX.cpp @@ -50,38 +50,17 @@ static char* GetFileName(const char* pathname) static PRUint32 CalculateVariantCount(char* mimeTypes) { PRUint32 variants = 0; - char* index = mimeTypes; - while (*index) + char* ptr = mimeTypes; + while (*ptr) { - if (*index == ';') + if (*ptr == ';') variants++; - ++index; + ++ptr; } return variants; } -static char** MakeStringArray(PRUint32 variants, char* data) -{ - char** buffer = NULL; - char* index = data; - PRUint32 count = 0; - - buffer = (char **)PR_Malloc(variants * sizeof(char *)); - buffer[count++] = index; - - while (*index && countGetItemCount();i++) { - nsAutoString buf; - listBox->GetItemAt(buf, i); - char * str = buf.ToNewCString(); + nsAutoString buf2; + listBox->GetItemAt(buf2, i); + char * str = buf2.ToNewCString(); fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); @@ -273,9 +273,9 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) { fprintf(fd, "\nTesting RemoveItemAt\n\tTest: [%s]\n", eval(-1 == (int)listBox->FindItem(item4string, 0))); fflush(fd); for (i=0;i<(int)listBox->GetItemCount();i++) { - nsAutoString buf; - listBox->GetItemAt(buf, i); - char * str = buf.ToNewCString(); + nsAutoString buf2; + listBox->GetItemAt(buf2, i); + char * str = buf2.ToNewCString(); fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); @@ -393,9 +393,9 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { } for (i=0;i<(int)multi->GetItemCount();i++) { - nsAutoString buf; - multi->GetItemAt(buf, i); - char * str = buf.ToNewCString(); + nsAutoString buf2; + multi->GetItemAt(buf2, i); + char * str = buf2.ToNewCString(); fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); @@ -408,9 +408,9 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { fprintf(fd, "\nTesting RemoveItemAt\n\tTest: [%s]\n", eval(-1 == (int)multi->FindItem(item4string, (PRInt32)0))); fflush(fd); for (i=0;i<(int)multi->GetItemCount();i++) { - nsAutoString buf; - multi->GetItemAt(buf, i); - char * str = buf.ToNewCString(); + nsAutoString buf2; + multi->GetItemAt(buf2, i); + char * str = buf2.ToNewCString(); fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); @@ -471,7 +471,7 @@ nsITooltipWidget* createTooltipWindow(nsIWidget * aWin, nsIWidget* toolTipWidget; if (NS_OK == tooltip->QueryInterface(kIWidgetIID,(void**)&toolTipWidget)) { - nsIButton *toolTipButton = createSimpleButton(toolTipWidget, "tooltip",5, 5, 80, 0); + /*nsIButton *toolTipButton =*/ createSimpleButton(toolTipWidget, "tooltip",5, 5, 80, 0); NS_RELEASE(toolTipWidget); } return tooltip; @@ -551,10 +551,10 @@ nsEventStatus PR_CALLBACK ListBoxTestHandleEvent(nsGUIEvent *aEvent) { nsEventStatus result = nsEventStatus_eIgnore; nsIListWidget* widget = nsnull; - if (listBox != nsnull && NS_OK == listBox->QueryInterface(kIListWidgetIID,(void**)&widget)) + if (gListBox != nsnull && NS_OK == gListBox->QueryInterface(kIListWidgetIID,(void**)&widget)) { result = GenericListHandleEvent(aEvent, "ListBox", widget); - NS_RELEASE(listBox); + NS_RELEASE(gListBox); } return result; } @@ -583,12 +583,11 @@ nsEventStatus PR_CALLBACK MultiListBoxTestHandleEvent(nsGUIEvent *aEvent) if (!strcmp(title, kSetSelection)) { gMultiListBox->Deselect(); - PRInt32 inxs[] = {0,2,4}; PRInt32 len = 3; int i; for (i=0;iSelectItem(2);//inxs[i]); + gMultiListBox->SelectItem(2); } fprintf(gFD, "\tTested SelectItem()\n"); str.Append(" should show 'List Item 0,2,5'"); @@ -596,7 +595,6 @@ nsEventStatus PR_CALLBACK MultiListBoxTestHandleEvent(nsGUIEvent *aEvent) gFailedMsg = "Multi-List::SelectItem"; } else if (!strcmp(title, kSetSelectedIndices)) { PRInt32 inxs[] = {0,2,4}; - PRInt32 len = 3; gMultiListBox->SetSelectedIndices(inxs, 3); } else if (!strcmp(title, kRemoveSelection)) { nsString item2("Multi List Item 2"); @@ -904,12 +902,12 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent) NS_ShowWidget(tooltipWindow,PR_FALSE); break; - case NS_MOVE: + case NS_MOVE: { char str[256]; sprintf(str, "Moved window to %d,%d", aEvent->point.x, aEvent->point.y); statusText->SetText(str,actualSize); break; - + } case NS_MOUSE_LEFT_DOUBLECLICK: statusText->SetText("Left button double click",actualSize); break; @@ -919,11 +917,13 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent) break; case NS_MOUSE_ENTER: - if (DEBUG_MOUSE) printf("NS_MOUSE_ENTER 0x%X\n", aEvent->widget); + if (DEBUG_MOUSE) printf("NS_MOUSE_ENTER 0x%X\n", + (unsigned int)aEvent->widget); break; case NS_MOUSE_EXIT: - if (DEBUG_MOUSE) printf("NS_MOUSE_EXIT 0x%X\n", aEvent->widget); + if (DEBUG_MOUSE) printf("NS_MOUSE_EXIT 0x%X\n", + (unsigned int)aEvent->widget); break; case NS_MOUSE_MOVE: @@ -936,7 +936,9 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent) for (i=0;iQueryInterface(kIWidgetIID, (void**)&win)) { - printf("%d 0x%x 0x%x\n", i, win, aEvent->widget); + printf("%d 0x%x 0x%x\n", i, + (unsigned int)win, + (unsigned int)aEvent->widget); if (win == aEvent->widget) { gRadioBtns[i]->SetState(PR_TRUE); } else { @@ -1164,10 +1166,10 @@ nsEventStatus PR_CALLBACK DoSelfTests(nsGUIEvent *aEvent) textSelfTest(gFD, "Password Text", passwordText); - if (listBox) + if (gListBox) { nsIListWidget* widget; - if (NS_OK == listBox->QueryInterface(kIListWidgetIID,(void**)&widget)) + if (NS_OK == gListBox->QueryInterface(kIListWidgetIID,(void**)&widget)) { listSelfTest(gFD, "ListBox", widget); NS_RELEASE(widget); @@ -1527,14 +1529,14 @@ nsresult WidgetTest(int *argc, char **argv) y = saveY; x = saveX; rect.SetRect(x, y, 150, 100); - nsComponentManager::CreateInstance(kCListBoxCID, nsnull, kIListBoxIID, (void**)&listBox); - if (listBox) + nsComponentManager::CreateInstance(kCListBoxCID, nsnull, kIListBoxIID, (void**)&gListBox); + if (gListBox) { - NS_CreateListBox(window,listBox,rect,HandleEvent); + NS_CreateListBox(window,gListBox,rect,HandleEvent); for (i=0;iAddItemAt(listStr1, i); + gListBox->AddItemAt(listStr1, i); } } diff --git a/xpcom/tests/TestBuffers.cpp b/xpcom/tests/TestBuffers.cpp index 764f785be813..09a17bf64d5c 100644 --- a/xpcom/tests/TestBuffers.cpp +++ b/xpcom/tests/TestBuffers.cpp @@ -223,18 +223,18 @@ TestSearch(const char* delim, PRUint32 segDataSize) rv = NS_NewBuffer(&buffer, segSize, bufSize, nsnull); NS_ASSERTION(NS_SUCCEEDED(rv), "NewBuffer failed"); - PRUint32 i, amt; + PRUint32 i, j, amt; PRUint32 delimLen = nsCRT::strlen(delim); for (i = 0; i < bufDataSize; i++) { // first fill the buffer - for (PRUint32 j = 0; j < i; j++) { + for (j = 0; j < i; j++) { rv = buffer->Write("-", 1, &amt); NS_ASSERTION(NS_SUCCEEDED(rv) && amt == 1, "Write failed"); } rv = buffer->Write(delim, delimLen, &amt); NS_ASSERTION(NS_SUCCEEDED(rv), "Write failed"); if (i + amt < bufDataSize) { - for (PRUint32 j = i + amt; j < bufDataSize; j++) { + for (j = i + amt; j < bufDataSize; j++) { rv = buffer->Write("+", 1, &amt); NS_ASSERTION(NS_SUCCEEDED(rv) && amt == 1, "Write failed"); } diff --git a/xpcom/typelib/xpidl/xpidl_java.c b/xpcom/typelib/xpidl/xpidl_java.c index 47552c8c87af..7f565ea91575 100644 --- a/xpcom/typelib/xpidl/xpidl_java.c +++ b/xpcom/typelib/xpidl/xpidl_java.c @@ -403,7 +403,6 @@ type_declaration(TreeState *state) */ IDL_tree type = IDL_TYPE_DCL(state->tree).type_spec; IDL_tree dcls = IDL_TYPE_DCL(state->tree).dcls; - IDL_tree complex = NULL; /* XXX: check for illegal types */ diff --git a/xpfe/bootstrap/nsAppRunner.cpp b/xpfe/bootstrap/nsAppRunner.cpp index d8d95bc14b2f..21f01f48e357 100644 --- a/xpfe/bootstrap/nsAppRunner.cpp +++ b/xpfe/bootstrap/nsAppRunner.cpp @@ -237,13 +237,6 @@ int main(int argc, char* argv[]) // XXX: This call will be replaced by a registry initialization... NS_SetupRegistry_1(); - nsIFileLocator* locator = nsnull; - rv = nsServiceManager::GetService(kFileLocatorCID, nsIFileLocator::GetIID(), (nsISupports**)&locator); - if (NS_FAILED(rv)) - return rv; - if (!locator) - return NS_ERROR_FAILURE; - // get and start the ProfileManager service #if defined(NS_USING_PROFILES) rv = nsServiceManager::GetService(kProfileCID, @@ -345,8 +338,10 @@ int main(int argc, char* argv[]) // No directory name provided. Get File Locator nsIFileLocator* locator = nsnull; rv = nsServiceManager::GetService(kFileLocatorCID, nsIFileLocator::GetIID(), (nsISupports**)&locator); - if (NS_FAILED(rv) || !locator) - return NS_ERROR_FAILURE; + if (NS_FAILED(rv)) + return rv; + if (!locator) + return NS_ERROR_FAILURE; // Get current profile, make the new one a sibling... nsIFileSpec* spec; @@ -740,8 +735,6 @@ done: } #endif // defined(NS_USING_PROFILES) - nsServiceManager::ReleaseService(kFileLocatorCID, locator); - #ifdef XP_MAC (void)CloseTSMAwareApplication(); #endif