Ignore:
Timestamp:
Jan 13, 2009, 12:51:36 AM (11 years ago)
Author:
Sam Hocevar
Message:

Got rid of the modular codec stuff. All codecs should work the same way.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/codec/jpeg.c

    r3342 r3343  
    1818 */
    1919
    20 #include "../modular.h"
     20#include "config.h"
     21
     22#include <stdio.h>
     23#include <stdlib.h>
     24#include <string.h>
     25#include <ctype.h>
    2126#include <setjmp.h>
    2227
     28#include <jpeglib.h>
     29
     30#include "pipi.h"
     31#include "pipi_internals.h"
     32
    2333static int pipi_free_jpeg(pipi_image_t *img);
    24 
    25 
    26 
    2734
    2835struct my_error_mgr {
     
    5663    pipi_image_t *img = NULL;
    5764    unsigned int i, j, k = 0;
    58 
    59     FILE *fp = fopen(name, "rb");
     65    FILE *fp;
     66
     67    fp = fopen(name, "rb");
    6068    if(!fp) goto end;
    6169
     
    143151    unsigned char *data = NULL;
    144152    unsigned char *line = NULL;
     153    size_t len;
     154
     155    len = strlen(name);
     156    if(len < 4 || name[len - 4] != '.'
     157        || toupper(name[len - 3]) != 'J'
     158        || toupper(name[len - 2]) != 'P'
     159        || toupper(name[len - 1]) != 'G')
     160    {
     161        if(len < 5 || name[len - 5] != '.'
     162            || toupper(name[len - 4]) != 'J'
     163            || toupper(name[len - 3]) != 'P'
     164            || toupper(name[len - 2]) != 'E'
     165            || toupper(name[len - 1]) != 'G')
     166            return -1;
     167    }
    145168
    146169    pipi_pixels_t *pixels = pipi_get_pixels(img, PIPI_PIXELS_RGBA_U8);
Note: See TracChangeset for help on using the changeset viewer.