Ignore:
Timestamp:
29/10/2008 20:57:33 (3 years ago)
Author:
chris
Message:

Use the same ostringstream formatting for protocol logging to file
that we use for standard logging, to fix 64bit platform warnings
reported by Matt Brown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/server/makeprotocol.pl.in

    r2172 r2371  
    539539        if($implement_filelog) 
    540540        { 
    541                 my ($format,$args) = make_log_strings($cmd); 
     541                my ($log) = make_log_strings_framework($cmd); 
    542542                print CPP <<__E; 
    543543void ${class}LogFile(const char *Action, FILE *File) const 
    544544{ 
    545         ::fprintf(File,"%s $format\\n",Action$args); 
     545        std::ostringstream oss; 
     546        oss << $log; 
     547        ::fprintf(File, "%s\\n", oss.str().c_str()); 
    546548        ::fflush(File); 
    547549} 
     
    10521054                        $arg =~ s/VAR/m$nm/g; 
    10531055 
    1054                         if ($format =~ m'x$') 
    1055                         { 
    1056                                 $arg = "std::hex << std::showbase " . 
    1057                                         "<< $arg << std::dec"; 
     1056                        if ($format eq '\\"%s\\"') 
     1057                        { 
     1058                                $arg = "\"\\\"\" << $arg << \"\\\"\""; 
     1059                        } 
     1060                        elsif ($format =~ m'x$') 
     1061                        { 
     1062                                # my $width = 0; 
     1063                                # $ty =~ /^int(\d+)$/ and $width = $1 / 4; 
     1064                                $arg =  "($arg == 0 ? \"0x\" : \"\") " . 
     1065                                        "<< std::hex " . 
     1066                                        "<< std::showbase " . 
     1067                                        # "<< std::setw($width) " . 
     1068                                        # "<< std::setfill('0') " . 
     1069                                        # "<< std::internal " . 
     1070                                        "<< $arg " . 
     1071                                        "<< std::dec"; 
    10581072                        } 
    10591073 
Note: See TracChangeset for help on using the changeset viewer.