Ignore:
Timestamp:
Mar 12, 2024, 3:10:24 AM (3 months ago)
Author:
Bruno Cornec
Message:

More compiler fixes

  • Fix unused vars
  • Fix FreeBSD #if alone
  • Use MDSTAT_FILE everywhere
  • Fix missing break
  • Fix some strncpy. mr_strncpy used when safe
  • Fix wrong g_isoform_header_str proto !
  • find-cd & find-dvd => find-optical
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/newt-specific.c

    r3882 r3892  
    7979    long g_isoform_starttime;   ///< The time (in seconds since the epoch) that the evalcall form was opened.
    8080    int g_isoform_old_progress = -1;    ///< The most recent progress update of the evalcall form (percent).
    81     char g_isoform_header_str = NULL;   ///< The string for the evalcall form title.
     81    char *g_isoform_header_str = NULL;  ///< The string for the evalcall form title.
    8282    int g_mysterious_dot_counter;   ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3
    8383    int g_noof_log_lines = 6;   ///< The number of lines to show in the log at the bottom of the screen.
     
    602602
    603603        assert(ttl != NULL);
    604         //strcpy(g_isoform_header_str, ttl);
    605604        if (g_text_mode) {
    606605            log_msg(0, ttl);
     
    614613        g_isoform_starttime = get_time();
    615614        if (g_text_mode) {
    616             log_msg(0, g_isoform_header_str);
     615            log_msg(0, "g_isoform_header_str = %s", g_isoform_header_str);
    617616        } else {
    618617            g_isoform_header = newtLabel(1, 1, g_isoform_header_str);
     
    10121011        }
    10131012
    1014         /* not sure it's useful to shrink here
    1015         prompt = malloc(MAX_NEWT_COMMENT_LEN);
    1016         strncpy(prompt, p, MAX_NEWT_COMMENT_LEN - 1);
    1017         prompt[MAX_NEWT_COMMENT_LEN - 1] = '\0';
    1018         text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0);
    1019         */
    10201013        text = newtTextboxReflowed(1, 1, p, 40, 5, 5, 0);
    10211014        b_1 = newtButton(20 - ((button2[0] != '\0') ? strlen(button1) + 2 : strlen(button1) / 2), newtTextboxGetNumLines(text) + 3, button1);
     
    15281521 * @param flentry The filelist entry to stringify.
    15291522 * @return The string form of @p flentry.
    1530  * @note The returned value points to static storage that will be overwritten with each call.
     1523 * @note The returned value points to a dynamically allocated string that the caller needs to free.
    15311524 */
    15321525char *filelist_entry_to_string(struct s_filelist_entry *flentry) {
    1533         static char comment[100];
    1534         char *tmp = NULL;
     1526        char *comment = NULL;
    15351527
    15361528        log_msg(8, "entering");
    15371529        assert(flentry != NULL);
    15381530        if (flentry->severity == 0) {
    1539             mr_asprintf(tmp, "0   ");
     1531            mr_asprintf(comment, "0   ");
    15401532        } else if (flentry->severity == 1) {
    1541             mr_asprintf(tmp, "low ");
     1533            mr_asprintf(comment, "low ");
    15421534        } else if (flentry->severity == 2) {
    1543             mr_asprintf(tmp, "med ");
    1544         } else {
    1545             mr_asprintf(tmp, "high");
    1546         }
    1547         mr_strcat(tmp, "  ");
    1548         mr_strcat(tmp, flentry->filename);
    1549         strncpy(comment, tmp, 99);
    1550         mr_free(tmp);
    1551 
     1535            mr_asprintf(comment, "med ");
     1536        } else {
     1537            mr_asprintf(comment, "high");
     1538        }
     1539        mr_strcat(comment, "  ");
     1540        mr_strcat(comment, flentry->filename);
    15521541        log_it("leaving");
    15531542        return (comment);
     
    16151604        for (i = 0; i < filelist->entries; i++) {
    16161605            keylist[i] = (void *) i;
     1606            tmp = filelist_entry_to_string(&(filelist->el[i]));
    16171607            newtListboxAppendEntry(fileListbox,
    1618                                    filelist_entry_to_string(&
    1619                                                             (filelist->
    1620                                                              el[i])),
     1608                                    tmp,
    16211609                                   keylist[i]);
     1610            mr_free(tmp);
    16221611        }
    16231612        mr_asprintf(differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
Note: See TracChangeset for help on using the changeset viewer.