* \e$B8=:_!"\e(Bnkf \e$B$O\e(B SorceForge \e$B$K$F%a%s%F%J%s%9$,B3$1$i$l$F$$$^$9!#\e(B
* http://sourceforge.jp/projects/nkf/
***********************************************************************/
-#define NKF_IDENT "$Id: nkf.c,v 1.191 2008/11/09 21:10:04 naruse Exp $"
+#define NKF_IDENT "$Id: nkf.c,v 1.192 2008/11/09 23:09:22 naruse Exp $"
#define NKF_VERSION "2.0.8"
#define NKF_RELEASE_DATE "2008-11-10"
#define COPY_RIGHT \
nkf_enc_to_index(enc) == CP50222)
#ifdef DEFAULT_CODE_LOCALE
-static char*
+static const char*
nkf_locale_charmap()
{
#ifdef HAVE_LANGINFO_H
return nl_langinfo(CODESET);
#elif defined(__WIN32__)
- char buf[16];
- char *str;
- int len = sprintf(buf, "CP%d", GetACP());
- if (len > 0) {
- str = nkf_malloc(len + 1);
- strcpy(str, buf);
- str[len] = '\0';
- return str;
- }
- else return NULL;
+ static char buf[16];
+ sprintf(buf, "CP%d", GetACP());
+ return buf;
#elif defined(__OS2__)
# if defined(INT_IS_SHORT)
/* OS/2 1.x */
sprintf(buf, "CP%lu", ulCP[0]);
return buf;
# endif
-#else
- return NULL;
#endif
+ return NULL;
}
static nkf_encoding*
nkf_locale_encoding()
{
nkf_encoding *enc = 0;
- char *encname = nkf_locale_charmap();
+ const char *encname = nkf_locale_charmap();
if (encname)
enc = nkf_enc_find(encname);
return enc;
overwrite_f = TRUE;
preserve_time_f = TRUE;
backup_f = TRUE;
- backup_suffix = nkf_malloc(strlen((char *) p) + 1);
- strcpy(backup_suffix, (char *) p);
+ backup_suffix = (char *)p;
continue;
}
if (strcmp(long_option[i].name, "in-place") == 0){
overwrite_f = TRUE;
preserve_time_f = FALSE;
backup_f = TRUE;
- backup_suffix = nkf_malloc(strlen((char *) p) + 1);
- strcpy(backup_suffix, (char *) p);
+ backup_suffix = (char *)p;
continue;
}
#endif