Last change
on this file since 3085 was
3085,
checked in by Jean-Yves Lamoureux, 12 years ago
|
- Added bound-checking to file extension detection
|
File size:
1010 bytes
|
Rev | Line | |
---|
[3083] | 1 | /* |
---|
| 2 | * libpipi Pathetic image processing interface library |
---|
| 3 | * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org> |
---|
| 4 | * 2008 Jean-Yves Lamoureux <jylam@lnxscene.org> |
---|
| 5 | * All Rights Reserved |
---|
| 6 | * |
---|
| 7 | * $Id$ |
---|
| 8 | * |
---|
| 9 | * This library is free software. It comes without any warranty, to |
---|
| 10 | * the extent permitted by applicable law. You can redistribute it |
---|
| 11 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
| 12 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
| 13 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | /* |
---|
| 17 | * modular.c: hand-written codecs multiplexer |
---|
| 18 | */ |
---|
| 19 | |
---|
[3075] | 20 | #include "modular.h" |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | pipi_image_t *pipi_load_modular(const char *name) |
---|
| 24 | { |
---|
| 25 | return pipi_load_jpeg(name); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | int pipi_save_modular(pipi_image_t *img, const char *name) |
---|
| 29 | { |
---|
[3085] | 30 | if(strlen(name) >= 4) |
---|
| 31 | if(!strncasecmp(&name[strlen(name) - 3], "jpg", 3) || |
---|
| 32 | !strncasecmp(&name[strlen(name) - 4], "jpeg", 4) ) |
---|
| 33 | return pipi_save_jpeg(img, name); |
---|
[3083] | 34 | return -1; |
---|
[3075] | 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.