From 46139a7a1c1d6f169fa3c6127db8f2836cfb5937 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/ILS/trunk@7228 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/apachemods/json_xml.c | 4 ++-- Open-ILS/src/c-apps/oils_auth.c | 6 +++--- Open-ILS/src/c-apps/oils_utils.c | 2 +- OpenSRF/src/gateway/fieldmapper-c-xml-out.pl | 4 ++-- OpenSRF/src/gateway/osrf_json_gateway.c | 2 +- OpenSRF/src/libstack/osrf_app_session.c | 2 +- OpenSRF/src/libstack/osrf_stack.c | 2 +- OpenSRF/src/libstack/osrf_system.c | 2 +- OpenSRF/src/objson/json2xml.c | 4 ++-- OpenSRF/src/objson/objson_test.c | 2 +- OpenSRF/src/srfsh/srfsh.c | 2 +- OpenSRF/src/utils/socket_bundle.c | 2 +- OpenSRF/src/utils/utils.h | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Open-ILS/src/apachemods/json_xml.c b/Open-ILS/src/apachemods/json_xml.c index 783e1b5c86..e7c11b6d16 100644 --- a/Open-ILS/src/apachemods/json_xml.c +++ b/Open-ILS/src/apachemods/json_xml.c @@ -117,12 +117,12 @@ void _rest_xml_output(growing_buffer* buf, jsonObject* obj, char * obj_class, in if (x == (int)x) buffer_fadd(buf,"%d",(int)x); else - buffer_fadd(buf,"%lf",x); + buffer_fadd(buf,"%f",x); } else { if (x == (int)x) buffer_fadd(buf,"<%s>%d",tag, (int)x,tag); else - buffer_fadd(buf,"<%s>%lf",tag, x,tag); + buffer_fadd(buf,"<%s>%f",tag, x,tag); } } else if (obj->type == JSON_ARRAY) { diff --git a/Open-ILS/src/c-apps/oils_auth.c b/Open-ILS/src/c-apps/oils_auth.c index 24b718ffed..1b449192f7 100644 --- a/Open-ILS/src/c-apps/oils_auth.c +++ b/Open-ILS/src/c-apps/oils_auth.c @@ -279,7 +279,7 @@ oilsEvent* oilsAuthHandleLoginOK( "Auth session trying org from param [%d] for auth timeout", orgloc ); timeout = oilsAuthGetTimeout( userObj, type, orgloc ); } - osrfLogDebug(OSRF_LOG_MARK, "Auth session timeout for %s: %lf", uname, timeout ); + osrfLogDebug(OSRF_LOG_MARK, "Auth session timeout for %s: %f", uname, timeout ); char* string = va_list_to_string( "%d.%d.%s", getpid(), time(NULL), uname ); @@ -292,14 +292,14 @@ oilsEvent* oilsAuthHandleLoginOK( "successful login: username=%s, authtoken=%s, workstation=%s", uname, authToken, ws ); oilsFMSetString( userObj, "passwd", "" ); - jsonObject* cacheObj = jsonParseStringFmt("{\"authtime\": %lf}", timeout); + jsonObject* cacheObj = jsonParseStringFmt("{\"authtime\": %f}", timeout); jsonObjectSetKey( cacheObj, "userobj", jsonObjectClone(userObj)); osrfCachePutObject( authKey, cacheObj, timeout ); jsonObjectFree(cacheObj); osrfLogInternal(OSRF_LOG_MARK, "oilsAuthComplete(): Placed user object into cache"); jsonObject* payload = jsonParseStringFmt( - "{ \"authtoken\": \"%s\", \"authtime\": %lf }", authToken, timeout ); + "{ \"authtoken\": \"%s\", \"authtime\": %f }", authToken, timeout ); response = oilsNewEvent2( OSRF_LOG_MARK, OILS_EVENT_SUCCESS, payload ); free(string); free(authToken); free(authKey); diff --git a/Open-ILS/src/c-apps/oils_utils.c b/Open-ILS/src/c-apps/oils_utils.c index 845a657fb5..a572316b27 100644 --- a/Open-ILS/src/c-apps/oils_utils.c +++ b/Open-ILS/src/c-apps/oils_utils.c @@ -147,7 +147,7 @@ jsonObject* oilsUtilsFetchUserByBarcode(char* barcode) { free(usr); jsonObjectFree(params); - params = jsonParseStringFmt("[%lf]", iusr); + params = jsonParseStringFmt("[%f]", iusr); jsonObject* user = oilsUtilsQuickReq( "open-ils.cstore", "open-ils.cstore.direct.actor.user.retrieve", params); diff --git a/OpenSRF/src/gateway/fieldmapper-c-xml-out.pl b/OpenSRF/src/gateway/fieldmapper-c-xml-out.pl index 857a3fc7ed..8f28c91558 100755 --- a/OpenSRF/src/gateway/fieldmapper-c-xml-out.pl +++ b/OpenSRF/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/OpenSRF/src/gateway/osrf_json_gateway.c b/OpenSRF/src/gateway/osrf_json_gateway.c index b9262e0c68..a575bd9769 100644 --- a/OpenSRF/src/gateway/osrf_json_gateway.c +++ b/OpenSRF/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/OpenSRF/src/libstack/osrf_app_session.c b/OpenSRF/src/libstack/osrf_app_session.c index 2bc03da45f..770446fc9f 100644 --- a/OpenSRF/src/libstack/osrf_app_session.c +++ b/OpenSRF/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/OpenSRF/src/libstack/osrf_stack.c b/OpenSRF/src/libstack/osrf_stack.c index 528abd0ff5..fe59c927d2 100644 --- a/OpenSRF/src/libstack/osrf_stack.c +++ b/OpenSRF/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/OpenSRF/src/libstack/osrf_system.c b/OpenSRF/src/libstack/osrf_system.c index 3f24038362..68f2e3cae5 100644 --- a/OpenSRF/src/libstack/osrf_system.c +++ b/OpenSRF/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/OpenSRF/src/objson/json2xml.c b/OpenSRF/src/objson/json2xml.c index 918c958a77..ef4fa19bf3 100644 --- a/OpenSRF/src/objson/json2xml.c +++ b/OpenSRF/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/OpenSRF/src/objson/objson_test.c b/OpenSRF/src/objson/objson_test.c index dc1d9d3670..20cf2ff648 100644 --- a/OpenSRF/src/objson/objson_test.c +++ b/OpenSRF/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/OpenSRF/src/srfsh/srfsh.c b/OpenSRF/src/srfsh/srfsh.c index 52b6918bb0..98870389d2 100644 --- a/OpenSRF/src/srfsh/srfsh.c +++ b/OpenSRF/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/OpenSRF/src/utils/socket_bundle.c b/OpenSRF/src/utils/socket_bundle.c index 013359ce50..5441adf2d0 100644 --- a/OpenSRF/src/utils/socket_bundle.c +++ b/OpenSRF/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/OpenSRF/src/utils/utils.h b/OpenSRF/src/utils/utils.h index 41aa48812b..308e3b7d46 100644 --- a/OpenSRF/src/utils/utils.h +++ b/OpenSRF/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