Skip to content

Commit

Permalink
itoa() call using a char * instead of a char []
Browse files Browse the repository at this point in the history
  • Loading branch information
elwynor committed Jul 1, 2024
1 parent e90da0f commit 08fbf8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions ELWBDS.C
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ INT
genbrg(INT brg, INT usr)
{
INT j,k,b,c,rb;
CHAR *brgnum="",*dash="-",*zero1="0",*zero2="00";
CHAR brgnum[12]; // sufficient to hold the largest possible integer - RH to elim V10 crash
CHAR *dash="-",*zero1="0",*zero2="00"; // *brgnum="" RH eliminate V10 crash

setbd();
b=-1;
Expand Down Expand Up @@ -727,12 +728,12 @@ genbrg(INT brg, INT usr)
bdbpt->weapon=(CHAR)bdrand(bbrg[rb].lowep,bbrg[rb].hiwep);
updbchs(bdrand(bbrg[rb].lochs,bbrg[rb].hichs));
strcpy(bdbar[b].name,bbrg[rb].name);
c=btpcnt(bbrg[rb].name);
strcat(bdbar[b].name,dash);
if (c < 10) strcat(bdbar[b].name,zero2);
else if (c < 100) strcat(bdbar[b].name,zero1);
itoa(c,brgnum,10);
strcat(bdbar[b].name,brgnum);
c = btpcnt(bbrg[rb].name);
strcat(bdbar[b].name, dash);
if (c < 10) strcat(bdbar[b].name, zero2);
else if (c < 100) strcat(bdbar[b].name, zero1);
itoa(c, brgnum, 10);
strcat(bdbar[b].name, brgnum);
for (k=0; k<NBORGS; k++)
if ((sameas(bdbar[b].name,bdbar[k].name)) &&
(b != k) && (bdbar[k].active == 1)) return(0);
Expand Down
2 changes: 1 addition & 1 deletion elwbds.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>WIN32;GCWINNT;GCMVC;BBSVER=1000;USE_DEF_FILE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;__BUILDV10MODULE</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
Expand Down

0 comments on commit 08fbf8c

Please sign in to comment.