Advertisement
sbaldovi

fuse-utils fmfconv sscanf_64bits

Nov 11th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.00 KB | None | 0 0
  1. Index: fmfconv.c
  2. ===================================================================
  3. --- fmfconv.c   (revision 4532)
  4. +++ fmfconv.c   (working copy)
  5. @@ -37,6 +37,12 @@
  6.  #endif /* #ifdef HAVE_STRINGS_H */
  7.  #include <fcntl.h>
  8.  
  9. +#ifdef HAVE_INTTYPES_H
  10. +#include <inttypes.h>
  11. +#else
  12. +#define PRIu64 "llu"
  13. +#endif /* #ifdef HAVE_INTTYPES_H */
  14. +
  15.  #include "libspectrum.h"
  16.  #include "movie_tables.h"
  17.  
  18. @@ -100,7 +106,7 @@
  19.  char *out_nmbr = NULL;     /* start of number */
  20.  char *out_next = NULL;     /* multiple out filename next name */
  21.  
  22. -unsigned long long int cut_frm = 0, cut__to = 0;
  23. +libspectrum_qword cut_frm = 0, cut__to = 0;
  24.  type_t cut_f_t, cut_t_t, cut_cmd = TYPE_NONE;
  25.  char *out_cut = NULL;
  26.  
  27. @@ -108,8 +114,8 @@
  28.  
  29.  int sound_exists = 0;              /* FMF frame without sound */
  30.  
  31. -unsigned long long int input_no = 0;       /* current file (input) no */
  32. -unsigned long long int input_last_no = 0;  /* number of files (input) - 1 */
  33. +libspectrum_qword input_no = 0;         /* current file (input) no */
  34. +libspectrum_qword input_last_no = 0;    /* number of files (input) - 1 */
  35.  
  36.  
  37.  int inp_fps = 50000;
  38. @@ -162,11 +168,11 @@
  39.    pix_rgb, NULL, NULL
  40.  };
  41.  
  42. -unsigned long long int frame_no = 0;   /* current frame (input) no */
  43. -unsigned long long int time_sec = 0, time_frm = 0; /* current time (input) no */
  44. -unsigned long long int drop_no = 0;    /* dropped frame no */
  45. -unsigned long long int dupl_no = 0;    /* duplicated frame no */
  46. -unsigned long long int output_no = 0;  /* output frame no */
  47. +libspectrum_qword frame_no = 0;    /* current frame (input) no */
  48. +libspectrum_qword time_sec = 0, time_frm = 0;  /* current time (input) no */
  49. +libspectrum_qword drop_no = 0; /* dropped frame no */
  50. +libspectrum_qword dupl_no = 0; /* duplicated frame no */
  51. +libspectrum_qword output_no = 0;   /* output frame no */
  52.  int frm_scr = 0, frm_rte = 0, frm_mch = 0; /* screen type, frame rate, machine type (A/B/C/D) */
  53.  int frm_slice_x, frm_slice_y, frm_slice_w, frm_slice_h;
  54.  int frm_w = -1, frm_h = -1;
  55. @@ -182,8 +188,8 @@
  56.  int fmf_compr = 0;         /* fmf compressed or not */
  57.  int fmf_little_endian = 0;     /* little endian PCM */
  58.  int snd_little_endian = -1;            /* little endian PCM */
  59. -unsigned long long int fmf_slice_no = 0;
  60. -unsigned long long int fmf_sound_no = 0;
  61. +libspectrum_qword fmf_slice_no = 0;
  62. +libspectrum_qword fmf_sound_no = 0;
  63.  
  64.  /* sound variables */
  65.  #define SOUND_BUFF_MAX_SIZE 65536  /* soft max size of collected sound samples */
  66. @@ -472,15 +478,15 @@
  67.  }
  68.  
  69.  int
  70. -inp_get_cut_value( char *s, unsigned long long int *value, type_t *type )
  71. +inp_get_cut_value( char *s, libspectrum_qword *value, type_t *type )
  72.  {
  73.    int n = 0;
  74. -  unsigned long long int frm = 0;
  75. +  libspectrum_qword frm = 0;
  76.  
  77.    char *tmp = strchr( s, ':' );
  78.    if( tmp ) {      /*OK, min:sec */
  79.      unsigned int sec = 0;
  80. -    if( ( sscanf( s, "%llu:%n%u", &frm, &n, &sec) != 2 ) || sec > 59 ) {   /* OK, unknown value.. */
  81. +    if( ( sscanf( s, "%"PRIu64":%n%u", &frm, &n, &sec) != 2 ) || sec > 59 ) {  /* OK, unknown value.. */
  82.        printe( "Bad intervall definition in a -C/--cut option\n" );
  83.        return 6;
  84.      }
  85. @@ -489,7 +495,7 @@
  86.      *type = TYPE_TIME;
  87.      return 0;
  88.    }
  89. -  if( ( sscanf( s, "%llu", &frm) != 1 ) ) {    /* OK, unknown value.. */
  90. +  if( ( sscanf( s, "%"PRIu64, &frm) != 1 ) ) { /* OK, unknown value.. */
  91.        printe( "Bad intervall definition in a -C/--cut option\n" );
  92.        return 6;
  93.    }
  94. @@ -1510,7 +1516,7 @@
  95.    npos = ftell( inp );
  96.    if( npos <= fpos ) return;
  97.  
  98. -  perc = (long long int)npos * 1009 / inp_ftell / 10;
  99. +  perc = (libspectrum_signed_qword)npos * 1009 / inp_ftell / 10;
  100.  
  101.    if( !force && last_perc == perc ) return;
  102.    if( perc > 100 ) perc = 100;
  103. @@ -1520,9 +1526,9 @@
  104.    else if( prg_t == TYPE_BAR )
  105.      fprintf( stderr, "[%s%s]\r", bar + 78 - 78 * perc / 100, spc + 78 * perc / 100 );
  106.    else if( prg_t == TYPE_FRAME )
  107. -    fprintf( stderr, "[%s%s]%8llu\r", bar + 78 - 70 * perc / 100, spc + 8 + 70 * perc / 100, frame_no );
  108. +    fprintf( stderr, "[%s%s]%8"PRIu64"\r", bar + 78 - 70 * perc / 100, spc + 8 + 70 * perc / 100, frame_no );
  109.    else if( prg_t == TYPE_TIME )
  110. -    fprintf( stderr, "[%s%s]%8llu\r", bar + 78 - 70 * perc / 100, spc + 8 + 70 * perc / 100, time_sec );
  111. +    fprintf( stderr, "[%s%s]%8"PRIu64"\r", bar + 78 - 70 * perc / 100, spc + 8 + 70 * perc / 100, time_sec );
  112.    last_perc = perc;
  113.  }
  114.  
  115. @@ -1954,10 +1960,10 @@
  116.    close_snd();             /* close snd file */
  117.    close_out();             /* close out file */
  118.    if( prg_t != TYPE_NONE ) fprintf( stderr, "\n" );
  119. -  printi( 0, "main(): read %llu frame (%llusec) and %llu fmf slice and %llu fmf sound chunk\n",
  120. +  printi( 0, "main(): read %"PRIu64" frame (%"PRIu64" sec) and %"PRIu64" fmf slice and %"PRIu64" fmf sound chunk\n",
  121.         frame_no, time_sec, fmf_slice_no, fmf_sound_no );
  122.    if( !do_info )
  123. -    printi( 0, "main(): wrote %llu frame dropped %llu frame and inserted %llu frame\n",
  124. +    printi( 0, "main(): wrote %"PRIu64" frame dropped %"PRIu64" frame and inserted %"PRIu64" frame\n",
  125.         output_no, drop_no, dupl_no );
  126.  
  127.  #ifdef USE_ZLIB
  128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement