MCPcopy Create free account
hub / github.com/MariaDB/server / PROFILE_GetString

Function PROFILE_GetString

storage/connect/inihandl.cpp:968–999  ·  view source on GitHub ↗

* PROFILE_GetString * * Get a profile string. * * Tests with GetPrivateProfileString16, W95a, * with filled buffer ("****...") and section "set1" and key_name "1" valid: * section key_name def_val res buffer * "set1" "1" "x" 43 [data] * "set1" "1 " "x" 43 [data] (!) * "set1"

Source from the content-addressed store, hash-verified

966 *
967 *************************************************************************/
968static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
969 LPCSTR def_val, LPSTR buffer, uint len)
970{
971 PROFILEKEY *key = NULL;
972
973 if(!buffer)
974 return 0;
975
976 if (!def_val)
977 def_val = "";
978
979 if (key_name && key_name[0]) {
980 key = PROFILE_Find(&CurProfile->section, section, key_name, FALSE, FALSE);
981 PROFILE_CopyEntry(buffer, (key && key->value) ? key->value : def_val, len, FALSE);
982
983 if (trace(2))
984 htrc("('%s','%s','%s'): returning '%s'\n",
985 section, key_name, def_val, buffer );
986
987 return strlen(buffer);
988 } // endif key_name
989
990 if (key_name && !(key_name[0]))
991 /* Win95 returns 0 on keyname "". Tested with Likse32 bon 000227 */
992 return 0;
993
994 if (section && section[0])
995 return PROFILE_GetSection(CurProfile->section, section, buffer, len,
996 FALSE, FALSE);
997 buffer[0] = '\0';
998 return 0;
999} // end of PROFILE_GetString
1000
1001
1002/***********************************************************************

Callers 1

Calls 4

PROFILE_FindFunction · 0.85
PROFILE_CopyEntryFunction · 0.85
PROFILE_GetSectionFunction · 0.85
htrcFunction · 0.70

Tested by

no test coverage detected