Fix warning and Win32 in general
This commit is contained in:
parent
7993ba946c
commit
5e3b8b3b12
7 changed files with 27 additions and 12 deletions
|
|
@ -36,6 +36,7 @@ elseif(SJ4_EMBED)
|
|||
endif()
|
||||
|
||||
sj4_library(sj4rkcv)
|
||||
sj4_library(sj4ime)
|
||||
|
||||
if(NOT SJ4_GLOBAL)
|
||||
sj4_library(sj4lib)
|
||||
|
|
|
|||
4
include/sj4ime/sj_ime.h
Normal file
4
include/sj4ime/sj_ime.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef __SJ_IME_H__
|
||||
#define __SJ_IME_H__
|
||||
|
||||
#endif
|
||||
|
|
@ -364,7 +364,7 @@ static size_t dopr(char* buffer, size_t maxlen, const char* format, va_list args
|
|||
break;
|
||||
case 'p':
|
||||
strvalue = va_arg(args, void*);
|
||||
fmtint(buffer, &currlen, maxlen, (long)strvalue, 16, min, max, flags);
|
||||
fmtint(buffer, &currlen, maxlen, (size_t)strvalue, 16, min, max, flags);
|
||||
break;
|
||||
case 'n':
|
||||
if(cflags == DP_C_SHORT) {
|
||||
|
|
|
|||
|
|
@ -233,9 +233,9 @@ opendict(SJ4_CONTEXT char* name, char* passwd) {
|
|||
u_char* dp;
|
||||
VFile vf;
|
||||
|
||||
#if defined(EMBED) || defined(EMBED_PLUS)
|
||||
memset(&vf, 0, sizeof(vf));
|
||||
|
||||
#if defined(EMBED) || defined(EMBED_PLUS)
|
||||
if(strcmp(name, "sj4main.dic") == 0) {
|
||||
extern u_char sj4main_dic[];
|
||||
extern u_int sj4main_dic_len;
|
||||
|
|
|
|||
1
lib/sj4ime/ime.c
Normal file
1
lib/sj4ime/ime.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include <sj_ime.h>
|
||||
|
|
@ -142,10 +142,16 @@ int codesize(u_char code) {
|
|||
euc[strlen(euc)] = (c); \
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define TO sj4_to_sjis
|
||||
#else
|
||||
#define TO sj4_to_utf8
|
||||
#endif
|
||||
|
||||
void output_knj(FILE* fp, u_char* p, int l) {
|
||||
u_char euc[64];
|
||||
#ifdef UTF8
|
||||
u_char ucs[64];
|
||||
u_char to[64];
|
||||
#endif
|
||||
euc[0] = 0;
|
||||
|
||||
|
|
@ -203,9 +209,9 @@ void output_knj(FILE* fp, u_char* p, int l) {
|
|||
}
|
||||
|
||||
#ifdef UTF8
|
||||
ucs[sj4_to_utf8(ucs, euc, strlen(euc))] = 0;
|
||||
to[TO(to, euc, strlen(euc))] = 0;
|
||||
|
||||
fputs(ucs, fp);
|
||||
fputs(to, fp);
|
||||
#else
|
||||
fputs(euc, fp);
|
||||
#endif
|
||||
|
|
@ -289,7 +295,7 @@ void output_yomi(FILE* fp, u_char* p) {
|
|||
char buf[5];
|
||||
#ifdef UTF8
|
||||
u_char euc[2];
|
||||
u_char ucs[64];
|
||||
u_char to[64];
|
||||
#endif
|
||||
|
||||
while(*p) {
|
||||
|
|
@ -299,9 +305,9 @@ void output_yomi(FILE* fp, u_char* p) {
|
|||
euc[0] = (i >> 8) & 0xff;
|
||||
euc[1] = i & 0xff;
|
||||
|
||||
ucs[sj4_to_utf8(ucs, euc, 2)] = 0;
|
||||
to[TO(to, euc, 2)] = 0;
|
||||
|
||||
fputs(ucs, fp);
|
||||
fputs(to, fp);
|
||||
#else
|
||||
fputc((i >> 8) & 0xff, fp);
|
||||
fputc(i & 0xff, fp);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,16 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CHARSET SJ4SJIS
|
||||
#else
|
||||
#define CHARSET SJ4UTF8
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char c[8 * 1024];
|
||||
Sj4Lib* ctx = sj4_open(SJ4UTF8, "sj4main.dic");
|
||||
Sj4Lib* ctx = sj4_open(CHARSET, "sj4main.dic");
|
||||
char b;
|
||||
|
||||
if(ctx == NULL) {
|
||||
|
|
@ -16,8 +21,6 @@ int main(int argc, char** argv) {
|
|||
|
||||
c[0] = 0;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
while(fread(&b, 1, sizeof(b), stdin)) {
|
||||
int n, i;
|
||||
Sj4Kouho kouho;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue