Menu

#48 encoding at Save As

1.6
closed
nobody
None
6 days ago
2026-02-05
SweetTyler
No

I got some warning when I tried to compile xnedit (laest code from github) with a different Makefile:

userCmds.c:2606:15: warning: writing 2 bytes into a region of size 1 [-Wstringop-overflow=]
2606 | outPtr++ = '\';
| ^
In function ‘NEditMalloc’,
inlined from ‘writeMenuItemString’ at userCmds.c:2602:21:
../util/nedit_malloc.c:43:17: note: destination object of size 1 allocated by ‘malloc’
43 | void
ptr = malloc(size);
| ^
In function ‘safeStrCpy’,
inlined from ‘FormatWindowTitle’ at windowTitle.c:409:32:
windowTitle.c:140:8: warning: ‘strncpy’ specified size between 9223372036854775808 and 0 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
140 | strncpy(dest, source, destEnd - dest);

I am not sure if these are problems or not, but the binary executable works fine.

Discussion

  • SweetTyler

    SweetTyler - 2026-02-05

    The tile is wrong. I don't know how I made the mistake. for your reference, the following is the Makefile.linux I tried with:

    CC ?= gcc
    AR ?= gcc-ar

    PKG_DEPS = x11 xt xft fontconfig

    C_OPT_FLAGS ?= -O3 -flto -fno-semantic-interposition
    C_ARCH_FLAGS ?= -march=native
    C_VIS_FLAGS ?= -fvisibility=hidden
    LD_OPT_FLAGS ?= -flto

    CFLAGS = $(C_OPT_FLAGS) $(C_ARCH_FLAGS) $(C_VIS_FLAGS) \
    -std=gnu99 -DREPLACE_SCOPE -DUSE_LPR_PRINT_CMD \
    $(shell pkg-config --cflags $(PKG_DEPS))

    ARFLAGS = -urs

    LIBS = $(LD_OPT_FLAGS) $(shell pkg-config --libs $(PKG_DEPS)) \
    -lXm -lXrender -lm -lpthread

    include Makefile.common

     
  • SweetTyler

    SweetTyler - 2026-02-05

    The correct order is:

    LIBS = $(LD_OPT_FLAGS) -lXm -lXrender -lm -lpthread $(shell pkg-config --libs $(PKG_DEPS))

     
  • Pyrphoros

    Pyrphoros - 7 days ago

    I think both warnings are not an issue, especially the first one. Which compiler version is this?

     
  • SweetTyler

    SweetTyler - 7 days ago

    Thank you. The compiler is gcc (GCC) 15.2.1 20260123 on Fedora 43.

     
  • SweetTyler

    SweetTyler - 7 days ago

    Then please close this report.

     
  • Pyrphoros

    Pyrphoros - 6 days ago
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB