Skip to content
Snippets Groups Projects
  • Jakub Jelinek's avatar
    4805b92a
    libcpp: Fix makeucnid bug with combining values [PR100977] · 4805b92a
    Jakub Jelinek authored
    I've noticed in ucnid.h two adjacent lines that had all flags and combine
    values identical and as such were supposed to be merged.
    
    This is due to a bug in makeucnid.c, which records last_flag,
    last_combine and really_safe of what has just been printed, but
    because of a typo mishandles it for last_combine, always compares against
    the combining_value[0] which is 0.
    
    This has two effects on the table, one is that often the table is
    unnecessarily large, as for non-zero .combine every character has its own
    record instead of adjacent characters with the same flags and combine
    being merged.  This means larger tables.
    The other is that sometimes the last char that has combine set doesn't
    actually have it in the tables, because the code is printing entries only
    upon seeing the next character and if that character does have
    combining_value of 0 and flags are otherwise the same as previously printed,
    it will not print anything.
    
    The following patch fixes that, for clarity what exactly it affects
    I've regenerated with the same Unicode files as last time it has
    been regenerated.
    
    2021-08-05  Jakub Jelinek  <jakub@redhat.com>
    
    	PR c++/100977
    	* makeucnid.c (write_table): Fix computation of last_combine.
    	* ucnid.h: Regenerated using Unicode 6.3.0 files.
    4805b92a
    History
    libcpp: Fix makeucnid bug with combining values [PR100977]
    Jakub Jelinek authored
    I've noticed in ucnid.h two adjacent lines that had all flags and combine
    values identical and as such were supposed to be merged.
    
    This is due to a bug in makeucnid.c, which records last_flag,
    last_combine and really_safe of what has just been printed, but
    because of a typo mishandles it for last_combine, always compares against
    the combining_value[0] which is 0.
    
    This has two effects on the table, one is that often the table is
    unnecessarily large, as for non-zero .combine every character has its own
    record instead of adjacent characters with the same flags and combine
    being merged.  This means larger tables.
    The other is that sometimes the last char that has combine set doesn't
    actually have it in the tables, because the code is printing entries only
    upon seeing the next character and if that character does have
    combining_value of 0 and flags are otherwise the same as previously printed,
    it will not print anything.
    
    The following patch fixes that, for clarity what exactly it affects
    I've regenerated with the same Unicode files as last time it has
    been regenerated.
    
    2021-08-05  Jakub Jelinek  <jakub@redhat.com>
    
    	PR c++/100977
    	* makeucnid.c (write_table): Fix computation of last_combine.
    	* ucnid.h: Regenerated using Unicode 6.3.0 files.