Issue 120179

Summary: WaE: sc/source/filter/excel/excform.cxx
Product: Calc Reporter: pavel
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: awf.aoo, issues
Version: 3.4.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description pavel 2012-07-03 16:33:45 UTC
Current trunk:

/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sc/source/filter/excel/excform.cxx: In function ‘sal_Bool lcl_isInMissArgForZeroList(DefTokenId)’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sc/source/filter/excel/excform.cxx:1553: warning: comparison between signed and unsigned integer expressions

Proposed change:

diff -ur sc.orig/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
--- sc.orig/source/filter/excel/excform.cxx     2012-07-03 14:41:38.000000000 +0200
+++ sc/source/filter/excel/excform.cxx  2012-07-03 14:42:16.000000000 +0200
@@ -1550,7 +1550,7 @@
 sal_Bool lcl_isInMissArgForZeroList(DefTokenId id)
-       for(short index = 0; index < missArgForZeroCount; index++)
+       for(DefTokenId index = 0; index < missArgForZeroCount; index++)
                if(missArgForZeroList[index] == id)
                        return sal_True;
        return sal_False;
Comment 1 Oliver-Rainer Wittmann 2012-08-14 13:45:44 UTC
proposed patch looks fine for me.
Comment 2 Andre 2012-08-15 11:20:57 UTC
Hm, DefTokenId is the type of content of the missArgForZeroList array.  It is just a coincidence that it can be used as an array index.

It is defined as
    typedef OpCode DefTokenId;
with OpCode defined in 
    typedef sal_uInt16 OpCode;
and in
    typedef USHORT OpCode;

What about this instead (I did not compile it):

sal_Bool lcl_isInMissArgForZeroList(DefTokenId id)
    const sal_uInt32 nCount (sizeof(missArgForZeroList)/sizeof(DefTokenId));
    for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
        if(missArgForZeroList[nIndex] == id)
            return sal_True;
    return sal_False;

nCount could be static or have a different type (size_t?)
Comment 3 pavel 2012-08-15 15:36:25 UTC
Compiles fine and is clean. Yes.
Comment 4 Andre 2012-08-16 11:54:44 UTC
Pavel, do you want to commit it or shall I?
Comment 5 pavel 2012-08-16 11:57:07 UTC
Please do so. Thanks.
Comment 6 pavel 2012-08-30 19:43:07 UTC
Comment 7 Oliver-Rainer Wittmann 2012-10-25 12:31:48 UTC
damn - I have overseen this issue.

Andre, as it is your patch will you go ahead and commit it?
Comment 8 Marcus 2017-05-20 11:27:54 UTC
Reset assigne to the default "".