Fix build warnings.

This commit is contained in:
slamm%netscape.com 1999-07-16 20:06:37 +00:00
parent 51eb48d73b
commit e33e65a165
8 changed files with 65 additions and 112 deletions

View File

@ -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;
}
}

View File

@ -224,6 +224,8 @@ extern XP_Bool XP_FileNameContainsBadChars (const char *name)
#if defined(XP_UNIX) || defined(XP_BEOS)
#include <unistd.h> /* 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 <unistd.h> /* 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) */

View File

@ -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 && count<variants)
{
if (*index == '|')
{
buffer[count++] = index + 1;
*index = 0;
}
++index;
}
return buffer;
}
///////////////////////////////////////////////////////////////////////////
/* nsPluginsDir implementation */
@ -149,7 +128,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
pLibrary = outLibrary = PR_LoadLibrary(path);
#ifdef NS_DEBUG
printf("LoadPlugin() %s returned %lx\n",path,pLibrary);
printf("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary);
#endif
return NS_OK;
@ -170,7 +149,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
UNIX_Plugin_GetMIMEDescription procedure = nsnull;
mimedescr=(char *)"";
if(procedure = (UNIX_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) {
if((procedure = (UNIX_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) != 0) {
mimedescr = procedure();
} else {
#ifdef NS_DEBUG
@ -182,7 +161,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
info.fName = GetFileName(path);
#ifdef NS_DEBUG
printf("GetMIMEDescription() %lx returned \"%s\"\n",procedure,mimedescr);
printf("GetMIMEDescription() %lx returned \"%s\"\n",
(unsigned long)procedure, mimedescr);
#endif
// copy string
@ -200,8 +180,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
for(i=0;i<num && *start;i++) {
// search start of next token (separator is ';')
if(i+1<num) {
if(nexttoc=PL_strchr(start, ';'))
if(i+1 < num) {
if((nexttoc=PL_strchr(start, ';')) != 0)
*nexttoc++=0;
else
nexttoc=start+strlen(start);

View File

@ -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 && count<variants)
{
if (*index == '|')
{
buffer[count++] = index + 1;
*index = 0;
}
++index;
}
return buffer;
}
///////////////////////////////////////////////////////////////////////////
/* nsPluginsDir implementation */
@ -149,7 +128,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
pLibrary = outLibrary = PR_LoadLibrary(path);
#ifdef NS_DEBUG
printf("LoadPlugin() %s returned %lx\n",path,pLibrary);
printf("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary);
#endif
return NS_OK;
@ -170,7 +149,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
UNIX_Plugin_GetMIMEDescription procedure = nsnull;
mimedescr=(char *)"";
if(procedure = (UNIX_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) {
if((procedure = (UNIX_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) != 0) {
mimedescr = procedure();
} else {
#ifdef NS_DEBUG
@ -182,7 +161,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
info.fName = GetFileName(path);
#ifdef NS_DEBUG
printf("GetMIMEDescription() %lx returned \"%s\"\n",procedure,mimedescr);
printf("GetMIMEDescription() %lx returned \"%s\"\n",
(unsigned long)procedure, mimedescr);
#endif
// copy string
@ -200,8 +180,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
for(i=0;i<num && *start;i++) {
// search start of next token (separator is ';')
if(i+1<num) {
if(nexttoc=PL_strchr(start, ';'))
if(i+1 < num) {
if((nexttoc=PL_strchr(start, ';')) != 0)
*nexttoc++=0;
else
nexttoc=start+strlen(start);

View File

@ -75,7 +75,7 @@ nsITextAreaWidget *textWidgetInstance = NULL;
nsITextWidget *passwordText = NULL;
nsIComboBox *comboBox = NULL;
nsIListBox *listBox = NULL;
nsIListBox *gListBox = NULL;
nsIListBox *gMultiListBox = NULL;
nsIWidget *movingWidget = NULL;
@ -258,9 +258,9 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) {
int i;
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);
@ -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;i<len;i++) {
gMultiListBox->SelectItem(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;i<gNumRadioBtns;i++) {
nsIWidget * win;
if (NS_OK == gRadioBtns[i]->QueryInterface(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;i<NUM_COMBOBOX_ITEMS;i++) {
sprintf(str, "%s %d", "List Item", i);
nsString listStr1(str);
listBox->AddItemAt(listStr1, i);
gListBox->AddItemAt(listStr1, i);
}
}

View File

@ -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");
}

View File

@ -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 */

View File

@ -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