more locale cleanup
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 3 Aug 2007 02:57:57 +0000 (02:57 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 3 Aug 2007 02:57:57 +0000 (02:57 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1072 9efc2488-bf62-4759-914b-345cdb29e865

src/gateway/osrf_json_gateway.c
src/libopensrf/osrf_message.c

index 0349473..0663789 100644 (file)
@@ -215,7 +215,7 @@ static int osrf_json_gateway_method_handler (request_rec *r) {
                if (index(param_locale, ',')) {
                        int ind = index(param_locale, ',') - param_locale;
                        int i;
-                       for ( i = 0; i < ind - 1 && i < 128; i++ )
+                       for ( i = 0; i < ind && i < 128; i++ )
                                buffer_add_char( osrf_locale_buf, param_locale[i] );
                } else {
                        buffer_add( osrf_locale_buf, param_locale );
index 220a29c..ce25723 100644 (file)
@@ -285,11 +285,12 @@ int osrf_message_deserialize(char* string, osrf_message* msgs[], int count) {
                        }
 
                        /* use the sender's locale, or the global default */
+                       if (current_locale)
+                               free( current_locale );
+
                        tmp = jsonObjectGetKey(message, "locale");
                        if(tmp) {
                                new_msg->sender_locale = jsonObjectToSimpleString(tmp);
-                               if (current_locale)
-                                       free( current_locale );
                                current_locale = strdup( new_msg->sender_locale );
                        } else {
                                current_locale = NULL;