From f9d8dea1de914debaa36dda9589b5136bd047591 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 3 Aug 2007 02:57:57 +0000 Subject: [PATCH] more locale cleanup git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1072 9efc2488-bf62-4759-914b-345cdb29e865 --- src/gateway/osrf_json_gateway.c | 2 +- src/libopensrf/osrf_message.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gateway/osrf_json_gateway.c b/src/gateway/osrf_json_gateway.c index 0349473..0663789 100644 --- a/src/gateway/osrf_json_gateway.c +++ b/src/gateway/osrf_json_gateway.c @@ -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 ); diff --git a/src/libopensrf/osrf_message.c b/src/libopensrf/osrf_message.c index 220a29c..ce25723 100644 --- a/src/libopensrf/osrf_message.c +++ b/src/libopensrf/osrf_message.c @@ -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; -- 2.11.0