I'm building a big piece of inherited code that uses OpenLDAP extensively, and now that we're (trying to) switch to FreeBSD 7.0, GCC complains quite a bit more than before:
43 modFormat.mod_op = LDAP_MOD_ADD; 44 modFormat.mod_type = "rocketseedFormat"; 45 vformat[0] = "2"; 46 vformat[1] = NULL; 47 modFormat.mod_values = vformat;
rscode/rocketutil/mydap.cpp:44: warning: deprecated conversion from string constant to 'char*' rscode/rocketutil/mydap.cpp:45: warning: deprecated conversion from string constant to 'char*'
Are we risking some sort of free()-based crashes by populating the struct with string constants? I grepped for mod_type in the OpenLDAP source and couldn't find any explicit dependency on the strings being dynamically allocated (except for ldap_mods_free(), which we don't call). That doesn't mean there exists no such dependency!
Would it be safe to const_cast<char *> the string constants, or will I need to wrap each with a strdup() and ldap_mods_free() it all after we're done?
Thanks