~ubuntu-branches/ubuntu/jaunty/clamav/jaunty-backports

« back to all changes in this revision

Viewing changes to libclamav/pe_icons.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-05-20 22:09:21 UTC
  • mfrom: (1.44.1 upstream) (10.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20100520220921-flsp1pbntitvwc59
Tags: 0.96.1+dfsg-0ubuntu1
* New upstream release
  - Remove non-free libclamunrar directory and repack +dfsg tarball
  - Remove win32/ for size reasons since the tarball is repacked already and
    adjust Makefile.in/am
  - Add support for new TestDatabases option in debian/clamav-
    freshclam.postinst.in (match upstream default of yes)
  - Add VirusAction option to debian/clamav-milter.postinst.in
  - Drop powerpc clamd fix, incorporated upstream
  - Drop diff in docs/man/clamd.conf.5.in, incorporated upstream
  - Drop addition of COPYING.llvm, incorporated upstream
* Remaining differences from Debian:
  - Drop initial signature definitions from clamav-base
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Detect incorrect value for clamav-freshclam/NotifyClamd and set it to true

Show diffs side-by-side

added added

removed removed

Lines of Context:
563
563
    *B = 200.0f * (y - z);
564
564
}
565
565
 
 
566
#ifndef USE_FLOATS
566
567
static void lab2(uint32_t r, uint32_t g, uint32_t b, int32_t *L, int32_t *A, int32_t *B) {
567
568
    uint32_t xx,yy,zz;
568
569
 
591
592
    *A = 500/4*(xx - yy);
592
593
    *B = 200/4*(yy - zz);/* /4 to avoid overflow */
593
594
}
 
595
#endif
594
596
 
595
597
static double labdiff(unsigned int rgb) {
596
598
    unsigned int r, g, b;
606
608
    return sqrt(pow(L1 - L2, 2.0f) + pow(A1 - A2, 2.0f) + pow(B1 - B2, 2.0f));
607
609
}
608
610
 
 
611
#ifndef USE_FLOATS
609
612
static uint32_t labdiff2(unsigned int b) {
610
613
    unsigned int r2, g2, b2;
611
614
    int32_t L1, A1, B1, L2, A2, B2;
629
632
     ld += ad + bd;
630
633
     return ((uint32_t)(sqrt(ld/1024.0)))>>17;
631
634
}
 
635
#endif
632
636
 
633
637
static void makebmp(const char *step, const char *tempd, int w, int h, void *data) {
634
638
    unsigned int tmp1, tmp2, tmp3, tmp4, y;
1189
1193
    struct icomtr metrics;
1190
1194
    unsigned char *rawimage;
1191
1195
    const char *tempd;
1192
 
    uint32_t *palette = NULL, *imagedata, *imagedata2;
 
1196
    uint32_t *palette = NULL, *imagedata;
1193
1197
    unsigned int scanlinesz, andlinesz;
1194
1198
    unsigned int width, height, depth, x, y;
1195
1199
    unsigned int err, scalemode = 2, enginesize;
1410
1414
            if(!(newdata = cli_malloc(newsize * newsize * sizeof(*newdata)))) {
1411
1415
                return CL_SUCCESS;
1412
1416
            }
1413
 
            memset(newdata, 0xaaccaabb, newsize * newsize * sizeof(*newdata));
1414
1417
            cli_dbgmsg("parseicon: Slow scaling to %ux%u (%f, %f)\n", newsize, newsize, scalex, scaley);
1415
1418
            for(y = 0; y<newsize; y++) {
1416
 
                unsigned int oldy = (unsigned int)((y * scaley) * width + 0.5f);
 
1419
                unsigned int oldy = (unsigned int)(y * scaley) * width;
1417
1420
                for(x = 0; x<newsize; x++)
1418
1421
                    newdata[y*newsize + x] = imagedata[oldy + (unsigned int)(x * scalex + 0.5f)];
1419
1422
            }