Mercurial > emacs
comparison src/mac.c @ 67088:5e6f93897afb
(DECODE_UTF_8): Remove macro.
[TARGET_API_MAC_CARBON] (cfstring_to_lisp_nodecode): New function
created from cfstring_to_lisp.
[TARGET_API_MAC_CARBON] (cfstring_to_lisp): Use it.
(xrm_get_preference_database) [TARGET_API_MAC_CARBON]: Likewise.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 23 Nov 2005 07:19:16 +0000 |
parents | 6a3a5a23008d |
children | 2efa50cbb7cd |
comparison
equal
deleted
inserted
replaced
67087:1fd0f45a7a2b | 67088:5e6f93897afb |
---|---|
263 ***********************************************************************/ | 263 ***********************************************************************/ |
264 | 264 |
265 #if TARGET_API_MAC_CARBON | 265 #if TARGET_API_MAC_CARBON |
266 static Lisp_Object Qstring, Qnumber, Qboolean, Qdate, Qdata; | 266 static Lisp_Object Qstring, Qnumber, Qboolean, Qdate, Qdata; |
267 static Lisp_Object Qarray, Qdictionary; | 267 static Lisp_Object Qarray, Qdictionary; |
268 #define DECODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 0) | |
269 | 268 |
270 struct cfdict_context | 269 struct cfdict_context |
271 { | 270 { |
272 Lisp_Object *result; | 271 Lisp_Object *result; |
273 int with_tag, hash_bound; | 272 int with_tag, hash_bound; |
334 | 333 |
335 return result; | 334 return result; |
336 } | 335 } |
337 | 336 |
338 | 337 |
339 /* From CFString to a lisp string. Never returns a unibyte string | 338 /* From CFString to a lisp string. Returns a unibyte string |
340 (even if it only contains ASCII characters). | 339 containing a UTF-8 byte sequence. */ |
341 This may cause GC during code conversion. */ | |
342 | 340 |
343 Lisp_Object | 341 Lisp_Object |
344 cfstring_to_lisp (string) | 342 cfstring_to_lisp_nodecode (string) |
345 CFStringRef string; | 343 CFStringRef string; |
346 { | 344 { |
347 Lisp_Object result = Qnil; | 345 Lisp_Object result = Qnil; |
348 const char *s = CFStringGetCStringPtr (string, kCFStringEncodingUTF8); | 346 const char *s = CFStringGetCStringPtr (string, kCFStringEncodingUTF8); |
349 | 347 |
360 result = cfdata_to_lisp (data); | 358 result = cfdata_to_lisp (data); |
361 CFRelease (data); | 359 CFRelease (data); |
362 } | 360 } |
363 } | 361 } |
364 | 362 |
363 return result; | |
364 } | |
365 | |
366 | |
367 /* From CFString to a lisp string. Never returns a unibyte string | |
368 (even if it only contains ASCII characters). | |
369 This may cause GC during code conversion. */ | |
370 | |
371 Lisp_Object | |
372 cfstring_to_lisp (string) | |
373 CFStringRef string; | |
374 { | |
375 Lisp_Object result = cfstring_to_lisp_nodecode (string); | |
376 | |
365 if (!NILP (result)) | 377 if (!NILP (result)) |
366 { | 378 { |
367 result = DECODE_UTF_8 (result); | 379 result = code_convert_string_norecord (result, Qutf_8, 0); |
368 /* This may be superfluous. Just to make sure that the result | 380 /* This may be superfluous. Just to make sure that the result |
369 is a multibyte string. */ | 381 is a multibyte string. */ |
370 result = string_to_multibyte (result); | 382 result = string_to_multibyte (result); |
371 } | 383 } |
372 | 384 |
1139 if (keys == NULL) | 1151 if (keys == NULL) |
1140 goto out; | 1152 goto out; |
1141 CFSetGetValues (key_set, (const void **)keys); | 1153 CFSetGetValues (key_set, (const void **)keys); |
1142 for (index = 0; index < count; index++) | 1154 for (index = 0; index < count; index++) |
1143 { | 1155 { |
1144 res_name = SDATA (cfstring_to_lisp (keys[index])); | 1156 res_name = SDATA (cfstring_to_lisp_nodecode (keys[index])); |
1145 quarks = parse_resource_name (&res_name); | 1157 quarks = parse_resource_name (&res_name); |
1146 if (!(NILP (quarks) || *res_name)) | 1158 if (!(NILP (quarks) || *res_name)) |
1147 { | 1159 { |
1148 plist = CFPreferencesCopyAppValue (keys[index], app_id); | 1160 plist = CFPreferencesCopyAppValue (keys[index], app_id); |
1149 value = xrm_cfproperty_list_to_value (plist); | 1161 value = xrm_cfproperty_list_to_value (plist); |