Blob Blame History Raw
--- ./include/sphinxbase/pio.h.orig	2012-12-05 07:06:01.000000000 -0700
+++ ./include/sphinxbase/pio.h	2013-03-27 17:05:58.476768707 -0600
@@ -285,7 +285,7 @@ int32 stat_retry (const char *file, stru
  */
 
 SPHINXBASE_EXPORT
-int32 stat_mtime (const char *file);
+time_t stat_mtime (const char *file);
 
 /**
  * Create a directory and all of its parent directories, as needed.
--- ./src/sphinx_fe/sphinx_fe.c.orig	2012-12-05 07:06:03.000000000 -0700
+++ ./src/sphinx_fe/sphinx_fe.c	2013-03-28 07:48:54.079307592 -0600
@@ -166,7 +166,7 @@ open_nist_file(sphinx_wave2feat_t *wtf,
         return FALSE;
     }
     /* Rewind, parse lines. */
-    fseek(fh, 0, SEEK_SET);
+    fseeko(fh, 0, SEEK_SET);
     for (li = lineiter_start(fh); li; li = lineiter_next(li)) {
         char **words;
         int nword;
@@ -194,7 +194,7 @@ open_nist_file(sphinx_wave2feat_t *wtf,
         ckd_free(words);
     }
 
-    fseek(fh, 1024, SEEK_SET);
+    fseeko(fh, 1024, SEEK_SET);
     if (out_fh)
         *out_fh = fh;
     else
@@ -283,7 +283,7 @@ detect_sphinx_mfc(sphinx_wave2feat_t *wt
 {
     FILE *fh;
     int32 len;
-    long flen;
+    off_t flen;
 
     if ((fh = fopen(wtf->infile, "rb")) == NULL) {
         E_ERROR_SYSTEM("Failed to open %s", wtf->infile);
@@ -294,8 +294,8 @@ detect_sphinx_mfc(sphinx_wave2feat_t *wt
         fclose(fh);
         return -1;
     }
-    fseek(fh, 0, SEEK_END);
-    flen = ftell(fh);
+    fseeko(fh, 0, SEEK_END);
+    flen = ftello(fh);
 
     /* figure out whether to byteswap */
     flen = (flen / 4) - 1;
@@ -304,7 +304,7 @@ detect_sphinx_mfc(sphinx_wave2feat_t *wt
         SWAP_INT32(&len);
         if (flen != len) {
             SWAP_INT32(&len);
-            E_ERROR("Mismatch in header/file lengths: 0x%08x vs 0x%08x\n",
+            E_ERROR("Mismatch in header/file lengths: 0x%08x vs 0x%08zx\n",
                     len, flen);
             return -1;
         }
@@ -314,7 +314,7 @@ detect_sphinx_mfc(sphinx_wave2feat_t *wt
                           ? "little" : "big"));
     }
     
-    fseek(fh, 4, SEEK_SET);
+    fseeko(fh, 4, SEEK_SET);
     wtf->infh = fh;
     if (cmd_ln_boolean_r(wtf->config, "-spec2cep")) {
         wtf->in_veclen = cmd_ln_int32_r(wtf->config, "-nfilt");
@@ -917,7 +917,7 @@ sphinx_wave2feat_convert_file(sphinx_wav
     }
 
     if (wtf->ot->output_header) {
-        if (fseek(wtf->outfh, 0, SEEK_SET) < 0) {
+        if (fseeko(wtf->outfh, 0, SEEK_SET) < 0) {
             E_ERROR_SYSTEM("Failed to seek to beginning of %s\n", outfile);
             goto error_out;
         }
@@ -1027,7 +1027,7 @@ run_control_file(sphinx_wave2feat_t *wtf
         part = cmd_ln_int32_r(wtf->config, "-part");
         for (li = lineiter_start(ctlfh); li; li = lineiter_next(li))
             ++nlines;
-        fseek(ctlfh, 0, SEEK_SET);
+        fseeko(ctlfh, 0, SEEK_SET);
         partlen = nlines / npart;
         nskip = partlen * (part - 1);
         if (part == npart)
--- ./src/sphinx_adtools/sphinx_pitch.c.orig	2012-12-05 07:06:09.000000000 -0700
+++ ./src/sphinx_adtools/sphinx_pitch.c	2013-03-28 08:03:12.205319946 -0600
@@ -176,7 +176,7 @@ guess_file_type(char const *file, FILE *
 {
     char header[4];
 
-    fseek(infh, 0, SEEK_SET);
+    fseeko(infh, 0, SEEK_SET);
     if (fread(header, 1, 4, infh) != 4) {
         E_ERROR_SYSTEM("Failed to read 4 byte header");
         return -1;
@@ -199,7 +199,7 @@ guess_file_type(char const *file, FILE *
         cmd_ln_set_boolean("-nist", FALSE);
         cmd_ln_set_boolean("-raw", TRUE);
     }
-    fseek(infh, 0, SEEK_SET);
+    fseeko(infh, 0, SEEK_SET);
     return 0;
 }
 
@@ -282,7 +282,7 @@ read_riff_header(FILE *infh)
 
     /* Any extra parameters. */
     if (header_len > 16)
-        fseek(infh, header_len - 16, SEEK_CUR);
+        fseeko(infh, header_len - 16, SEEK_CUR);
 
     /* Now skip to the 'data' chunk. */
     while (1) {
@@ -297,7 +297,7 @@ read_riff_header(FILE *infh)
             /* Number of bytes of ... whatever */
             TRY_FREAD(&intval, 4, 1, infh);
             if (WORDS_BIGENDIAN) SWAP_INT32(&intval);
-            fseek(infh, intval, SEEK_CUR);
+            fseeko(infh, intval, SEEK_CUR);
         }
     }
 
--- ./src/sphinx_cepview/main_cepview.c.orig	2012-12-13 02:01:21.000000000 -0700
+++ ./src/sphinx_cepview/main_cepview.c	2013-03-27 17:15:48.227654656 -0600
@@ -219,14 +219,14 @@ read_cep(char const *file, float ***cep,
 
     /* Check if n_float matches file size */
     byterev = FALSE;
-    if ((int) (n_float * sizeof(float) + 4) != statbuf.st_size) {
+    if ((off_t) (n_float * sizeof(float) + 4) != statbuf.st_size) {
         n = n_float;
         SWAP_INT32(&n);
 
-        if ((int) (n * sizeof(float) + 4) != statbuf.st_size) {
-    	    E_ERROR("Header size field: %d(%08x); filesize: %d(%08x)\n",
-                 n_float, n_float, (int) statbuf.st_size,
-                 (int) statbuf.st_size);
+        if ((off_t) (n * sizeof(float) + 4) != statbuf.st_size) {
+    	    E_ERROR("Header size field: %d(%08x); filesize: %zd(%08zx)\n",
+                 n_float, n_float, statbuf.st_size,
+                 statbuf.st_size);
             fclose(fp);
             return IO_ERR;
         }
--- ./src/libsphinxbase/util/bio.c.orig	2012-12-05 07:06:08.000000000 -0700
+++ ./src/libsphinxbase/util/bio.c	2013-03-28 07:54:31.943518377 -0600
@@ -513,8 +513,9 @@ bio_read_wavfile(char const *directory,
 {
     FILE *uttfp;
     char *inputfile;
-    int32 n, l;
+    int32 l;
     int16 *data;
+    off_t n;
 
     n = strlen(extension);
     l = strlen(filename);
@@ -530,11 +531,11 @@ bio_read_wavfile(char const *directory,
     if ((uttfp = fopen(inputfile, "rb")) == NULL) {
         E_FATAL_SYSTEM("Failed to open file '%s' for reading", inputfile);
     }
-    fseek(uttfp, 0, SEEK_END);
-    n = ftell(uttfp);
-    fseek(uttfp, 0, SEEK_SET);
+    fseeko(uttfp, 0, SEEK_END);
+    n = ftello(uttfp);
+    fseeko(uttfp, 0, SEEK_SET);
     if (header > 0) {
-        if (fseek(uttfp, header, SEEK_SET) < 0) {
+        if (fseeko(uttfp, header, SEEK_SET) < 0) {
             E_ERROR_SYSTEM("Failed to move to an offset %d in a file '%s'", header, inputfile);
             fclose(uttfp);
             ckd_free(inputfile);
@@ -545,7 +546,7 @@ bio_read_wavfile(char const *directory,
     n /= sizeof(int16);
     data = ckd_calloc(n, sizeof(*data));
     if ((l = fread(data, sizeof(int16), n, uttfp)) < n) {
-        E_ERROR_SYSTEM("Failed to read %d samples from %s: %d", n, inputfile, l);
+        E_ERROR_SYSTEM("Failed to read %zd samples from %s: %d", n, inputfile, l);
         ckd_free(data);
         ckd_free(inputfile);
         fclose(uttfp);
@@ -553,7 +554,7 @@ bio_read_wavfile(char const *directory,
     }
     ckd_free(inputfile);
     fclose(uttfp);
-    if (nsamps) *nsamps = n;
+    if (nsamps) *nsamps = (int32)n;
 
     return data;
 }
--- ./src/libsphinxbase/util/logmath.c.orig	2012-12-05 07:06:08.000000000 -0700
+++ ./src/libsphinxbase/util/logmath.c	2013-03-28 07:59:05.125888554 -0600
@@ -168,7 +168,7 @@ logmath_read(const char *file_name)
     int32 byteswap, i;
     int chksum_present, do_mmap;
     uint32 chksum;
-    long pos;
+    off_t pos;
     FILE *fp;
 
     E_INFO("Reading log table file '%s'\n", file_name);
@@ -228,9 +228,9 @@ logmath_read(const char *file_name)
 
     /* Check alignment constraints for memory mapping */
     do_mmap = 1;
-    pos = ftell(fp);
+    pos = ftello(fp);
     if (pos & ((long)lmath->t.width - 1)) {
-        E_WARN("%s: Data start %ld is not aligned on %d-byte boundary, will not memory map\n",
+        E_WARN("%s: Data start %zd is not aligned on %d-byte boundary, will not memory map\n",
                   file_name, pos, lmath->t.width);
         do_mmap = 0;
     }
@@ -272,7 +272,7 @@ int32
 logmath_write(logmath_t *lmath, const char *file_name)
 {
     FILE *fp;
-    long pos;
+    off_t pos;
     uint32 chksum;
 
     if (lmath->t.table == NULL) {
@@ -293,7 +293,7 @@ logmath_write(logmath_t *lmath, const ch
     fprintf(fp, "shift %d\n", lmath->t.shift);
     fprintf(fp, "logbase %f\n", lmath->base);
     /* Pad it out to ensure alignment. */
-    pos = ftell(fp) + strlen("endhdr\n");
+    pos = ftello(fp) + strlen("endhdr\n");
     if (pos & ((long)lmath->t.width - 1)) {
         size_t align = lmath->t.width - (pos & ((long)lmath->t.width - 1));
         assert(lmath->t.width <= 8);
--- ./src/libsphinxbase/util/pio.c.orig	2012-12-05 07:06:08.000000000 -0700
+++ ./src/libsphinxbase/util/pio.c	2013-03-28 07:56:11.374292764 -0600
@@ -464,7 +464,7 @@ stat_retry(const char *file, struct stat
 }
 
 
-int32
+time_t
 stat_mtime(const char *file)
 {
     struct stat statbuf;
@@ -472,7 +472,7 @@ stat_mtime(const char *file)
     if (stat_retry(file, &statbuf) != 0)
         return -1;
 
-    return ((int32) statbuf.st_mtime);
+    return statbuf.st_mtime;
 }
 #else
 #define STAT_RETRY_COUNT	10
@@ -490,8 +490,8 @@ stat_retry(const char *file, struct stat
 
 		if ((fp=(FILE *)fopen(file, "r"))!= 0)
 		{
-		    fseek( fp, 0, SEEK_END);
-		    statbuf->st_size = ftell( fp );
+		    fseeko( fp, 0, SEEK_END);
+		    statbuf->st_size = ftello( fp );
 		    fclose(fp);
 		    return 0;
 		}
@@ -511,7 +511,7 @@ stat_retry(const char *file, struct stat
     return -1;
 }
 
-int32
+time_t
 stat_mtime(const char *file)
 {
     struct stat statbuf;
@@ -524,7 +524,7 @@ stat_mtime(const char *file)
         return -1;
 #endif /* HAVE_SYS_STAT_H */
 
-    return ((int32) statbuf.st_mtime);
+    return statbuf.st_mtime;
 }
 #endif /* !_WIN32_WCE */
 
--- ./src/libsphinxbase/lm/ngram_model_dmp.c.orig	2012-12-13 02:01:21.000000000 -0700
+++ ./src/libsphinxbase/lm/ngram_model_dmp.c	2013-03-28 08:01:33.901539198 -0600
@@ -95,7 +95,7 @@ ngram_model_dmp_read(cmd_ln_t *config,
     trigram_t *tgptr;
     char *tmp_word_str;
     char *map_base = NULL;
-    size_t offset = 0;
+    off_t offset = 0;
 
     base = NULL;
     do_mmap = FALSE;
@@ -243,7 +243,7 @@ ngram_model_dmp_read(cmd_ln_t *config,
 
     /* Now mmap() the file and read in the rest of the (read-only) stuff. */
     if (do_mmap) {
-        offset = ftell(fp);
+        offset = ftello(fp);
 
         /* Check for improper word alignment. */
         if (offset & 0x3) {
@@ -320,7 +320,7 @@ ngram_model_dmp_read(cmd_ln_t *config,
     if (n_bigram > 0) {
         /* read n_prob2 and prob2 array (in memory) */
 	if (do_mmap)
-    	    fseek(fp, offset, SEEK_SET);
+    	    fseeko(fp, offset, SEEK_SET);
         if (fread(&k, sizeof(k), 1, fp) != 1)
 	    goto error_out;
         if (do_swap) SWAP_INT32(&k);
@@ -381,7 +381,7 @@ ngram_model_dmp_read(cmd_ln_t *config,
 
     /* read tseg_base size and tseg_base */
     if (do_mmap)
-        offset = ftell(fp);
+        offset = ftello(fp);
     if (n_trigram > 0) {
         if (do_mmap) {
             memcpy(&k, map_base + offset, sizeof(k));
@@ -753,7 +753,7 @@ static void
 ngram_model_dmp_write_fmtdesc(FILE * fh)
 {
     int32 i, k;
-    long pos;
+    off_t pos;
 
     /* Write file format description into header */
     for (i = 0; fmtdesc[i] != NULL; i++) {
@@ -762,7 +762,7 @@ ngram_model_dmp_write_fmtdesc(FILE * fh)
         fwrite(fmtdesc[i], 1, k, fh);
     }
     /* Pad it out in order to achieve 32-bit alignment */
-    pos = ftell(fh);
+    pos = ftello(fh);
     k = pos & 3;
     if (k) {
         fwrite_int32(fh, 4-k);
--- ./src/libsphinxbase/feat/feat.c.orig	2012-12-05 07:06:05.000000000 -0700
+++ ./src/libsphinxbase/feat/feat.c	2013-03-27 17:17:47.787440142 -0600
@@ -1041,13 +1041,13 @@ feat_s2mfc_read_norm_pad(feat_t *fcb, ch
 
     /* Check if n_float32 matches file size */
     byterev = 0;
-    if ((int32) (n_float32 * sizeof(float32) + 4) != (int32) statbuf.st_size) { /* RAH, typecast both sides to remove compile warning */
+    if ((off_t) (n_float32 * sizeof(float32) + 4) != statbuf.st_size) {
         n = n_float32;
         SWAP_INT32(&n);
 
-        if ((int32) (n * sizeof(float32) + 4) != (int32) (statbuf.st_size)) {   /* RAH, typecast both sides to remove compile warning */
+        if ((off_t) (n * sizeof(float32) + 4) != statbuf.st_size) {
             E_ERROR
-                ("%s: Header size field: %d(%08x); filesize: %d(%08x)\n",
+                ("%s: Header size field: %d(%08x); filesize: %zd(%08zx)\n",
                  file, n_float32, n_float32, statbuf.st_size,
                  statbuf.st_size);
             fclose(fp);