summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-11-09 21:17:04 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-11-09 21:17:04 (GMT)
commitc0b0e4b86db9d2bd699ce2bcd0bca479167a76a6 (patch)
tree1fb5abcbf32aeccbd67ec595f3d19833380001c6 /src/util.cpp
parent79a5fb85eb38d8a4388c9a281a09549e7bcb8b78 (diff)
downloadDoxygen-c0b0e4b86db9d2bd699ce2bcd0bca479167a76a6.zip
Doxygen-c0b0e4b86db9d2bd699ce2bcd0bca479167a76a6.tar.gz
Doxygen-c0b0e4b86db9d2bd699ce2bcd0bca479167a76a6.tar.bz2
Release-1.4.5-20051109
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index e07536a..50e0fb3 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -4277,7 +4277,7 @@ QCString convertNameToFile(const char *name,bool allowDots)
static bool shortNames = Config_getBool("SHORT_NAMES");
static bool createSubdirs = Config_getBool("CREATE_SUBDIRS");
QCString result;
- if (shortNames)
+ if (shortNames) // use short names only
{
static QDict<void> usedNames(10007);
static int count=1;
@@ -4298,6 +4298,16 @@ QCString convertNameToFile(const char *name,bool allowDots)
else // long names
{
result=escapeCharsInString(name,allowDots);
+ int resultLen = result.length();
+ if (resultLen>=128) // prevent names that cannot be created!
+ {
+ // third algorithm based on MD5 hash
+ uchar md5_sig[16];
+ QCString sigStr(33);
+ MD5Buffer((const unsigned char *)result.data(),resultLen,md5_sig);
+ MD5SigToString(md5_sig,sigStr.data(),33);
+ result=result.left(128-32)+sigStr;
+ }
}
if (createSubdirs)
{
@@ -5648,3 +5658,41 @@ void stringToSearchIndex(const QCString &docBaseUrl,const QCString &title,
}
}
+SrcLangExt getLanguageFromFileName(const QCString fileName)
+{
+ int i = fileName.findRev('.');
+ static bool init=FALSE;
+ static QDict<void> extLookup;
+ if (!init) // one time initialization
+ {
+ extLookup.insert(".idl", (void*)SrcLangExt_IDL);
+ extLookup.insert(".odl", (void*)SrcLangExt_IDL);
+ extLookup.insert(".java", (void*)SrcLangExt_Java);
+ extLookup.insert(".as", (void*)SrcLangExt_Java);
+ extLookup.insert(".cs", (void*)SrcLangExt_CSharp);
+ extLookup.insert(".d", (void*)SrcLangExt_D);
+ extLookup.insert(".php", (void*)SrcLangExt_PHP);
+ extLookup.insert(".php4", (void*)SrcLangExt_PHP);
+ extLookup.insert(".inc", (void*)SrcLangExt_PHP);
+ extLookup.insert(".phtml", (void*)SrcLangExt_PHP);
+ extLookup.insert(".m", (void*)SrcLangExt_ObjC);
+ extLookup.insert(".M", (void*)SrcLangExt_ObjC);
+ extLookup.insert(".mm", (void*)SrcLangExt_ObjC);
+ init=TRUE;
+ }
+ if (i!=-1) // name has an extension
+ {
+ QCString extStr=fileName.right(fileName.length()-i);
+ if (!extStr.isEmpty()) // non-empty extension
+ {
+ void *pVal=extLookup.find(extStr);
+ if (pVal) // listed extension
+ {
+ return *(SrcLangExt*)&pVal; // cast void* address to enum value
+ }
+ }
+ }
+ return SrcLangExt_Cpp; // not listed => assume C-ish language.
+}
+
+