29
29
unused_mut
30
30
) ]
31
31
32
+ use crate :: DisplayExt ;
32
33
use crate :: { info, warn} ;
33
34
use crate :: { streq_ptr, strstartswith} ;
35
+ use std:: ffi:: CStr ;
34
36
35
37
use super :: dpx_dpxfile:: dpx_tt_open;
36
38
use super :: dpx_dpxutil:: { ht_append_table, ht_clear_table, ht_init_table, ht_lookup_table} ;
37
- use super :: dpx_error:: { dpx_message , dpx_warning} ;
39
+ use super :: dpx_error:: dpx_warning;
38
40
use super :: dpx_mem:: new;
39
41
use super :: dpx_mfileio:: tt_mfgets;
40
42
use super :: dpx_pdfparse:: { parse_ident, skip_white} ;
@@ -800,7 +802,7 @@ unsafe extern "C" fn agl_load_listfile(mut filename: *const i8, mut is_predef: i
800
802
return -1i32 ;
801
803
}
802
804
if verbose != 0 {
803
- dpx_message ( b "<AGL:%s \x00 " as * const u8 as * const i8 , filename) ;
805
+ info ! ( "<AGL:{}" , CStr :: from_ptr ( filename) . display ( ) ) ;
804
806
}
805
807
loop {
806
808
p = tt_mfgets ( wbuf. as_mut_ptr ( ) , 1024i32 , handle) ;
@@ -826,9 +828,9 @@ unsafe extern "C" fn agl_load_listfile(mut filename: *const i8, mut is_predef: i
826
828
name = parse_ident ( & mut p, nextptr) ;
827
829
skip_white ( & mut p, endptr) ;
828
830
if name. is_null ( ) || * p. offset ( 0 ) as i32 != ';' as i32 {
829
- dpx_warning (
830
- b "Invalid AGL entry: %s \x00 " as * const u8 as * const i8 ,
831
- wbuf. as_mut_ptr ( ) ,
831
+ warn ! (
832
+ "Invalid AGL entry: {}" ,
833
+ CStr :: from_ptr ( wbuf. as_ptr ( ) ) . display ( )
832
834
) ;
833
835
free ( name as * mut libc:: c_void ) ;
834
836
} else {
@@ -851,9 +853,9 @@ unsafe extern "C" fn agl_load_listfile(mut filename: *const i8, mut is_predef: i
851
853
}
852
854
}
853
855
if n_unicodes == 0i32 {
854
- dpx_warning (
855
- b "AGL entry ignored (no mapping): %s \x00 " as * const u8 as * const i8 ,
856
- wbuf. as_mut_ptr ( ) ,
856
+ warn ! (
857
+ "AGL entry ignored (no mapping): {}" ,
858
+ CStr :: from_ptr ( wbuf. as_ptr ( ) ) . display ( ) ,
857
859
) ;
858
860
free ( name as * mut libc:: c_void ) ;
859
861
} else {
@@ -885,17 +887,17 @@ unsafe extern "C" fn agl_load_listfile(mut filename: *const i8, mut is_predef: i
885
887
}
886
888
if verbose > 3i32 {
887
889
if !( * agln) . suffix . is_null ( ) {
888
- dpx_message (
889
- b "agl: %s [%s.%s ] -->\x00 " as * const u8 as * const i8 ,
890
- name,
891
- ( * agln) . name ,
892
- ( * agln) . suffix ,
890
+ info ! (
891
+ "agl: {} [{}.{} ] -->" ,
892
+ CStr :: from_ptr ( name) . display ( ) ,
893
+ CStr :: from_ptr ( ( * agln) . name) . display ( ) ,
894
+ CStr :: from_ptr ( ( * agln) . suffix) . display ( ) ,
893
895
) ;
894
896
} else {
895
- dpx_message (
896
- b "agl: %s [%s ] -->\x00 " as * const u8 as * const i8 ,
897
- name,
898
- ( * agln) . name ,
897
+ info ! (
898
+ "agl: {} [{} ] -->" ,
899
+ CStr :: from_ptr ( name) . display ( ) ,
900
+ CStr :: from_ptr ( ( * agln) . name) . display ( ) ,
899
901
) ;
900
902
}
901
903
i = 0i32 ;
@@ -1100,9 +1102,9 @@ pub unsafe extern "C" fn agl_sput_UTF16BE(
1100
1102
* Glyph names starting with a underscore or two subsequent
1101
1103
* underscore in glyph name not allowed?
1102
1104
*/
1103
- dpx_warning (
1104
- b "Invalid glyph name component in \" %s \" .\x00 " as * const u8 as * const i8 ,
1105
- glyphstr,
1105
+ warn ! (
1106
+ "Invalid glyph name component in \" {} \" ." ,
1107
+ CStr :: from_ptr ( glyphstr) . display ( )
1106
1108
) ;
1107
1109
count += 1 ;
1108
1110
if !fail_count. is_null ( ) {
@@ -1147,11 +1149,11 @@ pub unsafe extern "C" fn agl_sput_UTF16BE(
1147
1149
agln0 = agl_normalized_name ( name) ;
1148
1150
if !agln0. is_null ( ) {
1149
1151
if verbose > 1i32 && !( * agln0) . suffix . is_null ( ) {
1150
- dpx_warning (
1151
- b "agl: fix %s --> %s.%s \x00 " as * const u8 as * const i8 ,
1152
- name,
1153
- ( * agln0) . name ,
1154
- ( * agln0) . suffix ,
1152
+ warn ! (
1153
+ "agl: fix {} --> {}.{}" ,
1154
+ CStr :: from_ptr ( name) . display ( ) ,
1155
+ CStr :: from_ptr ( ( * agln0) . name) . display ( ) ,
1156
+ CStr :: from_ptr ( ( * agln0) . suffix) . display ( ) ,
1155
1157
) ;
1156
1158
}
1157
1159
agln1 = agl_lookup_list ( ( * agln0) . name ) ;
@@ -1170,11 +1172,10 @@ pub unsafe extern "C" fn agl_sput_UTF16BE(
1170
1172
}
1171
1173
} else {
1172
1174
if verbose != 0 {
1173
- dpx_warning (
1174
- b"No Unicode mapping for glyph name \" %s\" found.\x00 " as * const u8
1175
- as * const i8 ,
1176
- name,
1177
- ) ;
1175
+ warn ! (
1176
+ "No Unicode mapping for glyph name \" {}\" found." ,
1177
+ CStr :: from_ptr( name) . display( )
1178
+ )
1178
1179
}
1179
1180
count += 1
1180
1181
}
@@ -1214,9 +1215,9 @@ pub unsafe extern "C" fn agl_get_unicodes(
1214
1215
* Glyph names starting with a underscore or two subsequent
1215
1216
* underscore in glyph name not allowed?
1216
1217
*/
1217
- dpx_warning (
1218
- b "Invalid glyph name component in \" %s \" .\x00 " as * const u8 as * const i8 ,
1219
- glyphstr,
1218
+ warn ! (
1219
+ "Invalid glyph name component in \" {} \" ." ,
1220
+ CStr :: from_ptr ( glyphstr) . display ( )
1220
1221
) ;
1221
1222
return -1i32 ;
1222
1223
/* Cannot continue */
@@ -1275,11 +1276,11 @@ pub unsafe extern "C" fn agl_get_unicodes(
1275
1276
agln0 = agl_normalized_name ( name) ;
1276
1277
if !agln0. is_null ( ) {
1277
1278
if verbose > 1i32 && !( * agln0) . suffix . is_null ( ) {
1278
- dpx_warning (
1279
- b "agl: fix %s --> %s.%s \x00 " as * const u8 as * const i8 ,
1280
- name,
1281
- ( * agln0) . name ,
1282
- ( * agln0) . suffix ,
1279
+ warn ! (
1280
+ "agl: fix {} --> {}.{}" ,
1281
+ CStr :: from_ptr ( name) . display ( ) ,
1282
+ CStr :: from_ptr ( ( * agln0) . name) . display ( ) ,
1283
+ CStr :: from_ptr ( ( * agln0) . suffix) . display ( ) ,
1283
1284
) ;
1284
1285
}
1285
1286
agln1 = agl_lookup_list ( ( * agln0) . name ) ;
@@ -1300,11 +1301,10 @@ pub unsafe extern "C" fn agl_get_unicodes(
1300
1301
}
1301
1302
} else {
1302
1303
if verbose > 1i32 {
1303
- dpx_warning (
1304
- b"No Unicode mapping for glyph name \" %s\" found.\x00 " as * const u8
1305
- as * const i8 ,
1306
- name,
1307
- ) ;
1304
+ warn ! (
1305
+ "No Unicode mapping for glyph name \" {}\" found." ,
1306
+ CStr :: from_ptr( name) . display( )
1307
+ )
1308
1308
}
1309
1309
free ( name as * mut libc:: c_void ) ;
1310
1310
return -1i32 ;
0 commit comments