Changeset 34265 for lang/cplusplus
- Timestamp:
- 07/03/09 13:37:11 (4 years ago)
- Files:
-
- 1 modified
-
lang/cplusplus/picojson/trunk/picojson.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/picojson/trunk/picojson.h
r34263 r34265 38 38 #include <string> 39 39 #include <vector> 40 41 #ifdef _MSC_VER 42 #define SNPRINTF _snprintf_s 43 #pragma warning(push) 44 #pragma warning(disable : 4244) // conversion from int to char 45 #else 46 #define SNPRINTF snprintf 47 #endif 40 48 41 49 namespace picojson { … … 224 232 case number_type: { 225 233 char buf[256]; 226 #if _MSC_VER >= 1400 // VC 2005 227 _snprintf_s(buf, sizeof(buf), "%f", number_); 228 #else 229 snprintf(buf, sizeof(buf), "%f", number_); 230 #endif 234 SNPRINTF(buf, sizeof(buf), "%f", number_); 231 235 return buf; 232 236 } … … 235 239 case object_type: return "object"; 236 240 default: assert(0); 237 #if _MSC_VER >= 1310 // VC 2003241 #ifdef _MSC_VER 238 242 __assume(0); 239 243 #endif … … 262 266 if ((unsigned char)*i < 0x20 || *i == 0x7f) { 263 267 char buf[7]; 264 sprintf(buf, "\\u%04x", *i & 0xff);268 SNPRINTF(buf, sizeof(buf), "\\u%04x", *i & 0xff); 265 269 copy(buf, buf + 6, oi); 266 270 } else { … … 518 522 while (! in.eof()) { 519 523 int ch = in.getc(); 520 if ( '0' <= ch && ch <= '9'|| ch == '+' || ch == '-' || ch == '.'524 if (('0' <= ch && ch <= '9') || ch == '+' || ch == '-' || ch == '.' 521 525 || ch == 'e' || ch == 'E') { 522 526 num_str.push_back(ch); … … 554 558 if (ch != -1) { 555 559 in.ungetc(); 556 if ( '0' <= ch && ch <= '9'|| ch == '-') {560 if (('0' <= ch && ch <= '9') || ch == '-') { 557 561 return _parse_number(out, in); 558 562 } … … 570 574 if (! _parse(out, in)) { 571 575 char buf[64]; 572 sprintf(buf, "syntax error at line %d near: ", in.line());576 SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line()); 573 577 err = buf; 574 578 while (! in.eof()) { … … 619 623 return os; 620 624 } 625 #ifdef _MSC_VER 626 #pragma warning(pop) 627 #endif 621 628 622 629 #endif 623 630 #ifdef TEST_PICOJSON 631 #ifdef _MSC_VER 632 #pragma warning(disable : 4127) // conditional expression is constant 633 #endif 624 634 625 635 using namespace std;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)