aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-13 07:51:45 -0700
committerPaul Eggert2016-05-13 07:52:14 -0700
commitf791efc057429c6370f02ab34e715ea2872f6cfa (patch)
treeffb2191d37848e31e663b9b48f3fa2ddec370090
parent1adfb5ee55d16cd3d9d78998ae7bbb8e5708d9c5 (diff)
downloademacs-f791efc057429c6370f02ab34e715ea2872f6cfa.tar.gz
emacs-f791efc057429c6370f02ab34e715ea2872f6cfa.zip
Sync from gnulib
This incorporates a spelling fix, plus: 2016-05-09 Fix undefined behaviour in gettext.h * lib/gettext.h, lib/mktime.c: Copy from gnulib.
-rw-r--r--lib/gettext.h8
-rw-r--r--lib/mktime.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/gettext.h b/lib/gettext.h
index 00af87265b4..9a232cc3a86 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -225,15 +225,17 @@ dcpgettext_expr (const char *domain,
225 if (msg_ctxt_id != NULL) 225 if (msg_ctxt_id != NULL)
226#endif 226#endif
227 { 227 {
228 int found_translation;
228 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); 229 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
229 msg_ctxt_id[msgctxt_len - 1] = '\004'; 230 msg_ctxt_id[msgctxt_len - 1] = '\004';
230 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); 231 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
231 translation = dcgettext (domain, msg_ctxt_id, category); 232 translation = dcgettext (domain, msg_ctxt_id, category);
233 found_translation = (translation != msg_ctxt_id);
232#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 234#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
233 if (msg_ctxt_id != buf) 235 if (msg_ctxt_id != buf)
234 free (msg_ctxt_id); 236 free (msg_ctxt_id);
235#endif 237#endif
236 if (translation != msg_ctxt_id) 238 if (found_translation)
237 return translation; 239 return translation;
238 } 240 }
239 return msgid; 241 return msgid;
@@ -271,15 +273,17 @@ dcnpgettext_expr (const char *domain,
271 if (msg_ctxt_id != NULL) 273 if (msg_ctxt_id != NULL)
272#endif 274#endif
273 { 275 {
276 int found_translation;
274 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); 277 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
275 msg_ctxt_id[msgctxt_len - 1] = '\004'; 278 msg_ctxt_id[msgctxt_len - 1] = '\004';
276 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); 279 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
277 translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); 280 translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
281 found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
278#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 282#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
279 if (msg_ctxt_id != buf) 283 if (msg_ctxt_id != buf)
280 free (msg_ctxt_id); 284 free (msg_ctxt_id);
281#endif 285#endif
282 if (!(translation == msg_ctxt_id || translation == msgid_plural)) 286 if (found_translation)
283 return translation; 287 return translation;
284 } 288 }
285 return (n == 1 ? msgid : msgid_plural); 289 return (n == 1 ? msgid : msgid_plural);
diff --git a/lib/mktime.c b/lib/mktime.c
index 419a177c018..40bc2a38a21 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -228,7 +228,7 @@ guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
228} 228}
229 229
230/* Use CONVERT to convert T to a struct tm value in *TM. T must be in 230/* Use CONVERT to convert T to a struct tm value in *TM. T must be in
231 range for time_t. Return TM if successfull, NULL if T is out of 231 range for time_t. Return TM if successful, NULL if T is out of
232 range for CONVERT. */ 232 range for CONVERT. */
233static struct tm * 233static struct tm *
234convert_time (struct tm *(*convert) (const time_t *, struct tm *), 234convert_time (struct tm *(*convert) (const time_t *, struct tm *),