On 09/18/2014 08:46 PM, Shuai Meng wrote:
+ LONG total, color[3];//color[0] for red, color[1] for green, color[2] for blue.
This could be just 'int', as you use to_int().
static HRESULT return_int(VARIANT *res, int val)
{
- if((short)val == val)
- return return_short(res, val);
-
That's a questionable thing to do as it affects all other places where this helper is used.
+ if(color[i] > 255)
+ color[i] = 255;
This needs a test too.
+ total = color[0] + 256 * color[1] + 256 * 256 * color[2];
RGB() macro does the same thing.