FLTK logo

STR #3068

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]

STR #3068

Application:FLTK Library
Status:2 - Closed w/o Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:3 - Applies to all machines and operating systems
Subsystem:Unicode support
Summary:xutf8/case.c:76: possible typo ?
Version:1.3.2
Created By:dcb
Assigned To:AlbrechtS
Fix Version:1.3.3
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 dcb
03:01 Apr 15, 2014
Static analyser cppcheck says many things, including

 [xutf8/case.c:76] -> [xutf8/case.c:77]: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.

Source code is

  if (ucs <= 0x33CE) {
    if (ucs >= 0x33CE) {
      ret = ucs_table_33CE[ucs - 0x33CE];
      if (ret > 0) return ret;
    }
    return ucs;
  }

Suggest code rework.
 
 
#2 AlbrechtS
13:39 Sep 18, 2014
I'd say cppcheck is wrong - almost. ;-)

Formally it is right, and the result is probably what a static code analyzer should do. However, there is no dead code "block" except the single statement

  return ret;

Explanation:

The code is built as for all other tables, but ucs_table_33CE[] has only one member (for ucs == 0x33CE); ret will always be 0, and the above statement can't be reached. Hence this entire block could be written as:

  if (ucs == 0x33CE) return ucs;

However, this analysis depends on an external header file (case.h) where the table is defined, and this could potentially be changed (return non-zero).

So this won't be "fixed" in the code - but thanks anyway, this was an interesting exercise.

If I missed something, please correct me - otherwise this STR will be closed soon.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.