# [PATCH] kill a few compiler warnings in 5_1 branch

- Thread: https://externals.io/message/21995
- Original archive: https://news-web.php.net/php.internals/21995
- Started by Steph Fox on 2006-02-24T14:05:15+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #21995 — Steph Fox — 2006-02-24T14:05:15+00:00

URL: https://externals.io/message/21995#21995

Hi all,

There are 174 compiler warnings in the PHP_5_1 branch under MSVC at present, 
so this is an attempt to get the number down a bit (like, by around 20%) by 
getting rid of the simpler ones.

I've separated out those I'm really not sure about 
(warnings_php5_unsure.txt), the rest are all simple casts. The test suite 
shows no changes if all three of these patches are applied, but obviously 
array.c and string.c are a bit close to the bone for 'probably works' so 
please use judgement if applying!

Note: nearly half the remaining compiler warnings are due to type 
conversions in ext/date, which is only to be expected of a new extension, so 
it's not _quite_ as bad as it looks...

Cheers,

- Steph

---

## #21997 — Marcus Boerger — 2006-02-24T14:16:00+00:00

URL: https://externals.io/message/21995#21997 · In reply to: #21995

Hello Steph,

  a few minor corrections to your patch, can you send the full patch in one
file?

best regards
marcus

Friday, February 24, 2006, 3:05:15 PM, you wrote:

> Index: Zend/zend_vm_execute.h
> ===================================================================
> RCS file: /repository/ZendEngine2/zend_vm_execute.h,v
> retrieving revision 1.62.2.24
> diff -u -r1.62.2.24 zend_vm_execute.h
> --- Zend/zend_vm_execute.h      6 Feb 2006 11:45:56 -0000       1.62.2.24
> +++ Zend/zend_vm_execute.h      24 Feb 2006 01:27:44 -0000
> @@ -7553,7 +7553,7 @@
>         HashTable *fe_ht;
>         zend_object_iterator *iter = NULL;
>         int key_type;
> -       zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
> +       zend_bool use_key = (zend_bool)opline->extended_value & ZEND_FE_FETCH_WITH_KEY;

+       zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);

>  
>         PZVAL_LOCK(array);
>  



>Index: ext/com_dotnet/com_saproxy.c
>===================================================================
>RCS file: /repository/php-src/ext/com_dotnet/com_saproxy.c,v
>retrieving revision 1.15.2.2
>diff -u -r1.15.2.2 com_saproxy.c
>--- ext/com_dotnet/com_saproxy.c        1 Jan 2006 12:50:00 -0000       1.15.2.2
>+++ ext/com_dotnet/com_saproxy.c        24 Feb 2006 00:34:20 -0000
>@@ -160,7 +160,7 @@
>                return return_value;
>        }
>
>-       if (dims - 1 == proxy->dimensions) {
>+       if ((int)dims - 1 == proxy->dimensions) {

+       if ((int)(dims - 1) == proxy->dimensions) {

>                LONG *indices;
>                VARTYPE vt;
>                VARIANT v;



>Index: ext/standard/array.c
>===================================================================
>RCS file: /repository/php-src/ext/standard/array.c,v
>retrieving revision 1.308.2.17
>diff -u -r1.308.2.17 array.c
>--- ext/standard/array.c        7 Feb 2006 17:54:24 -0000       1.308.2.17
>+++ ext/standard/array.c        24 Feb 2006 12:41:17 -0000
>@@ -1810,14 +1810,14 @@
>        /* Clamp the offset.. */
>        if (offset > num_in)
>                offset = num_in;
>-       else if (offset < 0 && (offset=num_in+offset) < 0)
>+       else if (offset < 0 && (offset = num_in + offset) < 0)

+       else if (offset < 0 && (offset = (num_in + offset)) < 0)

>                offset = 0;
>
>        /* ..and the length */
>        if (length < 0) {
>-               length = num_in-offset+length;
>-       } else if (((unsigned) offset + (unsigned) length) > num_in) {
>-               length = num_in-offset;
>+               length = num_in - offset + length;
>+       } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) {
>+               length = num_in - offset;
>        }
>
>        /* Create and initialize output hash */
>@@ -2204,14 +2204,14 @@
>        /* Clamp the offset.. */
>        if (offset_val > num_in)
>                return;
>-       else if (offset_val < 0 && (offset_val=num_in+offset_val) < 0)
>+       else if (offset_val < 0 && (offset_val = num_in + offset_val) < 0)

+       else if (offset_val < 0 && (offset_val = (num_in + offset_val)) < 0)

>                offset_val = 0;
>
>        /* ..and the length */
>        if (length_val < 0) {
>-               length_val = num_in-offset_val+length_val;
>-       } else if (((unsigned) offset_val + (unsigned) length_val) > num_in) {
>-               length_val = num_in-offset_val;
>+               length_val = num_in - offset_val + length_val;
>+       } else if (((unsigned)offset_val + (unsigned)length_val) > (unsigned)num_in) {
>+               length_val = num_in - offset_val;
>        }
>
>        if (length_val == 0)


Best regards,
 Marcus
