Skip to content
Permalink
Browse files
Updates to compile on MSVC
  • Loading branch information
nitslp-ri committed Aug 28, 2020
1 parent 2e0cc8e commit c23f5d8d2b8d8fa8983a0a61dff8374f5cc56e5a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
@@ -8,7 +8,9 @@
#include <stdio.h>
#include <string.h>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define strmatch !strcmp

@@ -70,7 +72,7 @@ str2code(char *codestr, unsigned int *code)
/* codepage number */
*code = atoi(codestr);
if (! IsValidCodePage(*code)) {
jlog("Error: charconv_win32: codepage \"%d\" not found\n", codestr);
fprintf(stderr, "Error: charconv_win32: codepage \"%s\" not found\n", codestr);
return -1;
}
} else {
@@ -163,23 +165,23 @@ charconv(char *instr, char *outstr, int maxoutlen)
/* get length of unicode string */
unilen = MultiByteToWideChar(from_cp, 0, srcbuf, -1, NULL, 0);
if (unilen <= 0) {
jlog("Error: charconv: conversion error?\n");
fprintf(stderr, "Error: charconv: conversion error?\n");
return(instr);
}
if (unilen > UNICODE_BUFFER_SIZE) {
jlog("Error: charconv: unicode buffer size exceeded (%d > %d)!\n", unilen, UNICODE_BUFFER_SIZE);
fprintf(stderr, "Error: charconv: unicode buffer size exceeded (%d > %d)!\n", unilen, UNICODE_BUFFER_SIZE);
return(instr);
}
/* convert source string to unicode */
MultiByteToWideChar(from_cp, 0, srcbuf, -1, unibuf, unilen);
/* get length of target string */
newlen = WideCharToMultiByte(to_cp, 0, unibuf, -1, outstr, 0, NULL, NULL);
if (newlen <= 0) {
jlog("Error: charconv: conversion error?\n");
fprintf(stderr, "Error: charconv: conversion error?\n");
return(instr);
}
if (newlen > maxoutlen) {
jlog("Error: charconv: target buffer size exceeded (%d > %d)!\n", newlen, maxoutlen);
fprintf(stderr, "Error: charconv: target buffer size exceeded (%d > %d)!\n", newlen, maxoutlen);
return(instr);
}
/* convert unicode to target string */
@@ -1,6 +1,6 @@
/**
* @file mkbingram.c
*
*
* <JA>
* @brief ARPA標準形式のN-gramから Julius 用のバイナリN-gramに変換する.
*
@@ -10,16 +10,16 @@
* バイナリN-gramの形式はまた古い形式(3.4.2以前)
* のバイナリN-gramを 3.5 以降の新しい形式に変換することもできる.
* </JA>
*
*
* <EN>
* @brief
* @brief
* </EN>
*
*
* @author Akinobu LEE
* @date Thu Mar 24 12:22:27 2005
*
* $Revision: 1.7 $
*
*
*/
/*
* Copyright (c) 1991-2016 Kawahara Lab., Kyoto University
@@ -35,7 +35,9 @@
#include <sys/stat.h>
#include <time.h>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "charconv.h"

static NGRAM_INFO *ngram;
@@ -213,7 +215,7 @@ main(int argc, char *argv[])
}

print_ngram_info(stdout, ngram);

#if defined(HAVE_WINNLS) || defined(HAVE_ICONV)
if (charconv_enabled == TRUE) {
int fail_count = 0;
@@ -252,7 +254,7 @@ main(int argc, char *argv[])
fclose_writefile(fp);

printf("completed\n");

return 0;

}
@@ -484,7 +484,7 @@ bool cJulius::addGrammar( char *name, char *dictfile, char *dfafile, bool delete
multigram_delete_all(r->lm);
}
/* register the new grammar to multi-gram tree */
multigram_add(dfa, winfo, name, r->lm);
multigram_add(dfa, winfo, name, r->lm, NULL);
/* need to rebuild the global lexicon */
/* tell engine to update at requested timing */
schedule_grammar_update(m_recog);

0 comments on commit c23f5d8

Please sign in to comment.