Skip to content

Commit 23cb1ab

Browse files
committed
ndb
- Fix "no format arguments" warnings to snprintf
1 parent e0cbef5 commit 23cb1ab

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

storage/ndb/src/mgmsrv/ConfigInfo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5380,7 +5380,7 @@ saveSectionsInConfigValues(Vector<ConfigInfo::ConfigRuleSection>& notused,
53805380
require(tmp->get("Type", &type) != 0);
53815381
require((ctx.m_currentInfo = ctx.m_info->getInfo(type)) != 0);
53825382
ctx.m_currentSection = const_cast<Properties*>(tmp);
5383-
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), type);
5383+
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), "%s", type);
53845384
saveInConfigValues(ctx, 0);
53855385
}
53865386
}

storage/ndb/src/mgmsrv/InitConfigFileParser.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ InitConfigFileParser::parseConfig(FILE * file) {
114114
"of configuration file.");
115115
return 0;
116116
}
117-
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
117+
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), "%s", section);
118+
free(section);
118119
ctx.type = InitConfigFileParser::DefaultSection;
119120
ctx.m_sectionLineno = ctx.m_lineno;
120121
ctx.m_currentSection = new Properties(true);
@@ -134,7 +135,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
134135
"of configuration file.");
135136
return 0;
136137
}
137-
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section);
138+
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), "%s", section);
138139
free(section);
139140
ctx.type = InitConfigFileParser::Section;
140141
ctx.m_sectionLineno = ctx.m_lineno;
@@ -184,7 +185,8 @@ InitConfigFileParser::run_config_rules(Context& ctx)
184185
return 0;
185186

186187
for(size_t j = 0; j<tmp.size(); j++){
187-
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), tmp[j].m_sectionType.c_str());
188+
BaseString::snprintf(ctx.fname, sizeof(ctx.fname),
189+
"%s", tmp[j].m_sectionType.c_str());
188190
ctx.type = InitConfigFileParser::Section;
189191
ctx.m_currentSection = tmp[j].m_sectionData;
190192
ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
@@ -560,13 +562,15 @@ InitConfigFileParser::storeSection(Context& ctx){
560562
for(int i = strlen(ctx.fname) - 1; i>=0; i--){
561563
ctx.fname[i] = toupper(ctx.fname[i]);
562564
}
563-
BaseString::snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname);
565+
BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "%s", ctx.fname);
566+
564567
char buf[255];
565568
if(ctx.type == InitConfigFileParser::Section)
566569
BaseString::snprintf(buf, sizeof(buf), "%s", ctx.fname);
567570
if(ctx.type == InitConfigFileParser::DefaultSection)
568571
BaseString::snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname);
569-
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), buf);
572+
BaseString::snprintf(ctx.fname, sizeof(ctx.fname), "%s", buf);
573+
570574
if(ctx.type == InitConfigFileParser::Section){
571575
for(int i = 0; i<m_info->m_NoOfRules; i++){
572576
const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i];

0 commit comments

Comments
 (0)