/************************************************************************/
/* Reads charset file (as got from ftp.unicode.org) and returns array of*/
/* 256 short ints (malloced) mapping from charset t unicode */
-/************************************************************************/int * read_charset(const char *filename) {
+/************************************************************************/
uint16_t * read_charset(const char *filename) {
char *path;
FILE *f;
/************************************************************************/
int check_charset(char **filename,const char *charset) {
char *tmppath;
+ if (charset == NULL ) {
+ return 0;
+ }
if (!strncmp(charset,"utf-8",6)) {
*filename=strdup("utf-8");
return 1;
}
tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path);
- /* Some compilers evalate both arguments of && before
- applying, so let's not use && as in the shell */
- if (tmppath) {
- if (*tmppath) {
+ if (tmppath && *tmppath) {
*filename=strdup(charset);
free(tmppath);
return 1;
- }
}
return 0;
}