[Box Backup-commit] COMMIT r2371 - box/trunk/lib/server
boxbackup-dev@boxbackup.org
boxbackup-dev@boxbackup.org
Wed, 29 Oct 2008 20:57:33 +0000 (GMT)
Author: chris
Date: 2008-10-29 20:57:33 +0000 (Wed, 29 Oct 2008)
New Revision: 2371
Modified:
box/trunk/lib/server/makeprotocol.pl.in
Log:
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.
Modified: box/trunk/lib/server/makeprotocol.pl.in
===================================================================
--- box/trunk/lib/server/makeprotocol.pl.in 2008-10-29 20:57:11 UTC (rev 2370)
+++ box/trunk/lib/server/makeprotocol.pl.in 2008-10-29 20:57:33 UTC (rev 2371)
@@ -538,11 +538,13 @@
}
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,11 +1053,23 @@
my ($format,$arg) = @{$log_display_types{$ty}};
$arg =~ s/VAR/m$nm/g;
- if ($format =~ m'x$')
+ if ($format eq '\\"%s\\"')
{
- $arg = "std::hex << std::showbase " .
- "<< $arg << std::dec";
+ $arg = "\"\\\"\" << $arg << \"\\\"\"";
}
+ elsif ($format =~ m'x$')
+ {
+ # 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;
}