// We use the profile name to create the first part of each event name // We do so to avoid problems between different instances of the plugin concurrently running void createEventPrefix(TCHAR *prefixName, size_t maxLen) { size_t len; TCHAR profileName[MAX_PATH+1], *str; getAbsoluteProfileName(profileName, MAX_PATH); while (str = _tcschr(profileName, _T('\\'))) *str = _T('/'); if ((len = _tcslen(profileName)) <= maxLen) _tcscpy(prefixName, profileName); else { str = profileName + len - maxLen / 2; mir_sntprintf(prefixName, maxLen / 2, _T("%s"), profileName); _tcscat(prefixName, str); } }
// We use the profile name to create the first part of each event name // We do so to avoid problems between different instances of the plugin concurrently running void createEventPrefix(TCHAR *prefixName, size_t maxLen) { size_t len; TCHAR profileName[MAX_PATH + 1], *str; getAbsoluteProfileName(profileName, MAX_PATH); while (str = _tcschr(profileName, _T('\\'))) *str = _T('/'); if ((len = mir_tstrlen(profileName)) <= maxLen) _tcsncpy_s(prefixName, maxLen, profileName, _TRUNCATE); else { str = profileName + len - maxLen / 2; _tcsncpy_s(prefixName, (maxLen / 2), profileName, _TRUNCATE); mir_tstrcat(prefixName, str); } }