Refactored InfoSink. I have replaced most instances of sprintf with std::ostringstream to make it safer. I have made sure that everything still compiles and passes conformance tests.
Review URL: http://codereview.appspot.com/1391041

git-svn-id: https://angleproject.googlecode.com/svn/trunk@322 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/parseConst.cpp b/src/compiler/parseConst.cpp
index 4b130e9..833d429 100644
--- a/src/compiler/parseConst.cpp
+++ b/src/compiler/parseConst.cpp
@@ -63,9 +63,10 @@
     TQualifier qualifier = node->getType().getQualifier();
     
     if (qualifier != EvqConst) {
-        char buf[200];
-        sprintf(buf, "'constructor' : assigning non-constant to %s", type.getCompleteString().c_str());
-        infoSink.info.message(EPrefixError, buf, node->getLine());
+        TString buf;
+        buf.append("'constructor' : assigning non-constant to ");
+        buf.append(type.getCompleteString());
+        infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
         error = true;
         return false;  
     }
@@ -77,9 +78,10 @@
 
 bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node)
 {
-    char buf[200];
-    sprintf(buf, "'constructor' : assigning non-constant to '%s'", type.getCompleteString().c_str());
-    infoSink.info.message(EPrefixError, buf, node->getLine());
+    TString buf;
+    buf.append("'constructor' : assigning non-constant to ");
+    buf.append(type.getCompleteString());
+    infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
     error = true;
     return false;  
 }
@@ -87,9 +89,10 @@
 bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
 {
     if (!node->isConstructor() && node->getOp() != EOpComma) {
-        char buf[200];
-        sprintf(buf, "'constructor' : assigning non-constant to '%s'", type.getCompleteString().c_str());
-        infoSink.info.message(EPrefixError, buf, node->getLine());
+        TString buf;
+        buf.append("'constructor' : assigning non-constant to ");
+        buf.append(type.getCompleteString());
+        infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
         error = true;
         return false;  
     }