[cfe-commits] r118478 - in /cfe/trunk/lib: Frontend/DocumentXML.cpp Lex/PPMacroExpansion.cpp
Douglas Gregor
dgregor at apple.com
Mon Nov 8 19:20:07 PST 2010
Author: dgregor
Date: Mon Nov 8 21:20:07 2010
New Revision: 118478
URL: http://llvm.org/viewvc/llvm-project?rev=118478&view=rev
Log:
sprintf -> snprintf conversion, from Vladimir Kirillov
Modified:
cfe/trunk/lib/Frontend/DocumentXML.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
Modified: cfe/trunk/lib/Frontend/DocumentXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DocumentXML.cpp?rev=118478&r1=118477&r2=118478&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DocumentXML.cpp (original)
+++ cfe/trunk/lib/Frontend/DocumentXML.cpp Mon Nov 8 21:20:07 2010
@@ -104,7 +104,7 @@
if (isprint(C))
value += C;
else {
- sprintf(buffer, "\\%03o", C);
+ snprintf(buffer, sizeof(buffer), "\\%03o", C);
value += buffer;
}
break;
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=118478&r1=118477&r2=118478&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Mon Nov 8 21:20:07 2010
@@ -497,8 +497,8 @@
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
};
- char TmpBuffer[100];
- sprintf(TmpBuffer, "\"%s %2d %4d\"", Months[TM->tm_mon], TM->tm_mday,
+ char TmpBuffer[32];
+ snprintf(TmpBuffer, sizeof(TmpBuffer), "\"%s %2d %4d\"", Months[TM->tm_mon], TM->tm_mday,
TM->tm_year+1900);
Token TmpTok;
@@ -506,7 +506,7 @@
PP.CreateString(TmpBuffer, strlen(TmpBuffer), TmpTok);
DATELoc = TmpTok.getLocation();
- sprintf(TmpBuffer, "\"%02d:%02d:%02d\"", TM->tm_hour, TM->tm_min, TM->tm_sec);
+ snprintf(TmpBuffer, sizeof(TmpBuffer), "\"%02d:%02d:%02d\"", TM->tm_hour, TM->tm_min, TM->tm_sec);
PP.CreateString(TmpBuffer, strlen(TmpBuffer), TmpTok);
TIMELoc = TmpTok.getLocation();
}
More information about the cfe-commits
mailing list