Ignore:
Timestamp:
Feb 4, 2016, 6:25:22 PM (9 years ago)
Author:
meunier
Message:
  • Ajout de quelques fonction dans la lib math
  • Déplacement de certaines fonctions de stdlib vers string
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/nrc2/src/nrio0.c

    r772 r777  
    2626
    2727/* --------------------------------------------------------------------------------------------------- */
    28 IMAGE_EXPORT(void) generate_filename_k_ndigit(char *filename, int k, int ndigit, char *complete_filename)
     28IMAGE_EXPORT(void) generate_filename_k_ndigit(char *filename, int k, int ndigit, char *complete_filename, int maxlen)
    2929/* --------------------------------------------------------------------------------------------------- */
    3030{
     
    4343    case 9 : format = "%s%09d.txt"; break;
    4444  }
    45   sprintf(complete_filename, format, filename, k);
     45  snprintf(complete_filename, maxlen, format, filename, k);
    4646}
    47 /* ------------------------------------------------------------------------------------------------------------------------------ */
    48 IMAGE_EXPORT(void) generate_filename_k_ndigit_extension(char *filename, int k, int ndigit, char *extension, char *complete_filename)
    49 /* ------------------------------------------------------------------------------------------------------------------------------ */
     47/* ------------------------------------------------------------------------------------------------------------------------------------------ */
     48IMAGE_EXPORT(void) generate_filename_k_ndigit_extension(char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)
     49/* ------------------------------------------------------------------------------------------------------------------------------------------ */
    5050{
    5151  char *format = "%s%d.%s";
     
    6363    case 9 : format = "%s%09d.%s"; break;
    6464  }
    65   sprintf(complete_filename, format, filename, k, extension);
     65  snprintf(complete_filename, maxlen, format, filename, k, extension);
    6666}
    67 /* ---------------------------------------------------------------------------------------- */
    68 IMAGE_EXPORT(void) generate_path_filename(char *path, char *filename, char *complete_filename)
    69 /* ---------------------------------------------------------------------------------------- */
     67/* ---------------------------------------------------------------------------------------------------- */
     68IMAGE_EXPORT(void) generate_path_filename(char *path, char *filename, char *complete_filename, int maxlen)
     69/* ---------------------------------------------------------------------------------------------------- */
    7070{
    71   sprintf(complete_filename, "%s%s", path, filename);
     71  snprintf(complete_filename, maxlen, "%s%s", path, filename);
    7272}
    73 /* ------------------------------------------------------------------------------------------------------------------- */
    74 IMAGE_EXPORT(void) generate_path_filename_extension(char *path, char *filename, char *extension, char *complete_filename)
    75 /* ------------------------------------------------------------------------------------------------------------------- */
     73/* ------------------------------------------------------------------------------------------------------------------------------- */
     74IMAGE_EXPORT(void) generate_path_filename_extension(char *path, char *filename, char *extension, char *complete_filename, int maxlen)
     75/* ------------------------------------------------------------------------------------------------------------------------------- */
    7676{
    77   sprintf(complete_filename, "%s%s.%s", path, filename, extension);
     77  snprintf(complete_filename, maxlen, "%s%s.%s", path, filename, extension);
    7878}
    79 /* ---------------------------------------------------------------------------------------------------------------------------------------- */
    80 IMAGE_EXPORT(void) generate_path_filename_suffix_extension(char *path, char *filename, char *suffix, char *extension, char *complete_filename)
    81 /* ---------------------------------------------------------------------------------------------------------------------------------------- */
     79/* ---------------------------------------------------------------------------------------------------------------------------------------------------- */
     80IMAGE_EXPORT(void) generate_path_filename_suffix_extension(char *path, char *filename, char *suffix, char *extension, char *complete_filename, int maxlen)
     81/* ---------------------------------------------------------------------------------------------------------------------------------------------------- */
    8282{
    83     sprintf(complete_filename, "%s%s%s.%s", path, filename, suffix, extension);
     83    snprintf(complete_filename, maxlen, "%s%s%s.%s", path, filename, suffix, extension);
    8484}
    85 /* ----------------------------------------------------------------------------------------------------------------------------------------------- */
    86 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_extension(char *path, char *filename, int k, int ndigit, char *extension, char *complete_filename)
    87 /* ----------------------------------------------------------------------------------------------------------------------------------------------- */
     85/* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */
     86IMAGE_EXPORT(void) generate_path_filename_k_ndigit_extension(char *path, char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)
     87/* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */
    8888{
    8989  char *format = "%s%s%d.%s";
     
    101101    case 9 : format = "%s%s%09d.%s"; break;
    102102  }
    103   sprintf(complete_filename, format, path, filename, k, extension);
     103  snprintf(complete_filename, maxlen, format, path, filename, k, extension);
    104104}
    105 /* -------------------------------------------------------------------------------------------------------------------------------------------------------- */
    106 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_l_extension(char *path, char *filename, int k, int ndigit, int l, char *extension, char *complete_filename)
    107 /* -------------------------------------------------------------------------------------------------------------------------------------------------------- */
     105/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
     106IMAGE_EXPORT(void) generate_path_filename_k_ndigit_l_extension(char *path, char *filename, int k, int ndigit, int l, char *extension, char *complete_filename, int maxlen)
     107/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
    108108{
    109109  char *format = "%s%s%d_%d.%s";
     
    121121    case 9 : format = "%s%s%09d_%09d.%s"; break;
    122122  }
    123   sprintf(complete_filename, format, path, filename, k, l, extension);
     123  snprintf(complete_filename, maxlen, format, path, filename, k, l, extension);
    124124}
    125125// ----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.