Skip to content
Snippets Groups Projects
Commit 922ebfe9 authored by Mirar (Pontus Hagland)'s avatar Mirar (Pontus Hagland)
Browse files

hey, it works. (not gif or decode() yet, though)

Rev: src/modules/Image/encodings/any.c:1.2
parent d800dadd
No related branches found
No related tags found
No related merge requests found
/* $Id: any.c,v 1.1 1999/02/24 03:18:08 mirar Exp $ */ /* $Id: any.c,v 1.2 1999/02/24 03:33:34 mirar Exp $ */
/* /*
**! module Image **! module Image
**! note **! note
**! $Id: any.c,v 1.1 1999/02/24 03:18:08 mirar Exp $ **! $Id: any.c,v 1.2 1999/02/24 03:33:34 mirar Exp $
**! submodule ANY **! submodule ANY
**! **!
**! This method calls the other decoding methods **! This method calls the other decoding methods
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <ctype.h> #include <ctype.h>
#include "stralloc.h" #include "stralloc.h"
RCSID("$Id: any.c,v 1.1 1999/02/24 03:18:08 mirar Exp $"); RCSID("$Id: any.c,v 1.2 1999/02/24 03:33:34 mirar Exp $");
#include "pike_macros.h" #include "pike_macros.h"
#include "object.h" #include "object.h"
#include "constants.h" #include "constants.h"
...@@ -42,7 +42,7 @@ void image_any__decode(INT32 args) ...@@ -42,7 +42,7 @@ void image_any__decode(INT32 args)
if (sp[-args].u.string->len<4) if (sp[-args].u.string->len<4)
error("Image.ANY.decode: too short string\n"); error("Image.ANY.decode: too short string\n");
#define CHAR2(a,b) (((a)<<8)|(b)) #define CHAR2(a,b) ((((unsigned char)(a))<<8)|((unsigned char)(b)))
/* ok, try the heuristics */ /* ok, try the heuristics */
switch (CHAR2(sp[-args].u.string->str[0],sp[-args].u.string->str[1])) switch (CHAR2(sp[-args].u.string->str[0],sp[-args].u.string->str[1]))
{ {
...@@ -58,7 +58,7 @@ void image_any__decode(INT32 args) ...@@ -58,7 +58,7 @@ void image_any__decode(INT32 args)
push_text("image/x-pnm"); push_text("image/x-pnm");
goto simple_image; goto simple_image;
case CHAR2('J','F'): case CHAR2(255,216):
/* JFIF */ /* JFIF */
push_text("Image"); push_text("Image");
push_int(0); push_int(0);
...@@ -69,6 +69,7 @@ void image_any__decode(INT32 args) ...@@ -69,6 +69,7 @@ void image_any__decode(INT32 args)
f_index(2); f_index(2);
stack_swap(); stack_swap();
f_call_function(2); f_call_function(2);
push_text("image/jpeg");
goto simple_image; goto simple_image;
case CHAR2('P','N'): case CHAR2('P','N'):
...@@ -109,6 +110,7 @@ simple_image: ...@@ -109,6 +110,7 @@ simple_image:
push_text("image"); push_text("image");
push_text("type"); push_text("type");
f_aggregate(2); f_aggregate(2);
stack_swap();
f_mkmapping(2); f_mkmapping(2);
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment