This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 259130 - Wrong format string notification (wide char is treated as integer)
Summary: Wrong format string notification (wide char is treated as integer)
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: danilasergeyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-04 20:23 UTC by noisebringer
Modified: 2016-07-21 01:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Bug screenshot (2.61 KB, image/png)
2016-05-04 20:23 UTC, noisebringer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description noisebringer 2016-05-04 20:23:10 UTC
Created attachment 159542 [details]
Bug screenshot

Hello.
printf("<p class = \"CBL\"><a name = \"CBL\">%lc</a></p>", wcCityName[0]);
In this code string format specifier lc marked as wrong because wcCityName[0] variable is treated as integer while it is wide char.

Best regards, Daniil.
Comment 1 Vladimir Voskresensky 2016-05-05 22:26:42 UTC
Could you, please, provide declaration of wcCityName.

Thanks!
Comment 2 noisebringer 2016-05-06 02:24:39 UTC
wchar_t *wcCityName = NULL;
Comment 3 noisebringer 2016-05-06 02:31:37 UTC
Then some memory is allocated for it with 
wcCityName = realloc(wcCityName, strlen(Row[1]) * WCHAR_SIZE);

and it is filled with
mbstowcs(wcCityName, Row[1], strlen(Row[1]));

Where Row[1] is char pointer which is fetched from mysql result.
Comment 4 danilasergeyev 2016-07-20 10:13:46 UTC
The issue is that wchar_t* is recognized as just wchar_t
Comment 5 danilasergeyev 2016-07-20 13:39:37 UTC
Sorry, I was wrong. Everything recognized correctly and we shouldn't mark %lc for wchar_t as error.
Comment 6 danilasergeyev 2016-07-20 14:07:38 UTC
fixed in change set:
http://hg.netbeans.org/cnd-main/rev/e12136eb92df
Comment 7 Quality Engineering 2016-07-21 01:51:38 UTC
Integrated into 'main-silver', will be available in build *201607210002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e12136eb92df
User: Danila Sergeyev <danilasergeyev@netbeans.org>
Log: fix bug #259130 Wrong format string notification