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

Function GetPrivateProfileInt

storage/connect/inihandl.cpp:1175–1200  ·  view source on GitHub ↗

* GetPrivateProfileIntA (KERNEL32.@) ***********************************************************************/

Source from the content-addressed store, hash-verified

1173 * GetPrivateProfileIntA (KERNEL32.@)
1174 ***********************************************************************/
1175uint GetPrivateProfileInt(LPCSTR section, LPCSTR entry,
1176 int def_val, LPCSTR filename)
1177{
1178 char buffer[20];
1179 int result;
1180
1181 if (!PROFILE_GetPrivateProfileString(section, entry, "", buffer,
1182 sizeof(buffer), filename, FALSE))
1183 return def_val;
1184
1185 /* FIXME: if entry can be found but it's empty, then Win16 is
1186 * supposed to return 0 instead of def_val ! Difficult/problematic
1187 * to implement (every other failure also returns zero buffer),
1188 * thus wait until testing framework avail for making sure nothing
1189 * else gets broken that way. */
1190 if (!buffer[0])
1191 return (uint)def_val;
1192
1193 /* Don't use strtol() here !
1194 * (returns LONG_MAX/MIN on overflow instead of "proper" overflow)
1195 YES, scan for unsigned format ! (otherwise compatibility error) */
1196 if (!sscanf(buffer, "%u", &result))
1197 return 0;
1198
1199 return (uint)result;
1200} // end of GetPrivateProfileInt
1201
1202
1203/***********************************************************************

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected