Build Fix -- compatibility issue with newer autoconf
[sxemacs] / src / ui / redisplay.c
index 12da833..2f18de9 100644 (file)
@@ -1094,9 +1094,9 @@ static prop_block_dynarr *add_bufbyte_string_runes(pos_data * data,
 
                                pb.type = PROP_STRING;
                                pb.data.p_string.str =
-                                       xnew_atomic_array(Bufbyte, len);
-                               strncpy((char *)pb.data.p_string.str,
-                                       (char *)pos, len);
+                                       xnew_atomic_array(Bufbyte, len+1);
+                               xstrncpy((char *)pb.data.p_string.str,
+                                       (char *)pos, len+1);
                                pb.data.p_string.len = len;
 
                                Dynarr_add(prop, pb);
@@ -1275,7 +1275,7 @@ static prop_block_dynarr *add_octal_runes(pos_data * data)
        ADD_NEXT_OCTAL_RUNE_CHAR;
 
        (void)add_failed;
-       
+
        data->cursor_type = orig_cursor_type;
        if (prop && prop != ADD_FAILED )
                Dynarr_free(prop);
@@ -1815,8 +1815,15 @@ static prop_block_dynarr *add_glyph_rune(pos_data * data,
                        data->bi_start_col_enabled = 0;
                        if (!allow_cursor)
                                data->bi_bufpos = 0;
-                       add_bufbyte_string_runes(data, XSTRING_DATA(string),
-                                                XSTRING_LENGTH(string), 0, 1);
+                       {
+                               prop_block_dynarr * tmp = NULL;
+                               tmp = add_bufbyte_string_runes(data,
+                                                      XSTRING_DATA(string),
+                                                      XSTRING_LENGTH(string),
+                                                      0, 1);
+                               if(tmp)
+                                       Dynarr_free(tmp);
+                       }
                        data->findex = orig_findex;
                        data->bi_bufpos = orig_bufpos;
                        data->bi_start_col_enabled = orig_start_col_enabled;
@@ -2183,23 +2190,23 @@ create_text_block(struct window *w, struct display_line *dl,
                        glyph_block_dynarr* tmpglyphs = 0;
                        /* #### I think this is safe, but could be wrong. */
                        data.ch = BI_BUF_FETCH_CHAR (b, data.bi_bufpos);
-                       
+
                        *prop = add_glyph_runes (&data);
                        tmpglyphs = data.ef->glyphs;
-                       
-                       if (*prop) 
+
+                       if (*prop)
                        {
                                /* If we just clipped a glyph and we are
                                   at the end of a line and there are more
                                   glyphs to display then do appropriate
                                   processing to not get a continuation
                                   glyph. */
-                               if (*prop != ADD_FAILED 
+                               if (*prop != ADD_FAILED
                                    && Dynarr_atp (*prop, 0)->type == PROP_GLYPH
                                    && data.ch == '\n') {
                                        /* If there are no more glyphs
                                           then do the normal processing.
-                                          
+
                                           #### This doesn't actually work
                                           if the same glyph is present
                                           more than once in the block. To
@@ -2207,7 +2214,7 @@ create_text_block(struct window *w, struct display_line *dl,
                                           carry the index around which
                                           might be problematic since the
                                           fragment is recalculated for
-                                          each line.  */ 
+                                          each line.  */
                                        if (EQ (Dynarr_end (tmpglyphs)->glyph,
                                                Dynarr_atp (*prop, 0)->data.p_glyph.glyph)) {
                                                Dynarr_free (*prop);
@@ -2223,7 +2230,7 @@ create_text_block(struct window *w, struct display_line *dl,
                                        goto done;
                        }
                }
-               
+
                /* If the current position is covered by an invisible
                   extent, do nothing (except maybe add some
                   ellipses).  */
@@ -2594,8 +2601,8 @@ create_text_block(struct window *w, struct display_line *dl,
                                        gb.extent = Qnil;
                                        gb.glyph = Vhscroll_glyph;
                                        add_glyph_rune_noret(&data, &gb, BEGIN_GLYPHS,
-                                                            0, GLYPH_CACHEL(w,
-                                                                            HSCROLL_GLYPH_INDEX));
+                                                            0, GLYPH_CACHEL(w,
+                                                                            HSCROLL_GLYPH_INDEX));
                                } else {
                                        /* This duplicates code down below to add a newline to
                                           the end of an otherwise empty line. */
@@ -5113,8 +5120,10 @@ regenerate_window(struct window *w, Bufpos start_pos, Bufpos point, int type)
        int need_modeline;
 
        /* The lines had better exist by this point. */
-       if (!(dla = window_display_lines(w, type)))
+       if (!(dla = window_display_lines(w, type))) {
                abort();
+               return;
+       }
        Dynarr_reset(dla);
        w->max_line_len = 0;
 
@@ -5446,6 +5455,8 @@ regenerate_window_extents_only_changed(struct window *w, Bufpos startp,
                new_start =
                    generate_display_line(w, ddl, 0, ddl->bufpos + ddl->offset,
                                          &prop, DESIRED_DISP);
+               (void)new_start; // Silence set-not-read warning.
+
                ddl->offset = 0;
 
                /* #### If there is propagated stuff the fail.  We could
@@ -5592,6 +5603,8 @@ regenerate_window_incrementally(struct window *w, Bufpos startp, Bufpos pointm)
                new_start =
                    generate_display_line(w, ddl, 0, ddl->bufpos + ddl->offset,
                                          &prop, DESIRED_DISP);
+               (void)new_start; // Silence set-not-read warning.
+
                ddl->offset = 0;
 
                /* If there is propagated stuff then it is pretty much a
@@ -6669,7 +6682,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                        const size_t order_strmax = sizeof(f->order_count)*3+2;
                        char *writable_str = alloca_array(char, order_strmax);
                        int n = snprintf(writable_str, order_strmax, "-%d", f->order_count);
-                       assert(n>=0 && n < order_strmax);
+                       assert(n>=0 && (size_t)n < order_strmax);
                        str = writable_str;
                }
 #endif                         /* HAVE_TTY */
@@ -6760,7 +6773,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                                percent = 99;
 
                        n = snprintf(buf, sizeof(buf), "%d%%", percent);
-                       assert(n>=0 && n < sizeof(buf));
+                       assert(n>=0 && (size_t)n < sizeof(buf));
                        Dynarr_add_many(mode_spec_bufbyte_string,
                                        (Bufbyte *) buf, strlen(buf));
 
@@ -6809,7 +6822,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                                n = snprintf(buf, sizeof(buf), "Top%d%%", percent);
                        else
                                n = snprintf(buf, sizeof(buf), "%d%%", percent);
-                       assert(n>=0 && n < sizeof(buf));
+                       assert(n>=0 && (size_t)n < sizeof(buf));
                        Dynarr_add_many(mode_spec_bufbyte_string,
                                        (Bufbyte *) buf, strlen(buf));
 
@@ -9007,14 +9020,6 @@ void init_redisplay(void)
        }
 #endif                         /* HAVE_X_WINDOWS */
 
-#ifdef HAVE_GTK
-       if (!strcmp(display_use, "gtk")) {
-               Vwindow_system = Qgtk;
-               Vinitial_window_system = Qgtk;
-               return;
-       }
-#endif
-
 #ifdef HAVE_TTY
        /* If no window system has been specified, try to use the terminal.  */
        if (!isatty(0)) {