printf family format fixup found (har har) and suggested by Scott McKellar -- %lf...
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 9 May 2007 20:20:46 +0000 (20:20 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 9 May 2007 20:20:46 +0000 (20:20 +0000)
(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
src/gateway/osrf_json_gateway.c
src/libstack/osrf_app_session.c
src/libstack/osrf_stack.c
src/libstack/osrf_system.c
src/objson/json2xml.c
src/objson/objson_test.c
src/srfsh/srfsh.c
src/utils/socket_bundle.c
src/utils/utils.h

index 857a3fc..8f28c91 100755 (executable)
@@ -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</%s>",tag,obj->double_value,tag);
+                       buffer_fadd(buf,"<%s>%f</%s>",tag,obj->double_value,tag);
 
 
        } else if (obj->is_array) {
index b9262e0..a575bd9 100644 (file)
@@ -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)
index 2bc03da..770446f 100644 (file)
@@ -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 );
index 528abd0..fe59c92 100644 (file)
@@ -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");
index 3f24038..68f2e3c 100644 (file)
@@ -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 = "";
index 918c958..ef4fa19 100644 (file)
@@ -70,12 +70,12 @@ int _recurse_jsonObjectToXML(jsonObject* obj, growing_buffer* res_xml) {
                        if (x == (int)x)
                                buffer_fadd(res_xml,"<number class_hint=\"%s\">%d</number>", hint, (int)x);
                        else
-                               buffer_fadd(res_xml,"<number class_hint=\"%s\">%lf</number>", hint, x);
+                               buffer_fadd(res_xml,"<number class_hint=\"%s\">%f</number>", hint, x);
                } else {
                        if (x == (int)x)
                                buffer_fadd(res_xml,"<number>%d</number>", (int)x);
                        else
-                               buffer_fadd(res_xml,"<number>%lf</number>", x);
+                               buffer_fadd(res_xml,"<number>%f</number>", x);
                }
 
        } else if (obj->type == JSON_ARRAY) {
index dc1d9d3..20cf2ff 100644 (file)
@@ -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);
 
 
index 52b6918..9887038 100644 (file)
@@ -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;
 
index 013359c..5441adf 100644 (file)
@@ -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);
index 41aa488..308e3b7 100644 (file)
@@ -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) \