diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-10-29 20:57:33 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-10-29 20:57:33 +0000 |
commit | 66c1674cd519155febbb878cf09a130d24b39d11 (patch) | |
tree | 93b1e3711e37a7cd23ee3cfbdb5c20a9dff6433f /lib/server | |
parent | 473744559fa20f204a6bbd8e18c618d0e59e4db3 (diff) |
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.
Diffstat (limited to 'lib/server')
-rwxr-xr-x | lib/server/makeprotocol.pl.in | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/server/makeprotocol.pl.in b/lib/server/makeprotocol.pl.in index 0cc66f35..91ba55b0 100755 --- a/lib/server/makeprotocol.pl.in +++ b/lib/server/makeprotocol.pl.in @@ -538,11 +538,13 @@ __E } if($implement_filelog) { - my ($format,$args) = make_log_strings($cmd); + my ($log) = make_log_strings_framework($cmd); print CPP <<__E; void ${class}LogFile(const char *Action, FILE *File) const { - ::fprintf(File,"%s $format\\n",Action$args); + std::ostringstream oss; + oss << $log; + ::fprintf(File, "%s\\n", oss.str().c_str()); ::fflush(File); } __E @@ -1051,10 +1053,22 @@ sub make_log_strings_framework my ($format,$arg) = @{$log_display_types{$ty}}; $arg =~ s/VAR/m$nm/g; - if ($format =~ m'x$') + if ($format eq '\\"%s\\"') + { + $arg = "\"\\\"\" << $arg << \"\\\"\""; + } + elsif ($format =~ m'x$') { - $arg = "std::hex << std::showbase " . - "<< $arg << std::dec"; + # my $width = 0; + # $ty =~ /^int(\d+)$/ and $width = $1 / 4; + $arg = "($arg == 0 ? \"0x\" : \"\") " . + "<< std::hex " . + "<< std::showbase " . + # "<< std::setw($width) " . + # "<< std::setfill('0') " . + # "<< std::internal " . + "<< $arg " . + "<< std::dec"; } push @args, $arg; |