[tex-k] Patch for -Wall

Martin Schröder martin at oneiros.de
Tue Jan 3 19:16:04 CET 2006


On 2006-01-03 18:59:20 +0100, Martin Schröder wrote:
> the check in readtcxfile (the warning in line 640 of texmfmp.c)
> looks wrong to me:
> ---------------
>   if (translate_filename) {
>     string line;
>     unsigned line_count = 0;
>     FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
>     while (line = read_line (translate_file)) {
> ---------------
> Shouldn't that be 
>     while (strcmp (line, read_line (translate_file))) {

No, now I understand more of C. :-(

Attached is a patch for lib/texmfmp.c

Best
    Martin
-- 
                    http://www.tm.oneiros.de
-------------- next part --------------
*** /home/ms/tex/pdftex/releases/pdftex-1.30.5/src/texk/web2c/lib/texmfmp.c	Wed Aug  3 09:39:52 2005
--- texmfmp.c	Tue Jan  3 19:12:45 2006
***************
*** 542,548 ****
  {
    static boolean begun = false;
    unsigned len = 0;
-   unsigned i;
    string p = "";
  
    if (!begun) {
--- 542,547 ----
***************
*** 560,565 ****
--- 559,565 ----
  #if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
      strncpy (name, &strpool[strstart[outputfilename]], len);
  #else
+     unsigned i;
      for (i=0; i<len; i++)
        name[i] =  strpool[i+strstartar[outputfilename - 65536L]];
  #endif
***************
*** 637,643 ****
      string line;
      unsigned line_count = 0;
      FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
!     while (line = read_line (translate_file)) {
        int first;
        string start2;
        string comment_loc = strchr (line, '%');
--- 637,643 ----
      string line;
      unsigned line_count = 0;
      FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
!     while ((line = read_line (translate_file))) {
        int first;
        string start2;
        string comment_loc = strchr (line, '%');
***************
*** 1610,1616 ****
  }
  
  /* FIXME -- some (most?) of this can/should be moved to the Pascal/WEB side. */
! #if defined(TeX) || defined(MP) || defined(MF)
  static void
  checkpoolpointer (poolpointer poolptr, size_t len)
  {
--- 1610,1616 ----
  }
  
  /* FIXME -- some (most?) of this can/should be moved to the Pascal/WEB side. */
! #if !defined(pdfTeX) && !defined(pdfeTeX)
  static void
  checkpoolpointer (poolpointer poolptr, size_t len)
  {
***************
*** 1621,1627 ****
    }
  }
  
- #if !defined(pdfTeX) && !defined(pdfeTeX)
  static int
  maketexstring(const_string s)
  {
--- 1621,1626 ----
***************
*** 1635,1640 ****
--- 1634,1640 ----
  }
  #endif
  
+ #if defined(TeX) || defined(MP) || defined(MF)
  strnumber
  makefullnamestring()
  {
***************
*** 1674,1680 ****
  string
  gettexstring P1C(strnumber, s)
  {
!   poolpointer i, len;
    string name;
  #if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
    len = strstart[s + 1] - strstart[s];
--- 1674,1680 ----
  string
  gettexstring P1C(strnumber, s)
  {
!   poolpointer len;
    string name;
  #if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
    len = strstart[s + 1] - strstart[s];
***************
*** 1685,1690 ****
--- 1685,1691 ----
  #if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
    strncpy (name, (string)&strpool[strstart[s]], len);
  #else
+   poolpointer i;
    /* Don't use strncpy.  The strpool is not made up of chars. */
    for (i=0; i<len; i++) name[i] =  strpool[i+strstartar[s - 65536L]];
  #endif
***************
*** 1717,1723 ****
    char *filename = gettexstring(srcfilename);
    /* FIXME: Magic number. */
    char buf[40];
-   size_t len = strlen(filename);
    char * s = buf;
  
    /* Always put a space after the number, which makes things easier
--- 1718,1723 ----


More information about the tex-k mailing list