Last change
on this file since 92274 was 76030, checked in by vboxsync, 6 years ago |
libpng-1.6.36: properly export to OSE, and while at it fix EOL style for shell scripts
|
-
Property svn:eol-style
set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | /* contrib/powerpc-vsx/linux.c
|
---|
2 | *
|
---|
3 | * Copyright (c) 2017 Glenn Randers-Pehrson
|
---|
4 | * Written by Vadim Barkov, 2017.
|
---|
5 | * Last changed in libpng 1.6.29 [March 16, 2017]
|
---|
6 | *
|
---|
7 | * This code is released under the libpng license.
|
---|
8 | * For conditions of distribution and use, see the disclaimer
|
---|
9 | * and license in png.h
|
---|
10 | *
|
---|
11 | * STATUS: TESTED
|
---|
12 | * BUG REPORTS: [email protected]
|
---|
13 | *
|
---|
14 | * png_have_vsx implemented for Linux by reading the widely available
|
---|
15 | * pseudo-file /proc/cpuinfo.
|
---|
16 | *
|
---|
17 | * This code is strict ANSI-C and is probably moderately portable; it does
|
---|
18 | * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include <stdio.h>
|
---|
22 | #include <string.h>
|
---|
23 | #include <stdlib.h>
|
---|
24 | #include "png.h"
|
---|
25 |
|
---|
26 | #ifndef MAXLINE
|
---|
27 | # define MAXLINE 1024
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | static int
|
---|
31 | png_have_vsx(png_structp png_ptr)
|
---|
32 | {
|
---|
33 | FILE *f;
|
---|
34 |
|
---|
35 | const char *string = "altivec supported";
|
---|
36 | char input[MAXLINE];
|
---|
37 | char *token = NULL;
|
---|
38 |
|
---|
39 | PNG_UNUSED(png_ptr)
|
---|
40 |
|
---|
41 | f = fopen("/proc/cpuinfo", "r");
|
---|
42 | if (f != NULL)
|
---|
43 | {
|
---|
44 | memset(input,0,MAXLINE);
|
---|
45 | while(fgets(input,MAXLINE,f) != NULL)
|
---|
46 | {
|
---|
47 | token = strstr(input,string);
|
---|
48 | if(token != NULL)
|
---|
49 | return 1;
|
---|
50 | }
|
---|
51 | }
|
---|
52 | #ifdef PNG_WARNINGS_SUPPORTED
|
---|
53 | else
|
---|
54 | png_warning(png_ptr, "/proc/cpuinfo open failed");
|
---|
55 | #endif
|
---|
56 | return 0;
|
---|
57 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.