From 92e2e7c6788ce4e4ec382693578e4304f6a08bb9 Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 9 May 2007 20:20:46 +0000 Subject: [PATCH] printf family format fixup found (har har) and suggested by Scott McKellar -- %lf -> %f (no need for the precision and/or scale of %Lf) git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@879 9efc2488-bf62-4759-914b-345cdb29e865 --- src/gateway/fieldmapper-c-xml-out.pl | 4 ++-- src/gateway/osrf_json_gateway.c | 2 +- src/libstack/osrf_app_session.c | 2 +- src/libstack/osrf_stack.c | 2 +- src/libstack/osrf_system.c | 2 +- src/objson/json2xml.c | 4 ++-- src/objson/objson_test.c | 2 +- src/srfsh/srfsh.c | 2 +- src/utils/socket_bundle.c | 2 +- src/utils/utils.h | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gateway/fieldmapper-c-xml-out.pl b/src/gateway/fieldmapper-c-xml-out.pl index 857a3fc..8f28c91 100755 --- a/src/gateway/fieldmapper-c-xml-out.pl +++ b/src/gateway/fieldmapper-c-xml-out.pl @@ -166,9 +166,9 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * fm_class, int fm_ } else if(obj->is_double) { if (notag) - buffer_fadd(buf,"%lf",tag,obj->double_value,tag); + buffer_fadd(buf,"%f",tag,obj->double_value,tag); else - buffer_fadd(buf,"<%s>%lf",tag,obj->double_value,tag); + buffer_fadd(buf,"<%s>%f",tag,obj->double_value,tag); } else if (obj->is_array) { diff --git a/src/gateway/osrf_json_gateway.c b/src/gateway/osrf_json_gateway.c index b9262e0..a575bd9 100644 --- a/src/gateway/osrf_json_gateway.c +++ b/src/gateway/osrf_json_gateway.c @@ -238,7 +238,7 @@ static int osrf_json_gateway_method_handler (request_rec *r) { } double duration = get_timestamp_millis() - starttime; - osrfLogDebug(OSRF_LOG_MARK, "gateway request took %lf seconds", duration); + osrfLogDebug(OSRF_LOG_MARK, "gateway request took %f seconds", duration); if (isXML) diff --git a/src/libstack/osrf_app_session.c b/src/libstack/osrf_app_session.c index 2bc03da..770446f 100644 --- a/src/libstack/osrf_app_session.c +++ b/src/libstack/osrf_app_session.c @@ -229,7 +229,7 @@ osrf_app_session* osrf_app_client_session_init( char* remote_service ) { char id[256]; memset(id,0,256); - sprintf(id, "%lf.%d%d", get_timestamp_millis(), (int)time(NULL), getpid()); + sprintf(id, "%f.%d%d", get_timestamp_millis(), (int)time(NULL), getpid()); session->session_id = strdup(id); osrfLogDebug( OSRF_LOG_MARK, "Building a new client session with id [%s] [%s]", session->remote_service, session->session_id ); diff --git a/src/libstack/osrf_stack.c b/src/libstack/osrf_stack.c index 528abd0..fe59c92 100644 --- a/src/libstack/osrf_stack.c +++ b/src/libstack/osrf_stack.c @@ -100,7 +100,7 @@ osrfAppSession* osrf_stack_transport_handler( transport_message* msg, char* my_s } double duration = get_timestamp_millis() - starttime; - osrfLogInfo(OSRF_LOG_MARK, "Message processing duration %lf", duration); + osrfLogInfo(OSRF_LOG_MARK, "Message processing duration %f", duration); message_free( msg ); osrfLogDebug( OSRF_LOG_MARK, "after msg delete"); diff --git a/src/libstack/osrf_system.c b/src/libstack/osrf_system.c index 3f24038..68f2e3c 100644 --- a/src/libstack/osrf_system.c +++ b/src/libstack/osrf_system.c @@ -201,7 +201,7 @@ int osrf_system_bootstrap_client_resc( char* config_file, char* contextnode, cha char tbuf[32]; memset(tbuf, 0x0, 32); - snprintf(tbuf, 32, "%lf", get_timestamp_millis()); + snprintf(tbuf, 32, "%f", get_timestamp_millis()); if(!host) host = ""; if(!resource) resource = ""; diff --git a/src/objson/json2xml.c b/src/objson/json2xml.c index 918c958..ef4fa19 100644 --- a/src/objson/json2xml.c +++ b/src/objson/json2xml.c @@ -70,12 +70,12 @@ int _recurse_jsonObjectToXML(jsonObject* obj, growing_buffer* res_xml) { if (x == (int)x) buffer_fadd(res_xml,"%d", hint, (int)x); else - buffer_fadd(res_xml,"%lf", hint, x); + buffer_fadd(res_xml,"%f", hint, x); } else { if (x == (int)x) buffer_fadd(res_xml,"%d", (int)x); else - buffer_fadd(res_xml,"%lf", x); + buffer_fadd(res_xml,"%f", x); } } else if (obj->type == JSON_ARRAY) { diff --git a/src/objson/objson_test.c b/src/objson/objson_test.c index dc1d9d3..20cf2ff 100644 --- a/src/objson/objson_test.c +++ b/src/objson/objson_test.c @@ -54,7 +54,7 @@ int main() { /* number, double, and 'null' parsing... */ printf("------------------------------------------------------------------\n"); o = jsonParseString("1"); - printf("\nParsed number: %lf\n", jsonObjectGetNumber(o)); + printf("\nParsed number: %f\n", jsonObjectGetNumber(o)); jsonObjectFree(o); diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index 52b6918..9887038 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -308,7 +308,7 @@ int handle_login( char* words[]) { } else login_session = NULL; - printf("Login Session: %s. Session timeout: %lf\n", login_session, authtime ); + printf("Login Session: %s. Session timeout: %f\n", login_session, authtime ); return 1; diff --git a/src/utils/socket_bundle.c b/src/utils/socket_bundle.c index 013359c..5441adf 100644 --- a/src/utils/socket_bundle.c +++ b/src/utils/socket_bundle.c @@ -639,7 +639,7 @@ int _socket_handle_client_data(socket_manager* mgr, socket_node* node) { memset(buf, 0, RBUFSIZE); set_fl(sock_fd, O_NONBLOCK); - osrfLogInternal( OSRF_LOG_MARK, "%d : Received data at %lf\n", getpid(), get_timestamp_millis()); + osrfLogInternal( OSRF_LOG_MARK, "%d : Received data at %f\n", getpid(), get_timestamp_millis()); while( (read_bytes = recv(sock_fd, buf, RBUFSIZE-1, 0) ) > 0 ) { osrfLogInternal( OSRF_LOG_MARK, "Socket %d Read %d bytes and data: %s", sock_fd, read_bytes, buf); diff --git a/src/utils/utils.h b/src/utils/utils.h index 41aa488..308e3b7 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -91,10 +91,10 @@ GNU General Public License for more details. char* LONGSTR = __b; #define DOUBLE_TO_STRING(l) \ - unsigned int __len = snprintf(NULL, 0, "%lf", l) + 2; \ + unsigned int __len = snprintf(NULL, 0, "%f", l) + 2; \ char __b[__len]; \ bzero(__b, __len); \ - snprintf(__b, __len - 1, "%lf", l); \ + snprintf(__b, __len - 1, "%f", l); \ char* DOUBLESTR = __b; #define LONG_DOUBLE_TO_STRING(l) \ -- 2.11.0