Warning fix and source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-05-31 12:19:04 +00:00
parent 12cca26a83
commit cb9c71ecca

View File

@@ -18,10 +18,10 @@
// to get info from a file instead/addition to current get all stuff
// API so that we can use Launch Services to get mime type info.
//
// Implement geticon from one of the finder info functions - or
// use launch services and search that app's plist for the icon.
// Implement geticon from one of the finder info functions - or
// use launch services and search that app's plist for the icon.
//
// Put some special juice in for the print command.
// Put some special juice in for the print command.
//
//
//
@@ -101,7 +101,7 @@ OSErr BuildVolumeList(Boolean includeRemote, short *vols,
long *count, long vMAttribMask) {
HParamBlockRec volPB;
Boolean isRemote;
OSErr err;
OSErr err = noErr;
long nlocal, nremote;
long vMAttrib;
@@ -341,14 +341,14 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool
{
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
return FALSE;
return false;
}
bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int index)
{
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
return FALSE;
return false;
}
bool wxFileTypeImpl::GetOpenCommand(wxString *openCmd,
@@ -548,10 +548,10 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
{
mimeTypes.Clear();
mimeTypes.Add(s);
return TRUE;
return true;
}
else
return FALSE;
return false;
}
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
@@ -559,7 +559,7 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
// no such file type or no value or incorrect icon entry
return FALSE;
return false;
}
size_t wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
@@ -647,8 +647,7 @@ void wxMimeTypesManagerImpl::Initialize(int mailcapStyles, const wxString& extra
{
wxString cmd;
impl.GetOpenCommand (&cmd,
wxFileType::MessageParameters (wxT("http://www.google.com"),
_T("")));
wxFileType::MessageParameters (wxT("http://www.google.com")));
wxPrintf(wxT("APP: [%s]\n"), cmd.c_str());
}
@@ -820,16 +819,16 @@ public:
}
~wxCFDictionary()
{ Clear(); }
{ Clear(); }
void Clear()
{if(m_cfmdRef) CFRelease(m_cfmdRef);}
static const void* RetainProc(CFAllocatorRef, const void* v)
{ return (const void*) CFRetain(v); }
{ return (const void*) CFRetain(v); }
static void ReleaseProc(CFAllocatorRef, const void* v)
{ CFRelease(v); }
{ CFRelease(v); }
void MakeMutable(CFIndex cfiSize = 0)
{
@@ -863,13 +862,13 @@ public:
}
operator CFTypeRef () const
{ return (CFTypeRef)m_cfmdRef; }
{ return (CFTypeRef)m_cfmdRef; }
CFDictionaryRef GetCFDictionary() const
{ return (CFDictionaryRef)m_cfmdRef; }
{ return (CFDictionaryRef)m_cfmdRef; }
CFMutableDictionaryRef GetCFMutableDictionary()
{ return (CFMutableDictionaryRef) m_cfmdRef; }
{ return (CFMutableDictionaryRef) m_cfmdRef; }
CFTypeRef operator [] (CFTypeRef cftEntry) const
{
@@ -910,7 +909,7 @@ public:
return CFDictionaryContainsKey((CFDictionaryRef)m_cfmdRef, cftKey) == true;
}
bool IsOk() const {return m_cfmdRef != NULL; }
bool IsOk() const {return m_cfmdRef != NULL; }
bool IsValid() const
{
@@ -1026,7 +1025,7 @@ public:
kCFAllocatorDefault,
(CFDataRef)cfData,
kCFPropertyListMutableContainersAndLeaves,
&cfsError );
&cfsError );
if(cfsError)
{
if(pErrorMsg)
@@ -1056,10 +1055,10 @@ public:
}
wxCFArray(CFIndex cfiSize = 0) : m_cfmaRef(NULL)
{ Create(cfiSize); }
{ Create(cfiSize); }
~wxCFArray()
{ Clear(); }
{ Clear(); }
void MakeMutable(CFIndex cfiSize = 0)
{
@@ -1095,19 +1094,19 @@ public:
{if(m_cfmaRef) CFRelease(m_cfmaRef);}
static const void* RetainProc(CFAllocatorRef, const void* v)
{ return (const void*) CFRetain(v); }
{ return (const void*) CFRetain(v); }
static void ReleaseProc(CFAllocatorRef, const void* v)
{ CFRelease(v); }
{ CFRelease(v); }
operator CFTypeRef () const
{ return (CFTypeRef)m_cfmaRef; }
{ return (CFTypeRef)m_cfmaRef; }
CFArrayRef GetCFArray() const
{ return (CFArrayRef)m_cfmaRef; }
{ return (CFArrayRef)m_cfmaRef; }
CFMutableArrayRef GetCFMutableArray()
{ return (CFMutableArrayRef) m_cfmaRef; }
{ return (CFMutableArrayRef) m_cfmaRef; }
CFTypeRef operator [] (CFIndex cfiIndex) const
{
@@ -1141,7 +1140,7 @@ public:
CFArraySetValueAtIndex(m_cfmaRef, cfiIndex, cftValue);
}
bool IsOk() const {return m_cfmaRef != NULL; }
bool IsOk() const {return m_cfmaRef != NULL; }
bool IsValid() const
{
@@ -1164,20 +1163,20 @@ class wxCFString
{
public:
wxCFString(CFTypeRef ref, bool bRetain = wxCF_RELEASE) : m_Holder((CFStringRef)ref, bRetain == wxCF_RELEASE)
{ }
{ }
wxCFString(const wxChar* szString) : m_Holder(wxString(szString), wxLocale::GetSystemEncoding())
{ }
{ }
wxCFString(const wxString& sString) : m_Holder(sString, wxLocale::GetSystemEncoding())
{ }
{ }
operator CFTypeRef() const
{return (CFTypeRef) ((CFStringRef) m_Holder); }
{ return (CFTypeRef) ((CFStringRef) m_Holder); }
bool IsOk() { return ((CFTypeRef)(*this)) != NULL; }
bool IsOk() { return ((CFTypeRef)(*this)) != NULL; }
wxString BuildWXString() {return m_Holder.AsString(); }
wxString BuildWXString() {return m_Holder.AsString(); }
private:
wxMacCFStringHolder m_Holder;
@@ -1192,8 +1191,7 @@ class wxCFNumber
public:
wxCFNumber(int nValue)
{
m_cfnRef = CFNumberCreate(kCFAllocatorDefault,
kCFNumberIntType, &nValue);
m_cfnRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &nValue);
}
wxCFNumber(CFTypeRef ref, bool bRetain = wxCF_RELEASE) : m_cfnRef((CFNumberRef)ref)
@@ -1203,25 +1201,27 @@ public:
}
~wxCFNumber()
{ if(m_cfnRef) CFRelease(m_cfnRef); }
{
if(m_cfnRef)
CFRelease(m_cfnRef);
}
operator CFTypeRef() const
{ return (CFTypeRef) m_cfnRef; }
{ return (CFTypeRef) m_cfnRef; }
int GetValue()
{
int nOut;
CFNumberGetValue(
m_cfnRef,
kCFNumberIntType,
&nOut
);
CFNumberGetValue( m_cfnRef,
kCFNumberIntType,
&nOut
);
return nOut;
}
bool IsOk() { return m_cfnRef != NULL; }
bool IsOk() { return m_cfnRef != NULL; }
private:
CFNumberRef m_cfnRef;
@@ -1260,9 +1260,9 @@ public:
}
operator CFTypeRef() const
{ return (CFTypeRef)m_cfurlRef; }
{ return (CFTypeRef)m_cfurlRef; }
bool IsOk() { return m_cfurlRef != NULL; }
bool IsOk() { return m_cfurlRef != NULL; }
private:
CFURLRef m_cfurlRef;
};
@@ -1307,9 +1307,9 @@ public:
}
operator CFTypeRef() const
{ return (CFTypeRef)m_cfdaRef; }
{ return (CFTypeRef)m_cfdaRef; }
bool IsOk() { return m_cfdaRef != NULL; }
bool IsOk() { return m_cfdaRef != NULL; }
private:
CFDataRef m_cfdaRef;
};
@@ -1359,9 +1359,9 @@ void wxCFDictionary::MakeValidXML()
cfdCurrent.MakeValidXML();
Set(pKeys[i], cfdCurrent);
}
else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
{
Remove(pKeys[i]);
--i;
@@ -1406,9 +1406,9 @@ void wxCFArray::MakeValidXML()
cfdCurrent.MakeValidXML();
Set(i, cfdCurrent);
}
else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
{
Remove(i);
--i;
@@ -1469,7 +1469,7 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
indictfile.Read((void*)pBuffer, cfiBufLen);
wxCFData cfdaInDict(pBuffer, cfiBufLen);
wxString sError;
bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError);
bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError);
if(!bInfoOpenSuccess)
wxLogDebug(sError);
indictfile.Close();
@@ -1513,7 +1513,7 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
dwFoundIndex = iWXExt;
break;
}
} //end of wxstring array
} //end of wxstring array
if(bEntryFound)
break;
@@ -1705,9 +1705,9 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
Str255 psMimeType;
Str255 psDescription;
wxMacStringToPascal(wxString(wxT(".")) + ftInfo.GetExtensions()[0], psExtension);
wxMacStringToPascal(ftInfo.GetMimeType(), psMimeType);
wxMacStringToPascal(ftInfo.GetDescription(), psDescription);
wxMacStringToPascal(wxString(wxT(".")) + ftInfo.GetExtensions()[0], psExtension);
wxMacStringToPascal(ftInfo.GetMimeType(), psMimeType);
wxMacStringToPascal(ftInfo.GetDescription(), psDescription);
Str255 psPostCreatorName;
wxMacStringToPascal(wxT(""), psPostCreatorName);
@@ -1775,7 +1775,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
if(!asExtensions.GetCount())
{
wxLogDebug(wxT("Must have extension to disassociate"));
return FALSE;
return false;
}
//Find and write to Info.plist in main bundle (note that some other
@@ -1812,7 +1812,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
indictfile.Read((void*)pBuffer, cfiBufLen);
wxCFData cfdaInDict(pBuffer, cfiBufLen);
wxString sError;
bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError);
bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError);
if(!bInfoOpenSuccess)
wxLogDebug(sError);
indictfile.Close();
@@ -1853,7 +1853,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
cfdInfo.Set( wxCFString(wxT("CFBundleDocumentTypes")) , cfaDocTypes );
break;
}
} //end of wxstring array
} //end of wxstring array
if(bEntryFound)
break;
@@ -1937,7 +1937,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
#if defined(__DARWIN__)
if(!bInfoSuccess)
return FALSE;
return false;
#endif
//this should be as easy as removing the entry from the database and then saving
@@ -1953,7 +1953,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
// kICAttrNoChange, (Handle) m_hDatabase);
// if(status == noErr)
return TRUE;
return true;
// else
// {
// wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICSetPrefHandle failed.")));
@@ -1965,12 +1965,12 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICDeleteMapEntry failed.")));
}
return FALSE;
return false;
}
/*
CFWriteStreamRef cfwsInfo = CFWriteStreamCreateWithFile(
kCFAllocatorDefault,
(CFURLRef) (CFTypeRef)cfurlInfoLoc );
(CFURLRef) (CFTypeRef)cfurlInfoLoc );
// CFShow(cfdInfo);
if(cfwsInfo)